eral not a good practice and we recommend using .loc. df.iloc[0:5]['group'] = 'a' Nz