9951 explained code solutions for 126 technologies


python-pandasConvert dataframe column values to list


import pandas as pd

data = pd.DataFrame({
  'Phone': ['ip5', 'ip6', 'ip8', 'sms', 'xi'],
  'Phone Price': [204, 304, 404, 405, 305]
})

lst = data['Phone Price'].tolist()ctrl + c
import pandas as pd

load Pandas module

pd.DataFrame

creates Pandas DataFrame object

'Phone Price'

column to convert to list

.tolist()

converts given column to list

lst

will contain final list