Skip to content

Make -NaN and -nan default NA values #6038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ the corresponding equivalent values will also imply a missing value (in this cas

To completely override the default values that are recognized as missing, specify ``keep_default_na=False``.
The default ``NaN`` recognized values are ``['-1.#IND', '1.#QNAN', '1.#IND', '-1.#QNAN', '#N/A','N/A', 'NA',
'#NA', 'NULL', 'NaN', 'nan']``.
'#NA', 'NULL', 'NaN', '-NaN', 'nan', '-nan']``.

.. code-block:: python

Expand Down
2 changes: 2 additions & 0 deletions doc/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ API Changes
- ``autocorrelation_plot`` now accepts ``**kwargs``. (:issue:`5623`)
- ``convert_objects`` now accepts a ``convert_timedeltas='coerce'`` argument to allow forced dtype conversion of
timedeltas (:issue:`5458`,:issue:`5689`)
- Add ``-NaN`` and ``-nan`` to the default set of NA values
(:issue:`5952`). See :ref:`NA Values <io.na_values>`.

Experimental Features
~~~~~~~~~~~~~~~~~~~~~
Expand Down
3 changes: 3 additions & 0 deletions doc/source/v0.13.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ There are several new or updated docs sections including:
API changes
~~~~~~~~~~~

- Add ``-NaN`` and ``-nan`` to the default set of NA values (:issue:`5952`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just add this line also to doc/source/release.rst under API changes as well. we use the whatsnew to 'announce' important changes, and the release.rst as a log of them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be there now.

See :ref:`NA Values <io.na_values>`.

Prior Version Deprecations/Changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion pandas/io/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def read_fwf(filepath_or_buffer, colspecs='infer', widths=None, **kwds):
# '1.#INF','-1.#INF', '1.#INF000000',
_NA_VALUES = set([
'-1.#IND', '1.#QNAN', '1.#IND', '-1.#QNAN', '#N/A', 'N/A', 'NA', '#NA',
'NULL', 'NaN', 'nan', ''
'NULL', 'NaN', '-NaN', 'nan', '-nan', ''
])


Expand Down
5 changes: 3 additions & 2 deletions pandas/io/tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import pandas.tseries.tools as tools

from numpy.testing.decorators import slow
from numpy.testing import assert_array_equal

from pandas.parser import OverflowError

Expand Down Expand Up @@ -685,8 +686,8 @@ def test_non_string_na_values(self):
def test_default_na_values(self):
_NA_VALUES = set(['-1.#IND', '1.#QNAN', '1.#IND', '-1.#QNAN',
'#N/A','N/A', 'NA', '#NA', 'NULL', 'NaN',
'nan', ''])

'nan', '-NaN', '-nan', ''])
assert_array_equal (_NA_VALUES, parsers._NA_VALUES)
nv = len(_NA_VALUES)
def f(i, v):
if i == 0:
Expand Down