0% found this document useful (0 votes)
4 views2 pages

Pandas

The document contains Python code snippets that create various pandas DataFrames with student and car data. It demonstrates different methods to initialize DataFrames, including using dictionaries and lists. Additionally, there are comments indicating tasks related to filtering and accessing DataFrame elements.

Uploaded by

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

Pandas

The document contains Python code snippets that create various pandas DataFrames with student and car data. It demonstrates different methods to initialize DataFrames, including using dictionaries and lists. Additionally, there are comments indicating tasks related to filtering and accessing DataFrame elements.

Uploaded by

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

#Baitap2

import pandas as pd
df=pd.DataFrame({'First time':['Nguyen Van','Nguyen Ngoc','Nguyen
Thi','Vo Minh','Nguyen Tran'],
'Surname':['Anh','Bao','Linh','Thong','Kiet'],
'Quiz1':[5,7,4,2,10],
'Quiz2':[3,3,7,7,9],
'Quiz3':[10,10,8,2,4]})
#df[(df['Quiz1']==10) | (df['Quiz2']==10) | (df['Quiz3']==10)] bỏ vào
#df.iloc[0,1] => 'Anh'
#df.loc[['

#1
import pandas as pd
df=pd.DataFrame({
'Name':['Nguyen Van A',
'Nguyen Van B',
'Nguyen Van C',],
'Age':[11,12,13],
'Sex':['male','male','female'],
})
#Cach 1
import pandas as pd
cach1f=pd.DataFrame({'cars':['honda','BMW','Toyota'],
'years':['1990','2002','2020'],
'rating':[15,20,12]})

#Cach 2
import pandas as pd
cach2df=pd.DataFrame([['Honda','1990','15'],
['BMW','2002','20'],
['Toyota','2020','12']],
columns=['cars','years','rating'])
#Cach 3
import pandas as pd
cach3df=pd.DataFrame()
cach3df['cars']=['honda','BMW','toyota']
cach3df['years']=['1990','2002','2020']
cach3df['rating']=[15,20,12]

#Baitap1: hay viet chuong trinh tao bang du lieu sau day su dung DataFrame
cua Python
import pandas as pd
df=pd.DataFrame({'TT':['1','2','3','4','5'],
'Ma SV':
['23126081','23126096','23126097','23126139','23126093'],
'Ho va ten lot':['Truong Le Bao','Le Thi Kieu','Nguyen Thi
Tra','Nguyen Huu','Trinh Thi'],
'Ten':['Han','My','My','Tien','Linh']})

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