This is a rather interesting feature in pandas. Any tabular data that has been copied onto the clipboard can be read as a DataFrame in pandas.
Let's copy the following tabular data with the usual ctrl + C keyboard command:
Gender |
Entry_Date |
Flag |
|
A |
M |
2012-01-19 |
True |
B |
F |
2012-12-30 |
False |
C |
M |
2012-05-05 |
False |
Calling the read_clipboard() function makes this data available as a pandas DataFrame:
pd.read_clipboard()
Take a look at the following output:
Output of read_clipboard
This function also recognizes the Flag column as a bool data type by default and assigns the unnamed column to be the index:
Data types after reading the clipboard