-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Grid Accept Dataframe #675
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
test_grid: | ||
========== | ||
|
||
A module intended for use with Nose. | ||
|
||
""" | ||
from __future__ import absolute_import | ||
|
||
from unittest import TestCase | ||
|
||
from plotly.exceptions import InputError | ||
from plotly.grid_objs import Grid | ||
|
||
import pandas as pd | ||
|
||
|
||
class Test_Dataframe_to_Grid(TestCase): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pep:8ball: haha class names should be like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two things:
I'm changing it to your suggested class name, just curious There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I can see why that's confusing ;__;. I was talking about camelCase vs snake_case (hence the 🐍 and 🐫). |
||
|
||
# Test duplicate columns | ||
def test_duplicate_columns(self): | ||
df = pd.DataFrame([[1, 'a'], | ||
[2, 'b']], columns=['col_1', 'col_1']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🐄 this is a weird way to break this line, I'd suggest:
|
||
|
||
NON_UNIQUE_COLUMN_MESSAGE = ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🐄 no real need for this to be a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean rename it to something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"Yikes, plotly grids currently " | ||
"can't have duplicate column names. Rename " | ||
"the column \"{}\" and try again.".format('col_1') | ||
) | ||
|
||
with self.assertRaisesRegexp(InputError, NON_UNIQUE_COLUMN_MESSAGE): | ||
Grid(df) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