@@ -5037,6 +5037,13 @@ def _make_frame(names=None):
5037
5037
result .columns .names = df .columns .names
5038
5038
assert_frame_equal (df ,result )
5039
5039
5040
+ # tupleize_cols=True and index=False
5041
+ df = _make_frame (True )
5042
+ df .to_csv (path ,tupleize_cols = True ,index = False )
5043
+ result = read_csv (path ,header = 0 ,tupleize_cols = True ,index_col = None )
5044
+ result .columns = df .columns
5045
+ assert_frame_equal (df ,result )
5046
+
5040
5047
# whatsnew example
5041
5048
df = _make_frame ()
5042
5049
df .to_csv (path ,tupleize_cols = False )
@@ -5060,6 +5067,18 @@ def _make_frame(names=None):
5060
5067
df .to_csv (path ,tupleize_cols = False )
5061
5068
5062
5069
# catch invalid headers
5070
+ try :
5071
+ read_csv (path ,tupleize_cols = False ,header = range (3 ),index_col = 0 )
5072
+ except (Exception ), detail :
5073
+ if not str (detail ).startswith ('Passed header=[0,1,2] are too many rows for this multi_index of columns' ):
5074
+ raise AssertionError ("failure in read_csv header=range(3)" )
5075
+
5076
+ try :
5077
+ read_csv (path ,tupleize_cols = False ,header = range (7 ),index_col = 0 )
5078
+ except (Exception ), detail :
5079
+ if not str (detail ).startswith ('Passed header=[0,1,2,3,4,5,6], len of 7, but only 6 lines in file' ):
5080
+ raise AssertionError ("failure in read_csv header=range(7)" )
5081
+
5063
5082
for i in [3 ,4 ,5 ,6 ,7 ]:
5064
5083
self .assertRaises (Exception , read_csv , path , tupleize_cols = False , header = range (i ), index_col = 0 )
5065
5084
self .assertRaises (Exception , read_csv , path , tupleize_cols = False , header = [0 ,2 ], index_col = 0 )
0 commit comments