Home > Back-end >  How to create a dataframe with rows name
How to create a dataframe with rows name

Time:11-17

I need to create a dataframe as given below and then later I need to add values as per rows and column.Can anybody please tell me how can i do this?

    ColA  ColB  ColC

Name 2 21 10

Roll 4 67 21

CodePudding user response:

IIUC use:

df = pd.DataFrame(index= ['Name','Roll'], columns=['ColA', 'ColB', 'ColC'])

df.loc['Name','ColA'] = val
  • Related