You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IndexError: index 0 is out of bounds for axis 0 with size 0
Reason:
When the grid is created, this issue appears:
for year in years:
for category in categories:
**dataset_by_year_and_cat = dataset[(dataset[time_column] == int(year)) & (dataset[category_column] == category)]**
for col_name in column_names:
# Each column name is unique
temp = col_name_template.format(year, col_name, category)
if dataset_by_year_and_cat[col_name].size != 0:
grid = grid.append({'value': list(dataset_by_year_and_cat[col_name]), 'key': temp}, ignore_index=True)
Missing category in current year
The text was updated successfully, but these errors were encountered:
In the get_trace function we can put the existing code in try block and change as below to fix issues of missing categories in a year not being represented on the graph
try:
Scenario:
Define data with the following pattern:
Categories: C1, C2, C3
Items: I1, I2, I3, I4, I5, I6
Year Category Item Value
2010 C3 I6 1
2010 C3 I6 1
2011 C1 I1 3
2011 C2 I3 2
2012 C1 I1 2
2012 C2 I3 1
2012 C3 I5 3
Because Category C1 and C2 are not represented in year 2010, there will be a crash in bubbly, as following:
/opt/conda/lib/python3.6/site-packages/bubbly/bubbly.py in bubbleplot(dataset, x_column, y_column, bubble_column, z_column, time_column, size_column, color_column, x_logscale, y_logscale, z_logscale, x_range, y_range, z_range, x_title, y_title, z_title, title, colorbar_title, scale_bubble, colorscale, marker_opacity, marker_border_width, show_slider, show_button, show_colorbar, show_legend, width, height)
88 bubble_column, z_column, size_column,
89 sizeref, scale_bubble, marker_opacity, marker_border_width,
---> 90 category=category)
91 if z_column:
92 trace['type'] = 'scatter3d'
/opt/conda/lib/python3.6/site-packages/bubbly/bubbly.py in get_trace(grid, col_name_template, x_column, y_column, bubble_column, z_column, size_column, sizeref, scale_bubble, marker_opacity, marker_border_width, color_column, colorscale, show_colorbar, colorbar_title, category)
397
398 trace = {
--> 399 'x': grid.loc[grid['key']==col_name_template.format(x_column, category), 'value'].values[0],
400 'y': grid.loc[grid['key']==col_name_template.format(y_column, category), 'value'].values[0],
401 'text': grid.loc[grid['key']==col_name_template.format(bubble_column, category), 'value'].values[0],
IndexError: index 0 is out of bounds for axis 0 with size 0
Reason:
When the grid is created, this issue appears:
Missing category in current year
The text was updated successfully, but these errors were encountered: