import pandas as pd ser=pd.Series(range(5),index = ["a","b","c","d","e"]) (1)写出ser.values的结果? (2)写出(ser * 2)的结果? (3)写出(ser[ser >= 3])的值? ( 4 ) df = pd.DataFrame({'key':['A','B','C','A','B','C','A','B','C'], 'data': [0,5,10,5,10,15,10,15,20]}) 写出df.groupby('key').sum()的结果?
时间: 2024-01-14 10:02:35 浏览: 75
import pandas as pd.docx
(1) ser.values的结果为array([0, 1, 2, 3, 4])
(2) (ser * 2)的结果为:
a 0
b 2
c 4
d 6
e 8
dtype: int64
(3) (ser[ser >= 3])的值为:
d 3
e 4
dtype: int64
(4) df.groupby('key').sum()的结果为:
data
key
A 15
B 30
C 45
阅读全文