jeudi 12 novembre 2020

Command for loop and if calculation

I am new in Python and I would like to ask something.

My code reads a csv file. I want to use one column. I want to use an equation which calculates, depending on the value of the column I want to use, several values. I am using commands for and if.

my code

import pandas as pd
import matplotlib as mpl
import numpy as np

dfArxika = pd.read_csv('AIALL.csv', usecols=[0,1,2,3,4,5,6,7,8,9,10], header=None, index_col=False)
print(dfArxika.columns)

A=dfArxika[9]

for i in A:
    if (A(i)>=4.8 and A(i)<66):
        IA=(2.2*log10(A(i)/66)+5.5)
    elif A(i)>=66:
        IA=3.66*log10(A(i)/66)+5.5
    else:
        IA=2.2*log10(A(i)/66)+5.5

but command window shbows me the error:

TypeError: 'Series' object is not callable

Could you help me?

Aucun commentaire:

Enregistrer un commentaire