-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
EnhancementMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations
Description
It appears that fill_value
option for the df.add()
method is not actually implemented in the source code. This was brought up in a StackOverflow question.
piRSquared is the user that identified it.
The following are all copied from that SO post.
Code Sample, a copy-pastable example if possible
import pandas as pd
import numpy as np
np.random.seed([3,1415])
df = pd.DataFrame(np.random.choice((1, 2, np.nan), (5, 5)))
s = pd.Series(range(5))
df.add(s, fill_value=0)
>>>
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-18-ce2809aeda79> in <module>()
----> 1 df.add(s, fill_value=0)
/Users/daddy30000/anaconda/lib/python2.7/site-packages/pandas/core/ops.pyc in f(self, other, axis, level, fill_value)
1060 return self._combine_frame(other, na_op, fill_value, level)
1061 elif isinstance(other, ABCSeries):
-> 1062 return self._combine_series(other, na_op, fill_value, axis, level)
1063 elif isinstance(other, (list, tuple)):
1064 if axis is not None and self._get_axis_name(axis) == 'index':
/Users/daddy30000/anaconda/lib/python2.7/site-packages/pandas/core/frame.pyc in _combine_series(self, other, func, fill_value, axis, level)
3511 else:
3512 return self._combine_match_columns(other, func, level=level,
-> 3513 fill_value=fill_value)
3514 return self._combine_series_infer(other, func, level=level,
3515 fill_value=fill_value)
/Users/daddy30000/anaconda/lib/python2.7/site-packages/pandas/core/frame.pyc in _combine_match_columns(self, other, func, level, fill_value)
3542 if fill_value is not None:
3543 raise NotImplementedError("fill_value %r not supported" %
-> 3544 fill_value)
3545
3546 new_data = left._data.eval(func=func, other=right,
NotImplementedError: fill_value 0 not supported
Expected Output
0 1 2 3 4
0 1.0 1.0 2.0 3.0 4.0
1 2.0 3.0 2.0 4.0 4.0
2 1.0 1.0 3.0 4.0 4.0
3 1.0 1.0 2.0 4.0 6.0
4 1.0 3.0 4.0 3.0 5.0
output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.11.final.0
python-bits: 64
OS: Darwin
OS-release: 15.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.18.1
nose: 1.3.7
pip: 8.1.1
setuptools: 21.2.1
Cython: 0.22.1
numpy: 1.11.0
scipy: 0.15.1
statsmodels: 0.6.1
xarray: None
IPython: 3.2.0
sphinx: 1.3.1
patsy: 0.3.0
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: 1.0.0
tables: 3.2.0
numexpr: 2.4.3
matplotlib: 1.4.3
openpyxl: 1.8.5
xlrd: 0.9.3
xlwt: 1.0.0
xlsxwriter: 0.7.3
lxml: 3.4.4
bs4: 4.3.2
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.5
pymysql: None
psycopg2: 2.5.4 (dt dec pq3 ext)
jinja2: 2.7.3
boto: 2.38.0
pandas_datareader: None
RobbieClarken
Metadata
Metadata
Assignees
Labels
EnhancementMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations