cid-harvard / visualization-notebook-templates

A set of iPython notebooks that can be used to generate some of the most common atlas-style visualizations with datasets in stata or csv
15 stars 6 forks source link

error in my code:ValueError: Use `.rename` to alter labels with a mapper. #2

Open AdrianZT opened 2 years ago

AdrianZT commented 2 years ago

The variables 'color' and 'df' were successfully imported into memory, but an error occurred while drawing: File F:\ReplicateAtlasPSnet\cid-harvardvisualization-notebook-templates./modules\d3plus2.py:86 in draw data = self.preprocess_data(data)

File F:\ReplicateAtlasPSnet\cid-harvardvisualization-notebook-templates./modules\d3plus2.py:260 in preprocess_data return data.rename_axis({self.id: self.network_id}, axis=1)

File d:\anaconda3\lib\site-packages\pandas\util_decorators.py:324 in wrapper return func(*args, **kwargs)

File d:\anaconda3\lib\site-packages\pandas\core\generic.py:1315 in rename_axis raise ValueError("Use .rename to alter labels with a mapper.")

ValueError: Use .rename to alter labels with a mapper.

domenik8 commented 6 months ago

try using .rename instead of .rename_axis at row 260 of d3plus.py module

def preprocess_data(self, data):
    return data.rename(columns={self.id: self.network_id})

#def preprocess_data(self, data):
    #return data.rename_axis({self.id: self.network_id}, axis=1)