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.