-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Changed integer based indexing to location based index #781
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
Conversation
Now selects first element in series rather than 0th element - old way could cause problems when the dataframe being drawn doesn't start at index 0 and starts at a higher number. Happened to me :P
I was getting error that kwargs is undefined:
```NameError Traceback (most recent call last)
<ipython-input-173-30fb7f3aeb2e> in <module>()
9 facet_row='cut',
10 color_name='depth',
---> 11 facet_col='z'
12
13 )
/home/alishobeiri/anaconda2/lib/python2.7/site-packages/plotly/figure_factory/_facet_grid.pyc in create_facet_grid(df, x, y, facet_row, facet_col, color_name, colormap, color_is_cat, facet_row_labels, facet_col_labels, height, width, trace_type, scales, dtick_x, dtick_y, show_boxes, ggplot2, binsize, **kwargs)
867 facet_row_labels, facet_col_labels, trace_type,
868 flipped_rows, flipped_cols, show_boxes, marker_color,
--> 869 kwargs_trace, kwargs_marker
870 )
871
/home/alishobeiri/anaconda2/lib/python2.7/site-packages/plotly/figure_factory/_facet_grid.pyc in _facet_grid_color_numerical(df, x, y, facet_row, facet_col, color_name, colormap, num_of_rows, num_of_cols, facet_row_labels, facet_col_labels, trace_type, flipped_rows, flipped_cols, show_boxes, marker_color, kwargs_trace, kwargs_marker)
414 type=trace_type,
415 showlegend=False,
--> 416 **kwargs
417 )
418 fig.append_trace(trace, row_count + 1, col_count + 1)
NameError: global name 'kwargs' is not defined ```
Thought it might be because kwargs should actually be kwards_trace - not sure tho
| show_legend = False | ||
| if color_name: | ||
| if isinstance(df[color_name][0], str) or color_is_cat: | ||
| if isinstance(df[color_name].iloc[0], str) or color_is_cat: |
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.
are there other places in the code where this happens?
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.
@alishobeiri There's a elif isinstance(df[color_name][0], Number): line a little further down the code that you can change too.
Thanks for doing this! Awesome stuff.
|
Looks good! @alishobeiri - could you add a simple test that breaks before this code was applied but is fixed after this code was applied? |
|
Error code: df starts at 2 so there is a key error thrown |
| type=trace_type, | ||
| showlegend=False, | ||
| **kwargs | ||
| **kwargs_trace |
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.
good catch
|
💃 |
Now selects first element in series rather than 0th index item - old way could cause problems when the dataframe doesn't start at index 0 but rather starts at a higher number. Happened to me :P