Unexpected behavior in DataFrame.shift(..., axis=1) with missing data #17441
Labels
Bug
Internals
Related to non-user accessible pandas implementation
Missing-data
np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Multi-Block
Issues caused by the presence of multiple Blocks
Code Sample
Problem description
The shift operation with
axis=1
produces unexpected results when the underlying dataframe contains missing values.The issue is that unexpected additional missing values get inserted with the shift operation.
Expected Output
print(check_shift(df))
should return trueOutput of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.1.final.0
python-bits: 64
OS: Darwin
OS-release: 16.7.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.20.3
pytest: None
pip: 9.0.1
setuptools: 32.2.0
Cython: None
numpy: 1.13.1
scipy: 0.19.0
xarray: None
IPython: 6.0.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: 0.4.0
matplotlib: 2.0.2
openpyxl: None
xlrd: 1.0.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.6.0
html5lib: 0.999999999
sqlalchemy: 1.1.10
pymysql: None
psycopg2: 2.7.1 (dt dec pq3 ext lo64)
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: