Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (55.6k points)
Can anyone tell me the use of pandas library in python?

1 Answer

0 votes
by (119k points)

Pandas is the most famous and essential library in Python to manage and analyze series and data frames. Here are a few examples using pandas library of Python:

import pandas as pd

series = pd.series([ 21,25,27,42])

#To create a dataframe form lists

items = [['Phone', 10000], ['Telivision', 25000], ['Laptop, 48000]]

df = pd.DataFrame(items, columns=['Item', 'Cost'], dtype=float)

df

You can see the following data frame:

df = pd.read_csv(“path_to_file/file_name.csv”) #To load the dataframe of csv format

df_excel = pd.read_excel(“path_to_file/file_name.xlsx”) #To load the dataframe of xlsx format

df_merge = pd.merge(df , df_excel , on = “common_id” #To merge two dataframes

Pandas can be used for indexing the data using .loc[] and .iloc[], handling missing values using isnull(), notnull(), fillna(), dropna(), etc.

You can check out this Python Tutorial by Intellipaat for a detailed explanation using examples.

Related questions

Browse Categories

...