parsers.pyi 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. from typing import (
  2. Hashable,
  3. Literal,
  4. )
  5. import numpy as np
  6. from pandas._typing import (
  7. ArrayLike,
  8. Dtype,
  9. npt,
  10. )
  11. STR_NA_VALUES: set[str]
  12. def sanitize_objects(
  13. values: npt.NDArray[np.object_],
  14. na_values: set,
  15. ) -> int: ...
  16. class TextReader:
  17. unnamed_cols: set[str]
  18. table_width: int # int64_t
  19. leading_cols: int # int64_t
  20. header: list[list[int]] # non-negative integers
  21. def __init__(
  22. self,
  23. source,
  24. delimiter: bytes | str = ..., # single-character only
  25. header=...,
  26. header_start: int = ..., # int64_t
  27. header_end: int = ..., # uint64_t
  28. index_col=...,
  29. names=...,
  30. tokenize_chunksize: int = ..., # int64_t
  31. delim_whitespace: bool = ...,
  32. converters=...,
  33. skipinitialspace: bool = ...,
  34. escapechar: bytes | str | None = ..., # single-character only
  35. doublequote: bool = ...,
  36. quotechar: str | bytes | None = ..., # at most 1 character
  37. quoting: int = ...,
  38. lineterminator: bytes | str | None = ..., # at most 1 character
  39. comment=...,
  40. decimal: bytes | str = ..., # single-character only
  41. thousands: bytes | str | None = ..., # single-character only
  42. dtype: Dtype | dict[Hashable, Dtype] = ...,
  43. usecols=...,
  44. error_bad_lines: bool = ...,
  45. warn_bad_lines: bool = ...,
  46. na_filter: bool = ...,
  47. na_values=...,
  48. na_fvalues=...,
  49. keep_default_na: bool = ...,
  50. true_values=...,
  51. false_values=...,
  52. allow_leading_cols: bool = ...,
  53. skiprows=...,
  54. skipfooter: int = ..., # int64_t
  55. verbose: bool = ...,
  56. float_precision: Literal["round_trip", "legacy", "high"] | None = ...,
  57. skip_blank_lines: bool = ...,
  58. encoding_errors: bytes | str = ...,
  59. ) -> None: ...
  60. def set_noconvert(self, i: int) -> None: ...
  61. def remove_noconvert(self, i: int) -> None: ...
  62. def close(self) -> None: ...
  63. def read(self, rows: int | None = ...) -> dict[int, ArrayLike]: ...
  64. def read_low_memory(self, rows: int | None) -> list[dict[int, ArrayLike]]: ...
  65. # _maybe_upcast, na_values are only exposed for testing
  66. def _maybe_upcast(
  67. arr, use_dtype_backend: bool = ..., dtype_backend: str = ...
  68. ) -> np.ndarray: ...