0% found this document useful (0 votes)
12 views

Python Complete Notes Handwritten

The document outlines a comprehensive Python programming course divided into five units covering Python basics, file handling, exceptions, regular expressions, multithreading, database programming, and data manipulation using libraries like Numpy, Pandas, and Matplotlib. It includes topics such as standard types, file objects, exception handling, and data visualization techniques. The course is designed for learners to gain practical skills in Python programming and data analysis.

Uploaded by

venkatasai012345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Python Complete Notes Handwritten

The document outlines a comprehensive Python programming course divided into five units covering Python basics, file handling, exceptions, regular expressions, multithreading, database programming, and data manipulation using libraries like Numpy, Pandas, and Matplotlib. It includes topics such as standard types, file objects, exception handling, and data visualization techniques. The course is designed for learners to gain practical skills in Python programming and data analysis.

Uploaded by

venkatasai012345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 216

ns lectures youtube channel

PYTHON PROGRAMMING
UNIT-I
Python Basics: Objects- Python Objects, Standard Types, Other Built-in Types, Internal Types,
Standard Type Operators, Standard Type Built-in Functions, Categorizing the Standard Types,
Unsupported Types Numbers
Introduction to Numbers: Integers, Floating Point Real Numbers, Complex Numbers, Operators,
Built-in Functions, Related Modules
Sequences - Strings, Lists, and Tuples, Mapping and Set Types

UNIT-II
FILES: File Objects, File Built-in Function [ open() ], File Built-in Methods, File Built-in Attributes,
Standard Files, Command-line Arguments, File System, File Execution, Persistent Storage
Modules, Related Modules
Exceptions: Exceptions in Python, Detecting and Handling Exceptions, Context Management,
*Exceptions as Strings, Raising Exceptions, Assertions, Standard Exceptions, *Creating Exceptions,
Why Exceptions (Now)?, Why Exceptions at All?, Exceptions and the sys Module, Related Modules
Modules: Modules and Files, Namespaces, Importing Modules, Importing Module Attributes,
Module Built- in Functions, Packages, Other Features of Modules

UNIT-III
Regular Expressions: Introduction, Special Symbols and Characters, Res and Python
Multithreaded Programming: Introduction, Threads and Processes, Python, Threads, and the
Global Interpreter Lock, Thread Module, Threading Module, Related Modules

UNIT-IV
Database Programming: Introduction, Python Database Application Programmer’s Interface (DB-
API), Object Relational Managers (ORMs), Related Modules

UNIT-V
Numpy, Pandas,Sklearn, Matplotlib, Seaborn
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel
ns lectures youtube channel

anclaas
6) Python Data Arles's
Panel Data Systorm
Pondat Stoes in à0o
wo retedb We Meknney wH
w i h
datn SS
workng
is a python b y used and manpala
Panda cesning

Varioy unetionsor and , oanin,

hol therm
aadable and elevant.
Con deon messy t a Ctsond ereke
Pardas
Pandas

1stalli Pand Usin omnad pip instalpanda

ear
Amgunt o data
data
0Hong hug data, Remoe
duplicates Knin

Ceon Eopy cella, wwm


oobath
matpletl)
dVisual3ing
Gyping
Chwryping
utple -e -onat
Aws d eaba n
boed n Commn (lonnsM
ond joining(dth
rergh
Merging
ondwig data
saa i n Vanyuy mat
Soppor, Yeabrq
dtabosas et..
Gv, , SaL
Trehn and Iecdirg Daba
Aphediong
O ientol-Analysi's

Mack earnin
DataDaba Viuelizaton
f}nolyss
Businen and markeling
G)
hathtare Datands
Neuro Scna

Bg data
ond Seena
NLP hturek
arguagoe prousin
deta Stnichural o ns lectures youtube channel
nde o Y2
tant
opovtant

Senbs
Datathema

Seie in able.
panealSernies is lke a Caeanns a

data
One- lnensio na ro holsdng
Tta
Eornple oporPonde p e al
p
A

Bomla 2 import pandes

a,.+ a,2,3
esult peepSeno(a vt p res(a)
Pritreuult)
Pt(vl)
Oatpub
1 p
2
dtypehe6y

Lobs he valus a ave ulbdad hv


nsting else is Spechied,
i t Valu h
indx 0, stond yeluy h indn Aet
Ind umbr Hst
hisbe& Can e dto yal
attahaSpeutie Val
amp import parda a
pd
a-,2
b p Serrea (a, index |"x"y
Priot (6)
)
Ootput

type Int6y
ns lectures youtube channel
KValue Objods o Srdes
whn (rakny
objd, l:ke o ho no
donay,
ou Con olao Ule a
value
K/vale

po Pordas os pd
roqyam' d o y :aoo3
aoo9
oo1:

veultp. Sres
prit veulE)
Oakpue

do
oo

otype: iot 6y

Rendng Muliple aramhs


and Seleching daa
aru uedor ndang
Joc
oand
Dabafpraru
oY
ov Serio
in a ponde
od to Seleet data 0.0
ot 9oution. boed inderer) (lumn nama
the tnd or

.sntch p e Specty
means

Tiswcd
1t wed 4»
fo Sele J
Seleet dort
t
besd indoey)
o c ( L t g r -Jocadbien
whih man Specty he numeriak tndix
posihon,
by
ns lectures youtube channel

ornp
imporb pordas as p
D: Lyo
d d n ' ' 10
: s ' : 20, 3 0 ,
pdSevien data
a.DocC, ' 8 ]
Co, 3.3)
Print[lo)
print ( ilo)
Otpat
3o

type
lo

D
type: nt-64
ns lectures youtube channel

ist and ditionar


Sre Using

import pandas a pd
,So
a 1 0 ,ao, 3o,
D 4
' : |o, Biao,

Piot Seres (a)


priot pd. Serios b)

8utpu

ype: int 6y
A

P
type intG4
ns lectures youtube channel

ke a (olum
objact. Seri
iSawo imensiona aroy

Datatione +hot Grtans


erws
3rws
end
end umns
(umns
s whole le
a Dabrfrome
Datatrarna Consatt a Camponenk '.
he

Data
Rav
lmns
import Pandas a p
Bample
Pntpd. Datebvorma()

Btput
boph Dota trars

(odomns: C
Trdet C

pandad pe
blaryple import

datas name " So shiva", Y e m a "

onos:10, ao, 30

Print pa Dabafrera( Jata)


onos
ovtp name

O Sa
shiva
Yamesh
ns lectures youtube channel

Head m metods

coetod
mdhod ave diplay
uuxed duploy
ponchs, t 'haadk'ond l t yousa Daboe
Feu vus and
and
hlat w

import Pandos a d
barmpa
'Suvsh'
riane' Sa', shiva', am
Aqe :a5,30,23, 3
mak 95. 7,35,22]
a= pd-Datahame(Jata)
pot a.headoo)
piot(a.tado)

Oput larn

Siva 99
aneh

Nam

S
3

Yamesh 0

Sureh
ns lectures youtube channel

eadng CSV
lonrna Spraled
t se Csv les .

bl dda Gl
s
A Sirnple wo tove
wl
oat hat
kacrwnomat
kurwn
ar
Con
s
CSv Flu otasos plan tort and
b edbpandes
port pardas p d
Data.CSV

ad sv.('Data. Ca v')
uno, age, nam a
' a s Sa
, 26, Shiva
otpu
Sai
27, ganadh
shiva
29, vamesh 9anh

29 muhb

Readng TSonles.
Notstion
Java Srpt Oljutan objert. Ln aur
etample

plain teat, but he the omat


on
JSon-, (alled'data json'
we uolbe using a

Read MsEal
data. jion
"":'hiva, a: ganuh p dr e a d e x c l ( 4 l e . r d s )

"narne" i"o": "Sa",

Sechr":S":'a", A":8 ; "2": 2" oput


rotlno Suthm
Progra import peanda! as pd
daba. jton') Sa A
pd. Yeed -jios(
o
a
Shiva
Prlot (a)
ansh 23 .
ns lectures youtube channel

hosSpeeie o-d, (on be rprynhd


Ustng Coogoiced'dtatpe

prsenttd Usig
cago arhy
Can be

Pog inpost pandal


o
pd
data
'cdge
ordinal : Cdeqia'Lmdun "Hgh" lonu'h

0dared Tru

a pd Datnlyarn( dta)
prnt la)
Oredna
Octput Cesgoy
A
Mediu

A
ns lectures youtube channel

TMeqing teyom boce


on D ums

ierport pandas os pe
p.Datofrarne i o C , , 2Nama:So,'ska, v
Pa pe
Dabfant: [a.3.],'A'Aela,
Priet pdmgJ,Jo, m'To)

apu
Nem
Ag
Shiva

inin ata anne bescdd, m Omm ns


impat pandas
po as

arma': s ' Age :[as, 3o] )


PAPd. Datatome
Pa pe. Datatnne (sua [so Hr], ndu -sa",
p-rn
Prnt
. j dfa, on Name

Odtput:
Nom Agr
Sai as
ns lectures youtube channel

OnCale natng
ata Tyome

impoxt Danda ad pd

pDatsterne
Aa- pa- D-bahen
Print
o':4.5,,sn varna',Soresh',"hassh
1)
a pd. Cnat , a, nere- ndex =ho)
Ooput JD Nam
Sa

Tamish

Suryh
ha
ns lectures youtube channel

teritemsC ) iter renus ) ehplesCc)


tevabo7 data Using

Using'iteuternsc) enthedto
Hrate (olsns Q thoy Nalu
.
owsl

Usingtertuplst
Pgvo Using hernse
tridernsc)

Panedosopd
inpost
'Nama':.s"vermesh 'Suresh'
sata T:C,,,

Aas
ap. D.tatema (b)
hrikng () ounn
i ,Jin
prnt(" lumn: " i Yaly

Calumn 1 0
Outpu

NamaTD stype: nt64


Mun:Age 2

n dame
amaAqe, dtype:iot y
yacn
S reh

aruJarna , dtypt ;objeu


ns lectures youtube channel

kng terrouws ( mtho

npot panda as pd
doba-i':2,3 Yemu'Surb

Age 1, 30, daS


a
pe. Date trena (elato
Y
tn a. Hrws () deach yu
Indo no

pmint(Tder : " i prntt each w

pint
Dopu

Age
Nane: 0, dtype jeet

amelh

Neme

type : bjat

Tdu:

Narn Sursh

Age
Nerea type : ohjet
ns lectures youtube channel

Dqsam UAg tvhplest)

impo Pansas as
Nore 'Yamash'Sarah"
aloto 'To':,1,)
Age' Cas, 1e, a2] 1
pd. Dataho(data)

a.etplasy
point()

Oatpe
pandos(Tdes so , D e '
Name ramauh'
Pan da(Tdensi, w
Suiresh' Aae ai
ns lectures youtube channel

boronstate handling niSSinq be in


Camp

VNora
on
Juntons

Pando Using

pondas aj pd
inpos not a oumbc

iemport upy

o ' : [,2, np.nah 4J


dta
ane Ts,>arnush', np.nan, You

Ag as, np.inan, a2, 3o


a pe. Dxtnharndata
nutl vals
Print
Printa. snulUt) t w kployTru in phu o
velu
pmida
Pr'n dopnat)) it uw dp (ernplet ew wth missi

piot (a. 0na (a. meon Lg missing Val ut maar

piaIstnpilutet) FAapelg misstn09 lu


eman9 rniising vau
basd o Preunt dato
ns lectures youtube channel
Output
TD Namt Aq
Fale
Fase se Trut

Nama Ag
as.o

20.0
4.0
ota Namber
Name Ag
a5.5o
.oooo0
Sai a5. 66664
amesh
2.0c00
22.00od0
NanN 30. o n r o

larme
So
O
Torneb 23.S
22
20.0
UNIT-5 PTHON ns lectures youtube channel

What is

stands foy umerical ytthon


Tsavis
’dumpy
created In 2005 by Oiphant
with
’lumpy i ytthon bay used tor workira
Collection of packags, Collection
Kinetonsmodules Similar ty pe ol elernents
’Numpy provides funetions to work (ineaT algbra,
touies trans
tran forn and matias
Pythorn br
nlumpymajor
and part is written partiay writen
larguage
in PYtbon

To install Mumpy Þip install


numy
(D,2D,3D
bimple Python programn to psint Arrays usig
na ti
Numpy
tmport nunpY as nP 7

a nparay
b:nparrayCCc, 3], CHs, c3, O:3,9]]) I 2 3
/to 12

print ("D Array:\n", a)


print ("2 DArray:\n", b)
print("3D Array'\n", c)
erint (type la))
print Hee(b))
35 Array'
|print (tyece)
Dutput:
n-dlmensional
ID Array:
Ci 2 3
[lo
Array' Lclass
2 b
nump .ndarray'>
2 Lelass numpy nd arsay'
<elass numPY . ndaray'>
ns lectures youtube channel

plicationsubtracto
rogtam to perfosm matin additi oo , multi
2D Aray sing ump 2-3 3
2

import numpy as P 3 2

be

print ("'matrix addition:\o", npaddlarb))


su btaction:\n',npsubtract lab))
Print ('matri
(aib))
print ("mati multi pli cation: \n' np dot

Out puti
matrix addidion!

matri mul ipicaton!

[eu su]
matiX subtraction!

]]

You
Jndering elermernt
2 3

to t.s
nde
Can

numbe
acceSS an
byreferving
indexe s nunpy aays starts wit
The

tha t he
firs t element has index an d O,meani^
secood has
inde

impor Out put:


array
a nparraY CCi233)
print (aCo)
print aCo]aCL3)
ns lectures youtube channel

Slicing ays:
elemeots fom Íne
PYtho n needs means taking
qiven 1ndex to another qiven index
import hur
umpy as nP 2 i3i
3
a2nparray (Cti213)
print (aCo u] tt u218, u
print (a[:43) +C, 2| 3tu7
print (aCo:]) # C23 u]
u7
print (a[ :3) t 2 a u]
printCal-s:-)# [2 7
print (aC:3-)# Cu 3 2

tin ding LCM an d GcD

inpo t nunP as nP import numpy as n


a

beb
print (np-lenla,b)) print np-ged (ab))
Output: Out Pud:

3
(2

Creating ermpty and ful umy


num
ay
’You Can create an empya yusina the numpyempty0
func tion

You an create tull numPY arey using numPyfult )


’ r a n d o r n

fune tio0:
Output:
v a l e s

impot nurnpy as nP
EmptyAg
at npempty (a2)) 6. 36598137e -3|4
b:np.full CCa 2), ) (at2t44s79e-314
|.907962 e-313 2
334|9S3 37e-31a)
print (Empty teray \n", a) Full trray!
print ("Full ArraH:\n"b)
ns lectures youtube channel

all
and all
s ( l e d with

|(import
reatinynumpy nurnpy:3erosC) fune hon

a inp3evos (to12)) nurnp oncs ()


(3,33)
flle d with 3ero s!\n",a)
pint('Arays with ones:\n", b)
flled
pint ("Arrays
Out put
fle d with 3ero S!

(Co. o]
Co. o.]]
f;lled with ones:
|Arays
(.

as
irmport nunpy np
a-np 3ves ((212);dtypeint)
Prin t Ca)
Dutput:
(Co

Ditference betoeen Arsay and List:

List
’ Need to
import using ’ Inbuilt data stueture.
nurnP Enclosed in
’need to enelose using ar square brackets.
funcioo
import numpy as
b:totO5,8tech
prar ray (Ch23iu7)
(ontain elenents of contaio clements of
different types difternt ty pes.
ns lectures youtube channel

Need to bave the Sane


S3e Wariable si2e nesting
of the for nesting PDssble:

nparray CCCi,213],Cursia)
3

Can

Opetatons.
dire c+ arithmetic
Cannot appy
operations.
direct ari thrnctic

Co ns u m e s
less memo conSumes moe
mernorY
offer speeiali3ed functions >List have built in
|Aforrray numerical bperaions metho ds and funetionalies.

Various funcons for


Crea ting array objects usirg umy
as nP
import nurne Output:
anparay
print la)
C 2 3 s]
binp:3evo ((2,)) O. o]
CCo.
Co. O.
Print(b)
enpbnes((3,2))
printle)

