Closed qinxuye closed 1 year ago
Minimal reproduce:
df = pd.DataFrame({"vehicleId":list("abc"), "payFee":[1,2,3]})
vehicle_pass_count = df.groupby('vehicleId')['payFee'].count()
vehicle_total_fee = df.groupby('vehicleId')['payFee'].sum()
vehicle_total_fee_intervals = pd.cut(vehicle_total_fee, bins=[2, np.inf], labels=["b"], right=False)
print(pd.DataFrame({
'车辆总数': vehicle_total_fee_intervals.value_counts(),
'总通行次数': vehicle_pass_count.groupby(vehicle_total_fee_intervals).sum(),
'通行费金额小计': vehicle_total_fee.groupby(vehicle_total_fee_intervals).sum()
}))
Describe the bug
Encountering error: ValueError: cannot convert float NaN to integer
To Reproduce
To help us to reproduce this bug, please provide information below:
Code
Error message: