Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
43 views
23 pages
Series
gg
Uploaded by
Ayushmaan Maithani
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save series (1) For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
43 views
23 pages
Series
gg
Uploaded by
Ayushmaan Maithani
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save series (1) For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save series (1) For Later
You are on page 1
/ 23
Search
Fullscreen
r + Rie RcD i Sp h B15 tet tak, enclosed in curly proces. fis sage be chat ae “all Re AY WE HAVE TO MPOAT LIBRARY : NUMPY.——— | CATE AN A NOTE || To RI serackels and separated by commas. i Yt 1 hob ype’, » P00?! : Sobel J tie 20 a0 40d =t_wie sarray’ ¢ commgy oo al pecans 8 campy array sto § ces _}_import oumpy od np ___ stmiesinit 4g s op. ouay Cf" pein’, “Chenpai” -Koikata’ cen 4 mil OND yp: E’pethi’ Chennai’ KoiKata’ mM: h * och oz ySe Hl arongecs: used for creating arrays from thé given range. 2. i SYNTAX: 4 mumpy, orange (start, end, step) eg: | import numpy at np i ri = np. arange cio, 21,2) _print (ri) osP Cio 12 14 16 13 207 t S- 1 _@_ = op. arange (5) int Ca) OIF? 0 2 mgr] 7 =. - a @ = np. arange cg, 13) t print (a) O1F 2 6S 4 10. ui 49 y, i {| s- +82 np. orange <1, 10_ 3) | print ca orP: (1 ji = i a. @= np. aronge C1 10.13) | print Cay ree a eg a. t O + np. arange (1,4, 1-5) j-print (a OP? {te 2-5 4. s.5 9. 95) a | pieccrenaare BIW range() § arange(). ___ range.) arangecy Be if used in python cia. 1 Sed To _foeary dum, is 2. | sed to iurote for top. 2 Uled to create TUNE ory, —2-_|| Only tniegers can be used as 3 CON work with Floet argument ay oo oarSS * || INTRODUCTION To PANDAS rt Pandas is a python Mprary used for data analysiy, 2. |} ib ts best at Wing hu mt et rish ‘ferent formats, ae \k_was developed by wes Mckinney. 4 || Pandas nas derived eb el tern. CRANE! Data? System) 5: Pandas can read _and write data in many different formats Cinteger Float, strings ete.) Be It can catettate all possipie ways to nich the data is organised i-e: across rows and down the columns. Ti it can easily subsets cereate) of data from bulky aata ¢ can even combine muttole data steps Sets to gether = : DATA STRUCTURE IN PANDAS i Data structure is a way of storing g organising data so that t ik can pe accessed with ¢ porked within an appropriate way. Pandos provide 3 data structures: SERIES DATA FRAMES PANEL SERIES: 1- Dimensional structure with homogentour data Dor£9: Dato. s Ton! a | 3 “Fey | 2g ‘i \ ‘Mar’ 2 s >apnt’ | ao a e231 SeRes are MUTABLE_DATATUPE THE SIZE OC THE SERIES 1s immytaBLE CREATING SERIES ; Sih Can pe created sing Series () method. C1> || CREATING Eeaory scRiES SYNTAX: l import pandas as pd series _. pandas. Series cdata index) ‘object © Uist saictonory/ng army ete. CREATING @ SERIES FROM A List import panda, as pa egt: A= Cio, 20, 30, 40 50] Al: pasdar pd. Seriesce y print Ca Ly G- || CREATE A SERIES FOR STORING mARKE FOR & suBsEcTS. wetHoot: || import pandas as pd_ e a m= pd. Seria (C40, 45,80, 40 691) print (m) = = = METHOD: || import pandas as pd a= (4092 95 90,927 | marks = pd. Series (L) 1 eriop 2: || marks = pd. Series Caata = Ly els Sat i]| *®int 64 | atlooteY monject Cif strings ete.) dt G || CREATE A SERIES TO STORE THE MARKS Of F SUBTESTS wITH SUBTECT’s NAME AS_LABELS, import pandat as pd marks = £370, 92,75 80,8273 fz Lreng’, \ Maths! sHindi ‘sst’ ‘science’ 1 1: pd, Series (marke, 2) or Series (marks endersi) print C21) or Series (data marks, index =i) aLypez: int 64 im outpue _ CREATE A SERIES TO STORE NAMES Of UDVA 4 FRIEND: import pondos or pa op: 0 | ame" frlends = [> He? ‘Myself’ “ein! sien “J 1 reysele’ 4+ pd, Serie griends) 2 ~and’ a. | vie | CREATING SERIES FROM DICTIONARY dltype : object tspen we create series from dictionary ten the keys of the dichonary | phe index valtie_of the series, and the values of tne diétionacy become pecome phe data of the serign. CREATE A SEQIES FROM A DICTIONARY CONTAINING THE TEMPERATURE OF 4 Dauc of A WEEK. fmport pandas od pd a= { ‘sunday’: 33:5, ‘Monday’; 32-3, * Tuesday’: 26-8, * Wedneade temp: pa. Seria Cd) oe seriedCdata?d) + 34:04 _priot Ctemp) v Sunday 32:5 monday 383 Tuesday 3b: Wednesday 34-0 a dtyee = Haat 64— o- FIND THE OuTPuT oF THE FOLLOWING CODE: J Ht i = || frport_pandoa os pd 2 s? pd. Series (C‘ Jan’ sFeb’, ‘NOrch IA, index = cong C5, 20 5)] oP s *5an* to feb 18. March, Gi || CREATING SERIES USING nd arrays | import mumpy as op opps _*0 5-0 Import pando as 110.0 a= mp- asange (5, 25,5) 2 18-0 = pd. Series Ca 3 20:0 dtype = Floatey, FIND THE ovTPutT of THE FOLLOWING : = || import _oumpy as np import pandas os pd S = pd- series ({" gute’ “Tube’, » Switch’ 1 index = np. arange (3,5, 6S) {{ print ¢s) ope. 26 Buln 2 ae Juve 2x5. Switch import pandas as ed oer rams a “np | print (s) }8* paeSerien (dota? £5. 365 261 ingex Liarlf se no- of val 0: of indices ERROR f value, ¢ no- hi dox match, we get a Bence AE THE No- OF DATA VALUES po. BLQ_OF DATA vALu! X MATCH w/ THE MO. of INDEX VALUES IWEN 11 RETURNS @ VALE EReDR. Rom AR vA’ import pandas oa ed Ernport —nampy- P. = Lpemi’, :up/ = MP2 s+ pa. Serien ( ‘welcome’, index print Cs? Delhi wacome ue welcome mp _weleymne _dtype? object civ) oy? = @: -¢ THar STORES INITIAL BUDYET ALLOCATION OF 60,000 FOR EACH CREATE A SERIE. qupater of THE YEAR | Import pandas o» pd pudget = ed. Series (50,000 , index > Lrotray, tate2”) Obra’ atry’ print Coudget) — ols otra 50000 Otr2 _g0000 otra $0000 arr 50000. dtype topject CREATE A SERIES WHICH sToRGs ANY 4 STOTIONERY ITEMS STORED INA tg MULTIPLES OF 2 ¢ EiRST 4). LIST. ASSIGN INDI weimport pandas as S= pd. Serfes ¢ Pen’ Pencil’, “Eraser” sRuler' 14, indew = rar, print (8) © 3,15,3)] op: a Pen 4 i Pence 4 eraser Paty Rater | dkype s object AT ASCESSING SERIES Gementy H fete : . SYNTAX: || series, object index] stat object f print Cele) O1P: Pencit print (8 C41) O1p: KEV ERROL ® A | print sLE612 181] oLP: Thy T = H Moc {} fs used gor indexing or selection based on posi hon. iP is we nave +o specify integer tndex For celection by pos ftiin Ik ce fers 40 positive based indexing. SYNTAX: series. iloc Lrowno./ index no-d cio! tock is used for indexing or selection bared on nayne | we hae to specify row label, it is also k/a Label paged indexing. SYNTAX: series. 10¢ [ row name 7}+t gqo.|| DECLARE A SERIES wiTH A SALESMAN'S CALES FOR 6 MONTHS. ______ import pandas as pd = pd. Series CL 12001300 N00, 1500, 2000, 2222 1% index = [* Tan" Dep > Mar’ april’ Hay’, sune’ 3) print (s) oe: 2 Jan i200 z Ho Feb 13 00 2. Hor \uoo |_ 2 April 1500 4 May 2000 June 2222 XN won't ve printed fn poro/P ctype: inte print = || st‘ Apri] = print (st 31) 1600 ‘boo 2 | print ¢s 1:41) =) print (813: J) Feb Boo April goo Mor Woo — May 2000 April 1500 ae June 2222 : ctype + intou a dtype & int 6Y :
cep I M. Marty L Aphid Aprit | Zieh MH | % Nast index > print ¢st‘Fep’: 4) <* print ($ { : *March'1) Feb Jon ral Marth Feb P Apri March Jou type : fat gy Zum, Atype : fntoy Spree oF souks ters “Aprit"] = 8. jeer 37 1500 oe a | 1500 | L = $2) sie teas | print ($002,512) May 3 Mas MOO mR oR tune ; tua. 2222 Ate ints y oe) | atype: into el —gER cn! igs NOT SPECIFIED | THEN headin) FUNCTION FETCHES 5 oF THE SERIES (BY DEFAULT) April | Moy dtype . into4 aE Sa: ays [ask Sn! eles ec bik on’ ig not passes i © Sof the series. ——#3:||_s. tail «99 ja PPh 8 tl) ol pri Pp: Fe aif sprit oj: Feb May ss March a June April May — Sune Atype , itsyCHANGING VALVES OF SERIES’ ELEMENTS eee S £* Feb’ ] = 100 2) ${2] = 2100 print cs) print (Ss) Or Fe Jan o1P: San — = Feb 1700. Feb 1700 March Harch 2100 April Sprit May May Sune Tune dtype -intou dieype : int ou CREATING A SERIES USING OMURSING VALUES 2282s Be) ae yet 27|| import panaag as pd fenport oUmpy oh ng ec marks = pd, Series (030,27, mp. NaN, 26 , np. Nand), [ior 102 103 404, 105 1) Nore: || NaN MEANS Nor A NumgeR. IT REPRESENTS NULL yALUE _ print (marks) ~* o/P: 101 20.0 102 24-0 103 Non 104 25 1o5 Nan diype : floatéy PLEOLIST - replication - # af ™ ARRAY - muitiplicathor g:05:2 a @. || END THE 01? OF THE FoUDWING: import pandas as pd import numpy o8 np v op: 0 5 a) As 3,2) Hi $ 3 = pa. series (g #2) 2 2 print ¢s? 3 5 4 a 5 2 type: ints 22 || nz np- orange ¢%, 13) = pd: Seri@ Cdata = #2) | print (s? 4 ° ii t 4 , er ar dt ype int 6U = _| note: || cist * 9 repucates THEM LIST, WHEREAS, ndarray * 2 MULTIPLIES EACH ELEMENT BY 2. ao tla np-arange (5, 25, 5) ca ih as S+ pd. Series (dota = N¥2_ index =n) print (9) oie: ts to Bie 18 20 [ar | 20 wo ft type: int ou“42 }_S* pd. Seriea Crange (1.15.3), index = [x for x in ABCDE'y) A A B 4 c 3 D 10 E 13, 2: nt Ou PUVSUAIEy Oe SeelGt pate ea eh Ka AEE “ge spd. Serie (data = range C115 3) index = fx for x lie Yacht an print (3) ope: a i =: e 4 H i 2 ° to uw n > type + int 6y | index: 1¢ is used Lo return the fadex of a serioy eg: || print (s.index) opp: | Index (fra’ se’ si! vor ww] dtypes"object) ii- value : tt returns the series fo the form of nda 4: || print (5. values) ore: |} fi 4 # 10 137 ; |_ size: It returns the no of elements fn series. 3: print (s.size) 4 lr: § - ao Si.ndim 1X+ adim sie is used ject » to display the dimension? of cuny pandas’ " eg: siz pa: Series Crange (2, 11,20) (Pape Now = ne) Dae: iv-_|| _nasmans «14 returns Truc If there are any Nang tn the given cerles. Oimerwise False eq: || print ¢s.nosnans) False v- ll empty: it returns true Tf tne serter ts empty otnerwise False ___ £9: int LP vi name + it ts used to assign a name to o series import pandas as pd gz pd. Series (C New Dein’, ‘washington’, “London']_ index + CIndid usa’ sued) = || g.name => world’ print Cs) india New Delbi Ucn wasning ton _ uk London = Name: world diype : object vite index.name : it 1s Used to assign a name to the index of tne series. y eg: _||_s.index.name = + countries’ _ osP: || counties India New delni use Washington wie London 2 ate Name - World diype ject Fa a t— ——--— - = a 4 _viir_|| countc> meinod : re returns the no- of non-~ NaN values _P:T0+ (ey \G avove - ‘margin — is =KX remame() + yt is ured to rename the given cerfas. Seriesname. rename (new Series name) eg; || S. rename (35!)4 ————__——— Q- CONSIDER THE SERIES: $2.* pd. series (C10, np. NaN, (21) print(s2) WRATE THE O1P OF THE cope. WRITE STATEMENT TO COUNT NON- NULL VALWES LF Oo \o ii. print $2. count) as Nan 2 12 diype : float 64 N MATHEMANCAL OPERATIONS oM SeQIES (1) | appition of 2 serier lL si: pa. Series (£1, 2,3, 4,51 tndex = Ca’ sb’ se’ e. | 22 = ea. Series (Lio 20, 30,40 sol, index: f' 24 “44, +a’ stead | prick Cs452) on 3s sits?» print ced) fi “Reve be ou: | _o Bii.:6, INDEX SERIES 2 SERIESD b NON tes a 1 30 Ie 43.0 ee 2 nas || NoN « wo | e $8.0 “a a M NaN oe NaN e 5 50 4 pion 2 nan 10 citupe . Hoot gu y Nan 20 ix: || add © method: SYNTAX! | gf Series{- add (series 2. flevalue) | 29: [p3's1. add (52, fij\-values =O) i vedop per sp: S182 _print (53) diype: Float 64 subl) method : + xr SYNTAX: [ geregL unc serene)ee <3") || mutTPUcATION OF 2 sees —||_print (st * s2) 68 63: sie 82 print ¢S3) oO 30.0 b Nan s 120.0 a NON £ 250.0 Zz Nan y NON type: Hoot ey xi mul ©) method: SYNTAX: || s4. mul fs2 , fil _ voted eg: || 63 = simul (s2 FiM _ vauue =1) 01 Ps a 20.0 © 2.0 c 120.0 a 4o e 26d.0 aa | 20.0 | + = | diypes float 6y | (4 | division of 2 SERIES | priet s8= s2/81 T I print (83)ye: } a 20.9 ; b Nan c 13-3 7 dA Nan e foro Z NON y Nan — type: float 64 diy O metmnod: _geries. div (series? Fil value? RETRIEVING vAWES sing CONDITIONS marks. = pd. sertes (ogo 60,40, 45. 853), L101, 102. 103,10 1051) print Cracks) tol 80 102 60 | 103 40 | Joy as 105 ab diype coed a vo marks >=40 NO1 Ealse - 102 ratse 193 True JOY True 195 Eatse sitype + boolSETTING THE SERIES ELEMENT Sort values () method: Used to Sort the elements of a series. SYNTAX, sertes, sort values C ascending = True / False, / inplace = True) gow are NOTE) @4 DEFAULT ASCENDING > Fru. OP Sae 9 + Q- CREATE A SERIES FROM A DICTIONARY @ONTAINING ROUND ¢@ MARKY OF 5 sTOpENTS. DISPLAY THE SERIEC IN ASCENDING € - DESLENDING ORDER OF MARKS, t frport pandas ay pd ‘a 42 o> 43 FR 22 94 35 88 SH 4 6U..5 2 88 MOYkS = pa- Series Cd) print ¢ onerka ‘original marry +’) _ print ¢ marks) _ AM print © marks. sort _vawued ()) 2 2 as $ print ( mash). Sort — values ¢ abeending = False)) AA A pk: peut (Qa | : , eerie 9S. 80k yaa O. a ‘ aaeaney +S bal bt tr i TRTy atalemeat watt MAR —— f}——pSsupsiiotey | anges petman cette ihe }-——+-S-F9Fk-VoWuea Cinpiace trye) erighnat eerie se a+. po i 2 f° || DELETING ELEMENTS Of seQtes t— — — — ——__— | aropta memed: te ty cgudiba aiiets elements From tne se G optionat tek (:810, 20,80, 40,802) oo) aso esa an at a. pict ti ef reer — post | deo Ho tt ad f + 4 $0 . LC atype totgy —__cortginal coring unchangea) ene ind 21 permanently attsed tT H]S- drop (2, sisphace = True) int (5) 20 CindeX 2hos now been permanently deleted) 3 — a ests dtype : Tatoy _
You might also like
Data Handling With Pandas - 1 Notes Xii Ip
PDF
No ratings yet
Data Handling With Pandas - 1 Notes Xii Ip
28 pages
XII IP CH 1 Python Pandas - I Series
PDF
No ratings yet
XII IP CH 1 Python Pandas - I Series
45 pages
Informatics Practices Class 12
PDF
No ratings yet
Informatics Practices Class 12
225 pages
Unit I: Data Handling Using Pandas and Data Visualization: Marks:25
PDF
No ratings yet
Unit I: Data Handling Using Pandas and Data Visualization: Marks:25
135 pages
Class 12 IP Ch-1, 2 3
PDF
No ratings yet
Class 12 IP Ch-1, 2 3
28 pages
CH 1 Python Pandas-I
PDF
No ratings yet
CH 1 Python Pandas-I
13 pages
Ip Study Material
PDF
No ratings yet
Ip Study Material
185 pages
DAY6 Pandas Seaborn
PDF
No ratings yet
DAY6 Pandas Seaborn
97 pages
Python Pandas
PDF
No ratings yet
Python Pandas
96 pages
SR Ip Pandas I Full Notes
PDF
No ratings yet
SR Ip Pandas I Full Notes
30 pages
Pandas Class XII (2021-22)
PDF
No ratings yet
Pandas Class XII (2021-22)
246 pages
Ip Notes
PDF
No ratings yet
Ip Notes
72 pages
Leip 102
PDF
No ratings yet
Leip 102
36 pages
Pandas Notes 1
PDF
No ratings yet
Pandas Notes 1
6 pages
Python Pandas Series
PDF
No ratings yet
Python Pandas Series
30 pages
Httpsncert Nic Intextbookpdfleip102 PDF
PDF
No ratings yet
Httpsncert Nic Intextbookpdfleip102 PDF
36 pages
Data Handling Using Pandas-1
PDF
No ratings yet
Data Handling Using Pandas-1
23 pages
Ip Practical File
PDF
No ratings yet
Ip Practical File
39 pages
Final Print
PDF
No ratings yet
Final Print
43 pages
Python Code
PDF
No ratings yet
Python Code
44 pages
Ncert Pandas
PDF
No ratings yet
Ncert Pandas
36 pages
Ip Xii
PDF
No ratings yet
Ip Xii
6 pages
LastMinuteRevisionMaterial IP24 25 82423
PDF
No ratings yet
LastMinuteRevisionMaterial IP24 25 82423
18 pages
Practical File Ip Class 12
PDF
No ratings yet
Practical File Ip Class 12
40 pages
Pandas - Series - Introduction
PDF
No ratings yet
Pandas - Series - Introduction
19 pages
Pandas Notes
PDF
No ratings yet
Pandas Notes
19 pages
Study Material IP 2022
PDF
No ratings yet
Study Material IP 2022
55 pages
DataSeries Notes File
PDF
No ratings yet
DataSeries Notes File
12 pages
Unit-1 Python Pandas
PDF
No ratings yet
Unit-1 Python Pandas
56 pages
Informatics Practices Class 12 Study Material
PDF
No ratings yet
Informatics Practices Class 12 Study Material
128 pages
Nb7+ (Notes On Pandas)
PDF
No ratings yet
Nb7+ (Notes On Pandas)
34 pages
Python Pandas Series
PDF
No ratings yet
Python Pandas Series
45 pages
12 IP Notes On Series
PDF
No ratings yet
12 IP Notes On Series
5 pages
Pandas 730pm
PDF
No ratings yet
Pandas 730pm
5 pages
Python Pandas
PDF
No ratings yet
Python Pandas
22 pages
XII IP QuickRevision
PDF
No ratings yet
XII IP QuickRevision
26 pages
Panda Ncert 1
PDF
No ratings yet
Panda Ncert 1
36 pages
Data Handling Python NCERT
PDF
No ratings yet
Data Handling Python NCERT
36 pages
XII - Ip - Panda - I - Part - I - 2023 (1) 1 1
PDF
No ratings yet
XII - Ip - Panda - I - Part - I - 2023 (1) 1 1
25 pages
Working With Pandas Notes
PDF
No ratings yet
Working With Pandas Notes
27 pages
Unit I: Data Handling Using Pandas and Data Visualization: Marks:30
PDF
No ratings yet
Unit I: Data Handling Using Pandas and Data Visualization: Marks:30
75 pages
Pandas
PDF
No ratings yet
Pandas
20 pages
Python Pandas - I
PDF
No ratings yet
Python Pandas - I
32 pages
Python Pandas Series
PDF
No ratings yet
Python Pandas Series
37 pages
P03 Introduction To Pandas Ans
PDF
No ratings yet
P03 Introduction To Pandas Ans
45 pages
Data Handling Using Pandas-1
PDF
No ratings yet
Data Handling Using Pandas-1
25 pages
Ln. 1 - Data Handling Using Pandas - Series & Dataframe
PDF
No ratings yet
Ln. 1 - Data Handling Using Pandas - Series & Dataframe
14 pages
Ip 102
PDF
No ratings yet
Ip 102
36 pages
Ip Class 12
PDF
No ratings yet
Ip Class 12
11 pages
Panda Qus
PDF
No ratings yet
Panda Qus
8 pages
Pandas
PDF
No ratings yet
Pandas
14 pages
Pandas - Series - Short - Notes
PDF
No ratings yet
Pandas - Series - Short - Notes
7 pages
ATA Andling - 25 MARKS: D H Pandas
PDF
No ratings yet
ATA Andling - 25 MARKS: D H Pandas
102 pages
Unit-1: Data Handling - (DH) : PAN DA S
PDF
No ratings yet
Unit-1: Data Handling - (DH) : PAN DA S
12 pages
XII-IP-QuickRevision 2 in 1
PDF
No ratings yet
XII-IP-QuickRevision 2 in 1
13 pages
CH 2
PDF
No ratings yet
CH 2
36 pages
Data Handling Using Pandas I - Series
PDF
No ratings yet
Data Handling Using Pandas I - Series
11 pages
Class Xii
PDF
No ratings yet
Class Xii
3 pages