Skip to content

Commit

Permalink
chore[python]: Fix types for DataFrame.write_csv (#4738)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Sep 6, 2022
1 parent c8cfc99 commit bd7b8df
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion py-polars/polars/internals/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1783,6 +1783,38 @@ def write_json(
self._df.write_json(file, pretty, row_oriented, json_lines)
return None

@overload
def write_csv(
self,
file: None = None,
has_header: bool = ...,
sep: str = ...,
quote: str = ...,
batch_size: int = ...,
datetime_format: str | None = ...,
date_format: str | None = ...,
time_format: str | None = ...,
float_precision: int | None = ...,
null_value: str | None = ...,
) -> str:
...

@overload
def write_csv(
self,
file: TextIO | BytesIO | str | Path,
has_header: bool = ...,
sep: str = ...,
quote: str = ...,
batch_size: int = ...,
datetime_format: str | None = ...,
date_format: str | None = ...,
time_format: str | None = ...,
float_precision: int | None = ...,
null_value: str | None = ...,
) -> None:
...

def write_csv(
self,
file: TextIO | BytesIO | str | Path | None = None,
Expand All @@ -1802,7 +1834,8 @@ def write_csv(
Parameters
----------
file
File path to which the file should be written.
File path to which the result should be written. If set to ``None``
(default), the output is returned as a string instead.
has_header
Whether to include header in the CSV output.
sep
Expand Down

0 comments on commit bd7b8df

Please sign in to comment.