forked from pandas-dev/pandas-stubs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeneric.pyi
495 lines (488 loc) · 14.7 KB
/
generic.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
import sqlite3
from typing import (
Any,
Callable,
ClassVar,
Hashable,
Iterable,
Literal,
Mapping,
Sequence,
final,
overload,
)
import numpy as np
from pandas import (
DataFrame,
Index,
)
from pandas.core.base import PandasObject
import pandas.core.indexing as indexing
import sqlalchemy.engine
from pandas._typing import (
S1,
ArrayLike,
Axis,
CompressionOptions,
CSVQuoting,
Dtype,
DtypeArg,
FilePath,
FileWriteMode,
FillnaOptions,
HashableT1,
HashableT2,
HDFCompLib,
IgnoreRaise,
IndexLabel,
Level,
NDFrameT,
ReplaceMethod,
SeriesAxisType,
SortKind,
StorageOptions,
T,
WriteBuffer,
)
from pandas.io.pytables import HDFStore
from pandas.io.sql import SQLTable
_bool = bool
_str = str
class NDFrame(PandasObject, indexing.IndexingMixin):
__hash__: ClassVar[None] # type: ignore[assignment]
def set_flags(
self: NDFrameT,
*,
copy: bool = ...,
allows_duplicate_labels: bool | None = ...,
) -> NDFrameT: ...
@property
def attrs(self) -> dict[Hashable | None, Any]: ...
@attrs.setter
def attrs(self, value: Mapping[Hashable | None, Any]) -> None: ...
@property
def shape(self) -> tuple[int, ...]: ...
@property
def axes(self) -> list[Index]: ...
@property
def ndim(self) -> int: ...
@property
def size(self) -> int: ...
def swapaxes(
self, axis1: SeriesAxisType, axis2: SeriesAxisType, copy: _bool = ...
) -> NDFrame: ...
def droplevel(self, level: Level, axis: SeriesAxisType = ...) -> NDFrame: ...
def pop(self, item: _str) -> NDFrame: ...
def squeeze(self, axis=...): ...
def equals(self, other: Series[S1]) -> _bool: ...
def __neg__(self: NDFrameT) -> NDFrameT: ...
def __pos__(self: NDFrameT) -> NDFrameT: ...
def __nonzero__(self) -> None: ...
@final
def bool(self) -> _bool: ...
def __abs__(self) -> NDFrame: ...
def __round__(self, decimals: int = ...) -> NDFrame: ...
def keys(self): ...
def __len__(self) -> int: ...
def __contains__(self, key) -> _bool: ...
@property
def empty(self) -> _bool: ...
__array_priority__: int = ...
def __array__(self, dtype=...) -> np.ndarray: ...
def to_excel(
self,
excel_writer,
sheet_name: _str = ...,
na_rep: _str = ...,
float_format: _str | None = ...,
columns: _str | Sequence[_str] | None = ...,
header: _bool | list[_str] = ...,
index: _bool = ...,
index_label: _str | Sequence[_str] | None = ...,
startrow: int = ...,
startcol: int = ...,
engine: _str | None = ...,
merge_cells: _bool = ...,
# Not actually positional, but used to handle removal of deprecated
*,
inf_rep: _str = ...,
freeze_panes: tuple[int, int] | None = ...,
) -> None: ...
def to_hdf(
self,
path_or_buf: FilePath | HDFStore,
key: _str,
mode: Literal["a", "w", "r+"] = ...,
complevel: int | None = ...,
complib: HDFCompLib | None = ...,
append: _bool = ...,
format: Literal["t", "table", "f", "fixed"] | None = ...,
index: _bool = ...,
min_itemsize: int | dict[HashableT1, int] | None = ...,
nan_rep: _str | None = ...,
dropna: _bool | None = ...,
data_columns: Literal[True] | list[HashableT2] | None = ...,
errors: Literal[
"strict",
"ignore",
"replace",
"surrogateescape",
"xmlcharrefreplace",
"backslashreplace",
"namereplace",
] = ...,
encoding: _str = ...,
) -> None: ...
@overload
def to_markdown(
self,
buf: FilePath | WriteBuffer[str],
mode: FileWriteMode | None = ...,
index: _bool = ...,
storage_options: StorageOptions = ...,
**kwargs: Any,
) -> None: ...
@overload
def to_markdown(
self,
buf: None = ...,
mode: FileWriteMode | None = ...,
index: _bool = ...,
storage_options: StorageOptions = ...,
**kwargs: Any,
) -> _str: ...
def to_sql(
self,
name: _str,
con: str | sqlalchemy.engine.Connectable | sqlite3.Connection,
schema: _str | None = ...,
if_exists: Literal["fail", "replace", "append"] = ...,
index: _bool = ...,
index_label: IndexLabel = ...,
chunksize: int | None = ...,
dtype: DtypeArg | None = ...,
method: Literal["multi"]
| Callable[
[SQLTable, Any, list[str], Iterable[tuple[Any, ...]]],
int | None,
]
| None = ...,
) -> int | None: ...
def to_pickle(
self,
path: FilePath | WriteBuffer[bytes],
compression: CompressionOptions = ...,
protocol: int = ...,
storage_options: StorageOptions = ...,
) -> None: ...
def to_clipboard(
self, excel: _bool = ..., sep: _str | None = ..., **kwargs
) -> None: ...
@overload
def to_latex(
self,
buf: FilePath | WriteBuffer[str],
columns: list[_str] | None = ...,
col_space: int | None = ...,
header: _bool | list[_str] = ...,
index: _bool = ...,
na_rep: _str = ...,
formatters=...,
float_format=...,
sparsify: _bool | None = ...,
index_names: _bool = ...,
bold_rows: _bool = ...,
column_format: _str | None = ...,
longtable: _bool | None = ...,
escape: _bool | None = ...,
encoding: _str | None = ...,
decimal: _str = ...,
multicolumn: _bool | None = ...,
multicolumn_format: _str | None = ...,
multirow: _bool | None = ...,
caption: _str | tuple[_str, _str] | None = ...,
label: _str | None = ...,
position: _str | None = ...,
) -> None: ...
@overload
def to_latex(
self,
buf: None = ...,
columns: list[_str] | None = ...,
col_space: int | None = ...,
header: _bool | list[_str] = ...,
index: _bool = ...,
na_rep: _str = ...,
formatters=...,
float_format=...,
sparsify: _bool | None = ...,
index_names: _bool = ...,
bold_rows: _bool = ...,
column_format: _str | None = ...,
longtable: _bool | None = ...,
escape: _bool | None = ...,
encoding: _str | None = ...,
decimal: _str = ...,
multicolumn: _bool | None = ...,
multicolumn_format: _str | None = ...,
multirow: _bool | None = ...,
caption: _str | tuple[_str, _str] | None = ...,
label: _str | None = ...,
position: _str | None = ...,
) -> _str: ...
@overload
def to_csv(
self,
path_or_buf: FilePath | WriteBuffer[bytes] | WriteBuffer[str],
sep: _str = ...,
na_rep: _str = ...,
float_format: _str | Callable[[object], _str] | None = ...,
columns: list[HashableT1] | None = ...,
header: _bool | list[_str] = ...,
index: _bool = ...,
index_label: Literal[False] | _str | list[HashableT2] | None = ...,
mode: FileWriteMode = ...,
encoding: _str | None = ...,
compression: CompressionOptions = ...,
quoting: CSVQuoting = ...,
quotechar: _str = ...,
lineterminator: _str | None = ...,
chunksize: int | None = ...,
date_format: _str | None = ...,
doublequote: _bool = ...,
escapechar: _str | None = ...,
decimal: _str = ...,
errors: _str = ...,
storage_options: StorageOptions = ...,
) -> None: ...
@overload
def to_csv(
self,
path_or_buf: None = ...,
sep: _str = ...,
na_rep: _str = ...,
float_format: _str | Callable[[object], _str] | None = ...,
columns: list[HashableT1] | None = ...,
header: _bool | list[_str] = ...,
index: _bool = ...,
index_label: Literal[False] | _str | list[HashableT2] | None = ...,
mode: FileWriteMode = ...,
encoding: _str | None = ...,
compression: CompressionOptions = ...,
quoting: CSVQuoting = ...,
quotechar: _str = ...,
lineterminator: _str | None = ...,
chunksize: int | None = ...,
date_format: _str | None = ...,
doublequote: _bool = ...,
escapechar: _str | None = ...,
decimal: _str = ...,
errors: _str = ...,
storage_options: StorageOptions = ...,
) -> _str: ...
def take(
self, indices, axis=..., is_copy: _bool | None = ..., **kwargs
) -> NDFrame: ...
def xs(
self,
key: Hashable,
axis: SeriesAxisType = ...,
level: Level | None = ...,
drop_level: _bool = ...,
) -> DataFrame | Series: ...
def __delitem__(self, idx: Hashable): ...
def get(self, key: object, default: Dtype | None = ...) -> Dtype: ...
def reindex_like(
self,
other,
method: _str | None = ...,
copy: _bool = ...,
limit=...,
tolerance=...,
) -> NDFrame: ...
@overload
def drop(
self,
labels: Hashable | Sequence[Hashable] = ...,
*,
axis: Axis = ...,
index: Hashable | Sequence[Hashable] = ...,
columns: Hashable | Sequence[Hashable] = ...,
level: Level | None = ...,
inplace: Literal[True],
errors: IgnoreRaise = ...,
) -> None: ...
@overload
def drop(
self: NDFrame,
labels: Hashable | Sequence[Hashable] = ...,
*,
axis: Axis = ...,
index: Hashable | Sequence[Hashable] = ...,
columns: Hashable | Sequence[Hashable] = ...,
level: Level | None = ...,
inplace: Literal[False] = ...,
errors: IgnoreRaise = ...,
) -> NDFrame: ...
@overload
def drop(
self: NDFrame,
labels: Hashable | Sequence[Hashable] = ...,
*,
axis: Axis = ...,
index: Hashable | Sequence[Hashable] = ...,
columns: Hashable | Sequence[Hashable] = ...,
level: Level | None = ...,
inplace: _bool = ...,
errors: IgnoreRaise = ...,
) -> NDFrame | None: ...
def add_prefix(self, prefix: _str) -> NDFrame: ...
def add_suffix(self, suffix: _str) -> NDFrame: ...
def sort_index(
self,
axis: Literal["columns", "index", 0, 1] = ...,
level=...,
ascending: _bool = ...,
inplace: _bool = ...,
kind: SortKind = ...,
na_position: Literal["first", "last"] = ...,
sort_remaining: _bool = ...,
ignore_index: _bool = ...,
): ...
def filter(
self,
items=...,
like: _str | None = ...,
regex: _str | None = ...,
axis=...,
) -> NDFrame: ...
def head(self: NDFrameT, n: int = ...) -> NDFrameT: ...
def tail(self: NDFrameT, n: int = ...) -> NDFrameT: ...
def pipe(
self, func: Callable[..., T] | tuple[Callable[..., T], str], *args, **kwargs
) -> T: ...
def __finalize__(self, other, method=..., **kwargs) -> NDFrame: ...
def __setattr__(self, name: _str, value) -> None: ...
@property
def values(self) -> ArrayLike: ...
@property
def dtypes(self): ...
def astype(
self: NDFrameT,
dtype,
copy: _bool = ...,
errors: IgnoreRaise = ...,
) -> NDFrameT: ...
def copy(self: NDFrameT, deep: _bool = ...) -> NDFrameT: ...
def __copy__(self, deep: _bool = ...) -> NDFrame: ...
def __deepcopy__(self, memo=...) -> NDFrame: ...
def infer_objects(self) -> NDFrame: ...
def convert_dtypes(
self: NDFrameT,
infer_objects: _bool = ...,
convert_string: _bool = ...,
convert_integer: _bool = ...,
convert_boolean: _bool = ...,
) -> NDFrameT: ...
def fillna(
self,
value=...,
method=...,
axis=...,
inplace: _bool = ...,
limit=...,
downcast=...,
) -> NDFrame | None: ...
def replace(
self,
to_replace=...,
value=...,
inplace: _bool = ...,
limit=...,
regex: _bool = ...,
method: ReplaceMethod = ...,
): ...
def asof(self, where, subset=...): ...
def isna(self) -> NDFrame: ...
def isnull(self) -> NDFrame: ...
def notna(self) -> NDFrame: ...
def notnull(self) -> NDFrame: ...
def clip(
self, lower=..., upper=..., axis=..., inplace: _bool = ..., *args, **kwargs
) -> NDFrame: ...
def asfreq(
self,
freq,
method: FillnaOptions | None = ...,
how: Literal["start", "end"] | None = ...,
normalize: _bool = ...,
fill_value=...,
) -> NDFrame: ...
def at_time(self, time, asof: _bool = ..., axis=...) -> NDFrame: ...
def between_time(
self,
start_time,
end_time,
axis=...,
) -> NDFrame: ...
def first(self, offset) -> NDFrame: ...
def last(self, offset) -> NDFrame: ...
def rank(
self,
axis=...,
method: Literal["average", "min", "max", "first", "dense"] = ...,
numeric_only: _bool = ...,
na_option: Literal["keep", "top", "bottom"] = ...,
ascending: _bool = ...,
pct: _bool = ...,
) -> NDFrame: ...
def where(
self,
cond,
other=...,
inplace: _bool = ...,
axis=...,
level=...,
*, # Not actually positional-only, but needed due to depr in 1.5.0
try_cast: _bool = ...,
): ...
def mask(
self,
cond,
other=...,
inplace: _bool = ...,
axis=...,
level=...,
*, # Not actually positional-only, but needed due to depr in 1.5.0
try_cast: _bool = ...,
): ...
def shift(self, periods=..., freq=..., axis=..., fill_value=...) -> NDFrame: ...
def slice_shift(self, periods: int = ..., axis=...) -> NDFrame: ...
def tshift(self, periods: int = ..., freq=..., axis=...) -> NDFrame: ...
def truncate(
self, before=..., after=..., axis=..., copy: _bool = ...
) -> NDFrame: ...
def tz_convert(self, tz, axis=..., level=..., copy: _bool = ...) -> NDFrame: ...
def tz_localize(
self,
tz,
axis=...,
level=...,
copy: _bool = ...,
ambiguous=...,
nonexistent: str = ...,
) -> NDFrame: ...
def abs(self) -> NDFrame: ...
def describe(
self,
percentiles=...,
include=...,
exclude=...,
datetime_is_numeric: _bool | None = ...,
) -> NDFrame: ...
def pct_change(
self, periods=..., fill_method=..., limit=..., freq=..., **kwargs
) -> NDFrame: ...
def first_valid_index(self): ...
def last_valid_index(self): ...
from pandas.core.series import Series