2015-12-17 50 views
0

閱讀鳴叫線的JSON文件我有以下的代碼,節省鳴叫一個JSON文件使用熊貓和Tweepy我需要通過線

  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) 

使用熊貓dataframe.read_json做我需要閱讀JSON文件一行一行或有可能通過read_json文件名來創建一個數據幀

+1

您是否已經嘗試使用'read_json',如果是,發生了什麼?數據樣本也鼓勵更具體的解決方案。 http://stackoverflow.com/help/mcve – Stefan

回答

0

pandas.read_json應該返回一個數據幀。閱讀文檔here

+0

感謝您的回覆。如果我的json文件格式正確,或者我使用正確的參數調用read_json,我很難知道。在一些帖子中,我看到人們在向文件寫入推文之後添加/ n。你知道tweepy的_json是否需要被讀作分割,列,記錄,索引或列 – mobcdi

+0

你的代碼沒有調用'''read_json'''。 – theamateurdataanalyst

+0

你想要做什麼以及什麼阻止你? – theamateurdataanalyst