0

I have the following code that's giving me an error... I have no idea why - thoughts?

file = r"C:\Users\xxxxx"
xls = xlrd.open_workbook(file, on_demand=True)

def roundup(x):
    return int(math.ceil(x / 10000.0)) * 10000

df = pd.read_excel(file, sheet_name='Sheet2')
cols = ['Id','Total Cost','Custom']
df = df[cols]
df['Total Cost'] = df['Total Cost'].astype(float)
df['cSum'] = df['Total Cost'].cumsum()
print(roundup(df['cSum']))

Error: TypeError: cannot convert the series to class 'float'

wjandrea
  • 28,235
  • 9
  • 60
  • 81
RCarmody
  • 712
  • 1
  • 12
  • 29

0 Answers0