我是pandas
的新手,我正在尝试通过从原始数据的一列中提取部分字符串来创建数据帧
recipe_info = {
'title' = [ 'waffles', 'eggs', 'chocolate pancakes', 'pancakes']
'rating' = [ 3.4, 2.8, 3,6, 1.5 ]
my_recipes = pd.DataFrame(recipe_info)
recipe_info[recipe_info['title'].str.contains("pancake")]
所需输出:
all_the_pancakes = {
'title' = ['chocolate pancakes', 'pancakes']
'rating' = [3.6, 1.5]
提前谢谢。。。你知道吗
Use也可以使用filter():
您需要:
输出:
相关问题 更多 >
编程相关推荐