diff --git a/py-polars/polars/dataframe/frame.py b/py-polars/polars/dataframe/frame.py index 6060bcfc11e2c..e89e4169c3343 100644 --- a/py-polars/polars/dataframe/frame.py +++ b/py-polars/polars/dataframe/frame.py @@ -1386,7 +1386,7 @@ def item(self, row: int | None = None, column: int | str | None = None) -> Any: ) return s.get_index_signed(row) - def to_arrow(self, *, flavor: Flavor = Flavor.Compatible) -> pa.Table: + def to_arrow(self, *, future: Flavor = Flavor.Compatible) -> pa.Table: """ Collect the underlying arrow arrays in an Arrow Table. @@ -1397,7 +1397,7 @@ def to_arrow(self, *, flavor: Flavor = Flavor.Compatible) -> pa.Table: Parameters ---------- - flavor + future Use a specific version of Polars' internal data structures. Examples @@ -1416,10 +1416,10 @@ def to_arrow(self, *, flavor: Flavor = Flavor.Compatible) -> pa.Table: if not self.width: # 0x0 dataframe, cannot infer schema from batches return pa.table({}) - if isinstance(flavor, Flavor): - flavor = flavor.value # type: ignore[assignment] + if isinstance(future, Flavor): + future = future.value # type: ignore[assignment] - record_batches = self._df.to_arrow(flavor) + record_batches = self._df.to_arrow(future) return pa.Table.from_batches(record_batches) @overload @@ -3294,7 +3294,7 @@ def write_ipc( file: None, *, compression: IpcCompression = "uncompressed", - flavor: Flavor = Flavor.Future1, + future: Flavor = Flavor.Future1, ) -> BytesIO: ... @overload @@ -3303,7 +3303,7 @@ def write_ipc( file: str | Path | IO[bytes], *, compression: IpcCompression = "uncompressed", - flavor: Flavor = Flavor.Future1, + future: Flavor = Flavor.Future1, ) -> None: ... def write_ipc( @@ -3311,7 +3311,7 @@ def write_ipc( file: str | Path | IO[bytes] | None, *, compression: IpcCompression = "uncompressed", - flavor: Flavor = Flavor.Future1, + future: Flavor = Flavor.Future1, ) -> BytesIO | None: """ Write to Arrow IPC binary stream or Feather file. @@ -3325,7 +3325,7 @@ def write_ipc( written. If set to `None`, the output is returned as a BytesIO object. compression : {'uncompressed', 'lz4', 'zstd'} Compression method. Defaults to "uncompressed". - flavor + future Use a specific version of Polars' internal data structures. Examples @@ -3348,13 +3348,13 @@ def write_ipc( elif isinstance(file, (str, Path)): file = normalize_filepath(file) - if isinstance(flavor, Flavor): - flavor = flavor.value # type: ignore[assignment] + if isinstance(future, Flavor): + future = future.value # type: ignore[assignment] if compression is None: compression = "uncompressed" - self._df.write_ipc(file, compression, flavor) + self._df.write_ipc(file, compression, future) return file if return_bytes else None # type: ignore[return-value] @overload @@ -3363,7 +3363,7 @@ def write_ipc_stream( file: None, *, compression: IpcCompression = "uncompressed", - flavor: Flavor = Flavor.Future1, + future: Flavor = Flavor.Future1, ) -> BytesIO: ... @overload @@ -3372,7 +3372,7 @@ def write_ipc_stream( file: str | Path | IO[bytes], *, compression: IpcCompression = "uncompressed", - flavor: Flavor = Flavor.Future1, + future: Flavor = Flavor.Future1, ) -> None: ... def write_ipc_stream( @@ -3380,7 +3380,7 @@ def write_ipc_stream( file: str | Path | IO[bytes] | None, *, compression: IpcCompression = "uncompressed", - flavor: Flavor = Flavor.Future1, + future: Flavor = Flavor.Future1, ) -> BytesIO | None: """ Write to Arrow IPC record batch stream. @@ -3394,7 +3394,7 @@ def write_ipc_stream( be written. If set to `None`, the output is returned as a BytesIO object. compression : {'uncompressed', 'lz4', 'zstd'} Compression method. Defaults to "uncompressed". - flavor + future Use a specific version of Polars' internal data structures. Examples @@ -3417,13 +3417,13 @@ def write_ipc_stream( elif isinstance(file, (str, Path)): file = normalize_filepath(file) - if isinstance(flavor, Flavor): - flavor = flavor.value # type: ignore[assignment] + if isinstance(future, Flavor): + future = future.value # type: ignore[assignment] if compression is None: compression = "uncompressed" - self._df.write_ipc_stream(file, compression, flavor) + self._df.write_ipc_stream(file, compression, future) return file if return_bytes else None # type: ignore[return-value] def write_parquet( diff --git a/py-polars/polars/series/series.py b/py-polars/polars/series/series.py index d77e8d36ce127..cd70a53c6ebc5 100644 --- a/py-polars/polars/series/series.py +++ b/py-polars/polars/series/series.py @@ -4343,7 +4343,7 @@ def to_torch(self) -> torch.Tensor: # tensor.rename(self.name) return tensor - def to_arrow(self, *, flavor: Flavor = Flavor.Compatible) -> pa.Array: + def to_arrow(self, *, future: Flavor = Flavor.Compatible) -> pa.Array: """ Return the underlying Arrow array. @@ -4351,7 +4351,7 @@ def to_arrow(self, *, flavor: Flavor = Flavor.Compatible) -> pa.Array: Parameters ---------- - flavor + future Use a specific version of Polars' internal data structures. Examples @@ -4366,9 +4366,9 @@ def to_arrow(self, *, flavor: Flavor = Flavor.Compatible) -> pa.Array: 3 ] """ - if isinstance(flavor, Flavor): - flavor = flavor.value # type: ignore[assignment] - return self._s.to_arrow(flavor) + if isinstance(future, Flavor): + future = future.value # type: ignore[assignment] + return self._s.to_arrow(future) def to_pandas( self, *, use_pyarrow_extension_array: bool = False, **kwargs: Any