I need to insert value into a column based on row index of a pandas dataframe.
import pandas as pd
df=pd.DataFrame(np.random.randint(0,100,size=(11, 4)), columns=list('ABCD'))
df['ticker']='na'
df
Sample DataFrame In the above sample dataframe, the ticker column for first 25% of the total number of records must have value '$" the next 25% of the records must have value "$$" and so on.
I tried to get the length of the dataframe and calculate 25,50,75 percent on it and then access one row at a time and assign value to "ticker" based on row index.
total_row_count=len(df)
row_25 = int(total_row_count * .25)
row_50 = int(total_row_count * .5)
row_75=int(total_row_count*.75)
if ((row.index >=0) and (row.index<=row_25)):
    return"$"
elif ((row.index > row_25) and (row.index<=row_50)):
    return"$$"
elif ((row.index > row_50) and (row.index<=row_75)):
    return"$$$"
elif (row.index > row_75):
    return"$$$$"
But I'm not able to get the row index. Please let me know if there is a different way to assign these values



