Python Forum
Using Pandas to store spotipy output in csv (python)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Pandas to store spotipy output in csv (python)
#2
Try make a new Dataframe based on the loop.
Then write that Dataframe to csv new_df.to_csv
Untested example:
need = []
for i, item in enumerate(playlist['items']):
    track = item['track']
    need.append((i, track['artists'][0]['name'], track['name'], track['id']))

new_df = pd.DataFrame(need, columns=('Item', 'Artists', 'Name', 'Id'))
Reply


Messages In This Thread
RE: Using Pandas to store spotipy output in csv (python) - by snippsat - Jan-23-2018, 04:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Add NER output to pandas dataframe dg3000 0 280 Apr-22-2024, 08:14 PM
Last Post: dg3000
  No Output In Pandas DataFrame Query eddywinch82 1 1,966 Aug-17-2020, 09:25 PM
Last Post: eddywinch82
  How does pyplot know what was plotted by the output of pandas.DataFrame(...).cumprod( codeowl 2 2,264 Mar-28-2020, 08:27 AM
Last Post: j.crater
  Can't store pandas converted json dataframe into mongoDB mahmoud899 1 4,297 Dec-12-2018, 07:45 PM
Last Post: nilamo
  Output substrings from rows in pandas brocq_18 5 4,067 Jun-21-2018, 11:30 AM
Last Post: brocq_18
  Issue in getting the required data from nested json and store it in a pandas datafram PrateekG 2 3,355 May-20-2018, 11:25 AM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020