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
  • 16,334
  • 5
  • 30
  • 53
RCarmody
  • 527
  • 2
  • 17

0 Answers0