Skip to content

BUG: timeseries plot x-axis starts way off when one column is all NaNs #36252

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
2 of 3 tasks
gabrielecalvo opened this issue Sep 9, 2020 · 1 comment
Closed
2 of 3 tasks
Labels

Comments

@gabrielecalvo
Copy link

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.

Code Sample

import pandas as pd
import numpy as np

pd.DataFrame(dict(
    a=[np.nan, np.nan],
    b=[1, 2],
    ts = [pd.Timestamp('2020-01-01'), pd.Timestamp('2020-02-02')]
)).set_index('ts').plot()

Problem description

The x-axis (time axis) start in before 2000 where it really should start at 2020-01-01

image

Output of pd.show_versions()

INSTALLED VERSIONS

commit : 2a7d332
python : 3.8.5.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.18362
machine : AMD64
processor : Intel64 Family 6 Model 142 Stepping 9, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United Kingdom.1252

pandas : 1.1.2
numpy : 1.19.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.3
setuptools : 49.6.0.post20200814
Cython : None
pytest : None
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
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None

@gabrielecalvo gabrielecalvo added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 9, 2020
@fangchenli fangchenli added Visualization plotting and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 2, 2020
@mroeschke mroeschke added the Bug label Aug 13, 2021
@gabrielecalvo
Copy link
Author

Looks like this has been fixed. I just tried it in pandas==2.2.3 and it looks good:

Image

Feel free to close this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants