Series.from_csv not loading header names #10483
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
usesDataFrame.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 theseries.name
to be 1, and theseries.index.name
to be 0. The fix was to explicitly set the names in Series.from_csv toNone
.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!