A
A
Andrew2020-05-25 18:34:00
Python
Andrew, 2020-05-25 18:34:00

How to fix 'DataFrame' object is not callable' error?

Hey!

When I iterate over the dataframe, I get the following error:
TypeError: 'DataFrame' object is not callable

In the code, I check if a numeric value is entered in a cell. Empty cell allowed

def read_file_to_df(file):
    data = pd.read_excel(file)

    for index, row in data.iterrows():
        if row["Оценка"] is not None and type(row["Оценка"]) != float:
            raise ValueError(_("Упс... Строка {} столбца Оценка должна содержать число или быть пустой!").format(index + 2))

    return data


Tell me, what is the reason for the error?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question