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

对da_dataframe.py的封装,集成了dataframe的操作 更多...

#include <DAPyScriptsDataFrame.h>

类 DA::DAPyScriptsDataFrame 继承关系图:
DA::DAPyModule DA::DAPyObjectWrapper

Public 成员函数

 DAPyScriptsDataFrame (bool autoImport=true)
 
 DAPyScriptsDataFrame (const pybind11::object &obj)
 
bool import () noexcept
 
bool drop_irow (DAPyDataFrame &df, const QList< int > &index) noexcept
 移除dataframe的行,对应da_dataframe.da_drop_irow
 
bool drop_icolumn (DAPyDataFrame &df, const QList< int > &index) noexcept
 移除dataframe的列,对应da_dataframe.da_drop_icolumn
 
bool insert_nanrow (DAPyDataFrame &df, int r) noexcept
 DAPyScriptsDataFrame::insert_nanrow
 
bool insert_column (DAPyDataFrame &df, int c, const QString &name, const QVariant &defaultvalue=QVariant()) noexcept
 插入列
 
bool insert_column (DAPyDataFrame &df, int c, const QString &name, const QVariant &start, const QVariant &stop) noexcept
 插入列
 
bool to_csv (const DAPyDataFrame &df, const QString &path, const QString &sep) noexcept
 保存为txt/csv 对应da_dataframe.da_to_csv
 
bool to_excel (const DAPyDataFrame &df, const QString &path) noexcept
 保存为xlsx 对应da_dataframe.da_to_xlsx
 
bool to_pickle (const DAPyDataFrame &df, const QString &path) noexcept
 保存为pickle 对应da_dataframe.da_to_pickle
 
bool to_parquet (const DAPyDataFrame &df, const QString &path) noexcept
 保存为parquet对应da_dataframe.da_to_parquet
 
bool from_pickle (DAPyDataFrame &df, const QString &path) noexcept
 从pickle加载
 
bool from_parquet (DAPyDataFrame &df, const QString &path) noexcept
 从parquet加载
 
bool astype (DAPyDataFrame &df, const QList< int > &colsIndex, const DAPyDType &dt) noexcept
 对列转换为对应的类型
 
bool setnan (DAPyDataFrame &df, const QList< int > &rowsIndex, const QList< int > &colsIndex) noexcept
 设置nan值
 
bool cast_to_num (DAPyDataFrame &df, const QList< int > &colsIndex, pybind11::dict args) noexcept
 DAPyScriptsDataFrame::cast_to_num
 
bool cast_to_datetime (DAPyDataFrame &df, const QList< int > &colsIndex, pybind11::dict args) noexcept
 DAPyScriptsDataFrame::cast_to_num
 
bool set_index (DAPyDataFrame &df, const QList< int > &colsIndex) noexcept
 DAPyScriptsDataFrame::set_index
 
DAPySeries itake_column (DAPyDataFrame &df, int col) noexcept
 提取一列
 
bool insert_at (DAPyDataFrame &df, int col, const DAPySeries &series) noexcept
 插入series
 
bool dropna (DAPyDataFrame &df, int axis=0, const QString &how=QStringLiteral("any"), const QList< int > &indexs=QList< int >(), std::optional< int > thresh=std::nullopt) noexcept
 dropna方法的wrapper
 
bool fillna (DAPyDataFrame &df, double value, int limit) noexcept
 fillna方法的wrapper
 
bool interpolate (DAPyDataFrame &df, const QString &method, int order, int limit) noexcept
 interpolate方法的wrapper
 
bool ffillna (DAPyDataFrame &df, int axis, int limit) noexcept
 ffillna方法的wrapper
 
bool bfillna (DAPyDataFrame &df, int axis, int limit) noexcept
 bfillna方法的wrapper
 
bool dropduplicates (DAPyDataFrame &df, const QString &keep, const QList< int > &indexs) noexcept
 dropduplicates方法的wrapper
 
bool nstdfilteroutlier (DAPyDataFrame &df, double n, int axis, const QList< int > &indexs) noexcept
 nstdfilter方法的wrapper
 
bool clipoutlier (DAPyDataFrame &df, double lowervalue, double uppervalue, int axis) noexcept
 clipoutlier方法的wrapper
 
bool queryDatas (DAPyDataFrame &df, const QString &expr) noexcept
 query方法的wrapper
 
QList< QPair< int, int > > searchData (const DAPyDataFrame &df, const QString &expr) noexcept
 search方法的wrapper
 
bool evalDatas (DAPyDataFrame &df, const QString &expr) noexcept
 
bool sort (DAPyDataFrame &df, const QString &by, bool ascending) noexcept
 sort方法的wrapper
 
bool dataselect (DAPyDataFrame &df, double lowervalue, double uppervalue, const QString &index) noexcept
 select方法的wrapper
 
DAPyDataFrame pivotTable (const DAPyDataFrame &df, const QStringList &value, const QStringList &index, const QStringList &columns, const QString &aggfunc, bool margins, const QString &marginsName, bool sort) noexcept
 pivot_table方法的wrapper
 
