Skip to content

Commit 48a9ad9

Browse files
committed
CLN: Add annotations for stata
Add type annotations in Stata General clean up Fix one small bug using in rather than ==
1 parent 074bd9f commit 48a9ad9

File tree

3 files changed

+270
-225
lines changed

3 files changed

+270
-225
lines changed

pandas/core/frame.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
labeling information
1010
"""
1111
import collections
12+
import datetime
1213
from collections import abc
1314
from io import StringIO
1415
import itertools
@@ -18,6 +19,7 @@
1819
IO,
1920
TYPE_CHECKING,
2021
Any,
22+
Dict,
2123
FrozenSet,
2224
Hashable,
2325
Iterable,
@@ -1851,16 +1853,16 @@ def _from_arrays(cls, arrays, columns, index, dtype=None) -> "DataFrame":
18511853
@deprecate_kwarg(old_arg_name="fname", new_arg_name="path")
18521854
def to_stata(
18531855
self,
1854-
path,
1855-
convert_dates=None,
1856-
write_index=True,
1857-
byteorder=None,
1858-
time_stamp=None,
1859-
data_label=None,
1860-
variable_labels=None,
1861-
version=114,
1862-
convert_strl=None,
1863-
):
1856+
path: FilePathOrBuffer,
1857+
convert_dates: Optional[Dict[Hashable, str]] = None,
1858+
write_index: bool = True,
1859+
byteorder: Optional[str] = None,
1860+
time_stamp: Optional[datetime.datetime] = None,
1861+
data_label: Optional[str] = None,
1862+
variable_labels: Optional[Dict[Hashable, str]] = None,
1863+
version: Optional[int] = 114,
1864+
convert_strl: Optional[Sequence[Hashable]] = None,
1865+
) -> None:
18641866
"""
18651867
Export DataFrame object to Stata dta format.
18661868

pandas/io/common.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,9 @@ def get_filepath_or_buffer(
160160
161161
Returns
162162
-------
163-
tuple of ({a filepath_ or buffer or S3File instance},
164-
encoding, str,
165-
compression, str,
166-
should_close, bool)
163+
Tuple[FilePathOrBuffer, str, str, bool]
164+
Tuple containing the filepath or buffer, the encoding, the compression
165+
and should_close.
167166
"""
168167
filepath_or_buffer = stringify_path(filepath_or_buffer)
169168

0 commit comments

Comments
 (0)