|
7 | 7 | import pickle
|
8 | 8 | import re
|
9 | 9 | from textwrap import dedent
|
10 |
| -from typing import Callable, Dict, FrozenSet, List, Optional, Set |
| 10 | +from typing import Any, Callable, Dict, FrozenSet, List, Optional, Set, Union |
11 | 11 | import warnings
|
12 | 12 | import weakref
|
13 | 13 |
|
|
50 | 50 | from pandas.core.dtypes.missing import isna, notna
|
51 | 51 |
|
52 | 52 | import pandas as pd
|
53 |
| -from pandas._typing import Dtype |
| 53 | +from pandas._typing import Dtype, FilePathOrBuffer |
54 | 54 | from pandas.core import missing, nanops
|
55 | 55 | import pandas.core.algorithms as algos
|
56 | 56 | from pandas.core.base import PandasObject, SelectionMixin
|
@@ -122,6 +122,9 @@ def _single_replace(self, to_replace, method, inplace, limit):
|
122 | 122 | return result
|
123 | 123 |
|
124 | 124 |
|
| 125 | +bool_t = bool # Need alias because NDFrame has def bool: |
| 126 | + |
| 127 | + |
125 | 128 | class NDFrame(PandasObject, SelectionMixin):
|
126 | 129 | """
|
127 | 130 | N-dimensional analogue of DataFrame. Store multi-dimensional in a
|
@@ -2239,18 +2242,18 @@ def to_excel(
|
2239 | 2242 |
|
2240 | 2243 | def to_json(
|
2241 | 2244 | self,
|
2242 |
| - path_or_buf=None, |
2243 |
| - orient=None, |
2244 |
| - date_format=None, |
2245 |
| - double_precision=10, |
2246 |
| - force_ascii=True, |
2247 |
| - date_unit="ms", |
2248 |
| - default_handler=None, |
2249 |
| - lines=False, |
2250 |
| - compression="infer", |
2251 |
| - index=True, |
2252 |
| - indent=0, |
2253 |
| - ): |
| 2245 | + path_or_buf: Optional[FilePathOrBuffer] = None, |
| 2246 | + orient: Optional[str] = None, |
| 2247 | + date_format: Optional[str] = None, |
| 2248 | + double_precision: int = 10, |
| 2249 | + force_ascii: bool_t = True, |
| 2250 | + date_unit: str = "ms", |
| 2251 | + default_handler: Optional[Callable[[Any], Union[int, str, List, Dict]]] = None, |
| 2252 | + lines: bool_t = False, |
| 2253 | + compression: Optional[str] = "infer", |
| 2254 | + index: bool_t = True, |
| 2255 | + indent: int = 0, |
| 2256 | + ) -> Optional[str]: |
2254 | 2257 | """
|
2255 | 2258 | Convert the object to a JSON string.
|
2256 | 2259 |
|
|
0 commit comments