Skip to content
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

BUG: dataframe concat method error when using join='inner' #14040

Closed
joonpark72 opened this issue Aug 19, 2016 · 1 comment
Closed

BUG: dataframe concat method error when using join='inner' #14040

joonpark72 opened this issue Aug 19, 2016 · 1 comment
Labels
Bug Duplicate Report Duplicate issue or pull request Reshaping Concat, Merge/Join, Stack/Unstack, Explode

Comments

@joonpark72
Copy link

joonpark72 commented Aug 19, 2016

Code Sample, a copy-pastable example if possible

df1 = pd.DataFrame(np.arange(9).reshape(3, 3), columns=['a', 'b', 'c'])
df3 = pd.DataFrame(np.arange(20, 26).reshape(3, 2), columns=['a', 'd'], index=[2, 3, 4])
pd.concat([df1, df3], axis=1, join='inner')

   a  b  c   a   d
0  0  1  2 NaN NaN
1  3  4  5 NaN NaN

Expected Output

     a    b    c     a     d
2  6.0  7.0  8.0  20.0  21.0

output of pd.show_versions()

### INSTALLED VERSIONS
------------------
commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.18.1
nose: 1.3.7
pip: 8.1.2
setuptools: 23.0.0
Cython: 0.24
numpy: 1.11.1
scipy: 0.17.1
statsmodels: 0.6.1
xarray: None
IPython: 4.2.0
sphinx: 1.4.1
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: 1.1.0
tables: 3.2.2
numexpr: 2.6.0
matplotlib: 1.5.1
openpyxl: 2.3.2
xlrd: 1.0.0
xlwt: 1.1.2
xlsxwriter: 0.9.2
lxml: 3.6.0
bs4: 4.4.1
html5lib: 0.999
httplib2: None
apiclient: None
sqlalchemy: 1.0.13
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.40.0
pandas_datareader: 0.2.1
@jreback
Copy link
Contributor

jreback commented Aug 19, 2016

fixed by #13170 and will be in 0.19.0, coming soon. (it also preserves the dtype of the join keys)

In [39]: pd.__version__
Out[39]: '0.18.1+379.g5c955cb'

In [40]: df1
Out[40]: 
   a  b  c
0  0  1  2
1  3  4  5
2  6  7  8

In [41]: df3
Out[41]: 
    a   d
2  20  21
3  22  23
4  24  25

In [42]: pd.concat([df1, df3], axis=1, join='inner')
Out[42]: 
   a  b  c   a   d
2  6  7  8  20  21

@jreback jreback closed this as completed Aug 19, 2016
@jreback jreback added Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode Duplicate Report Duplicate issue or pull request labels Aug 19, 2016
@jreback jreback added this to the No action milestone Aug 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Duplicate Report Duplicate issue or pull request Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

No branches or pull requests

2 participants