d:np empty (ie12)) inerements by


print(d) 2 at e ach step

(o,e,2)
printle) ’ all main diagonal
o. elements
npeyel3) <qual to
o's.
printlt) [o.
.])vemaining
1np:Tandomirand (23)
o7ols3 o-6119522
print(a) Co:s3s763
Jo4os9bU
ns lectures youtube channel

Various methods to read elements trom rrays


2 3
2
impor t as np

anparray (Ci(21Brti 5) Out put:


print("me thod |- indezina' " aCo) method i-indezing:l
print "method method 2 slicing:C2 &y7
print ("nethod 3 -gteration:) mehod 3- terahon:

in
2
print(i)
nparvay (Co,su))
print ("method br tany ndezing:ati)tt me thod u-fant indesg
prrint C"method s- boolean indexing:"a Ca»2)
tmethod sboolean indeitg

yenpwhere la)
pint("netho d6-uwhere funcehon:", ay]) L2 3
pint ("me thod ? - talke furne hon:"; nptakela,)t Ct us
Arithmetic Operations and Statigtical methods

import unpy as
Numpy'
a 2nparay(Ci213 ,4,5])
b:nparay CC6,,e,9,to])
print Cnp add (a,b)) tt (1,9 (3 15
print (np. su btrae Cayb)) # C-s -S -5 5- 5
36 so]
prin
print(np divide (ab)) # loe6 b6b1 b29s7u2q
b375

2
print (np-power Cab)) tt GSG 2621
q165625]
X: np:array (C2bia)
Print (np:mean(x)+6

(npmedian C*) +o
print
(1)
ns lectures youtube channel

print npstd (x)) 828u27124


Pint(np:var(x))to
Print (npsum (*) t 30

Splt an d Concatenate Arvy Using umpy


Concatenate()' func tioo
using split)function
inport numPH as np
atnp:array (Cirds, ÄS,)
spnp split (a,C23)
print (" split rays:")
for Sp:
print(i)
lsp)
Ca -np:Concatenate
print (" Concatenated tsay: ca)

atput
split tays:

Basic (ineau Algebsa Opeations: Alumy


as np
impor t
C12]C,u])
anp Q a
print hp. branspose(a)) linee asgebr
print (np-tinala ·inv (a))
eval eveet -np:inalgeigla)
print(eva)
print (evect)
Output:
3].
ns lectures youtube channel

|.0-72 2813) S-37,23 182J tt eigan valy


(C-og2useus4
oq376713/ ttelgen veetors
|Bandom Num beys
Rando m num ber does not mean different number
that Canno4 be predicted evot
time Ran dom meanS
mething
legialy
’Normal (haussian) Distibuon
-’Binomial Distibutio
’ oisson Disti butioo
Dis tributoo.

d Normal (Gaussian) Dis tri bution:


has Parame ters

-loei- (mean)
- Sea le(standaud deviahon)
- 513e - shape of
Example: Genate ran dom Distributioo
of si2e 2x3 with
mean at standad
deviaton 2

impor t random
frorn nump
Vrandomnormal (loe l stas si3el, a))

Print (x)
Dutput
Co.o7437475
buua 2
ns lectures youtube channel

fBinomial Dishi bution:


Parameters
nno-of toials

P ’ po ba bilit of occUsence (eg: foT foss of a coin


each )
of
|513e shape
’ Gen trails for cach coin toss genea te o date
points.
Example:
fron ump import random
Xran dom binomial (n ebptos, sige lo)
rint (x)
Dutput.
Cu 3 3

Disttibutoo:
Poisson
has Palameters

Iam: bo of bccureney

si3eshape (91ge

Geneate ran dom IXLD distribution for occurren e

Tvom numpH mpoT t Tandom


Xe randompoisson CTam2 si3elo)
print (x)
Out put:
3 2 ]
ns lectures youtube channel

u Chi Sauae Distribution:

has 2 Paraneter s
free dom

Sige: size ot ay
Ex}- raw sample for ehi squared distibuhon
deqree of tree do m wwitth S13e 2X3

