我的数据
data = [{"content": "1", "title": "chestnut", "info": "", "time": 1578877014},
{"content": "2", "title": "chestnut", "info": "", "time": 1579877014},
{"content": "3", "title": "ches", "info": "", "time": 1582877014},
{"content": "aa", "title": "ap", "info": "", "time": 1582876014},
{"content": "15", "title": "apple", "info": "", "time": 1581877014},
{"content": "16", "title": "banana", "info": "", "time": 1561877014},
]
我的代码
index=[i['content'] for i in data]
s=pd.Series(data,index)
print((s[s.str.get('title').contains('ches',regex=True)]))
发生错误
AttributeError: 'Series' object has no attribute 'contains'
我想达到这个效果,我如何使用包含contais文档:https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.str.contains.html#pandas.Series.str.contains。
我希望数据是
[
{"content": "1", "title": "chestnut", "info": "", "time": 1578877014},
{"content": "2", "title": "chestnut", "info": "", "time": 1579877014},
{"content": "3", "title": "ches", "info": "", "time": 1582877014},
]
神不在的星期二
相关分类