Skip to main content

Time,Timeseries,vdict(combine the benefits of list and dict) is designed for Timeseries problem analysis

Project description

zdb

这个包的设计是模仿pathlib的,我们管这种设计方式叫基于群论的软件工程设计方法。 this package is designed follow the pathlib's design method we call this kind design method : software design base on group theory

群的性质越完备越好,则类的设计越好。 将群论引入软件工程有助于量化评估代码质量,我们经常无法解决的问题是什么代码算好的问题,缺乏一个量化的指标。 这是python和C++语言的魅力,未来语言应该怎样设计呢?

时间序列是数据处理中非常重要的领域,数据管理工程中很重要的原则就是一手数据源原则。 this package contains another design method. 一手数据源原则,避免计算列,所有的日期都是由时间戳获得,这是数据处理中最重要的原则之一。 一手数据源原则,就是A数据集由B数据集计算得来,但是为了避免A数据集计算错误和时间差造成的不一致,通常C计算集都是由A计算得来。 这有个概率公式A->B->C A->B出错的概率为a B->C出错的概率为b, C数据集会因为数据错误的概率会因为传递而导致增加( sum(A)a(1-b) + sum(B)*b ) /sum(B)。 当我们选择接口或者数据嵌套时,就需要深度评估,尤其加强测试。

install : python setup.py install

This package is very easy to use:

You can input data parameter with float timestamp or string datetime format to init the Time class instance.

from richdb import Time,Timeseries,rich

rich() #generate some magic numbers may make you rich, why not have a try!!!!!!!!!

#init the class Time with timestamp #用时间戳初始化这个时间Time类 t1 = Time(30000)

t2 = Time(1000)

t979 = Time(1)

t989 = Time(0)

t999 = Time(-1)

#init the class Time with some special strformat #用常见的几种日期格式初始化Time这个类。 t3 = Time('2022-01-05 12:12:12.1')

t909 = Time('2022-01-05 12:12:12.000001')

t4 = Time('2022.01.05 12:12:12.000001')

t5 = Time('2022/01/05 12:12:12.000001')

t6 = Time('20220105 12:12:12.000001')

t99 = Time('2022')

t99 = Time('202201')

t7 = Time('20220105')

t8 = Time('20220105 12')

t9 = Time('20220105 12:12')

t10 = Time('20220105 12:12:13')

t22 = Time('2022')

t23 = Time('2022-01')

t11 = Time('2022-01-05')

t12 = Time('2022-01-05 12')

t13 = Time('2022-01-05 12:12')

t14 = Time('2022-01-05 12:12:13')

t25 = Time('2022')

t26 = Time('2022.01')

t15 = Time('2022.01.05')

t16 = Time('2022.01.05 12')

t17 = Time('2022.01.05 12:12')

t17 = Time('2022.01.05 12:12:13')

#you can get all kinds of the datetime format with the function fmt. print( 't17 time format %Y-%m-%d %H:%M:%S ', t17.fmt( '%Y-%m-%d %H:%M:%S' ))

#you can do Time plus and minus ,the return is float second diff. print( t1 )

print( t2 )

print( t1 - t2 )

print( t1.timestamp )

print( t2.timestamp )

print( t1 + 100 )

print( t1 + 20000 )

#you also can get month diff years diff and day diff with the special diff function.

print( 'day is :', t1.day)

print( 'month is :', t1.month)

print( 'year is :', t1.year)

print( 'week is :', t1.week)

获取截止当前时间所在月的全部日期: ts1 = Timeseries()

获取截止日期20210101的所在月的全部日期: ts2 = Timeseries('20210101')

获取截止日期20210131的所在月的全部日期: ts3 = Timeseries('20210131')

按照%Y-%m-%d格式输出时间序列的list print( ts1.fmt('%Y-%m-%d') )

按照%Y-%m-%d格式输出时间序列的list print( ts2.fmt('%Y-%m-%d'))

按照%Y-%m-%d格式输出时间序列的list print( ts3.fmt('%Y-%m-%d'))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

richdb-0.0.3.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

richdb-0.0.3-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file richdb-0.0.3.tar.gz.

File metadata

  • Download URL: richdb-0.0.3.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for richdb-0.0.3.tar.gz
Algorithm Hash digest
SHA256 4b3f8798f9fd532f47d090da8b6326f766c446b38ce0ec4a2ee23697593fce34
MD5 3d14e39786317fab14d536c1ac7f0e4a
BLAKE2b-256 cca08decd42451147cf1645e4a799ab0c6184b02ccd5b131736206aea8a3e559

See more details on using hashes here.

File details

Details for the file richdb-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: richdb-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for richdb-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9521be9347d7ded20445b8e82ed425a9a6c468d0ef907967273d25a2bc673464
MD5 40a627cb94d68650cf1db78da913f995
BLAKE2b-256 ede19ad3c2c0801ec26ecab264387055cda8b5ce21af2a8889f4a02b6780214f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page