Unable to save Pandas DataFrame to CSV

Viewed 45

The code I was using to save data scraped from my external module is no longer saving to .csv.

Initially, all the code was in a Jupyter notebook - now I've moved to two python files, importing the class/module.

from datetime import datetime
import csv
import pandas as pd
import MixcloudScraperDiscoverFunc as search


terms = ['house', 'trance', 'techno']
discover = search.MixCloudDiscover()
discover_data = discover.discover(terms)
now = datetime.now()
# print(mixcloud_data)
fields = ['Link', 'Curator', 'Followers', 'Bio', 'Location', 'Twitter']
currentDateTime = datetime.now().strftime("%m-%d-%Y %H-%M-%S %p")
mixcloud_df = pd.DataFrame.from_dict(discover_data)
mixcloud_df.to_csv(
    f"Mixcloud_Data_{str(terms)}_{currentDateTime}.csv",
    index=False
)

Would anyone know what is wrong here?

0 Answers
Related