小编kar*_*waj的帖子

数据帧的频率

我有一个用日期索引的数据框(Python datetime 对象)。我怎样才能找到频率作为数据框中数据的月数?

我尝试了属性data_frame.index.freq,但它返回一个 none 值。我也尝试asfreq使用函数,data_frame.asfreq('M',how={'start','end'}但它没有返回预期的结果。请告知我如何获得预期的结果。

python pandas

5
推荐指数
1
解决办法
7470
查看次数

Python正则表达式匹配元组对

寻找正则表达式以匹配列表中的元组对.一直使用下面的正则表达式

s = '[(aleakedteaserand, NN), (abehind, IN), (the, DT)]'    
re.findall(r'\((.*,.*)\)',s)
Run Code Online (Sandbox Code Playgroud)

但它仍然缺少最终的支撑.

['aleakedteaserand, NN), (abehind, IN), (the, DT']
Run Code Online (Sandbox Code Playgroud)

预期产量:

[(aleakedteaserand,NN),(abehind,IN),(the,DT)]

regex python-2.7

2
推荐指数
1
解决办法
2631
查看次数

标签 统计

pandas ×1

python ×1

python-2.7 ×1

regex ×1