模塊也是類,例如pandas模塊,安裝方式 pip install pandas
from pandas import Series
#實例化
ser1=Series(data=[4,7,-5,3])
print(ser1.values)
print(ser1.sum())
[ 4 7 -5 3]
9
from datetime import datetime
#實例化
dt1=datetime(2022,1,1)
print(dt1)
2022-01-01 00:00:00
dt2=datetime(2022,1,1,12,30,5)
print(dt2)
2022-01-01 12:30:05
# 調用方法
print(dt2.day)#查看日
print(dt2.minute)#查看
print(dt2.date())
1
30
2022-01-01
#strpttime
string_dt='2019-1-1'
print(type(string_dt))
<class ‘str’>
print(datetime.strptime(string_dt,'%Y-%m-%d'))
2019-01-01 00:00:00