0

I imported excel file in python dataframe and stored column B data(links) as variable links. I want to convert pandas.core.frame.dataframe to list, so i used links.values.tolist() but found empty list.jupyter

import pandas as pd 
links = pd.read_excel('TRW-PARSING.xlsx',index_col=0, usecols='B')
links_list = links.values.tolist()
links_list
  • 1
    Does this answer your question? [Pandas DataFrame column to list](https://stackoverflow.com/questions/23748995/pandas-dataframe-column-to-list) – sai Oct 13 '20 at 08:35

1 Answers1

1

Try list(links['link'].values)

Ron Serruya
  • 3,181
  • 1
  • 17
  • 24
  • Please note: This should be `to_numpy()` as `values` is being deprecated. [Source](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.values.html). So the line should read: `links['LINK'].to_numpy()` or `links['LINK'].to_numpy().tolist()` – S3DEV Oct 13 '20 at 09:07