Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
24 changes: 23 additions & 1 deletion pandas-stubs/core/generic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down