One - One Code All

Blog Content

padas中DataFrame之模糊查询

Python 统计学-科学计算   2013-11-21 22:14:05

pandas的dataframe匹配模糊查询 str.contains

df_obj[df_obj['fund'].str.contains('000001')]

# 使用正则表达式进行模糊匹配,*匹配0或无限次,?匹配0或1次

df_obj[df_obj['title'].str.contains(r'.*?n.*')]

上一篇:pandas.DataFrame选取特定行
下一篇:python程序超时重试机制

The minute you think of giving up, think of the reason why you held on so long.