使用Pandas和Tweepy,我需要逐行读取一个包含推文的json文件吗?

2024-04-25 14:38:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我有以下代码将tweets保存到json文件中

            for tweets in tweepy.Cursor(api.user_timeline, id=account).items(1000):
            # depending on where the supports club are home or away
            if tweets.created_at >= EarliestTweet:
                #Write it to a file
                json.dump(tweets._json,jsonfile, sort_keys = True, skipkeys = True, indent = 2,ensure_ascii=False)

使用pandasdataframe.read_json我需要逐行读取json文件还是可以传递read_json文件名来创建数据帧


Tags: 文件代码inapiidjsontruefor