【发布时间】:2021-05-29 14:02:24
【问题描述】:
这是我在 jsonl 中的数据结构
"content": "Not yall gassing up a gay boy with no rhythm", "place": {"_type": "snscrape.modules.twitter.Place", "fullName": "Manhattan, NY", "name": "Manhattan", "type": "city", "country": "United States", "countryCode": "US"}
我尝试使用此代码从 place 列中选择 countryCode
country_df = test_df.loc[test_df['place'].notnull(), ['content', 'place']]
countrycode_df = country_df["place"].loc["countryCode"]
但它给了我这个错误
KeyError: 'countryCode'
我该如何解决这个问题?
我试过这个method,但它不适合我的情况
【问题讨论】: