SlideShare a Scribd company logo
1 of 20
Download to read offline
Pandas
Introduction to pandas
Pandas is an open source python library providing high performance data
manipulation and analysis tool using its powerful data structure .Pandas is the
backbone for most of the data projects.
Through pandas , you get acquainted with your data by cleaning,transforming
and analyzing it.Python with pandas is used in a wide range of fields including
academic and commercial domains including
finance,economics,Statistics,analytics,etc.
Pandas package
You need to import the library module
pip install pandas
Import pandas as pd
Here, pd is referred to as an alias to the Pandas. However, it is not necessary to
import the library using alias, it just helps in writing less amount of code every
time a method or property is called.
Pandas generally provide two data structure for manipulating data, They are:
1)Series
2)DataFrame
Pandas Series
Pandas Series
Pandas Series is a one-dimensional labeled array capable of holding data of any
type (integer, string, float, python datatypes, etc.). The axis labels are collectively
called index. Pandas Series is nothing but a column in an excel sheet.
Creating a series from array
In order to create a series from array, we have to import a numpy module and
have to use array() function.
import pandas as pd
import numpy as np
# simple array
data = np.array(['p','y','t','h','o','n'])
ser = pd.Series(data)
print(ser)
Creating a series from list
In order to create a series from list, we have to first create a list after that we can
create a series from list.
import pandas as pd
# a simple list
list = ['p', 'y', 't', 'h', ‘o', 'n']
# create series form a list
ser = pd.Series(list)
print(ser)
Creating a series from dictionary
# import the pandas lib as pd
import pandas as pd
# create a dictionary
dictionary = {'A' : 10, 'B' : 20, 'C' : 30}
# create a series
series = pd.Series(dictionary)
print(series)
Accessing elements from series with position
# import pandas and numpy
import pandas as pd
import numpy as np
# creating simple array
data = np.array(['p','y','t','h','o','n', 'p','r','o','g','r','a','m'])
ser = pd.Series(data)
#retrieve the first five elements
print(ser[:5])
Accessing Element Using Label (index)
# import pandas and numpy
import pandas as pd
import numpy as np
# creating simple array
data = np.array(['p','y','t','h','o','n'])
ser = pd.Series( data, index=[10,11,12,13,14,15])
print(ser)
# accessing a element using index element
print(ser[12])
To find maximum value
import pandas as pd
# Creating the Series
sr = pd.Series([10, 25, 3, 25, 24, 6],index=['Coca Cola', 'Sprite', 'Coke', 'Fanta',
'Dew', ‘ThumbsUp‘])
# Print the series
print(sr)
#maximum value
result=max(sr)
print(result)
Pandas data frame
Data frame
Pandas DataFrame is two-dimensional size-mutable, potentially heterogeneous
tabular data structure with labeled axes (rows and columns). A Data frame is a
two-dimensional data structure, i.e., data is aligned in a tabular fashion in rows
and columns.
Creating a data frame using List
import pandas as pd
# list of strings
lst = ['data', 'visualization', 'using', 'python',
'and', 'r', 'programming']
# converting list into data frame
df = pd.DataFrame(lst)
print(df)
Creating a dataframe from dictionary
import pandas as pd
# intialise data of lists.
data = {'Name':['Tom', 'nick', ‘krish', 'jack'],
'Age':[20, 21, 19, 18]}
# Create DataFrame
df = pd.DataFrame(data)
# Print the output.
print(df)
Column selection
import pandas as pd
# Define a dictionary containing employee data
data = {'Name':['Jai‘, ‘Princi', 'Gaurav', ‘Anuj'],
'Age':[27, 24, 22, 32],
'Address':['Delhi', 'Kanpur', 'Allahabad', ‘Kannauj'],
'Qualification':[‘Msc', 'MA', 'MCA', ‘Phd']}
# Convert the dictionary into DataFrame
df = pd.DataFrame(data)
print(df)
# select two columns
print(df[['Name', 'Qualification']])
Working with missing data
# importing pandas as pd
import pandas as pd
# dictionary of lists
dict = {'First Score':[100, 90, np.nan, 95],
'Second Score': [30, 45, 56, np.nan],
'Third Score':[np.nan, 40, 80, 98]}
# creating a dataframe from list
df = pd.DataFrame(dict)
print(df)
# using isnull() function
df.isnull()
Filling missing values
In order to fill null values in the data sets we can use fillna() function
import pandas as pd
import numpy as np
dict = {'First Score':[100, 90, np.nan, 95],
'Second Score': [30, 45, 56, np.nan],
'Third Score':[np.nan, 40, 80, 98]}
df = pd.DataFrame(dict)
df.fillna(0)

More Related Content

Similar to ACFrOgDHQC5OjIl5Q9jxVubx7Sot2XrlBki_kWu7QeD_CcOBLjkoUqIWzF_pIdWB9F91KupVVJdfRHEOHBF03mcm2hOQdV2b9fbqjReLZ5O3WmoYg18c8AOi-6A-Y8P4FpfdEBlifXh_7_xm5NRj.pdf

Python Pandas
Python PandasPython Pandas
Python PandasSunil OS
 
Introducing Pandas Objects.pptx
Introducing Pandas Objects.pptxIntroducing Pandas Objects.pptx
Introducing Pandas Objects.pptxssuser52a19e
 
pandas directories on the python language.pptx
pandas directories on the python language.pptxpandas directories on the python language.pptx
pandas directories on the python language.pptxSumitMajukar
 
Pandas Dataframe reading data Kirti final.pptx
Pandas Dataframe reading data  Kirti final.pptxPandas Dataframe reading data  Kirti final.pptx
Pandas Dataframe reading data Kirti final.pptxKirti Verma
 
Presentation on Pandas in _ detail .pptx
Presentation on Pandas in _ detail .pptxPresentation on Pandas in _ detail .pptx
Presentation on Pandas in _ detail .pptx16115yogendraSingh
 
Unit 3_Numpy_Vsp.pptx
Unit 3_Numpy_Vsp.pptxUnit 3_Numpy_Vsp.pptx
Unit 3_Numpy_Vsp.pptxprakashvs7
 
PYTHON PANDAS.pptx
PYTHON PANDAS.pptxPYTHON PANDAS.pptx
PYTHON PANDAS.pptxXICSStudents
 
Pandas pythonfordatascience
Pandas pythonfordatasciencePandas pythonfordatascience
Pandas pythonfordatascienceNishant Upadhyay
 
pandasppt with informative topics coverage.pptx
pandasppt with informative topics coverage.pptxpandasppt with informative topics coverage.pptx
pandasppt with informative topics coverage.pptxvallarasu200364
 
Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet Dr. Volkan OBAN
 
XII - 2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdf
XII -  2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdfXII -  2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdf
XII - 2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdfKrishnaJyotish1
 
pandas dataframe notes.pdf
pandas dataframe notes.pdfpandas dataframe notes.pdf
pandas dataframe notes.pdfAjeshSurejan2
 
pandas-221217084954-937bb582.pdf
pandas-221217084954-937bb582.pdfpandas-221217084954-937bb582.pdf
pandas-221217084954-937bb582.pdfscorsam1
 
Introduction to pandas
Introduction to pandasIntroduction to pandas
Introduction to pandasPiyush rai
 
Comparing EDA with classical and Bayesian analysis.pptx
Comparing EDA with classical and Bayesian analysis.pptxComparing EDA with classical and Bayesian analysis.pptx
Comparing EDA with classical and Bayesian analysis.pptxPremaGanesh1
 

Similar to ACFrOgDHQC5OjIl5Q9jxVubx7Sot2XrlBki_kWu7QeD_CcOBLjkoUqIWzF_pIdWB9F91KupVVJdfRHEOHBF03mcm2hOQdV2b9fbqjReLZ5O3WmoYg18c8AOi-6A-Y8P4FpfdEBlifXh_7_xm5NRj.pdf (20)

Python Pandas
Python PandasPython Pandas
Python Pandas
 
Introducing Pandas Objects.pptx
Introducing Pandas Objects.pptxIntroducing Pandas Objects.pptx
Introducing Pandas Objects.pptx
 
pandas directories on the python language.pptx
pandas directories on the python language.pptxpandas directories on the python language.pptx
pandas directories on the python language.pptx
 
Unit 3_Numpy_VP.pptx
Unit 3_Numpy_VP.pptxUnit 3_Numpy_VP.pptx
Unit 3_Numpy_VP.pptx
 
Pandas Dataframe reading data Kirti final.pptx
Pandas Dataframe reading data  Kirti final.pptxPandas Dataframe reading data  Kirti final.pptx
Pandas Dataframe reading data Kirti final.pptx
 
Presentation on Pandas in _ detail .pptx
Presentation on Pandas in _ detail .pptxPresentation on Pandas in _ detail .pptx
Presentation on Pandas in _ detail .pptx
 
Unit 3_Numpy_Vsp.pptx
Unit 3_Numpy_Vsp.pptxUnit 3_Numpy_Vsp.pptx
Unit 3_Numpy_Vsp.pptx
 
PYTHON PANDAS.pptx
PYTHON PANDAS.pptxPYTHON PANDAS.pptx
PYTHON PANDAS.pptx
 
Pandas pythonfordatascience
Pandas pythonfordatasciencePandas pythonfordatascience
Pandas pythonfordatascience
 
ppanda.pptx
ppanda.pptxppanda.pptx
ppanda.pptx
 
phgv.pptx.pptx
phgv.pptx.pptxphgv.pptx.pptx
phgv.pptx.pptx
 
2 pandasbasic
2 pandasbasic2 pandasbasic
2 pandasbasic
 
pandasppt with informative topics coverage.pptx
pandasppt with informative topics coverage.pptxpandasppt with informative topics coverage.pptx
pandasppt with informative topics coverage.pptx
 
Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet
 
XII - 2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdf
XII -  2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdfXII -  2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdf
XII - 2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdf
 
pandas dataframe notes.pdf
pandas dataframe notes.pdfpandas dataframe notes.pdf
pandas dataframe notes.pdf
 
Pandas.pptx
Pandas.pptxPandas.pptx
Pandas.pptx
 
pandas-221217084954-937bb582.pdf
pandas-221217084954-937bb582.pdfpandas-221217084954-937bb582.pdf
pandas-221217084954-937bb582.pdf
 
Introduction to pandas
Introduction to pandasIntroduction to pandas
Introduction to pandas
 
Comparing EDA with classical and Bayesian analysis.pptx
Comparing EDA with classical and Bayesian analysis.pptxComparing EDA with classical and Bayesian analysis.pptx
Comparing EDA with classical and Bayesian analysis.pptx
 

More from DineshThallapelly

D.Sai Tharun 20848 BCA 2nd year-converted.pptx
D.Sai Tharun 20848 BCA 2nd year-converted.pptxD.Sai Tharun 20848 BCA 2nd year-converted.pptx
D.Sai Tharun 20848 BCA 2nd year-converted.pptxDineshThallapelly
 
IMG_20230326_134431 (15 files merged).ppt
IMG_20230326_134431 (15 files merged).pptIMG_20230326_134431 (15 files merged).ppt
IMG_20230326_134431 (15 files merged).pptDineshThallapelly
 
IMG_20230325_121848 (13 files merged).ppt
IMG_20230325_121848 (13 files merged).pptIMG_20230325_121848 (13 files merged).ppt
IMG_20230325_121848 (13 files merged).pptDineshThallapelly
 
newmicrosoftofficepowerpointpresentation-160805121228 (1).pdf
newmicrosoftofficepowerpointpresentation-160805121228 (1).pdfnewmicrosoftofficepowerpointpresentation-160805121228 (1).pdf
newmicrosoftofficepowerpointpresentation-160805121228 (1).pdfDineshThallapelly
 
1601-308-Wright Brothers.pptx
1601-308-Wright Brothers.pptx1601-308-Wright Brothers.pptx
1601-308-Wright Brothers.pptxDineshThallapelly
 
ACFrOgAabSLW3ZCRLJ0i-To_2fPk_pA9QThyDKNNlA3VK282MnXaLGJa7APKD15-TW9zT_QI98dAH...
ACFrOgAabSLW3ZCRLJ0i-To_2fPk_pA9QThyDKNNlA3VK282MnXaLGJa7APKD15-TW9zT_QI98dAH...ACFrOgAabSLW3ZCRLJ0i-To_2fPk_pA9QThyDKNNlA3VK282MnXaLGJa7APKD15-TW9zT_QI98dAH...
ACFrOgAabSLW3ZCRLJ0i-To_2fPk_pA9QThyDKNNlA3VK282MnXaLGJa7APKD15-TW9zT_QI98dAH...DineshThallapelly
 

More from DineshThallapelly (6)

D.Sai Tharun 20848 BCA 2nd year-converted.pptx
D.Sai Tharun 20848 BCA 2nd year-converted.pptxD.Sai Tharun 20848 BCA 2nd year-converted.pptx
D.Sai Tharun 20848 BCA 2nd year-converted.pptx
 
IMG_20230326_134431 (15 files merged).ppt
IMG_20230326_134431 (15 files merged).pptIMG_20230326_134431 (15 files merged).ppt
IMG_20230326_134431 (15 files merged).ppt
 
IMG_20230325_121848 (13 files merged).ppt
IMG_20230325_121848 (13 files merged).pptIMG_20230325_121848 (13 files merged).ppt
IMG_20230325_121848 (13 files merged).ppt
 
newmicrosoftofficepowerpointpresentation-160805121228 (1).pdf
newmicrosoftofficepowerpointpresentation-160805121228 (1).pdfnewmicrosoftofficepowerpointpresentation-160805121228 (1).pdf
newmicrosoftofficepowerpointpresentation-160805121228 (1).pdf
 
1601-308-Wright Brothers.pptx
1601-308-Wright Brothers.pptx1601-308-Wright Brothers.pptx
1601-308-Wright Brothers.pptx
 
ACFrOgAabSLW3ZCRLJ0i-To_2fPk_pA9QThyDKNNlA3VK282MnXaLGJa7APKD15-TW9zT_QI98dAH...
ACFrOgAabSLW3ZCRLJ0i-To_2fPk_pA9QThyDKNNlA3VK282MnXaLGJa7APKD15-TW9zT_QI98dAH...ACFrOgAabSLW3ZCRLJ0i-To_2fPk_pA9QThyDKNNlA3VK282MnXaLGJa7APKD15-TW9zT_QI98dAH...
ACFrOgAabSLW3ZCRLJ0i-To_2fPk_pA9QThyDKNNlA3VK282MnXaLGJa7APKD15-TW9zT_QI98dAH...
 

Recently uploaded

꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Callshivangimorya083
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFAAndrei Kaleshka
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdfHuman37
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
vip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Book
vip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Bookvip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Book
vip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Bookmanojkuma9823
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home ServiceSapana Sha
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPramod Kumar Srivastava
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)jennyeacort
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024thyngster
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一fhwihughh
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAbdelrhman abooda
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一F sss
 

Recently uploaded (20)

꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFA
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
 
vip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Book
vip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Bookvip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Book
vip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Book
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
 
Call Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort ServiceCall Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort Service
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
 

ACFrOgDHQC5OjIl5Q9jxVubx7Sot2XrlBki_kWu7QeD_CcOBLjkoUqIWzF_pIdWB9F91KupVVJdfRHEOHBF03mcm2hOQdV2b9fbqjReLZ5O3WmoYg18c8AOi-6A-Y8P4FpfdEBlifXh_7_xm5NRj.pdf

  • 2. Introduction to pandas Pandas is an open source python library providing high performance data manipulation and analysis tool using its powerful data structure .Pandas is the backbone for most of the data projects. Through pandas , you get acquainted with your data by cleaning,transforming and analyzing it.Python with pandas is used in a wide range of fields including academic and commercial domains including finance,economics,Statistics,analytics,etc.
  • 3. Pandas package You need to import the library module pip install pandas Import pandas as pd Here, pd is referred to as an alias to the Pandas. However, it is not necessary to import the library using alias, it just helps in writing less amount of code every time a method or property is called. Pandas generally provide two data structure for manipulating data, They are: 1)Series 2)DataFrame
  • 5. Pandas Series Pandas Series is a one-dimensional labeled array capable of holding data of any type (integer, string, float, python datatypes, etc.). The axis labels are collectively called index. Pandas Series is nothing but a column in an excel sheet.
  • 6. Creating a series from array In order to create a series from array, we have to import a numpy module and have to use array() function. import pandas as pd import numpy as np # simple array data = np.array(['p','y','t','h','o','n']) ser = pd.Series(data) print(ser)
  • 7. Creating a series from list In order to create a series from list, we have to first create a list after that we can create a series from list. import pandas as pd # a simple list list = ['p', 'y', 't', 'h', ‘o', 'n'] # create series form a list ser = pd.Series(list) print(ser)
  • 8. Creating a series from dictionary # import the pandas lib as pd import pandas as pd # create a dictionary dictionary = {'A' : 10, 'B' : 20, 'C' : 30} # create a series series = pd.Series(dictionary) print(series)
  • 9. Accessing elements from series with position # import pandas and numpy import pandas as pd import numpy as np # creating simple array data = np.array(['p','y','t','h','o','n', 'p','r','o','g','r','a','m']) ser = pd.Series(data) #retrieve the first five elements print(ser[:5])
  • 10. Accessing Element Using Label (index) # import pandas and numpy import pandas as pd import numpy as np # creating simple array data = np.array(['p','y','t','h','o','n']) ser = pd.Series( data, index=[10,11,12,13,14,15]) print(ser) # accessing a element using index element print(ser[12])
  • 11. To find maximum value import pandas as pd # Creating the Series sr = pd.Series([10, 25, 3, 25, 24, 6],index=['Coca Cola', 'Sprite', 'Coke', 'Fanta', 'Dew', ‘ThumbsUp‘]) # Print the series print(sr) #maximum value result=max(sr) print(result)
  • 12.
  • 14. Data frame Pandas DataFrame is two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). A Data frame is a two-dimensional data structure, i.e., data is aligned in a tabular fashion in rows and columns.
  • 15. Creating a data frame using List import pandas as pd # list of strings lst = ['data', 'visualization', 'using', 'python', 'and', 'r', 'programming'] # converting list into data frame df = pd.DataFrame(lst) print(df)
  • 16. Creating a dataframe from dictionary import pandas as pd # intialise data of lists. data = {'Name':['Tom', 'nick', ‘krish', 'jack'], 'Age':[20, 21, 19, 18]} # Create DataFrame df = pd.DataFrame(data) # Print the output. print(df)
  • 17. Column selection import pandas as pd # Define a dictionary containing employee data data = {'Name':['Jai‘, ‘Princi', 'Gaurav', ‘Anuj'], 'Age':[27, 24, 22, 32], 'Address':['Delhi', 'Kanpur', 'Allahabad', ‘Kannauj'], 'Qualification':[‘Msc', 'MA', 'MCA', ‘Phd']} # Convert the dictionary into DataFrame df = pd.DataFrame(data) print(df) # select two columns print(df[['Name', 'Qualification']])
  • 18. Working with missing data # importing pandas as pd import pandas as pd # dictionary of lists dict = {'First Score':[100, 90, np.nan, 95], 'Second Score': [30, 45, 56, np.nan], 'Third Score':[np.nan, 40, 80, 98]} # creating a dataframe from list df = pd.DataFrame(dict) print(df)
  • 19. # using isnull() function df.isnull()
  • 20. Filling missing values In order to fill null values in the data sets we can use fillna() function import pandas as pd import numpy as np dict = {'First Score':[100, 90, np.nan, 95], 'Second Score': [30, 45, 56, np.nan], 'Third Score':[np.nan, 40, 80, 98]} df = pd.DataFrame(dict) df.fillna(0)