Create DataFrame Hassle-free By Using Clipboard
Many Pandas users think that a DataFrame can ONLY be loaded from disk. However, this is not true.
Imagine one wants to create a DataFrame from tabular data printed on a website. Here, they are most likely to be tempted to copy the contents to a CSV and read it using Pandas' 𝗿𝗲𝗮𝗱_𝗰𝘀𝘃() method. But this is not an ideal approach here.
Instead, with the 𝗿𝗲𝗮𝗱_𝗰𝗹𝗶𝗽𝗯𝗼𝗮𝗿𝗱() method, you can eliminate the CSV step altogether.
This method allows you to create a DataFrame from tabular data stored in a clipboard buffer. Thus, you just need to copy the data and invoke the method to create a DataFrame. This is an elegant approach that saves plenty of time.
Read more here: Pandas Docs.
View a video version of this post on LinkedIn: Post Link.
I like to explore, experiment and write about data science concepts and tools. You could connect with me on LinkedIn.