0

I'm trying to run the following code:

file_list=['TC20_test1.csv','TC20_test2.csv','TC20_test3.csv','TC20_test4.csv','TC20_test5.csv']

main_dataframe = pd.DataFrame(pd.read_csv(file_list[0])) #Read data

for i in range(1,len(file_list)):

data = pd.read_csv(file_list[i])

df = pd.DataFrame(data)

main_dataframe = pd.concat([main_dataframe,df],axis=1)

print(main_dataframe)

The main idea is to extract data from the same place in various csv files and add them to a data frame, however I keep getting this error code every time I try to run it. UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 181: invalid start byte.

Any help would be greatly appreciated :))

  • Does this answer your question? [UnicodeDecodeError when reading CSV file in Pandas with Python](https://stackoverflow.com/questions/18171739/unicodedecodeerror-when-reading-csv-file-in-pandas-with-python) – piet.t Mar 22 '22 at 10:06

0 Answers0