我有一个用日期索引的数据框(Python datetime 对象)。我怎样才能找到频率作为数据框中数据的月数?
我尝试了属性data_frame.index.freq,但它返回一个 none 值。我也尝试asfreq使用函数,data_frame.asfreq('M',how={'start','end'}但它没有返回预期的结果。请告知我如何获得预期的结果。
寻找正则表达式以匹配列表中的元组对.一直使用下面的正则表达式
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)]