polars/polars-pandas-round-trip
| Rule | polars-pandas-round-trip |
|---|---|
| Pack | Polars |
| Severity | info |
| Fix | unsafe, with xpd check --fix --unsafe-fixes |
| Library versions | every version |
A Polars to pandas to Polars round trip converts the data twice. Keep the original frame when no pandas operation is needed.
pl.from_pandas(df.to_pandas())dfWhat the rule reports
Section titled “What the rule reports”The integer-only round trip matched the original frame on 50,000 and 500,000 rows.
How to fix it
Section titled “How to fix it”Use xpd check --fix --unsafe-fixes to remove the pl.from_pandas(df.to_pandas()) round trip.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
A Polars to pandas to Polars round trip converts the data twice. Keep the original frame when no pandas operation is needed.Browse the other rules of the Polars pack.