我要完成的目标是对“mjtheme_namecode”列中任何数字出现的次数进行“计数”。我的导师说我们必须使用json\u normalize方法来完成这个任务。在
通常我会用pd.value_计数()但单元格中有其他文本,因此这是不可能的。在
格式如下:
我用过pd.read_json文件将数据读入pandas数据帧,然后在列mjtheme_namecode上进行过滤。我尝试过使用json\u normalize访问数据,但仍然出现错误:“字符串索引必须是整数”。在
sample = df.to_json #Convert series to a json string
json_normalize(sample2, 'name')
有人能指出我如何解决这个问题吗?在
谢谢你!在
对我来说:
相关问题 更多 >
编程相关推荐