I am trying to pass constant values in a python pandas data frame, and it is adding the only first row and the rest of the show as NaN. I am not sure what I am doing wrong. I tried all the possible answers but it still not working for. If you guys have any idea please let me know
weekdayDistance.loc[:,'UID'] = user.UID.head(1)
weekdayDistance['UID'] = user.UID.head(1)
weekdayDistance.loc['UID'] = user.UID.loc[0]
output:
a b c UID
1 1 1 1
2 2 2 NaN
3 3 3 NaN
what I want
a b c UID
1 1 1 1
2 2 2 1
3 3 3 1