Skip to content

Commit 5d2b7f2

Browse files
committed
movekwargs to generic.pyi, add tests, remove frame.pyi definition
1 parent 1d66fa8 commit 5d2b7f2

File tree

3 files changed

+26
-29
lines changed

3 files changed

+26
-29
lines changed

pandas-stubs/core/frame.pyi

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,8 @@ from pandas._typing import (
8383
CalculationMethod,
8484
ColspaceArgType,
8585
CompressionOptions,
86-
CSVQuoting,
8786
Dtype,
8887
FilePath,
89-
FileWriteMode,
9088
FillnaOptions,
9189
FormattersType,
9290
Frequency,
@@ -2228,32 +2226,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
22282226
def swapaxes(self, axis1: Axis, axis2: Axis, copy: _bool = ...) -> Self: ...
22292227
def tail(self, n: int = ...) -> Self: ...
22302228
def take(self, indices: list, axis: Axis = ..., **kwargs: Any) -> Self: ...
2231-
def to_clipboard(
2232-
self,
2233-
excel: _bool = True,
2234-
sep: _str | None = None,
2235-
*,
2236-
path_or_buf: FilePath | WriteBuffer[bytes] | WriteBuffer[str] | None = None,
2237-
na_rep: _str = "",
2238-
float_format: _str | Callable[[object], _str] | None = None,
2239-
columns: list[HashableT1] | None = None,
2240-
header: _bool | list[_str] = True,
2241-
index: _bool = True,
2242-
index_label: Literal[False] | _str | list[HashableT2] | None = None,
2243-
mode: FileWriteMode = "w",
2244-
encoding: _str | None = None,
2245-
compression: CompressionOptions = "infer",
2246-
quoting: CSVQuoting = ...,
2247-
quotechar: _str = '"',
2248-
lineterminator: _str | None = None,
2249-
chunksize: int | None = None,
2250-
date_format: _str | None = None,
2251-
doublequote: _bool = True,
2252-
escapechar: _str | None = None,
2253-
decimal: _str = ".",
2254-
errors: _str = "strict",
2255-
storage_options: StorageOptions = None,
2256-
) -> None: ...
22572229
@overload
22582230
def to_json(
22592231
self,

pandas-stubs/core/generic.pyi

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,29 @@ class NDFrame(indexing.IndexingMixin):
179179
storage_options: StorageOptions = ...,
180180
) -> None: ...
181181
def to_clipboard(
182-
self, excel: _bool = ..., sep: _str | None = ..., **kwargs
182+
self,
183+
excel: _bool = ...,
184+
sep: _str | None = ...,
185+
*,
186+
na_rep: _str = ...,
187+
float_format: _str | Callable[[object], _str] | None = ...,
188+
columns: list[HashableT1] | None = ...,
189+
header: _bool | list[_str] = ...,
190+
index: _bool = ...,
191+
index_label: Literal[False] | _str | list[HashableT2] | None = ...,
192+
mode: FileWriteMode = ...,
193+
encoding: _str | None = ...,
194+
compression: CompressionOptions = ...,
195+
quoting: CSVQuoting = ...,
196+
quotechar: _str = ...,
197+
lineterminator: _str | None = ...,
198+
chunksize: int | None = ...,
199+
date_format: _str | None = ...,
200+
doublequote: _bool = ...,
201+
escapechar: _str | None = ...,
202+
decimal: _str = ...,
203+
errors: _str = ...,
204+
storage_options: StorageOptions = ...,
183205
) -> None: ...
184206
@overload
185207
def to_latex(

tests/test_io.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ def test_clipboard():
275275
),
276276
DataFrame,
277277
)
278+
# Passing kwargs for to_csv
279+
DF.to_clipboard(quoting=csv.QUOTE_ALL)
280+
DF.to_clipboard(sep=",", index=False)
278281
if TYPE_CHECKING_INVALID_USAGE:
279282
pd.read_clipboard(names="abcd") # type: ignore[call-overload] # pyright: ignore[reportArgumentType]
280283
pd.read_clipboard(usecols="abcd") # type: ignore[call-overload] # pyright: ignore[reportArgumentType]

0 commit comments

Comments
 (0)