Importing dataset using Pandas (Python deep learning library )

Pandas is one of many deep learning libraries which enables the user to import a dataset from local directory to python code, in addition, it offers powerful, expressive and an array that makes dataset manipulation easy, among many other platforms. The DataFrame is one of these structures.

In addition for more brief details visit Pandas documentation  .

Pandas and relation of CSV

So In the field of data science here, the dataset is in the format of.csv

In this format were CSV stands for Comma-separated values. This is the only format in which pandas can import a dataset from the local directory to python for data preprocessing.

Load CSV using pandas

The following steps for importing dataset are:

  • initialize spyder environment which is our IDE for implementing deep learning model
  • import requered library which is pandas (to know about importing libraries click here )
  • initialize package pandas as pd
  • the syntax is shown below
#importing dataset using pandas
import pandas as pd
dataset = pd.read_csv('your file name .csv')

Note: in the above code, syntax (‘your file name.csv’) indicates the name of any local file name which should be present in the system

to see the imported dataset, just dd “variable.describe()”,as shown in below code



#importing dataset using pandas
#verifying the imported dataset 
import pandas as pd
dataset = pd.read_csv('your file name .csv')
dataset.describe()

This is how we can import local CSV dataset file in python.in next session we will see regarding importing dataset url file

Load CSV using pandas from URL

The following steps for importing dataset are:

#importing dataset using pandas from url 
import pandas as pd
url1 = "https://google.com"
dataset = pd.read_csv('url')

Note: Above all code URL is just an example of any URL in which dataset is available

in a case to verify your dataset its as simple in the previous section. following code is given below

 

#importing dataset using pandas from url 
#verifying the imported dataset
#print dataset shape
import pandas as pd
url1 = "https://google.com"
dataset = pd.read_csv('url')
dataset.describe()
print(dataset.shape)

Summary

In this post, you discovered Importing dataset using Pandas (Python deep learning library )

  • Load CSV with Python Standard Library.
  • Load CSV with pandas
  • Verifying dataset
  • Printing shape of the dataset

Do you have any questions about Importing dataset using Pandas (Python deep learning library ) or about this post? Ask your question in the comments and I will do my best to answer it as soon as possible. until then keep exploring.

Leave a Reply

Your email address will not be published. Required fields are marked *