diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index cbaa3096..5ae96b0d 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -2226,12 +2226,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def swapaxes(self, axis1: Axis, axis2: Axis, copy: _bool = ...) -> Self: ... def tail(self, n: int = ...) -> Self: ... def take(self, indices: list, axis: Axis = ..., **kwargs: Any) -> Self: ... - def to_clipboard( - self, - excel: _bool = ..., - sep: _str | None = ..., - **kwargs: Any, # TODO: make more precise https://github.com/pandas-dev/pandas-stubs/issues/1174 - ) -> None: ... @overload def to_json( self, diff --git a/pandas-stubs/core/generic.pyi b/pandas-stubs/core/generic.pyi index 0c432b86..456d0697 100644 --- a/pandas-stubs/core/generic.pyi +++ b/pandas-stubs/core/generic.pyi @@ -179,7 +179,29 @@ class NDFrame(indexing.IndexingMixin): storage_options: StorageOptions = ..., ) -> None: ... def to_clipboard( - self, excel: _bool = ..., sep: _str | None = ..., **kwargs + self, + excel: _bool = ..., + sep: _str | None = ..., + *, + 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_latex( diff --git a/tests/test_io.py b/tests/test_io.py index 0397629e..97d090c7 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -275,6 +275,9 @@ def test_clipboard(): ), DataFrame, ) + # Passing kwargs for to_csv + DF.to_clipboard(quoting=csv.QUOTE_ALL) + DF.to_clipboard(sep=",", index=False) if TYPE_CHECKING_INVALID_USAGE: pd.read_clipboard(names="abcd") # type: ignore[call-overload] # pyright: ignore[reportArgumentType] pd.read_clipboard(usecols="abcd") # type: ignore[call-overload] # pyright: ignore[reportArgumentType]