Reading data from the clipboard

To read data from the clipboard, first copy some data. In the following example, we have copied a table from a the movies dataset:

Next, use pandas' read_clipboard method to read the data and create a DataFrame , as follows:

df = pd.read_clipboard()df.head()

The data copied from the web page is now in memory as a DataFrame , as shown in the following screenshot. This method is quite handy when it comes to bringing data in quickly to pandas:

Get Mastering Exploratory Analysis with pandas now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.