sorry friend I have a dataframe in panda, I have a column that it has a value="Total" in some rows. I want to delete the rows which has "Total" value in it. before this stage I wrote several codes to make the dataframe like below:
and my code error is :
part of my codes are:
def Turk_Export_Excels(url,Tur_year,Tur_month):
df = pd.read_html(url)[0]
for i in range (9): # for deleting the 9 initial rows
df=df.drop(i)
for j in range(4): # deleting the 4 columns which is useless
df=df.drop(j, axis=1) # delete column
for j in range(5,12,1):
df=df.drop(j, axis=1) # delete column
df=df.drop(13, axis=1)
for j in range(15,18,1):
df=df.drop(j, axis=1) # delete column
for j in range(19,26,1):
df=df.drop(j, axis=1) # delete column
df=df.drop(26, axis=1)
for j in range(27,40,1):
df=df.drop(j, axis=1)
df=df.drop_duplicates(keep="first")
for i in range (0,100,1) :
df.iloc[i,3]=str(df.iloc[i,3])
df.iloc[i,3]=df.iloc[i,3].replace('.','')
# if df.iat[i,1]=="Total":
# df=df.drop(i)
df.drop(df.index[df['1'] == "Total"], inplace = True)