Handling error “TypeError: Expected tuple, got str” loading a CSV to pandas multilevel and multiindex (pandas)
问题 I'm trying to load a CSV file (this file) to create a multiindex e multilevel dataframe. It has 5(five) indexes and 3(three) levels in columns. How I can do? Here is the code: df = pd.read_csv('./teste.csv' ,index_col=[0,1,2,3,4] ,header=[0,1,2,3] ,skipinitialspace=True ,tupleize_cols=True) df.columns = pd.MultiIndex.from_tuples(df.columns) Expected output: variables u \ level 1 days 1 2 times 00h 06h 12h 18h 00h wsid lat lon start prcp_24 329 -43.969397 -19.883945 2007-03-18 10:00:00 72.0 0