DAWorkbench 0.0.1
DAWorkbench API
载入中...
搜索中...
未找到
DAPyIndex.h
1#ifndef DAPYINDEX_H
2#define DAPYINDEX_H
3#include "DAPyBindQtGlobal.h"
4#include "DAPyObjectWrapper.h"
5#include <QVariant>
6#include <QSet>
7#include <QDebug>
8#include "DAPybind11InQt.h"
9namespace DA
10{
14class DAPYBINDQT_API DAPyIndex : public DAPyObjectWrapper
15{
16public:
21 {
22 IM_None,
23 IM_Ffill,
24 IM_Bfill,
25 IM_Nearest
26 };
27
28public:
29 DAPyIndex();
30 DAPyIndex(const DAPyIndex& s);
32 DAPyIndex(const pybind11::object& obj);
33 DAPyIndex(pybind11::object&& obj);
34 ~DAPyIndex();
35 DAPyIndex& operator=(const pybind11::object& obj);
36 DAPyIndex& operator=(pybind11::object&& obj);
37 DAPyIndex& operator=(const DAPyIndex& obj);
38 DAPyIndex& operator=(DAPyIndex&& obj);
39 DAPyIndex& operator=(const DAPyObjectWrapper& obj);
40 DAPyIndex& operator=(DAPyObjectWrapper&& obj);
41 pybind11::object operator[](std::size_t i) const;
42 pybind11::object operator[](const QSet< std::size_t >& slice) const;
43 // 类似iat的属性,注意,实际index没有iat属性
44 pybind11::object iat(std::size_t i) const;
45 // 获取dtype
46 pybind11::dtype dtype() const;
47 // 转换为列表
48 pybind11::list toList() const;
49 // Index.empty
50 bool empty() const;
51 // Index.size
52 std::size_t size() const;
53 //
54 QVariant value(std::size_t i) const;
55 // 获取索引号
56 uint64_t getIndexer(pybind11::object v, const char* method = "nearest");
57
58protected:
59 // 检测是否为pandas.index,如果不是将会设置为none
60 void checkObjectValid();
61
62public:
63 static bool isIndexObj(const pybind11::object& obj);
64};
65} // namespace DA
66Q_DECLARE_METATYPE(DA::DAPyIndex)
67#endif // DAPYINDEX_H
对pandas.index的封装
Definition DAPyIndex.h:15
IndexerMethod
适配getIndexer的方法枚举,
Definition DAPyIndex.h:21
这是针对pubind11::object的封装
Definition DAPyObjectWrapper.h:15
序列化类都是带异常的,使用中需要处理异常
Definition AppMainWindow.cpp:44