- Public 成员函数 继承自 DA::DAPyModule
 DAPyModule (const char *moduleName)
 
 DAPyModule (const pybind11::object &obj)
 
 DAPyModule (pybind11::object &&obj)
 
DAPyModuleoperator= (const DAPyObjectWrapper &obj)
 
DAPyModuleoperator= (const pybind11::object &obj)
 
bool isImport () const
 判断是否导入
 
QString moduleName () const
 获取模块名
 
void reload ()
 重新加载模块
 
bool import (const char *module_n) noexcept
 导入模块
 
QString lastError () const
 
bool hasError () const
 
void clearError ()
 
- 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 类型 继承自 DA::DAPyObjectWrapper
using ErrCallback = std::function< void(const char *) >
 异常错误回调函数
 
- 静态 Public 成员函数 继承自 DA::DAPyModule
static DAPyModule importModule (const char *module_n)
 导入模块
 
static bool isInstanceTime (const pybind11::handle &obj)
 
static bool isInstanceDate (const pybind11::handle &obj)
 
static bool isInstanceDateTime (const pybind11::handle &obj)
 
static bool isInstancePandasDateTime (const pybind11::handle &obj)
 
static bool isInstanceNumpyDateTime (const pybind11::handle &obj)
 
static bool isInstanceTimedelta (const pybind11::handle &obj)
 
- Protected 属性 继承自 DA::DAPyObjectWrapper
pybind11::object _object
 
ErrCallback _errcallback
 

详细描述

对da_dataframe.py的封装,集成了dataframe的操作

需要在bool DAPyScripts::initScripts(QString* err)中import进来

成员函数说明

◆ astype()

bool DA::DAPyScriptsDataFrame::astype ( DAPyDataFrame df,
const QList< int > &  colsIndex,
const DAPyDType dt 
)
noexcept

对列转换为对应的类型

参数
df
colsIndex
dt
返回

◆ bfillna()

bool DA::DAPyScriptsDataFrame::bfillna ( DAPyDataFrame df,
int  axis,
int  limit 
)
noexcept

bfillna方法的wrapper

参数
df
axis
limit填充限制,-1代表不限制,大于0生效
返回

◆ cast_to_datetime()

bool DA::DAPyScriptsDataFrame::cast_to_datetime ( DAPyDataFrame df,
const QList< int > &  colsIndex,
pybind11::dict  args 
)
noexcept

DAPyScriptsDataFrame::cast_to_num

参数
df
args
返回

◆ cast_to_num()

bool DA::DAPyScriptsDataFrame::cast_to_num ( DAPyDataFrame df,
const QList< int > &  colsIndex,
pybind11::dict  args 
)
noexcept

DAPyScriptsDataFrame::cast_to_num

参数
df
args
返回

◆ clipoutlier()

bool DA::DAPyScriptsDataFrame::clipoutlier ( DAPyDataFrame df,
double  lowervalue,
double  uppervalue,
int  axis 
)
noexcept

clipoutlier方法的wrapper

参数
df
lowervalue
uppervalue
返回

◆ dataselect()

bool DA::DAPyScriptsDataFrame::dataselect ( DAPyDataFrame df,
double  lowervalue,
double  uppervalue,
const QString &  index 
)
noexcept

select方法的wrapper

参数
df
contents
返回

◆ drop_icolumn()

bool DA::DAPyScriptsDataFrame::drop_icolumn ( DAPyDataFrame df,
const QList< int > &  index 
)
noexcept

移除dataframe的列,对应da_dataframe.da_drop_icolumn

参数
df
index
返回
成功执行返回true

◆ drop_irow()

bool DA::DAPyScriptsDataFrame::drop_irow ( DAPyDataFrame df,
const QList< int > &  index 
)
noexcept

移除dataframe的行,对应da_dataframe.da_drop_irow

参数
df
index
返回
成功执行返回true

◆ dropduplicates()

bool DA::DAPyScriptsDataFrame::dropduplicates ( DAPyDataFrame df,
const QString &  keep,
const QList< int > &  indexs 
)
noexcept

dropduplicates方法的wrapper

参数
df
keep
indexs
返回

◆ dropna()

bool DA::DAPyScriptsDataFrame::dropna ( DAPyDataFrame df,
int  axis = 0,
const QString &  how = QStringLiteral("any"),
const QList< int > &  indexs = QList< int >(),
std::optional< int >  thresh = std::nullopt 
)
noexcept

dropna方法的wrapper

参数
df
axis
how
indexs
thresh
返回

◆ evalDatas()

bool DA::DAPyScriptsDataFrame::evalDatas ( DAPyDataFrame df,
const QString &  expr 
)
noexcept
参数
df
expr
返回

◆ ffillna()

bool DA::DAPyScriptsDataFrame::ffillna ( DAPyDataFrame df,
int  axis,
int  limit 
)
noexcept

ffillna方法的wrapper

参数
df
axis
limit填充限制,-1代表不限制,大于0生效
返回

◆ fillna()

bool DA::DAPyScriptsDataFrame::fillna ( DAPyDataFrame df,
double  value,
int  limit 
)
noexcept

fillna方法的wrapper

参数
df
value要填充的值
limit填充限制,-1代表不限制,大于0生效
返回

