Pandas - write Multiindex rows with to_csv
I am using to_csv to write a Multiindex DataFrame to csv files. The csv file has one column that contains the multiindexes in tuples, like: ('a', 'x') ('a', 'y') ('a', 'z') ('b', 'x') ('b', 'y') ('b', 'z') However, I want to be able to output the Multiindex to two columns instead of one column of tuples, such as: a, x , y , z b, x , y , z It looks like tupleize_cols can achieve this for columns, but there is no such option for the rows. Is there a way to achieve this? I think this will do it In [3]: df = DataFrame(dict(A = 'foo', B = 'bar', value = 1),index=range(5)).set_index(['A','B']) In [4