As we know that data comes in all shapes and sizes. They often come from various different sources having different formats. For an aspiring data scientist, it is very important that they know their way around data i.e. loading and storing data present in various formats.
We have some data present in string format, discuss ways to load that data into pandas dataframe.
Solution #1: One way to achieve this is by using the
StringIO() function. It will act as a wrapper and it will help use read the data using the
As we can see in the output, we have successfully read the given data in string format into a Pandas DataFrame.
Solution 2 : Another fantastic approach is to use the pandas
This is what it looks like after we copy the data to clipboard.
Now we will use pandas
pd.read_clipboard() function to read the data into a DataFrame
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.