Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
7 views

Python Programming Ha

The document provides an introduction to Python programming, focusing on mutable and immutable data types, type conversion, and the use of libraries like NumPy and pandas for efficient numerical computations and data handling. It explains how mutable objects can be changed while immutable objects cannot, and discusses both implicit and explicit type conversions in Python. Additionally, it highlights the differences between one-dimensional and two-dimensional data structures in Python.

Uploaded by

kokutherider
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Python Programming Ha

The document provides an introduction to Python programming, focusing on mutable and immutable data types, type conversion, and the use of libraries like NumPy and pandas for efficient numerical computations and data handling. It explains how mutable objects can be changed while immutable objects cannot, and discusses both implicit and explicit type conversions in Python. Additionally, it highlights the differences between one-dimensional and two-dimensional data structures in Python.

Uploaded by

kokutherider
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

QyaluO%O134

Trtoduetion to pytlen Preganig ViUyshaw'


tome ASsiqnment
Mtable ourd Lmmutahle oto types are createt
) after they
Mtahleobiets Can be changed ooieot itelf
ehanges mode to ebject effeotthe omiinal
Usts: mytist 3]
Srredifiesthe oriairad ist ?
myustappendlus
Otioraoies: mydiet= a:,b':12
key -ale pais to the
add nes
my dite7= 3
dltoreyi
Sets i-my-set= a s
muy-set.dlc)dds u to the set
connot be chaged after they
Tmmtoble objeets
modity an immetoble
oeats to
Any eperation thet oajcet
uoith mlfied volue
auctuoly ereocdes ane
object
Nunlelint tlaot Comple)i
Loc(h
+\ceales a new indeen obeat
0= x elue s enais
ith
ohile the onqiral sbect
Value 6,

strinap'
mystirga hello" create a nes
+Loord«
rewstigsmy-stg hello
Loor teaingy onginal string
Stying objed hello
unohagad
mg-tple e (lia, 3)
tupies can not lze morfie dineotly.
S) Tpe Convesion
type catlrg the phoces of
vole from doto type to another
Convetint
miit convesion (Actomatt!
one

python automaticolly perfms tMpe conveion bn certon


sitatons Usually fy nuneie daa types

Chen you add en inteqer to a floot, ytho inpity


Converts he inteoen to a ftoat befone perpoing tthe
addition

Eplicit Conversion
Jou epaituy tel ython to Convert a vale to e
Speaifie dota tpe wsin built n feretiors
Comon functio
tcs- Convets to inteoen
-flooetC \-conw erts to toat
trcs- Convets to tiro
stC),- Convets into list
tuplec '-Converts into tuple
Set t converts nto set

Sxounple.

dump a a ane desigred speaifically tor


efficient nmeical conptations
tomeneos:- Atu elements in a Numpyaay must
haue the Garna dato type
optimized tor vectozed opertios Copenotions teot ae
petomed on entire a a y t onco), naing them
caloulotion
mueh foste thon python Gsts for numecol
xonple:
import unpy s np
yoognprasaylt3,4)
prirtCmyey*2)
mutiplies each elernent bay 2 ettiaenty

pthon sts ae qeneed pupoe and coun hokt


elenents of diffeent dato ypes.
(es eftient tor numoial eomptoors copaee

Exople :
yist =Ct, 2,347
newist

forr num in mysi


neust: apperd Cnumt2)
operatiors.
4 tes etficierd for nmeicol
Parh see nd Cata franes
arh eie ae one dinnensional asyUke
object that con hold an datotpe inteqers float,
Caun be (abeled indee
Sonplei
Rport pardas
my-seies - diseies(ceo, 0, 30] ,iden-as b','e
print Cmysenies)
- andas Data-rane ne too dimenjonal , size -
mtable tabula daeta tructhe wtto lobe led oLs
and ostem
toblc
Gimilan to a spaeactsheet n SL
veious data types ithn ts Column.
Can hed

impot pardas os p
cedobrne':C'AUee,'Bob', 'heie'],
lordon',
Aqe':1S,30 ), 'city:CNes York',
'Paes'?
mydatotrmc = pd atoframe(soto)
mintemy-tocme)
Key Differences onedineoral ,ohile
Dimensiorality :;- Goies is
Colnn, ohlc
Sthuetre; Seles is Uke a
oith mltiplc colus,
i ke a toble

You might also like