0% found this document useful (0 votes)
29 views12 pages

IP Assignment

This document provides coding assignments to work with pandas DataFrames. It includes questions asking to import pandas, create DataFrames from lists, add/remove rows and columns, access values, transpose DataFrames, and filter DataFrames based on column values. Code solutions and expected outputs are also included.

Uploaded by

Shresth Bhardwaj
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)
29 views12 pages

IP Assignment

This document provides coding assignments to work with pandas DataFrames. It includes questions asking to import pandas, create DataFrames from lists, add/remove rows and columns, access values, transpose DataFrames, and filter DataFrames based on column values. Code solutions and expected outputs are also included.

Uploaded by

Shresth Bhardwaj
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/ 12

TE 02 o5 2023

Assiqnment
Sen Se 2
A 3

34 S
39
31
34

a code Seies Se)

A- impont pandas Qs pd
Senl pd. Senies L3s,36, 3 9,32,34l,1ndex=['a','e, D

hhat is.

A-2.

04 wite a

A- 4 Impoai pamac
paintl Sal, tail (0)

Naitencode to updot Valv ee aneot c thon 30te


So.
A-5 impo pondas ospd

Wite a code to pimt even plGceS ualure.

A-6 pnmt CSeal sl:2])


I

Wnite the out put the 4ollbwinq


c) Selhead
A
B 36
C 39
37
34

A
NoW

NaN

-29-o

wnite a Code to (IaHe a data nome Us1ne dicto

impant panàos as pd
DE= pd.Data Fnomc C ons h' :Li,&,A, 'suja' :C79,90,
Shnesth I,s,1], 'Tushaw' : Ls, 7,

D. inden I'phy Sics', c he mis lny', pJ


Pant LRE)
pEl= pd.Datsfname (data, (olumsaL1)
Naite a rode to cIcate a st cemtaiming dicHones
20nal icsNames -lnbcr

A dictl= Tange Sok salcs':'30 K

did 3= TangeoK ´sale'ok'3


dict 4

DF pd @atcfnone C1indcx = I'zone A', Zonce,2ne 2ane

witeacode datajname in wbch n dexes


a e nome states famous Nish Cop to
Fomoy s plou

impunt pandas as pd
LI=[IdIi 'Mod zos'hi tombam
L2 ['vada Pov'MUmbai hotewo q lndlaJ
L3- APethoAgna' Toj Maho)
L4Senso ka sag, Punjo aol den TempLe'

Df-_pd. Dolafnom (L, coluK = Eamous DIsh (opitar or


'up chondig an h')

Fon Sclccng individua) valu(


< Dato£ngme>LAow indcd aumn nomc

IL0s Jon ernat Hng


lobelrd SPosHono)
Datainomp v5ng abeled

Syntox 07 accSNg column


<DatafomC nomc>[column DomeJ
OR
SVoaomc n9nc>Co lumn nom

Wite a code to GrtO(t column A Valucs nom DEI

OR

ite o code to eXtot Nalbes Colume and ColUmn D

Syni9Xon MolHple coluNn,


<Dakafom_e n0me> Liolumn noMe> talunn 22J

(Olumn

Accesing now toYn Patofnom

SxK
N A

X )3 2 4
(2
col Ont 0ws both COS
! putusing but qivinq
ht
Th)s
doung PF
staenent
Nc Jollowing the whot Explom -
80 32
15
L:303 Joc pEL. C
49
49 X33
36
3
onOutput the Wait
,B loA
m coond XX,
Ad ding
-DatafaonE nome > loc éRow no(volvg >

Ading mew column


<Datonome mo> olumn nont > <vol ur

ertaoching a subset nom paoJor

A 3

B 3
7 3 4.

< Doto ome no Me>,o s i a t p02!< nd 0w> <stowt robrao

pE. ilDL C I 3 i4

Book n9me SoleS

Nancy
The

Tw

GooKs.['Bice [So, so, 70, gQ

C) Add o new Ow
lDATE

pei)oc Ci: 5
0 Wate the Ovtput a he Jollow
3
35
S7.S 29 40
49

2 2
4SL0 30 29
237 66.6 70

35.0

2 E . loc Loi 23
460

50.6
36,0 30
DATE
PAGE:

Dcletimg oblique nenOmng


del <StoBment

ROuws fa <Daialnom noednop(andcx


axsO’ Row
Oxis=’ lolvmr

The indol a do tonome is actuolly the now lo ble


Synton - e DE>, ndex

Column lobc) data Jn0ms

DatofN9Me

dtype
hedata ypes a po}a in Dato fno9a

inkeqes epzCscnting the nymb(o a


clements im Dotasgmc.
(Ún Shope
Valoes
Rctunns nUmpy anoy epesnlaHon Dalolomt

Empy
TE indi (otcs whcothe the dato1ome is cmpy 0 n
boolcon e., T5ue i IA Cnpt,
ond Calse i it i4 no} cmpy
ndim
inteqcn whch Shows no. axS

luonsp0se ndo ond Colunn

A
230 60
70 4O 20

23 37

QUtput
A 30 23
50 40 37
C 66 35

ln (ase daBano Mt
the do taom
Cout()
I wil) snet0J) mn Na yolues
By dedou HoS vdes
a pnaq7Om to cncote Datoome
we ight,aqc ,nomes a the people pinl the pola
-fnOmc ond taanspose i ond displo
Aimpont pondos s pd

I'Honpccd 'ud 9'nàcx <'Nane

Vicnt belwern 0atoEaomc omd 20 ndaay

(on stOne
HeteoqenoiS Stoncs homoqunbuS elemes
elp menis

have

positive in)cgsAon bo th Xee

Consunmes ynoNçEY thon Consmesess e cneD4ly


On cyuwolen+ nd aNOy fo

Mutatle lmmu to ble

IE S apant o ndos
at> Lobeild
<Dotofoome> ot LRow, (olurgn)
aCessing theImdviduo) volue Jena ous/t(aumn
label po1n
iot fosilso

Access
nteqer position

30 76.0 30 9o

40

H 90 70 94

DE,<column non2>hn

wite Qcode to disploy the im de eS wrçh al


Column C value qncotca thon 5b
nouing
DE.C250
Ouiput !

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy