Skip to content
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

Fixed AttributeError: 'DataFrame' object has no attribute 'append' #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Bubbly is a package for plotting interactive and animated *bubble charts* using

Dependencies
------------
* Python 3.4+
* numpy
* pandas
* plotly
* Python == 3.10.9
* numpy == 1.25.0
* pandas == 2.0.3
* plotly == 5.18.0

Installation
-------------
Expand Down
12 changes: 8 additions & 4 deletions bubbly/bubbly.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,14 @@ def make_grid(dataset, column_names, time_column, years=None):
# Each column name is unique
temp = col_name_template.format(year, col_name)
if dataset_by_year[col_name].size != 0:
grid = grid.append({'value': list(dataset_by_year[col_name]), 'key': temp}, ignore_index=True)
# grid = grid.append({'value': list(dataset_by_year[col_name]), 'key': temp}, ignore_index=True)
grid = pd.concat([grid, pd.DataFrame([{'value': list(dataset_by_year[col_name]), 'key': temp}])], ignore_index=True)
else:
# Check if this can be simplified
for col_name in column_names:
# Each column name is unique
grid = grid.append({'value': list(dataset[col_name]), 'key': col_name + '_grid'}, ignore_index=True)
# grid = grid.append({'value': list(dataset[col_name]), 'key': col_name + '_grid'}, ignore_index=True)
grid = pd.concat([grid, pd.DataFrame([{'value': list(dataset[col_name]), 'key': col_name + '_grid'}])], ignore_index=True)

return grid

Expand All @@ -210,7 +212,8 @@ def make_grid_with_categories(dataset, column_names, time_column, category_colum
# 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)
# grid = grid.append({'value': list(dataset_by_year_and_cat[col_name]), 'key': temp}, ignore_index=True)
grid = pd.concat([grid, pd.DataFrame([{'value': list(dataset_by_year_and_cat[col_name]), 'key': temp}])], ignore_index=True)
else:
col_name_template = '{}+{}_grid'
for category in categories:
Expand All @@ -219,7 +222,8 @@ def make_grid_with_categories(dataset, column_names, time_column, category_colum
# Each column name is unique
temp = col_name_template.format(col_name, category)
if dataset_by_cat[col_name].size != 0:
grid = grid.append({'value': list(dataset_by_cat[col_name]), 'key': temp}, ignore_index=True)
# grid = grid.append({'value': list(dataset_by_cat[col_name]), 'key': temp}, ignore_index=True)
grid = pd.concat([grid, pd.DataFrame([{'value': list(dataset_by_cat[col_name]), 'key': temp}])], ignore_index=True)

return grid

Expand Down