question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unsorted Float64Index gives clipped plots

See original GitHub issue

Code Sample, a copy-pastable example if possible

import pandas as pd
df = pd.DataFrame({'y': [3.5, 4.5, 6.5]}, index=[2.5, 1.5, 3.5])
df.plot(style='o')

actual

Problem description

This above may or may not be expected behaviour, but it did catch me by surprise: The range of the horizontal axis will be [2.5, 3.5], even though one of the data points has an index value outside that range.

Expected Output

Instead, I would have expected the output currently obtainable through df.sort_index().plot(style='o'):

expected

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None python: 3.6.2.final.0 python-bits: 64 OS: Windows OS-release: 8.1 machine: AMD64 processor: Intel64 Family 6 Model 61 Stepping 4, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None

pandas: 0.20.3 pytest: 3.2.1 pip: 9.0.1 setuptools: 34.1.0 Cython: 0.26 numpy: 1.13.1 scipy: 0.19.1 xarray: None IPython: 6.1.0 sphinx: 1.6.2 patsy: 0.4.1 dateutil: 2.6.1 pytz: 2017.2 blosc: None bottleneck: 1.2.1 tables: 3.2.2 numexpr: 2.6.2 feather: None matplotlib: 2.0.2 openpyxl: 2.4.8 xlrd: 1.0.0 xlwt: 1.2.0 xlsxwriter: 0.9.8 lxml: 3.8.0 bs4: 4.6.0 html5lib: 0.9999999 sqlalchemy: 1.1.13 pymysql: None psycopg2: None jinja2: 2.9.6 s3fs: None pandas_gbq: None pandas_datareader: 0.5.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
fugledecommented, Oct 23, 2017

And thanks for looking into it; indeed, it looks like this one was a duplicate of #11471.

0reactions
bobhaffnercommented, Oct 22, 2017

No problem @jreback Thanks for closing this, @TomAugspurger

Read more comments on GitHub >

github_iconTop Results From Across the Web

plot with unsorted indices misses data points #11471 - GitHub
Compare these 2 plots below, this is not expected behavior: import pandas as pd from numpy.random ... Unsorted Float64Index gives clipped plots #17938....
Read more >
mne.EvokedArray — MNE 1.3.dev0 documentation
Plot evoked data as butterfly plot and add topomaps for time points. ... Can be array-like of shape (4,) to give the X/Y/Z...
Read more >
What's New — pandas 0.13.0 documentation
This is a major release from 0.12.0 and includes a number of API changes, several new features and enhancements along with a large...
Read more >
pandas.core.series — Lux 0.1.2 documentation
The object supports both integer- and label-based indexing and provides a host of methods for performing operations involving the index.
Read more >
What's new in 0.24.0 (January 25, 2019) - Pandas 中文
This provides a convenient way to apply users' predefined styling ... Use Series.clip(lower=threshold) , Series.clip(upper=threshold) and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found