We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb4f24e commit dc8285fCopy full SHA for dc8285f
pandas/io/parsers/readers.py
@@ -679,6 +679,24 @@ def _read(
679
kwds["parse_dates"] = False
680
else:
681
kwds["parse_dates"] = True
682
+ # 🆕 Handle engine='polars'
683
+ if kwds.get("engine") == "polars":
684
+ try:
685
+ import polars as pl
686
+ except ImportError:
687
+ raise ImportError(
688
+ "Polars is not installed. Please install it with 'pip install polars'."
689
+ )
690
+
691
+ pl_args = {}
692
+ if "nrows" in kwds:
693
+ pl_args["n_rows"] = kwds["nrows"]
694
+ if "encoding" in kwds:
695
+ pl_args["encoding"] = kwds["encoding"]
696
697
+ df = pl.read_csv(filepath_or_buffer, **pl_args)
698
+ return df.to_pandas()
699
700
701
# Extract some of the arguments (pass chunksize on).
702
iterator = kwds.get("iterator", False)
0 commit comments