Uh oh!
There was an error while loading. Please reload this page.
refactor: migrate exploratory data analysis examples to polars - #5
refactor: migrate exploratory data analysis examples to polars#5ugohuche wants to merge 46 commits into
Conversation
Convert categorical operations from pandas to Polars
refactor: replace pandas with polars in vis-layers.ipynb data process…
brentomagic
left a comment
There was a problem hiding this comment.
Thanks for taking on this larger EDA migration — diamonds/Enum, group_by+pivot, is_null() for cancelled flights, and skimpy usage are in the right direction. Before merge, the notebook still reads as a partial conversion: a lot of code is polars while much of the teaching text (and one key example) is still pandas/R.
Blocking
Unusual values: prose and code disagree
Option 2 recommends replacing unusual values with missing (pd.NA/ null) while keeping rows. The following cell does option 1 instead:diamonds2=diamonds.filter(~((pl.col("y") <3) | (pl.col("y") >20)))
That drops rows. Please implement the recommended approach, e.g.:
diamonds2=diamonds.with_columns( pl.when((pl.col("y") <3) | (pl.col("y") >20)) .then(None) .otherwise(pl.col("y")) .alias("y") )
Also update the markdown examples (
diamonds.loc[...],pd.NA) to polars.Prerequisites list a non-existent package
Text asks for polars-profiling, which isn’t a real/installable package here (and isn’t used in the notebook). Drop it or replace with whatever tool you actually intend (e.g. ydata-profiling, if supported).Large leftover pandas/R teaching text
Code and prose are out of sync in several places; readers will follow the wrong API:- “We pluck them out with pandas”
is.na()(R) next tois_null()codepd.crosstab()prose above agroup_by/pivotcell- Section still titled “pandas built-in tools for EDA” /
df.info()while showingdescribe() - Crosstab styling prose still describes
pd.crosstab()+background_gradient()but code builds a polars pivot and only uses.to_pandas().style... - “Exploratory Plotting with polars” heading, then “pandas has some built-in plotting…”
- Exercises still say “together with pandas”
Please do a full prose pass so every claim matches the polars code (or honestly document intentional
to_pandas()bridges for styling/plotting).
Medium
- Deprecated polars APIs (raise DeprecationWarning today):
pivot(..., columns=...)→on=....melt(id_vars=...)→.unpivot(index=...)
- Flights load — prefer
pl.read_csv(url)overpd.read_csv+pl.from_pandas(pandas isn’t needed here). max_countscell — markdown still talks as if this is dataframe styling (max_counts()); the code just takes column maxima. Align text and intent (or restore a styling example viato_pandas().style.highlight_max()and say so).- Kernelspec
display_name: ".venv"— local env noise; prefer a generic Python 3 kernel name.
Nit / process
- Commit author metadata is
Your Name <you@example@example.com>— please configure git user.name/email before further commits on this branch.
Happy to re-review once the unusual-values example and the prose pass are fixed.
brentomagic
commented
Jul 20, 2026
Review notesThanks for the EDA migration — core polars conversions for diamonds, grouping/pivots, and cancelled-flight flags look good. Before merge: Blocking
Medium
Full review is on the PR as changes requested. |
migrate: convert dates-and-times.ipynb from pandas to polars
migrate: convert joins.ipynb from pandas to polars
feat: convert tidy data chapter from pandas to Polars
Add database connection closure and disposal
…lars migrate: convert missing-values.ipynb from pandas to polars
…lars migrate: convert numbers.ipynb from pandas to polars
migrate: convert boolean-data.ipynb from pandas to polars
refactor: migrate data analysis examples and documentation from panda…
Show both str.slice and split().list.get(-1), and clarify fixed-field splitting versus dummy encoding. Co-authored-by: Cursor <cursoragent@cursor.com>
migrate: convert strings.ipynb from pandas to polars
…python4DSpolars into migrate-eda-to-polars # Conflicts: # exploratory-data-analysis.ipynb
meshackamadi
commented
Jul 29, 2026
Summary
File Modified
|
This comment was marked as low quality.
This comment was marked as low quality.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
No description provided.