Skip to content

ENH: Minor change to parallel_coordinates (#15908) #15935

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
wants to merge 3 commits into from

Conversation

stangirala
Copy link
Contributor

@stangirala stangirala commented Apr 7, 2017

Add option to sort class lables, add to test

@codecov
Copy link

codecov bot commented Apr 7, 2017

Codecov Report

Merging #15935 into master will increase coverage by 0.07%.
The diff coverage is 25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15935      +/-   ##
==========================================
+ Coverage      91%   91.08%   +0.07%     
==========================================
  Files         145      145              
  Lines       49581    49642      +61     
==========================================
+ Hits        45123    45217      +94     
+ Misses       4458     4425      -33
Flag Coverage Δ
#multiple 88.85% <25%> (+0.08%) ⬆️
#single 40.53% <0%> (-0.05%) ⬇️
Impacted Files Coverage Δ
pandas/tools/plotting.py 74.61% <25%> (+2.86%) ⬆️
pandas/core/base.py 92.32% <0%> (-3.19%) ⬇️
pandas/types/cast.py 85.11% <0%> (-0.63%) ⬇️
pandas/tseries/index.py 95.33% <0%> (-0.1%) ⬇️
pandas/util/testing.py 81.13% <0%> (ø) ⬆️
pandas/indexes/base.py 96.09% <0%> (ø) ⬆️
pandas/core/groupby.py 95.54% <0%> (ø) ⬆️
pandas/core/window.py 96.24% <0%> (+0.02%) ⬆️
pandas/formats/format.py 95.4% <0%> (+0.05%) ⬆️
pandas/core/common.py 91.03% <0%> (+0.34%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6c0cfff...1467f9f. Read the comment docs.

@jreback jreback added the Visualization plotting label Apr 7, 2017
@@ -241,6 +241,22 @@ def test_parallel_coordinates(self):
with tm.assert_produces_warning(FutureWarning):
parallel_coordinates(df, 'Name', colors=colors)

df = DataFrame({"feat": [i for i in range(30)],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this a separate named test

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the issue number as a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -718,6 +719,8 @@ def parallel_coordinates(frame, class_column, cols=None, ax=None, color=None,
If true, vertical lines will be added at each xtick
axvlines_kwds: keywords, optional
Options to be passed to axvline method for vertical lines
sort_labels: bool, optional
Sort class_column labels, useful when assigning colours
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a versionadded tag here, add the default (False) instead of optional

@jreback
Copy link
Contributor

jreback commented Apr 7, 2017

pls add a whatsnew entry, in Other Enhancements.

@TomAugspurger
Copy link
Contributor

@stangirala could you rebase and push one more time? Looks like our CI services were having trouble last time you pushed.

@TomAugspurger TomAugspurger added this to the 0.20.0 milestone Apr 11, 2017
Add option to sort class lables, add to test
Also fix minor bug due to a misnamed var that both the test and pyflakes
missed
@stangirala
Copy link
Contributor Author

@TomAugspurger @jreback Looks like the CI builds are passing.

@stangirala
Copy link
Contributor Author

@TomAugspurger I'm actually not sure why the code coverage tool is reporting a decrease in coverage.

@TomAugspurger
Copy link
Contributor

Yeah, I took a glance and couldn't figure it out either. I'm guessing it's just a fluke, but I'll take a closer look later and merge.

@stangirala
Copy link
Contributor Author

Thanks!

@jreback
Copy link
Contributor

jreback commented Apr 11, 2017

if your master is not up to date code coverage doesn't make much sense

@@ -371,6 +371,8 @@ Other Enhancements
- :func:`MultiIndex.remove_unused_levels` has been added to facilitate :ref:`removing unused levels <advanced.shown_levels>`. (:issue:`15694`)
- ``pd.read_csv()`` will now raise a ``ParserError`` error whenever any parsing error occurs (:issue:`15913`, :issue:`15925`)
- ``pd.read_csv()`` now supports the ``error_bad_lines`` and ``warn_bad_lines`` arguments for the Python parser (:issue:`15925`)
- ``pd.read_csv()`` will now raise a ``csv.Error`` error whenever an end-of-file character is encountered in the middle of a data row (:issue:`15913`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is duped

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this duped on my copy, can you double check?

@@ -371,6 +371,8 @@ Other Enhancements
- :func:`MultiIndex.remove_unused_levels` has been added to facilitate :ref:`removing unused levels <advanced.shown_levels>`. (:issue:`15694`)
- ``pd.read_csv()`` will now raise a ``ParserError`` error whenever any parsing error occurs (:issue:`15913`, :issue:`15925`)
- ``pd.read_csv()`` now supports the ``error_bad_lines`` and ``warn_bad_lines`` arguments for the Python parser (:issue:`15925`)
- ``pd.read_csv()`` will now raise a ``csv.Error`` error whenever an end-of-file character is encountered in the middle of a data row (:issue:`15913`)
- ``parallel_coordinates()`` now has a ``sort_labels`` keyword arg that sorts class labels and the colours assigned to them (:issue:`15908`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has gained a

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -241,6 +241,26 @@ def test_parallel_coordinates(self):
with tm.assert_produces_warning(FutureWarning):
parallel_coordinates(df, 'Name', colors=colors)

def test_parallel_coordinates_with_sorted_labels(self):
""" For #15908 """
from pandas.tools.plotting import parallel_coordinates
Copy link
Contributor

@jreback jreback Apr 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may need a mpl skip here (if its not available)? @TomAugspurger ? or is that done already on the whole class?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done on the class.

@@ -774,6 +780,9 @@ def parallel_coordinates(frame, class_column, cols=None, ax=None, color=None,
colormap=colormap, color_type='random',
color=color)

if sort_labels is True:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if sort_labels is enough

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mirrored an if expression from the lines above, but fixed.

@jreback
Copy link
Contributor

jreback commented Apr 11, 2017

lgtm. minor comment.

@jreback jreback closed this in 3fde134 Apr 14, 2017
@jreback
Copy link
Contributor

jreback commented Apr 14, 2017

thanks @stangirala

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

Successfully merging this pull request may close these issues.

Class label colours with parallel coordinates
3 participants