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

loc setting NaN in an int column should upcast · Issue #4204 · pandas-dev/pandas · GitHub

I think upcasting to float should occur here.

For example:

In [1]: df = pd.DataFrame([[0, 0]])

In [2]: df.loc[0] = np.nan

In [3]: df
Out[3]:
                     0                    1
0 -9223372036854775808 -9223372036854775808

Sometimes this is caught:

In [11]: df = pd.DataFrame([[0]])

In [12]: df.loc[0] = np.nan
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-12-92653b6a9ef8> in <module>()
----> 1 df.loc[0] = np.nan

/Users/234BroadWalk/pandas/core/indexing.pyc in __setitem__(self, key, value)
     86
     87         self._setitem_with_indexer(indexer, value)
---> 88
     89     def _has_valid_tuple(self, key):
     90         pass

/Users/234BroadWalk/pandas/core/indexing.pyc in _setitem_with_indexer(self, indexer, value)
    183             if np.prod(values.shape):
    184                 values[indexer] = value
--> 185
    186     def _align_series(self, indexer, ser):
    187         # indexer to assign Series can be tuple or scalar

ValueError: cannot convert float NaN to integer

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