Python中各个数据类型常见方法总结---实时性更新
总结:
一.Python中的主要数据类型:
- Numbers(数字)
- String(字符串)
- List(列表)
- Tuple(元组)
- Dictionary(字典)
二.numpy中常见函数
1.numpy.linspace()函数:
numpy.linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None)
在指定的间隔内返回均匀间隔的数字。
返回num均匀分布的样本,在[start, stop]。
这个区间的端点可以任意的被排除在外。
Parameters(参数): |
start : scalar(标量)
stop : scalar
num : int, optional(可选)
endpoint : bool, optional
retstep : bool, optional
dtype : dtype, optional
|
---|---|
Returns: |
samples : ndarray
step : float(只有当retstep设置为真的时候才会存在)
|
三.pandas中常见函数
1.DataFrame
1.1 创建:通常以传入一个字典的方式来创建df:
- df = pd.DataFrame(data={'books':['bk1','bk1','bk1','bk2','bk2','bk3'], 'price': [12,12,12,15,15,17]})
注意:取值的时候是两个中括号。