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/9798 below:

read_csv() interprets index_col="True" as "1" · Issue #9798 · pandas-dev/pandas · GitHub

epi.txt

OBS ID PERIOD TMT Y0 AGE COUNT
1 1 1 0 11 31 5
2 1 2 0 11 31 3
3 1 3 0 11 31 3
4 1 4 0 11 31 3
5 2 1 0 11 30 3
6 2 2 0 11 30 5
7 2 3 0 11 30 3
8 2 4 0 11 30 3
9 3 1 0 6 25 2
10 3 2 0 6 25 4
epi = pandas.read_csv("./epi.datn.txt", sep=" ", index_col=True)
print(epi)
    OBS  PERIOD  TMT  Y0  AGE  COUNT
ID                                  
1     1       1    0  11   31      5
1     2       2    0  11   31      3
1     3       3    0  11   31      3
1     4       4    0  11   31      3
2     5       1    0  11   30      3
2     6       2    0  11   30      5
2     7       3    0  11   30      3
2     8       4    0  11   30      3
3     9       1    0   6   25      2
3    10       2    0   6   25      4

I had some code that used False to disable reading indexes from the data, and was expecting True to be the opposite. Instead it read the second column, because True == 1 in python.

I think that True should be explicitly handled, because this behaviour is counterintuitive given that False is meaningful. False is not the same as index_col=0, after all.


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