|from numpy import randorn

Xrandom chisquae (df2,s13e C23) )


print Cx)
Output:
3 6u34036I
(·su8783s
38822725
ns lectures youtube channel

MAPLOTLI6;
Malplotib vs a pouwyul tort un pythonhot halps
Creade vmal preertaioy chaib and graghs
ws made un

the by John 4unu.

undavtard dage amounts daa tough


easy- to - untuutand pictwes

|Such a Jine choib , ban qhaphs eokter plo


and histoqam
pldla: Gpaphial apreendalin diia)
lypes plála

1) Jine plet

4) Scott plot
5) plot
6) vo Volin lot
þlt. (a19)tlottt. impovt finaly,unclion
the apetaNmeicalwing By )
xlabel Line
(x- madplotib daw to Plot
anis)" the i
i0,6])(8,e, Showt)
-pyplot hen,
chartyou
connecing
line a matplotlib
as uncan
pt
hoiyondal tow
halgs
"plotc"
employhe in
display poia.
these (xpython,
)
and
he You
chat edicallo) satp
ns lectures youtube channel
ns lectures youtube channel

Jinty'daubed' colew 'y)


t. itl(" Line Pot")
lt. xlabel( *-anis) nec: aNke
ms : manke ie.

yYellow
k: Blak

G 10
ns lectures youtube channel

a Bar Plot :

A Bar plot Ahait toinad wy to hon


dola uaing Jongthvs. Each ban
aprexendo Calagouy and he hight o the ba
unuical
Cowesponds to the
oa plot Un you
We he

PAogam

t. bon (29) RORA btuh heults

pt. ShowC).

Java RAhon C++

Skjedo
ns lectures youtube channel

A Wstaqon plot way to diplay the


dishibdibry by diding t unto iteawal
heing he tuqenuy vales
aing nts eah biun wing uns.

histsqua plot uin malpltlb,


Wse the tuncis.

nport matplatb. pylat au pt

y: o5, 1-5, a.5, 4.8

phist a bins y, oeught-z, edqetlen blauk')


t. adatoetf ta

t. alabel(" aley) A

4
ns lectures youtube channel

4) Scaten Plot
Jike a dat to dot dawing
each. det resens a paiçn ot vaes
yous data.. ît helps you ik thenes a
ulalionvhip baten tuwo aiables.

Scoktacs Hunzuon plata one dot to

angth, One tor the Nauy el the x- a14


kame
ond Vales. e the y-ania

roeam
imput maatlib- pyplat ad plt
[,2,3, 4.5
i9: 2,3,1,21)
| * (2,3,5,G,J

|t. StatBen (2,9, tabl quli, coler')


t- sesteu (aisYhg label:' boys", Colar'b)
and quls)
plk. nlabell Girh and Beys )
plt. yobel Mauks
Ahewc) plt.
ds
CSe 25] a5, 15,(85, ay np. i
npas npy imqort
ece
nydingany
Can
that Aadstiead
plat cida chat Pia
chart
the Wbe
Plot: Pu
iD 8 1 45
6 23
quh and boys Ruulaks
ns lectures youtube channel
ns lectures youtube channel

to explode any seko.

a: Ap. aay (B5, 15, a5, a5])

(o.5,0, 0,0)
pu 2, (albels: y explode:2, Ahadoo Inue)
.how() aind

Vio
6) Violin Pati

cox. plet.ad a
tonel dewiiy plet
can aate a vielin plot wing
vioin plot () undi.
ns lectures youtube channel

Paqyam: motplatib. Pylet a pt


impot

b a3, a5)
C: [3r4,5,6]
d: (a.5,6.]
dada [ai b, Ci)
Plt. Vieinglot (dota, Nhowmudiany sTu)
pt. Ahow)

3 4 8
ns lectures youtube channel

is data Visual3atiom brary


Jeaboan:Sealbodn a Pthon
aterfote * drewing
On
On matplotib. J povdes a
high Jevel
attechive iforma Sistil grphics.
inStall Seabon
To nstall Seaborn-CormmandPip
because Seaborn is a

often USed adong wth matploli


