Fix: Replace cufflinks with plotly.express for Python 3.13+ compatibility #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: Replace cufflinks with plotly.express for Python 3.13+ compatibility
Problem
The current codebase uses the
cufflinkslibrary which is no longer actively maintained and causes compatibility issues with Python 3.13 and newer versions of pandas (2.x). This results in aValueErrorwhen attempting to generate plots, preventing learners from running the code successfully.Solution
This PR migrates all plotting functionality from
cufflinkstoplotly.express, which is:Changes Made
Code Changes:
cufflinksandIPython.displayimportsplotly.express.iplot()calls to their plotly.express equivalents:df.iplot(kind='line')→px.line(df)df.iplot(kind='bar')→px.bar(df)df.iplot(kind='pie')→px.pie(df)df.iplot(kind='box')→px.box(df)df.iplot(kind='hist')→px.histogram(df)df.iplot(kind='scatter')→px.scatter(df)Parameter Mapping:
xTitleandyTitle→labelsdictionarybins→nbinslabels(in pie charts) →namesInstallation Requirements
Since there is no
requirements.txtfile in the repository, users will need to install the required packages manually:Testing
Tested on Python 3.13 with pandas 2.2.1 and plotly 5.x. All plots render correctly.
Fix issues #5