I need to concatenate 6 data frames and csv file names are stored as 'all_files'. I have the following code:
df_from_each_file = (pd.read_csv(f, encoding = 'utf-8') for f in all_files)
data = pd.concat(df_from_each_file, ignore_index=True)
It gives the following error:
First line works well, but second line gives this error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 1: invalid start byte
I tried different encodings but still gives the error. Do you guys have any idea?
cp1252,cp1251?