Seabon is
op matplot-s
data Vsualgetion l:hvo but en

igh-deve
"Michaal was kor ". This ravy
obon wa daulaped by
i
wo ioibally xeleaked in 3o2.and t ha aplned popularity ov
Simpichy and ePPechivenei in sesbng Statisticol Visuaahn on top
matp lot:b.

Python (ode check bu:lt-in dtSets avaloble 1 Seabor

impotSeaborn as Sns
dataset.
nanes( )
name= Sns. oet-
priotnamal)
a n s o m b e ' ' a t e n t o n b r a l n _nehso iKS',Cav-(vash

outputanaqvecns, btanie'
mondS dots", 'qlue
ns lectures youtube channel

aoqvam oood preedkrad det. Ct Called ps" tht (ontens


lobumotim aboutips in
a otfoiont
Aoqyam: import Se abovn a Sns

.Sns.oad detaset"ps")
priot (a)
Output:f Sex Sno Kev ine Si3e
total-b:00
Dinner 2
F No Sun
O 6-99 3
66 Sun Dione
o 34
M Sun Dinner
3 SO
3-3 N Sun Diane
3 3. 68

&42 H9 Dioner
ay 3 18-8 3.00 hu Dinne

(onns

ooedt
ps' data Sel
Drogrerm
impor Seabom o Sns duplo
method o i u
a = Sns. Doad dat«Set (-bip") headc
ony-t ve ws

pri (. heads S3e


Sno Kev
totolb Sest
lo
c
un Dime
6.99 .01 Dlone
Sun
3 1.66
Sun Dinn
a01 3-SO Sun Dinney
M
23.68 3-3
Sun Dinnc
3 6 F
24.59
ns lectures youtube channel

bay plot ViSualla malo cnales


dala Set Uing ount plot unchon

Seaborn a SnS
impo
irnpost rmotplot Pyplob a
plE
oad -data Sot ( ps")
a Sns.

data
Sns (ountpot (x =" Sex", dataset ")
female in the tips
plt. tle(" (ound male and
plE.show) males ond knale
in ipi'datoset
Lount d

Ouctput

0-

20

Fenale
Mole

Se
ns lectures youtube channel

."total_L"
Proqrom o (ompae
Shipmlot wo (olnns
irmpl
ond Usinq Stir plb

impovt Seasorn SnS

impo matplotib. Pyplot


a
pt
bps"
Sns. Doad-dlataset
bolb "data
Sns. Shipplat2 "doy"
ple 4te"onporisoo bode do
pt.Chrw ()
LomponiSen
4biu bosed do
Ouhput

20

Sa Sun
ns lectures youtube channel

Scatter plot Proqre m


mpot Seabonn a Sns
impor matplot:b.pyplot a plt
aSns.0..d dtaget ("tps")
Sns. Scatterplot x HotL:0 "
="d yot
1
e a)
ata

pl. e " mpa ris o n dthb based n da")


plt.how )
ns lectures youtube channel

Outpab (omporison otol_LAA bded

0-
Scaeplo

Sat Sun
ns lectures youtube channel

Chivasiate Dishibulion
Uni Vasiate disbtim efers to . Jsilzkon SingVanable
(o)Geno
Seobom is usedto Visue he
ctptesPundtim
Chivaziate distribdim d a dataSet.
estimabe (kDE) plot
with a kvnel densthy
Jombines a m plot
output
Poqvami
Impost
Seaborn a SnS o6

inport matplst:b. Pypet


o plE
("tips")
a Sns.d Jabaset
SnS. displo

pt.shawt)
otol b:0") -
03

.o AT
O.o
30
totak- : R

progrerm 2:-(wthou histogrorn plot o.o6

o.o
poStaborn a SoS
impart motplotbb- pyplet
Imper
pl .0

o C
a Sns.oad. datasct+("tips")
Sns. dpht (a taL:A"hit:False totabill

pltshuw)
witht kde plot O 6 6
Progyam-
at SoS
impo rt Seaborn
impevt matylot1:6.pyplot plt o

o Sns. oad dataset (tips)


tphot (a C» bptalL:0kde folse -
)
Sns.
o

y 6
plt shawl)

You might also like