A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/10184 below:

read_csv does not set index name on empty dataframe · Issue #10184 · pandas-dev/pandas · GitHub

If foo.csv contains

x,y
1,2

then you get the normal behavior:

>>> df = pd.read_csv('foo.csv', index_col=0)
>>> list(df.columns)
['y']
>>> df.index.name
'x'

but if you remove the data row "1,2" in the CSV the index name gets dropped:

>>> df = pd.read_csv('foo.csv', index_col=0)
>>> list(df.columns)
['y']
>>> df.index.name
None

This means round-tripping with to_csv/read_csv fails for empty dataframes.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4