Pandas is a Powerful data Analysis toolkit. It is open Source. A Fast and efficient DataFrame object for Data Manipulation. Reading and writing data Structure and different formats: csv, tsv, txt, xml, JSON, ZIP etc. Read on to know the top 20 Pandas libraries to use in 2022 for Data Science.

pandas
pandas

There are following important Pandas Functions:

Insert

The pandas data-frame insert() function is use to insert a column as a specific position. 

Syntax

The pandas data-frame insert() function is use to insert a column as a specific position. 

read_csv()

This is one of the most pandas library Function in python. read_csv() function help read a comma separates value (csv) file into a Pandas DataFrame. All you need to do is mention the path of the file you want it to read. It can also read files separates by delimiters.

Head ()

head (n) is use to return the first “n” rows of a dataset. By default, df.head() will return the first 5 rows of the dataFrame. If you want more and less no. of row and you can specify “n” as an integer.

Syntax : data_.head(n)

describe ()

describe () is use to generates descriptive statistics of the data in a pandas DataFrame. It summarises central tendency and dispersion of the dataset. describe() helps in getting a quick overview of the dataset.

Syntax : data_describe()

memory_usages()

memory_usages () returns a pandas series having the memory usage of each column in a pandas DataFrame. By specifying the deep attribute as True, We can get to know the actual space being taken by each column

Syntax : data_1 .memory_usage (deep=true)

astype ()

astype () is use to cast a Python object to a particular data type. It can be a very helpful function in case your data is not stores in the correct format. or instance, if floating point numbers have somehow been misinterpreted by Python as strings, you can convert them back to floating point numbers with astype(). Or if you want to convert an object datatype to category, you can use astype()

Syntax : data_1 [‘Gender’] = data_1 .Gender . astype (‘category’)

loc[:]

loc[:] helps to access a group of rows and columns in a dataset, a slice of the dataset, as per our requirement . For instance, if we only want the last 2 rows and the first 3 columns of a dataset, we can access them with the help of loc[:]. We can also access rows and columns based on labels instead of row and column number.

Syntax : data_1 .loc[2:7 , [‘name’, ‘class’, ‘section’]]

to_datetime()

to_datetime() converts a Python object to datetime format. It can take an integer, floating point number, list, Pandas Series, or Pandas DataFrame as argument. to_datetime() is very powerful when the dataset has time series values or dates. The DOB column has now been changes to Pandas datatime format.

Syntax : data_1 [‘DOB’] = pd.to_datetime(data_1[‘DOB’])

If you have any queries regarding this article or if I have missed something on this topic, please feel free to add in the comment down below for the audience. See you guys in another article.

To know more about pandas please Wikipedia Click Here

Stay Connected Stay Safe. Thank you


Basic Engineer

Hey Readers! We have more than fifteen years of experience in Software Development, IoT, Telecom, Banking, Finance and Embedded domain. Currently we are actively working on Data Science, ML and AI with multiple market leaders worldwide. Happy Reading. Cheers!

0 Comments

Leave a Reply

Avatar placeholder

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