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

case insensitive bool parsing · Issue #1295 · pandas-dev/pandas · GitHub

From mailing list:

This is something that surprised me.
When reading from csv the values "True" and "False" are converted to bool, while "TRUE" and "FALSE"' to object
Using a converter {...: np.bool} I could take it into account.
Is it useful to take more possibilities into account knowing that there are a lot of possibilies True/False, Yes/No, ....?

In [19]: data = '''A;B
....: True;False
....: False;True'''
In [20]: df = pd.read_csv(StringIO(data), sep=';')
In [22]: df.dtypes
Out[22]:
A bool
B bool

In [23]: data = '''A;B
....: TRUE;FALSE
....: FALSE;TRUE'''

In [24]: df = pd.read_csv(StringIO(data), sep=';')

In [25]: df.dtypes
Out[25]:
A object
B object

In [27]: df = pd.read_csv(StringIO(data), sep=';', converters={'A':np.bool})

In [28]: df.dtypes
Out[28]:
A bool
B object


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