Python 如何比较熊猫的频率/采样率?

Python 如何比较熊猫的频率/采样率?,python,pandas,sample-data,Python,Pandas,Sample Data,在[4]:从pandas.tseries.frequencies导入到_offset中,有没有一种方法可以说“13Min”是“>59S”和 [5]中:to_offset('59s')to_offset('59s')) Out[6]:对 在[7]中:to_offset('13T')to_offset('2H')) Out[8]:假 [10]中:to_offset('13T')to_offset('W')抛出类型错误:无序类型:MonthEnd()>Week()是否也有方法比较这些? In [2]:

在[4]:从pandas.tseries.frequencies导入到_offset中,有没有一种方法可以说“13Min”是“>59S”和

[5]中:to_offset('59s')to_offset('59s'))
Out[6]:对
在[7]中:to_offset('13T')to_offset('2H'))
Out[8]:假
[10]中:to_offset('13T')
另一种方法是将两个频率添加到一个公共日期,并比较
时间戳的结果实例。这也解决了@rixmit的评论

In [2]: import pandas as pd
In [3]: from pandas.tseries.frequencies import to_offset

In [4]: common_dt = pd.to_datetime("2000-01-01")
In [5]: f_a = common_dt + to_offset('59s')
In [6]: f_b = common_dt + to_offset('1T')
In [7]: f_a > f_b
Out[8]: False

In [9]: f_a = common_dt + to_offset('M')
In [9]: f_b = common_dt + to_offset('W')
In [10]: f_a > f_b
Out[10]: True

这一直有效,直到您开始比较,例如月份偏移量:to_offset('M')>to_offset('W')抛出类型错误:无序类型:MonthEnd()>Week()是否也有方法比较这些?
In [2]: import pandas as pd
In [3]: from pandas.tseries.frequencies import to_offset

In [4]: common_dt = pd.to_datetime("2000-01-01")
In [5]: f_a = common_dt + to_offset('59s')
In [6]: f_b = common_dt + to_offset('1T')
In [7]: f_a > f_b
Out[8]: False

In [9]: f_a = common_dt + to_offset('M')
In [9]: f_b = common_dt + to_offset('W')
In [10]: f_a > f_b
Out[10]: True