Pandas 系列是带有轴标签的一维ndarray。标签不必是唯一的,但必须是可哈希的类型。该对象同时支持基于整数和基于标签的索引,并提供了许多方法来执行涉及索引的操作。
Pandas Series.floordiv()函数返回Series和其他按元素计算的整数除法(二进制运算符floordiv)。该操作等效于series // other,但支持用fill_value代替输入之一中的丢失数据
用法: Series.floordiv(other, level=None, fill_value=None, axis=0)
参数:
other:序列或标量值
fill_value:在计算之前,请使用此值填充现有的缺失(NaN)值以及成功进行系列比对所需的任何新元素。
level:在一个级别上广播,在传递的MultiIndex级别上匹配索引值
返回:结果:系列
范例1:采用Series.floordiv()函数执行带有标量的系列对象的 floor 划分操作。
# importing pandas as pd
import pandas as pd
# Creating the Series
sr = pd.Series([10, 25, 3, 25, 24, 6])
# Create the Index
index_ = ['Coca Cola', 'Sprite', 'Coke', 'Fanta', 'Dew', 'ThumbsUp']
# set the index
sr.index = index_
# Print th