DAWorkbench 0.0.1
DAWorkbench API
载入中...
搜索中...
未找到
DA::DAPySeries类 参考

对Pandas.Series的Qt封装 更多...

#include <DAPySeries.h>

类 DA::DAPySeries 继承关系图:
DA::DAPyObjectWrapper

Public 成员函数

 DAPySeries (const DAPySeries &s)
 
 DAPySeries (DAPySeries &&s)
 
 DAPySeries (const pybind11::object &obj)
 
 DAPySeries (pybind11::object &&obj)
 
DAPySeriesoperator= (const pybind11::object &obj)
 
DAPySeriesoperator= (const DAPySeries &s)
 
DAPySeriesoperator= (const DAPyObjectWrapper &obj)
 
DAPySeriesoperator= (pybind11::object &&obj)
 
DAPySeriesoperator= (DAPySeries &&s)
 
DAPySeriesoperator= (DAPyObjectWrapper &&obj)
 
pybind11::object operator[] (std::size_t i) const
 
pybind11::object operator[] (const QString &colName) const
 针对索引是字符串的场景
 
pybind11::dtype dtype () const
 Return the dtype object of the underlying data.
 
bool empty () const
 Indicator whether Series/DataFrame is empty.
 
std::size_t size () const
 Series.size
 
QString name () const
 Series.name
 
pybind11::object iat (std::size_t i) const
 DASeries::iat Access a single value for a row/column pair by integer position.
 
void iat (std::size_t r, const pybind11::object &v)
 
QVariant value (std::size_t i) const
 
bool setValue (std::size_t i, const QVariant &v)
 
bool isNumeric () const
 
bool isDateTime () const
 
bool isString () const
 
bool isCategorical () const
 
DAPyIndex index () const
 
QStringList indexAsStringList () const
 
QVector< double > indexAsDoubleVector () const
 
QVector< QDateTime > indexAsDateTimeVector () const
 
DAPySeries astype (const pybind11::dtype &dt) const
 
DAPySeries toDateTime () const
 
template<typename T , typename VectLikeIte >
void castTo (VectLikeIte begin) const
 把series转换为一个容器数组
 
QString toString (std::size_t maxele=12) const
 
- Public 成员函数 继承自 DA::DAPyObjectWrapper
 DAPyObjectWrapper (const DAPyObjectWrapper &obj)
 
 DAPyObjectWrapper (DAPyObjectWrapper &&obj)
 
 DAPyObjectWrapper (const pybind11::object &obj)
 
 DAPyObjectWrapper (pybind11::object &&obj)
 
bool isNone () const
 
DAPyObjectWrapperoperator= (const DAPyObjectWrapper &obj)
 
DAPyObjectWrapperoperator= (DAPyObjectWrapper &&obj)
 
DAPyObjectWrapperoperator= (const pybind11::object &obj)
 
DAPyObjectWrapperoperator= (pybind11::object &&obj)
 
bool operator== (void *ptr) const
 
bool operator== (const pybind11::object &obj) const
 
bool operator== (const DAPyObjectWrapper &obj) const
 
bool operator!= (void *ptr) const
 
bool operator!= (const pybind11::object &obj) const
 
bool operator!= (const DAPyObjectWrapper &obj) const
 
 operator bool () const
 
void dealException (const std::exception &e) const
 统一的异常处理函数
 
DAPyObjectWrapper deepCopy () const
 深拷贝
 
pybind11::object & object ()
 
const pybind11::object & object () const
 
QVariant toVariant () const
 
bool isinstance (const pybind11::handle &type) const
 
bool isInt () const
 是否为int
 
bool isModule () const
 是否为Module
 
bool isFloat () const
 是否为float
 
bool isStr () const
 是否为str
 
bool isBool () const
 
bool isList () const
 
bool isDict () const
 
bool isTuple () const
 
bool isCallable () const
 
bool isSequence () const
 
bool isNumeric () const
 
void setErrCallback (const ErrCallback &fun)
 设置错误处理回调
 
ErrCallback getErrCallback () const
 
pybind11::object attr (const char *c_att)
 获取属性
 
pybind11::object attr (const char *c_att) const
 
template<typename... Args>
pybind11::object call (Args &&... args)
 直接调用Python可调用对象
 
QString __name__ () const
 对应__name__
 
QString __str__ () const
 
QString __repr__ () const
 
QString typeName () const
 
size_t refCount () const
 

静态 Public 成员函数

static bool isSeries (const pybind11::object &obj)
 

Protected 成员函数

void checkObjectValid ()
 

额外继承的成员函数

- Public 类型 继承自 DA::DAPyObjectWrapper
using ErrCallback = std::function< void(const char *) >
 异常错误回调函数
 
- Protected 属性 继承自 DA::DAPyObjectWrapper
pybind11::object _object
 
ErrCallback _errcallback
 

详细描述

对Pandas.Series的Qt封装

成员函数说明

◆ castTo()

template<typename T , typename VectLikeIte >
void DA::DAPySeries::castTo ( VectLikeIte  begin) const

把series转换为一个容器数组

支持的数据类型转换:

  • 数值类型:直接转换
  • 日期时间类型:转换为毫秒时间戳
  • 时间增量类型:转换为秒
  • 分类数据:转换为分类代码
  • 布尔类型:转换为0/1
// 示例1:转换为double向量
std::vector<double> vx;
vx.reserve(x.size());
x.castTo<double>(std::back_inserter(vx));
// 示例2:转换为QVector
QVector<double> qv;
qv.reserve(x.size());
x.castTo<double>(std::back_inserter(qv));
对Pandas.Series的Qt封装
Definition DAPySeries.h:22
void castTo(VectLikeIte begin) const
把series转换为一个容器数组
Definition DAPySeries.h:119
std::size_t size() const
Series.size
Definition DAPySeries.cpp:140
参数
begin输出迭代器
注解
对于日期时间类型,会转换为毫秒时间戳(从1970-01-01开始)
对于字符串类型,抛出异常因此需要先检查是否为字符串

◆ dtype()

pybind11::dtype DA::DAPySeries::dtype ( ) const

Return the dtype object of the underlying data.

返回

◆ empty()

bool DA::DAPySeries::empty ( ) const

Indicator whether Series/DataFrame is empty.

返回
If Series/DataFrame is empty, return True, if not return False.

◆ iat()

pybind11::object DA::DAPySeries::iat ( std::size_t  i) const

DASeries::iat Access a single value for a row/column pair by integer position.

参数
i
返回

◆ name()

QString DA::DAPySeries::name ( ) const

Series.name

Return the name of the Series.

The name of a Series becomes its index or column name if it is used to form a DataFrame. It is also used whenever displaying the Series using the interpreter.

返回

◆ operator[]()

pybind11::object DA::DAPySeries::operator[] ( const QString &  colName) const

针对索引是字符串的场景

参数
colName
返回

◆ size()

std::size_t DA::DAPySeries::size ( ) const

Series.size

Return the number of elements in the underlying data.

返回

该类的文档由以下文件生成: