The read_clipboard()
pandas function reads the content from the clipboard buffer and passes it to the read_csv()
function. Basically, it returns a parsed DataFrame instance.
pandas.read_clipboard(sep='\\s+',**kwargs)
's+'
shows one or more whitespace characters.It returns the parsed DataFrame instance.
The code below explains the read_clipboard()
function in detail:
import numpy as np import pandas as pd import tkinter as tk root = tk.Tk() # copy to clipboard df = pd.read_csv('Housing.csv') # Copy data to system buffer df.to_clipboard(excel = True) data = pd.read_clipboard() # reading the data from your clipboard # show data in GUI label = tk.Label(root,text=data) label.pack() root.mainloop()
pd.read_csv()
function to load the House.csv
file in the program.df.to_clipboard()
function to copy data to the system clipboard buffer.read_clipboard()
function to the read system clipboard buffer.Housing.csv
file data on the console.