Skip to content

merge with series #13240

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

Closed
zhangyingmath opened this issue May 20, 2016 · 2 comments
Closed

merge with series #13240

zhangyingmath opened this issue May 20, 2016 · 2 comments
Labels
Compat pandas objects compatability with Numpy or Python functions Error Reporting Incorrect or improved errors from pandas Reshaping Concat, Merge/Join, Stack/Unstack, Explode

Comments

@zhangyingmath
Copy link

Code Sample, a copy-pastable example if possible

a=pd.DataFrame({'f':[1,2,3,4]})
b=pd.DataFrame({'f':[2,3,4,5]})

pd.merge(a['f'],b,on='f')

Traceback (most recent call last):
File "", line 1, in
File "/opt/ci1/plus/tc10b/sles11sp2_gcc-4.8.3_x86-64/PythonModules-2.7.8/20160310/lib/python/pandas/tools/merge.py", line 34, in merge
copy=copy, indicator=indicator)
File "/opt/ci1/plus/tc10b/sles11sp2_gcc-4.8.3_x86-64/PythonModules-2.7.8/20160310/lib/python/pandas/tools/merge.py", line 190, in init
self.join_names) = self._get_merge_keys()
File "/opt/ci1/plus/tc10b/sles11sp2_gcc-4.8.3_x86-64/PythonModules-2.7.8/20160310/lib/python/pandas/tools/merge.py", line 412, in _get_merge_keys
left_keys.append(left[lk]._values)
File "/opt/ci1/plus/tc10b/sles11sp2_gcc-4.8.3_x86-64/PythonModules-2.7.8/20160310/lib/python/pandas/core/series.py", line 557, in getitem
result = self.index.get_value(self, key)
File "/opt/ci1/plus/tc10b/sles11sp2_gcc-4.8.3_x86-64/PythonModules-2.7.8/20160310/lib/python/pandas/core/index.py", line 1790, in get_value
return self._engine.get_value(s, k)
File "pandas/index.pyx", line 103, in pandas.index.IndexEngine.get_value (pandas/index.c:3204)
File "pandas/index.pyx", line 111, in pandas.index.IndexEngine.get_value (pandas/index.c:2903)
File "pandas/index.pyx", line 159, in pandas.index.IndexEngine.get_loc (pandas/index.c:3908)
KeyError: 'f'

Expected Output

f

0 2
1 3
2 4

output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 2.7.8.final.0
python-bits: 64
OS: Linux
OS-release: 3.0.38-0.5-default
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: C

pandas: 0.17.1
nose: 1.3.6
pip: 1.5.6
setuptools: 0.6
Cython: 0.21.1
numpy: 1.9.3
scipy: 0.16.1
statsmodels: 0.6.1
IPython: 4.0.1
sphinx: 1.2.2
patsy: 0.3.0
dateutil: 2.3
pytz: 2015.4
blosc: None
bottleneck: 0.8.0
tables: 3.2.2
numexpr: 2.4
matplotlib: 1.4.3
openpyxl: 2.0.4
xlrd: 0.9.0
xlwt: 0.7.4
xlsxwriter: 0.7.3
lxml: 3.4.4
bs4: 4.3.2
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 0.9.7
pymysql: 0.6.2.None
psycopg2: None
Jinja2: None

@jreback
Copy link
Contributor

jreback commented May 20, 2016

pls check with current version.

This changed fixed in 0.18.0 IIRC.

In [11]: pd.merge(a['f'],b,on='f')
ValueError: can not merge DataFrame with instance of type <class 'pandas.core.series.Series'>

@jreback jreback closed this as completed May 20, 2016
@jreback jreback added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Compat pandas objects compatability with Numpy or Python functions Error Reporting Incorrect or improved errors from pandas labels May 20, 2016
@jreback
Copy link
Contributor

jreback commented May 20, 2016

xref #12081

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions Error Reporting Incorrect or improved errors from pandas Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

No branches or pull requests

2 participants