Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(python): Improved type-inference for read_excel and read_ods, use calamine engine for read_ods #15808

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions py-polars/polars/io/avro.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def read_avro(
Parameters
----------
source
Path to a file or a file-like object (by file-like object, we refer to objects
that have a `read()` method, such as a file handler (e.g. via builtin `open`
function) or `BytesIO`).
Path to a file or a file-like object (by "file-like object" we refer to objects
that have a `read()` method, such as a file handler like the builtin `open`
function, or a `BytesIO` instance).
columns
Columns to select. Accepts a list of column indices (starting at zero) or a list
of column names.
Expand Down
37 changes: 17 additions & 20 deletions py-polars/polars/io/csv/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,14 @@ def read_csv(
Parameters
----------
source
Path to a file or a file-like object (by file-like object, we refer to objects
that have a `read()` method, such as a file handler (e.g. via builtin `open`
function) or `BytesIO`). If `fsspec` is installed, it will be used to open
remote files.
Path to a file or a file-like object (by "file-like object" we refer to objects
that have a `read()` method, such as a file handler like the builtin `open`
function, or a `BytesIO` instance). If `fsspec` is installed, it will be used
to open remote files.
has_header
Indicate if the first row of dataset is a header or not.
If set to False, column names will be autogenerated in the
following format: `column_x`, with `x` being an
enumeration over every column in the dataset starting at 1.
Indicate if the first row of the dataset is a header or not. If set to False,
column names will be autogenerated in the following format: `column_x`, with
`x` being an enumeration over every column in the dataset, starting at 1.
columns
Columns to select. Accepts a list of column indices (starting
at zero) or a list of column names.
Expand Down Expand Up @@ -637,15 +636,14 @@ def read_csv_batched(
Parameters
----------
source
Path to a file or a file-like object (by file-like object, we refer to objects
that have a `read()` method, such as a file handler (e.g. via builtin `open`
function) or `BytesIO`).If `fsspec` is installed, it will be used to open
remote files.
Path to a file or a file-like object (by "file-like object" we refer to objects
that have a `read()` method, such as a file handler like the builtin `open`
function, or a `BytesIO` instance). If `fsspec` is installed, it will be used
to open remote files.
has_header
Indicate if the first row of dataset is a header or not.
If set to False, column names will be autogenerated in the
following format: `column_x`, with `x` being an
enumeration over every column in the dataset starting at 1.
Indicate if the first row of the dataset is a header or not. If set to False,
column names will be autogenerated in the following format: `column_x`, with
`x` being an enumeration over every column in the dataset, starting at 1.
columns
Columns to select. Accepts a list of column indices (starting
at zero) or a list of column names.
Expand Down Expand Up @@ -940,10 +938,9 @@ def scan_csv(
source
Path to a file.
has_header
Indicate if the first row of dataset is a header or not.
If set to False, column names will be autogenerated in the
following format: `column_x`, with `x` being an
enumeration over every column in the dataset starting at 1.
Indicate if the first row of the dataset is a header or not. If set to False,
column names will be autogenerated in the following format: `column_x`, with
`x` being an enumeration over every column in the dataset, starting at 1.
separator
Single byte character to use as separator in the file.
comment_prefix
Expand Down
22 changes: 11 additions & 11 deletions py-polars/polars/io/ipc/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ def read_ipc(
Parameters
----------
source
Path to a file or a file-like object (by file-like object, we refer to objects
that have a `read()` method, such as a file handler (e.g. via builtin `open`
function) or `BytesIO`). If `fsspec` is installed, it will be used to open
remote files.
Path to a file or a file-like object (by "file-like object" we refer to objects
that have a `read()` method, such as a file handler like the builtin `open`
function, or a `BytesIO` instance). If `fsspec` is installed, it will be used
to open remote files.
columns
Columns to select. Accepts a list of column indices (starting at zero) or a list
of column names.
Expand Down Expand Up @@ -193,10 +193,10 @@ def read_ipc_stream(
Parameters
----------
source
Path to a file or a file-like object (by file-like object, we refer to objects
that have a `read()` method, such as a file handler (e.g. via builtin `open`
function) or `BytesIO`). If `fsspec` is installed, it will be used to open
remote files.
Path to a file or a file-like object (by "file-like object" we refer to objects
that have a `read()` method, such as a file handler like the builtin `open`
function, or a `BytesIO` instance). If `fsspec` is installed, it will be used
to open remote files.
columns
Columns to select. Accepts a list of column indices (starting at zero) or a list
of column names.
Expand Down Expand Up @@ -286,9 +286,9 @@ def read_ipc_schema(source: str | Path | IO[bytes] | bytes) -> dict[str, DataTyp
Parameters
----------
source
Path to a file or a file-like object (by file-like object, we refer to objects
that have a `read()` method, such as a file handler (e.g. via builtin `open`
function) or `BytesIO`).
Path to a file or a file-like object (by "file-like object" we refer to objects
that have a `read()` method, such as a file handler like the builtin `open`
function, or a `BytesIO` instance).

Returns
-------
Expand Down
6 changes: 3 additions & 3 deletions py-polars/polars/io/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def read_json(
Parameters
----------
source
Path to a file or a file-like object (by file-like object, we refer to objects
that have a `read()` method, such as a file handler (e.g. via builtin `open`
function) or `BytesIO`).
Path to a file or a file-like object (by "file-like object" we refer to objects
that have a `read()` method, such as a file handler like the builtin `open`
function, or a `BytesIO` instance).
schema : Sequence of str, (str,DataType) pairs, or a {str:DataType,} dict
The DataFrame schema may be declared in several ways:

Expand Down
6 changes: 3 additions & 3 deletions py-polars/polars/io/ndjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def read_ndjson(
Parameters
----------
source
Path to a file or a file-like object (by file-like object, we refer to objects
that have a `read()` method, such as a file handler (e.g. via builtin `open`
function) or `BytesIO`).
Path to a file or a file-like object (by "file-like object" we refer to objects
that have a `read()` method, such as a file handler like the builtin `open`
function, or a `BytesIO` instance).
schema : Sequence of str, (str,DataType) pairs, or a {str:DataType,} dict
The DataFrame schema may be declared in several ways:

Expand Down
12 changes: 6 additions & 6 deletions py-polars/polars/io/parquet/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def read_parquet(
Parameters
----------
source
Path to a file, or a file-like object (by file-like object, we refer to objects
that have a `read()` method, such as a file handler (e.g. via builtin `open`
function) or `BytesIO`). If the path is a directory, files in that
Path to a file or a file-like object (by "file-like object" we refer to objects
that have a `read()` method, such as a file handler like the builtin `open`
function, or a `BytesIO` instance). If the path is a directory, files in that
directory will all be read.
columns
Columns to select. Accepts a list of column indices (starting at zero) or a list
Expand Down Expand Up @@ -269,9 +269,9 @@ def read_parquet_schema(source: str | Path | IO[bytes] | bytes) -> dict[str, Dat
Parameters
----------
source
Path to a file or a file-like object (by file-like object, we refer to objects
that have a `read()` method, such as a file handler (e.g. via builtin `open`
function) or `BytesIO`).
Path to a file or a file-like object (by "file-like object" we refer to objects
that have a `read()` method, such as a file handler like the builtin `open`
function, or a `BytesIO` instance).

Returns
-------
Expand Down
Loading
Loading