Search the Internet for many answers you don't want , Grope to meet their own requirements , Write and share , Easy to remember later .
The origin of the problem : I want to use seanborn Of kdeplot drawing ,kdeplot The first parameter needs to be a one-dimensional array .
What I first introduced was Dataframe Class variables , This Dataframe Class variables are used Dataframe[[' Name ']] obtain , And then they report iloc giving 'IndexError: single positional indexer is out-of-bounds' This mistake .
Then I go through pandas.Dataframe.values The value of this column is converted to a numpy Two dimensional array of , Almost like this , as follows :
Then go ahead and deal with df.values.flatten() Into an array , Grow into the following :
This is the time to meet my requirements .
Add up :
You can also use the variable name directly ds= Dataframe[' Name ’] Get a column data without column name directly , This is the time ds For one Series object