Department = input("Is there a list you would like to view")
readfile = pd.read_csv('6.csv')
filevalues= readfile.loc[readfile['Customer'].str.contains(Department, na=False), 'June-18\nQty']
filevalues = filevalues.fillna(int(0))
int_series = filevalues.values.astype(int)
calculated_series = int_series.apply(lambda x: filevalues*1.3)
print(filevalues)
我遇到了这个错误: AttributeError: 'numpy.ndarray' object has no attribute 'apply'
我已经查看了这个网站,但没有任何解决方案似乎适用于我的情况。我只想在这个序列中将数据乘以1.3。谢谢
int_series * 1.3
? - rafaelcint_series * 1.3
会将系列中的每个值乘以1.3。 - roganjoshnumpy
数组中没有apply
函数。但是,在pandas.Series
对象中有,如果您使用filevalues.astype(int)
而不是filevalues.values.astype(int)
,则会得到该对象。 - rafaelc