跳转到主要内容

WhisperDB Python Pandas Reader

项目描述

WhisperDB Python Pandas Reader

入门

安装

pip install whisper-pandas

作为Python包使用

# Simple to read any Whisper file
>>> from whisper_pandas import WhisperFile
>>> wsp = WhisperFile.read("example.wsp")

# Simple to work with metadata as objects
>>> wsp.meta.archives
[WhisperArchiveMeta(index=0, offset=52, seconds_per_point=10, points=1555200, retention=15552000),
 WhisperArchiveMeta(index=1, offset=18662452, seconds_per_point=60, points=5256000, retention=315360000),
 WhisperArchiveMeta(index=2, offset=81734452, seconds_per_point=3600, points=87601, retention=315363600)]

# Simple to work with data as `pandas.Series`
>>> wsp.data[1]
2017-02-10 07:07:00+00:00    0.000000
2017-02-10 07:08:00+00:00    0.000000
2017-02-10 07:09:00+00:00    0.000000
2017-02-10 07:10:00+00:00    0.000000
2017-02-10 07:11:00+00:00    0.000000
                               ...   
2021-07-20 13:35:00+00:00    4.099915
2021-07-20 13:36:00+00:00    4.104024
2021-07-20 13:37:00+00:00    4.099772
2021-07-20 13:38:00+00:00    4.101358
2021-07-20 13:39:00+00:00    4.099854
Length: 2331015, dtype: float32

作为命令行工具使用

whisper-pandas example.wsp

描述

WhisperDB是一种固定大小的时序格式(见文档)。

官方Python包在这里: whisper

你应该使用它,除非你喜欢Pandas并且只需要读取(而不是写入)Whisper文件,那么你应该使用whisper-pandas

为什么?

  • 使用起来更简单
  • 你不太可能犯错
  • 速度更快

目前我们使用whisper.info内部读取元数据,然后使用Numpy和Pandas读取数据,使用对象来存储元数据和一些便利功能,如快速显示给定文件中可用的数据或读取压缩文件。

未实现部分读取,给定文件总是完整读取,并将数据直接转换为具有日期时间的列式pandas.Series格式。

开发

欢迎通过Github拉取请求进行贡献。

你可以通过pytest运行测试。

打包遵循打包Python项目的建议。要发布,请在setup.cfg中增加版本号并运行那里的命令。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源代码发行版

whisper-pandas-0.1.tar.gz (4.9 kB 查看哈希值)

上传时间 源代码

构建发行版

whisper_pandas-0.1-py3-none-any.whl (5.4 kB 查看哈希值)

上传时间 Python 3

由以下支持