@@ -128,9 +128,8 @@ def __init__(self, f: ReadCsvBuffer[str] | list, **kwds) -> None:
128
128
self .quoting = kwds ["quoting" ]
129
129
self .skip_blank_lines = kwds ["skip_blank_lines" ]
130
130
131
- self .has_index_names = False
132
- if "has_index_names" in kwds :
133
- self .has_index_names = kwds ["has_index_names" ]
131
+ # Passed from read_excel
132
+ self .has_index_names = kwds .get ("has_index_names" , False )
134
133
135
134
self .thousands = kwds ["thousands" ]
136
135
self .decimal = kwds ["decimal" ]
@@ -300,9 +299,10 @@ def read(
300
299
return index , conv_columns , col_dict
301
300
302
301
# handle new style for names in index
303
- count_empty_content_vals = count_empty_vals (content [0 ])
304
302
indexnamerow = None
305
- if self .has_index_names and count_empty_content_vals == len (columns ):
303
+ if self .has_index_names and sum (
304
+ int (v == "" or v is None ) for v in content [0 ]
305
+ ) == len (columns ):
306
306
indexnamerow = content [0 ]
307
307
content = content [1 :]
308
308
@@ -1524,10 +1524,6 @@ def _remove_empty_lines(self, lines: list[list[T]]) -> list[list[T]]:
1524
1524
]
1525
1525
1526
1526
1527
- def count_empty_vals (vals ) -> int :
1528
- return sum (1 for v in vals if v == "" or v is None )
1529
-
1530
-
1531
1527
def _validate_skipfooter_arg (skipfooter : int ) -> int :
1532
1528
"""
1533
1529
Validate the 'skipfooter' parameter.
0 commit comments