Series.from_csv not loading header names by lewisacidic · Pull Request #10483 · pandas-dev/pandas (original) (raw)
Series.from_csv at the moment does not load the series.name and series.index.name when the header keyword argument is stated.
This was introduced in 6078fba. The issue was that Series.from_csv
uses DataFrame.from_csv
, which automatically indexes columns (in practice, the index column gets labelled 0 and the values column gets labelled 1). Converting this to a series will then cause the series.name
to be 1, and the series.index.name
to be 0. The fix was to explicitly set the names in Series.from_csv to None
.
This caused the headers to be deleted even if they were provided by setting the header kwarg.
The fix is simple, to check if the headers are provided, and only setting the names to None if they are not.
I included some tests, please let me know if this is enough as I am new to open-source and pandas.
Thanks!