0
Klel, in this case Voce can use the function:
'pandas.DataFrame.values'
Follow the example of use:
import pandas as pd
df = pd.DataFrame({'idade': [ 3, 29],
'peso': [94, 170]})
vetor = df.values
To pass all DF to an array.
Or directly assign a single column to an array.
import pandas as pd
df = pd.DataFrame({'idade': [ 3, 29],
'peso': [94, 170]})
vetor = df['idade'].values
In the last row just place desired column.
Follows the Link for documentation.
Example with 1 column
import pandas as pd
df = pd.DataFrame({'idade':[ 3,29,13,15,16,14,12]})
vetor = df.values
Something like
lista = df['nome_coluna'].tolist()
?– AlexCiuffa
Klel, see if that helping
– Tuxpilgrim
Alexciuffa, I got the error: 'Dataframe' Object has no attribute 'tolist'
– Klel
Tuxpilgrim, is that my data is just a column, it would need that when converting to the array, it becomes only a row.
– Klel