Apr-24-2022, 06:12 PM
I want to insert lots of csvs in one dataframe. They are from zenodo and are charts from spotify. The .zip archive has three folders, 2017, 2018, 2019 that contain the csvs. I've tried this code, but I get an error saying no objects to concat:
header = 0 dfs = [] for file in glob.glob('Charts/*/201?/*.csv'): region = file.split('/')[1] dates = re.findall('\d{4}-\d{2}-\d{2}', file.split('/')[-1]) weekly_chart = pd.read_csv(file, header=header, sep='\t') weekly_chart['week_start'] = datetime.strptime(dates[0], '%Y-%m-%d') weekly_chart['week_end'] = datetime.strptime(dates[1], '%Y-%m-%d') weekly_chart['region'] = region dfs.append(weekly_chart) all_charts = pd.concat(dfs)What should I try? The archive is here, it's the charts.zip: https://zenodo.org/record/4778563/files/...download=1