我有一个看起来像这样的 df,叫做 full_senator_df:
Official Twitter Senator party
0 SenShelby Richard Shelby Republican
1 lisamurkowski Lisa Murkowski Republican
2 SenDanSullivan Dan Sullivan Republican
我已经编写了一些代码来使用这些数据来检索这些参议员的推文。是否可以将结果附加到表中或将结果作为 json 而不是它当前正在执行的打印?
senator_count = 0
num_senators = len(full_senator_df.index)
while senator_count <= num_senators:
senator_official_twitter = full_senator_df['Official Twitter'][senator_count]
tweets = api.user_timeline(screen_name = senator_official_twitter, count = tweet_num, include_rts = True)
for status in tweets:
print(full_senator_df['Senator'][senator_count], status.text, full_senator_df['party'][senator_count])
senator_count += 1
喵喔喔
心有法竹
相关分类