@@ -153,7 +153,7 @@ They can take a number of arguments:
153
153
time and lower memory usage.
154
154
- ``mangle_dupe_cols ``: boolean, default True, then duplicate columns will be specified
155
155
as 'X.0'...'X.N', rather than 'X'...'X'
156
- - ``tupleize_cols ``: boolean, default True , if False, convert a list of tuples
156
+ - ``tupleize_cols ``: boolean, default False , if False, convert a list of tuples
157
157
to a multi-index of columns, otherwise, leave the column index as a list of tuples
158
158
159
159
.. ipython :: python
@@ -860,19 +860,16 @@ Reading columns with a ``MultiIndex``
860
860
861
861
By specifying list of row locations for the ``header `` argument, you
862
862
can read in a ``MultiIndex `` for the columns. Specifying non-consecutive
863
- rows will skip the interveaning rows.
863
+ rows will skip the interveaning rows. In order to have the pre-0.13 behavior
864
+ of tupleizing columns, specify ``tupleize_cols=True ``.
864
865
865
866
.. ipython :: python
866
867
867
868
from pandas.util.testing import makeCustomDataframe as mkdf
868
869
df = mkdf(5 ,3 ,r_idx_nlevels = 2 ,c_idx_nlevels = 4 )
869
- df.to_csv(' mi.csv' , tupleize_cols = False )
870
+ df.to_csv(' mi.csv' )
870
871
print open (' mi.csv' ).read()
871
- pd.read_csv(' mi.csv' ,header = [0 ,1 ,2 ,3 ],index_col = [0 ,1 ],tupleize_cols = False )
872
-
873
- Note: The default behavior in 0.12 remains unchanged (``tupleize_cols=True ``) from prior versions,
874
- but starting with 0.13, the default *to * write and read multi-index columns will be in the new
875
- format (``tupleize_cols=False ``)
872
+ pd.read_csv(' mi.csv' ,header = [0 ,1 ,2 ,3 ],index_col = [0 ,1 ])
876
873
877
874
Note: If an ``index_col `` is not specified (e.g. you don't have an index, or wrote it
878
875
with ``df.to_csv(..., index=False ``), then any ``names `` on the columns index will be *lost *.
@@ -966,7 +963,7 @@ function takes a number of arguments. Only the first is required.
966
963
- ``sep `` : Field delimiter for the output file (default ",")
967
964
- ``encoding ``: a string representing the encoding to use if the contents are
968
965
non-ascii, for python versions prior to 3
969
- - ``tupleize_cols ``: boolean, default True , if False, write as a list of tuples,
966
+ - ``tupleize_cols ``: boolean, default False , if False, write as a list of tuples,
970
967
otherwise write in an expanded line format suitable for ``read_csv ``
971
968
972
969
Writing a formatted string
0 commit comments