This commit is contained in:
2025-09-07 22:09:54 +02:00
parent e1b817252c
commit 2fc0d000b6
7796 changed files with 2159515 additions and 933 deletions

View File

@ -0,0 +1,6 @@
from pandas.io.parsers.readers import (
TextFileReader as TextFileReader,
read_csv as read_csv,
read_fwf as read_fwf,
read_table as read_table,
)

View File

@ -0,0 +1,492 @@
from collections import (
abc,
defaultdict,
)
from collections.abc import (
Callable,
Hashable,
Mapping,
Sequence,
)
import csv
from types import TracebackType
from typing import (
Any,
Literal,
overload,
)
from pandas.core.frame import DataFrame
from typing_extensions import Self
from pandas._libs.lib import _NoDefaultDoNotUse
from pandas._typing import (
CompressionOptions,
CSVEngine,
CSVQuoting,
DtypeArg,
DtypeBackend,
FilePath,
HashableT,
ListLikeHashable,
ReadCsvBuffer,
StorageOptions,
UsecolsArgType,
)
from pandas.io.common import IOHandles
@overload
def read_csv(
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
*,
sep: str | None = ...,
delimiter: str | None = ...,
header: int | Sequence[int] | Literal["infer"] | None = ...,
names: ListLikeHashable | None = ...,
index_col: int | str | Sequence[str | int] | Literal[False] | None = ...,
usecols: UsecolsArgType[HashableT] = ...,
dtype: DtypeArg | defaultdict | None = ...,
engine: CSVEngine | None = ...,
converters: (
Mapping[int | str, Callable[[str], Any]]
| Mapping[int, Callable[[str], Any]]
| Mapping[str, Callable[[str], Any]]
| None
) = ...,
true_values: list[str] | None = ...,
false_values: list[str] | None = ...,
skipinitialspace: bool = ...,
skiprows: int | Sequence[int] | Callable[[int], bool] | None = ...,
skipfooter: int = ...,
nrows: int | None = ...,
na_values: Sequence[str] | Mapping[str, Sequence[str]] | None = ...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
skip_blank_lines: bool = ...,
parse_dates: (
bool
| list[int]
| list[str]
| Sequence[Sequence[int]]
| Mapping[str, Sequence[int | str]]
| None
) = ...,
keep_date_col: bool = ...,
date_format: dict[Hashable, str] | str | None = ...,
dayfirst: bool = ...,
cache_dates: bool = ...,
iterator: Literal[True],
chunksize: int | None = ...,
compression: CompressionOptions = ...,
thousands: str | None = ...,
decimal: str = ...,
lineterminator: str | None = ...,
quotechar: str = ...,
quoting: CSVQuoting = ...,
doublequote: bool = ...,
escapechar: str | None = ...,
comment: str | None = ...,
encoding: str | None = ...,
encoding_errors: str | None = ...,
dialect: str | csv.Dialect | None = ...,
on_bad_lines: (
Literal["error", "warn", "skip"] | Callable[[list[str]], list[str] | None]
) = ...,
delim_whitespace: bool = ...,
low_memory: bool = ...,
memory_map: bool = ...,
float_precision: Literal["high", "legacy", "round_trip"] | None = ...,
storage_options: StorageOptions | None = ...,
dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ...,
) -> TextFileReader: ...
@overload
def read_csv(
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
*,
sep: str | None = ...,
delimiter: str | None = ...,
header: int | Sequence[int] | Literal["infer"] | None = ...,
names: ListLikeHashable | None = ...,
index_col: int | str | Sequence[str | int] | Literal[False] | None = ...,
usecols: UsecolsArgType[HashableT] = ...,
dtype: DtypeArg | defaultdict | None = ...,
engine: CSVEngine | None = ...,
converters: (
Mapping[int | str, Callable[[str], Any]]
| Mapping[int, Callable[[str], Any]]
| Mapping[str, Callable[[str], Any]]
| None
) = ...,
true_values: list[str] | None = ...,
false_values: list[str] | None = ...,
skipinitialspace: bool = ...,
skiprows: int | Sequence[int] | Callable[[int], bool] | None = ...,
skipfooter: int = ...,
nrows: int | None = ...,
na_values: Sequence[str] | Mapping[str, Sequence[str]] | None = ...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
skip_blank_lines: bool = ...,
parse_dates: (
bool
| list[int]
| list[str]
| Sequence[Sequence[int]]
| Mapping[str, Sequence[int | str]]
| None
) = ...,
keep_date_col: bool = ...,
date_format: dict[Hashable, str] | str | None = ...,
dayfirst: bool = ...,
cache_dates: bool = ...,
iterator: bool = ...,
chunksize: int,
compression: CompressionOptions = ...,
thousands: str | None = ...,
decimal: str = ...,
lineterminator: str | None = ...,
quotechar: str = ...,
quoting: CSVQuoting = ...,
doublequote: bool = ...,
escapechar: str | None = ...,
comment: str | None = ...,
encoding: str | None = ...,
encoding_errors: str | None = ...,
dialect: str | csv.Dialect | None = ...,
on_bad_lines: (
Literal["error", "warn", "skip"] | Callable[[list[str]], list[str] | None]
) = ...,
delim_whitespace: bool = ...,
low_memory: bool = ...,
memory_map: bool = ...,
float_precision: Literal["high", "legacy", "round_trip"] | None = ...,
storage_options: StorageOptions | None = ...,
dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ...,
) -> TextFileReader: ...
@overload
def read_csv(
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
*,
sep: str | None = ...,
delimiter: str | None = ...,
header: int | Sequence[int] | Literal["infer"] | None = ...,
names: ListLikeHashable | None = ...,
index_col: int | str | Sequence[str | int] | Literal[False] | None = ...,
usecols: UsecolsArgType[HashableT] = ...,
dtype: DtypeArg | defaultdict | None = ...,
engine: CSVEngine | None = ...,
converters: (
Mapping[int | str, Callable[[str], Any]]
| Mapping[int, Callable[[str], Any]]
| Mapping[str, Callable[[str], Any]]
| None
) = ...,
true_values: list[str] | None = ...,
false_values: list[str] | None = ...,
skipinitialspace: bool = ...,
skiprows: int | Sequence[int] | Callable[[int], bool] | None = ...,
skipfooter: int = ...,
nrows: int | None = ...,
na_values: Sequence[str] | Mapping[str, Sequence[str]] | None = ...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
skip_blank_lines: bool = ...,
parse_dates: (
bool
| list[int]
| list[str]
| Sequence[Sequence[int]]
| Mapping[str, Sequence[int | str]]
| None
) = ...,
keep_date_col: bool = ...,
date_format: dict[Hashable, str] | str | None = ...,
dayfirst: bool = ...,
cache_dates: bool = ...,
iterator: Literal[False] = ...,
chunksize: None = ...,
compression: CompressionOptions = ...,
thousands: str | None = ...,
decimal: str = ...,
lineterminator: str | None = ...,
quotechar: str = ...,
quoting: CSVQuoting = ...,
doublequote: bool = ...,
escapechar: str | None = ...,
comment: str | None = ...,
encoding: str | None = ...,
encoding_errors: str | None = ...,
dialect: str | csv.Dialect | None = ...,
on_bad_lines: (
Literal["error", "warn", "skip"] | Callable[[list[str]], list[str] | None]
) = ...,
delim_whitespace: bool = ...,
low_memory: bool = ...,
memory_map: bool = ...,
float_precision: Literal["high", "legacy", "round_trip"] | None = ...,
storage_options: StorageOptions | None = ...,
dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ...,
) -> DataFrame: ...
@overload
def read_table(
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
*,
sep: str | None = ...,
delimiter: str | None = ...,
header: int | Sequence[int] | Literal["infer"] | None = ...,
names: ListLikeHashable | None = ...,
index_col: int | str | Sequence[str | int] | Literal[False] | None = ...,
usecols: UsecolsArgType[HashableT] = ...,
dtype: DtypeArg | defaultdict | None = ...,
engine: CSVEngine | None = ...,
converters: (
Mapping[int | str, Callable[[str], Any]]
| Mapping[int, Callable[[str], Any]]
| Mapping[str, Callable[[str], Any]]
| None
) = ...,
true_values: list[str] | None = ...,
false_values: list[str] | None = ...,
skipinitialspace: bool = ...,
skiprows: int | Sequence[int] | Callable[[int], bool] | None = ...,
skipfooter: int = ...,
nrows: int | None = ...,
na_values: Sequence[str] | Mapping[str, Sequence[str]] | None = ...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
skip_blank_lines: bool = ...,
parse_dates: (
bool
| list[int]
| list[str]
| Sequence[Sequence[int]]
| Mapping[str, Sequence[int | str]]
| None
) = ...,
infer_datetime_format: bool = ...,
keep_date_col: bool = ...,
date_format: dict[Hashable, str] | str | None = ...,
dayfirst: bool = ...,
cache_dates: bool = ...,
iterator: Literal[True],
chunksize: int | None = ...,
compression: CompressionOptions = ...,
thousands: str | None = ...,
decimal: str = ...,
lineterminator: str | None = ...,
quotechar: str = ...,
quoting: CSVQuoting = ...,
doublequote: bool = ...,
escapechar: str | None = ...,
comment: str | None = ...,
encoding: str | None = ...,
encoding_errors: str | None = ...,
dialect: str | csv.Dialect | None = ...,
on_bad_lines: (
Literal["error", "warn", "skip"] | Callable[[list[str]], list[str] | None]
) = ...,
delim_whitespace: bool = ...,
low_memory: bool = ...,
memory_map: bool = ...,
float_precision: Literal["high", "legacy", "round_trip"] | None = ...,
storage_options: StorageOptions | None = ...,
) -> TextFileReader: ...
@overload
def read_table(
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
*,
sep: str | None = ...,
delimiter: str | None = ...,
header: int | Sequence[int] | Literal["infer"] | None = ...,
names: ListLikeHashable | None = ...,
index_col: int | str | Sequence[str | int] | Literal[False] | None = ...,
usecols: UsecolsArgType[HashableT] = ...,
dtype: DtypeArg | defaultdict | None = ...,
engine: CSVEngine | None = ...,
converters: (
Mapping[int | str, Callable[[str], Any]]
| Mapping[int, Callable[[str], Any]]
| Mapping[str, Callable[[str], Any]]
| None
) = ...,
true_values: list[str] | None = ...,
false_values: list[str] | None = ...,
skipinitialspace: bool = ...,
skiprows: int | Sequence[int] | Callable[[int], bool] | None = ...,
skipfooter: int = ...,
nrows: int | None = ...,
na_values: Sequence[str] | Mapping[str, Sequence[str]] | None = ...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
skip_blank_lines: bool = ...,
parse_dates: (
bool
| list[int]
| list[str]
| Sequence[Sequence[int]]
| Mapping[str, Sequence[int | str]]
| None
) = ...,
infer_datetime_format: bool = ...,
keep_date_col: bool = ...,
date_format: dict[Hashable, str] | str | None = ...,
dayfirst: bool = ...,
cache_dates: bool = ...,
iterator: bool = ...,
chunksize: int,
compression: CompressionOptions = ...,
thousands: str | None = ...,
decimal: str = ...,
lineterminator: str | None = ...,
quotechar: str = ...,
quoting: CSVQuoting = ...,
doublequote: bool = ...,
escapechar: str | None = ...,
comment: str | None = ...,
encoding: str | None = ...,
encoding_errors: str | None = ...,
dialect: str | csv.Dialect | None = ...,
on_bad_lines: (
Literal["error", "warn", "skip"] | Callable[[list[str]], list[str] | None]
) = ...,
delim_whitespace: bool = ...,
low_memory: bool = ...,
memory_map: bool = ...,
float_precision: Literal["high", "legacy", "round_trip"] | None = ...,
storage_options: StorageOptions | None = ...,
) -> TextFileReader: ...
@overload
def read_table(
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
*,
sep: str | None = ...,
delimiter: str | None = ...,
header: int | Sequence[int] | Literal["infer"] | None = ...,
names: ListLikeHashable | None = ...,
index_col: int | str | Sequence[str | int] | Literal[False] | None = ...,
usecols: UsecolsArgType[HashableT] = ...,
dtype: DtypeArg | defaultdict | None = ...,
engine: CSVEngine | None = ...,
converters: (
Mapping[int | str, Callable[[str], Any]]
| Mapping[int, Callable[[str], Any]]
| Mapping[str, Callable[[str], Any]]
| None
) = ...,
true_values: list[str] | None = ...,
false_values: list[str] | None = ...,
skipinitialspace: bool = ...,
skiprows: int | Sequence[int] | Callable[[int], bool] | None = ...,
skipfooter: int = ...,
nrows: int | None = ...,
na_values: Sequence[str] | Mapping[str, Sequence[str]] | None = ...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
skip_blank_lines: bool = ...,
parse_dates: (
bool
| list[int]
| list[str]
| Sequence[Sequence[int]]
| Mapping[str, Sequence[int | str]]
| None
) = ...,
infer_datetime_format: bool = ...,
keep_date_col: bool = ...,
date_format: dict[Hashable, str] | str | None = ...,
dayfirst: bool = ...,
cache_dates: bool = ...,
iterator: Literal[False] = ...,
chunksize: None = ...,
compression: CompressionOptions = ...,
thousands: str | None = ...,
decimal: str = ...,
lineterminator: str | None = ...,
quotechar: str = ...,
quoting: CSVQuoting = ...,
doublequote: bool = ...,
escapechar: str | None = ...,
comment: str | None = ...,
encoding: str | None = ...,
encoding_errors: str | None = ...,
dialect: str | csv.Dialect | None = ...,
on_bad_lines: (
Literal["error", "warn", "skip"] | Callable[[list[str]], list[str] | None]
) = ...,
delim_whitespace: bool = ...,
low_memory: bool = ...,
memory_map: bool = ...,
float_precision: Literal["high", "legacy", "round_trip"] | None = ...,
storage_options: StorageOptions | None = ...,
) -> DataFrame: ...
@overload
def read_fwf(
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
*,
colspecs: Sequence[tuple[int, int]] | Literal["infer"] | None = ...,
widths: Sequence[int] | None = ...,
infer_nrows: int = ...,
dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ...,
date_format: dict[Hashable, str] | str | None = ...,
iterator: Literal[True],
chunksize: int | None = ...,
**kwds: Any,
) -> TextFileReader: ...
@overload
def read_fwf(
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
*,
colspecs: Sequence[tuple[int, int]] | Literal["infer"] | None = ...,
widths: Sequence[int] | None = ...,
infer_nrows: int = ...,
dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ...,
date_format: dict[Hashable, str] | str | None = ...,
iterator: bool = ...,
chunksize: int,
**kwds: Any,
) -> TextFileReader: ...
@overload
def read_fwf(
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
*,
colspecs: Sequence[tuple[int, int]] | Literal["infer"] | None = ...,
widths: Sequence[int] | None = ...,
infer_nrows: int = ...,
dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ...,
date_format: dict[Hashable, str] | str | None = ...,
iterator: Literal[False] = ...,
chunksize: None = ...,
**kwds: Any,
) -> DataFrame: ...
class TextFileReader(abc.Iterator):
engine: CSVEngine
orig_options: Mapping[str, Any]
chunksize: int | None
nrows: int | None
squeeze: bool
handles: IOHandles | None
def __init__(
self,
f: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str] | list,
engine: CSVEngine | None = ...,
**kwds: Any,
) -> None: ...
def close(self) -> None: ...
def read(self, nrows: int | None = ...) -> DataFrame: ...
def get_chunk(self, size: int | None = ...) -> DataFrame: ...
def __next__(self) -> DataFrame: ...
def __enter__(self) -> Self: ...
def __exit__(
self,
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
traceback: TracebackType | None,
) -> None: ...