◆ from_parquet()

bool DA::DAPyScriptsDataFrame::from_parquet ( DAPyDataFrame df,
const QString &  path 
)
noexcept

从parquet加载

参数
df
path
返回

◆ from_pickle()

bool DA::DAPyScriptsDataFrame::from_pickle ( DAPyDataFrame df,
const QString &  path 
)
noexcept

从pickle加载

参数
df
path
返回

◆ insert_at()

bool DA::DAPyScriptsDataFrame::insert_at ( DAPyDataFrame df,
int  col,
const DAPySeries series 
)
noexcept

插入series

参数
df
col
series
返回

◆ insert_column() [1/2]

bool DA::DAPyScriptsDataFrame::insert_column ( DAPyDataFrame df,
int  c,
const QString &  name,
const QVariant &  defaultvalue = QVariant() 
)
noexcept

插入列

参数
df
c列的索引
name列名
defaultvalue值,如果为QVariant,将插入np.nan,指定不同类型将插入不同的值
返回

◆ insert_column() [2/2]

bool DA::DAPyScriptsDataFrame::insert_column ( DAPyDataFrame df,
int  c,
const QString &  name,
const QVariant &  start,
const QVariant &  stop 
)
noexcept

插入列

参数
df
c
name
start
stop
返回

◆ insert_nanrow()

bool DA::DAPyScriptsDataFrame::insert_nanrow ( DAPyDataFrame df,
int  r 
)
noexcept

◆ interpolate()

bool DA::DAPyScriptsDataFrame::interpolate ( DAPyDataFrame df,
const QString &  method,
int  order,
int  limit 
)
noexcept

interpolate方法的wrapper

参数
df
method插值填充的方法
order多项式插值的次数
limit填充限制,-1代表不限制,大于0生效
返回

◆ itake_column()

DAPySeries DA::DAPyScriptsDataFrame::itake_column ( DAPyDataFrame df,
int  col 
)
noexcept

提取一列

参数
df
col
返回

◆ nstdfilteroutlier()

bool DA::DAPyScriptsDataFrame::nstdfilteroutlier ( DAPyDataFrame df,
double  n,
int  axis,
const QList< int > &  indexs 
)
noexcept

nstdfilter方法的wrapper

参数
df
axis
n标准差的倍数,范围是0.1~10,默认为3
返回

◆ pivotTable()

DAPyDataFrame DA::DAPyScriptsDataFrame::pivotTable ( const DAPyDataFrame df,
const QStringList &  values,
const QStringList &  index,
const QStringList &  columns,
const QString &  aggfunc,
bool  margins,
const QString &  marginsName,
bool  sort 
)
noexcept

pivot_table方法的wrapper

参数
values要进行汇总的数据值
index确定行参数
columns确定列参数
aggfunc要计算的函数,mean求均值、sum求和、size计算个数
margins行列数据的统计
sort聚合后的结果排序
返回
DAPyDataFrame

◆ queryDatas()

bool DA::DAPyScriptsDataFrame::queryDatas ( DAPyDataFrame df,
const QString &  expr 
)
noexcept

query方法的wrapper

参数
df
expr
返回

◆ searchData()

QList< QPair< int, int > > DA::DAPyScriptsDataFrame::searchData ( const DAPyDataFrame df,
const QString &  expr 
)
noexcept

search方法的wrapper

参数
df
expr
返回

◆ set_index()

bool DA::DAPyScriptsDataFrame::set_index ( DAPyDataFrame df,
const QList< int > &  colsIndex 
)
noexcept

DAPyScriptsDataFrame::set_index

参数
df
colsIndex
返回

◆ setnan()

bool DA::DAPyScriptsDataFrame::setnan ( DAPyDataFrame df,
const QList< int > &  rowsIndex,
const QList< int > &  colsIndex 
)
noexcept

设置nan值

参数
df
rowsIndex
colsIndex
返回

◆ sort()

bool DA::DAPyScriptsDataFrame::sort ( DAPyDataFrame df,
const QString &  by,
bool  ascending 
)
noexcept

sort方法的wrapper

参数
df
by
ascending
返回

◆ to_csv()

bool DA::DAPyScriptsDataFrame::to_csv ( const DAPyDataFrame df,
const QString &  path,
const QString &  sep 
)
noexcept

保存为txt/csv 对应da_dataframe.da_to_csv

参数
df
path
返回

◆ to_excel()

bool DA::DAPyScriptsDataFrame::to_excel ( const DAPyDataFrame df,
const QString &  path 
)
noexcept

保存为xlsx 对应da_dataframe.da_to_xlsx

参数
df
path
返回

◆ to_parquet()

bool DA::DAPyScriptsDataFrame::to_parquet ( const DAPyDataFrame df,
const QString &  path 
)
noexcept

保存为parquet对应da_dataframe.da_to_parquet

参数
df
path
返回

◆ to_pickle()

bool DA::DAPyScriptsDataFrame::to_pickle ( const DAPyDataFrame df,
const QString &  path 
)
noexcept

保存为pickle 对应da_dataframe.da_to_pickle

参数
df
path
返回

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