We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
import pandas as pd df1 = pd.read_json('{"PassengerId":{"1":2.0},"Survived":{"1":1.0},"Pclass":{"1":1.0},"Name":{"1":"Cumings, Mrs. John Bradley (Florence Briggs Thayer)"},"Sex":{"1":"female"},"Age":{"1":38.0},"SibSp":{"1":1.0},"Parch":{"1":0.0},"Ticket":{"1":"PC 17599"},"Fare":{"1":71.2833},"Cabin":{"1":"C85"},"Embarked":{"1":"C"},"score":{"1":1.0}}') df2 = pd.read_json('{"score_calib":{"0":0.9647065937}}') pd.concat((df1, df2), axis="columns")
The result from the reproducible example is the following:
This seems to be due to the differences in the indices (df1 has index 1 and df2 has index 0), however I think pd.concat should either:
pd.concat
Because of the nature and usage of pd.concat(axis="columns"), I think alternative 1 would be preferable.
pd.concat(axis="columns")
The expected behaviour is to obtain a dataframe with a single row and 14 columns like this one:
On a Databricks instance:
commit : 2cb9652 python : 3.8.10.final.0 python-bits : 64 OS : Linux OS-release : 5.4.0-1090-azure Version : #95~18.04.1-Ubuntu SMP Sun Aug 14 20:09:27 UTC 2022 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : C.UTF-8 LOCALE : en_US.UTF-8
pandas : 1.2.4 numpy : 1.22.4 pytz : 2020.5 dateutil : 2.8.1 pip : 21.0.1 setuptools : 52.0.0 Cython : 0.29.23 pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : 2.8.5 (dt dec pq3 ext lo64) jinja2 : 2.11.3 IPython : 8.4.0 pandas_datareader: None bs4 : 4.11.1 bottleneck : 1.3.2 fsspec : 0.9.0 fastparquet : None gcsfs : None matplotlib : 3.4.2 numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : 4.0.0 pyxlsb : None s3fs : None scipy : 1.6.2 sqlalchemy : None tables : None tabulate : 0.8.7 xarray : None xlrd : None xlwt : None numba : 0.55.2
Also happening in a Windows environment:
commit : e8093ba python : 3.10.4.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19044 machine : AMD64 processor : Intel64 Family 6 Model 142 Stepping 11, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : es_ES.cp1252 pandas : 1.4.3 numpy : 1.23.1 pytz : 2022.1 dateutil : 2.8.2 setuptools : 60.2.0 pip : 21.3.1 Cython : None pytest : 7.1.2 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : None pandas_datareader: None bs4 : None bottleneck : None brotli : None fastparquet : None fsspec : None gcsfs : None markupsafe : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyreadstat : None pyxlsb : None s3fs : None scipy : 1.9.0 snappy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None xlwt : None zstandard : None
The text was updated successfully, but these errors were encountered:
Closing the issue, just realized this is what the argument ignore_index=True is for
ignore_index=True
Sorry, something went wrong.
No branches or pull requests
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
The result from the reproducible example is the following:
This seems to be due to the differences in the indices (df1 has index 1 and df2 has index 0), however I think
pd.concat
should either:Because of the nature and usage of
pd.concat(axis="columns")
, I think alternative 1 would be preferable.Expected Behavior
The expected behaviour is to obtain a dataframe with a single row and 14 columns like this one:
Installed Versions
On a Databricks instance:
INSTALLED VERSIONS
commit : 2cb9652
python : 3.8.10.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-1090-azure
Version : #95~18.04.1-Ubuntu SMP Sun Aug 14 20:09:27 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.2.4
numpy : 1.22.4
pytz : 2020.5
dateutil : 2.8.1
pip : 21.0.1
setuptools : 52.0.0
Cython : 0.29.23
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.8.5 (dt dec pq3 ext lo64)
jinja2 : 2.11.3
IPython : 8.4.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : 1.3.2
fsspec : 0.9.0
fastparquet : None
gcsfs : None
matplotlib : 3.4.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 4.0.0
pyxlsb : None
s3fs : None
scipy : 1.6.2
sqlalchemy : None
tables : None
tabulate : 0.8.7
xarray : None
xlrd : None
xlwt : None
numba : 0.55.2
Also happening in a Windows environment:
INSTALLED VERSIONS
commit : e8093ba
python : 3.10.4.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19044
machine : AMD64
processor : Intel64 Family 6 Model 142 Stepping 11, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : es_ES.cp1252
pandas : 1.4.3
numpy : 1.23.1
pytz : 2022.1
dateutil : 2.8.2
setuptools : 60.2.0
pip : 21.3.1
Cython : None
pytest : 7.1.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
markupsafe : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.9.0
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
The text was updated successfully, but these errors were encountered: