Skip to content

concat with axis='rows' #14369

Closed
Closed
@AlbertDeFusco

Description

@AlbertDeFusco

A small, complete example of the issue

Is there something special going on here that pd.concat seems to interpret axis='rows' as axis=1?

In [1]: import pandas as pd

In [2]: pd.__version__
Out[2]: '0.19.0'

In [3]: import numpy as np

In [5]: df1 = pd.DataFrame({'A':np.random.normal(size=5)}, index=range(5))

In [6]: df2 = pd.DataFrame({'A':np.random.normal(size=5)}, index=range(5))

In [7]: pd.concat([df1,df2], axis=0)
Out[7]: 
          A
0  1.302686
1 -0.463573
2  0.057750
3  0.908621
4 -0.637590
0 -1.876701
1  0.946551
2 -1.696579
3  0.793796
4  1.403455

In [8]: pd.concat([df1,df2], axis='rows')
Out[8]: 
          A         A
0  1.302686 -1.876701
1 -0.463573  0.946551
2  0.057750 -1.696579
3  0.908621  0.793796
4 -0.637590  1.403455

Expected Output

I would think that axis='rows' and axis=0 do the same thing.

Output of pd.show_versions()

## INSTALLED VERSIONS

commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Darwin
OS-release: 15.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.19.0
nose: None
pip: 8.1.2
setuptools: 27.2.0
Cython: None
numpy: 1.11.2
scipy: None
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.7
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReshapingConcat, Merge/Join, Stack/Unstack, Explode

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions