kgygb
kgygb

Reputation: 11

" TypeError: 'DataFrame' object is not callable " for excel data

anyone know why it's showed TypeError: 'DataFrame' object is not callable for this code?

import pandas as pd

file  = pd.ExcelFile('ReadData.xlsx')
data_ch = file.parse('Sheet1')
idx_ch = data_ch.pop('Tanggal')
data_ch.index = idx_ch

Norm_1 = (data_ch - data_ch.min())/(data_ch.max() - data_ch.min())
Norm_CH = Norm_1.T 
month = 8
date = 31
n=1
m=1
z = date*(month-1)
 for n in range z:
     for m in range date:
            train_ch = Norm_CH(m) + Norm_CH(n) - 1

print (train_ch)

i'm using the Excel Data that has String in the first columns

Upvotes: 1

Views: 511

Answers (1)

Matthieu Brucher
Matthieu Brucher

Reputation: 22043

I assume that the error is showing up at the line:

Norm_CH(m) + Norm_CH(n) - 1

You need to use brackets, not parentheses here:

Norm_CH[m] + Norm_CH[n] - 1

But there are other issues in you code, you are assigning this to train_ch, so only the last value is saved, and then you display another variable, train, that is never set.

Upvotes: 1

Related Questions