Home > Blockchain >  How can I convert one row of values with panda
How can I convert one row of values with panda

Time:08-18

How can I convert one row of values with panda

df = pd.read_csv('blackred.csv')

words = []
for i in df:
    words.append(i)

num = []

I want to grab the index 0 column and convert it into a list of numbers and set it to num

How can I do that

This is my csv file I just want to grab 7,21,19,9,2 please let me know how

enter image description here

CodePudding user response:

you can use .iloc and list()

list(words.iloc[0])

CodePudding user response:

I understood that grab the index 0 column is actually grab the index 0 column.

num = df.loc[0].to_list()
  • Related