python - I'm trying to pass usernames to excel using praw I get: AttributeError: 'list' object has no attribute 'to_excel -


i trying run analysis on subreddit users. when try send the data (df) excel error: attributeerror: 'list' object has no attribute 'to_excel. code below.

import config  import pandas pd  import os  import itertools  import xlsxwriter  df = []  def bot_login():      print ("logging in")     r = praw.reddit(username = config.username,             password = config.password,             client_id = config.client_id,             client_secret = config.client_secret,             user_agent= "u/1234 testing bot lerns programming")     print("logged in")     return r  def run_bot(r):      settings = {'subreddit': 'test'}     submissions = r.subreddit(settings['subreddit']).new(limit=1)      print('still working')     s in submissions:         print("downvoted: '{}'".format(s.title[0:70]))         df.append(s.author)         time.sleep(2)  r = bot_login()  run_bot(r)  os.chdir('c:/users/jonathan/desktop/data')  df.to_excel('users.xlsx')   print(df) 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -