使用Pandas和Tweepy我需要逐行读取推文的json文件

时间:2015-12-17 21:14:36

标签: python pandas tweepy

我有以下代码将推文保存到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)

使用pandas dataframe.read_json我是否需要逐行读取json文件,或者是否可以传递read_json文件名以创建数据帧

1 个答案:

答案 0 :(得分:0)

pandas.read_json应该返回一个数据帧。阅读文档here