pandas_Series和DataFrame基础
目录
Series
DataFrame
Series
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Series
s = pd.Series(data=np.random.randint(60,100,size=(10,)))
s
s.shape
# out: (10,)
s.size
# out: 10
s.index
# out: RangeIndex(start=0, stop=10, step=1)
s.values
# out: array([66, 73, 67, 67, 75, 97, 73, 62, 83, 77])
s.dtype
# out: dtype('int32')
s.values.tolist()
# out: [66, 73, 67, 67, 75, 97, 73, 62, 83, 77]
DataFrame
# DataFrame
df = pd.DataFrame(data=np.ra
共有 0 条评论