i'm trying to extract 'Country' column data into python list using pandas. Below the code i used to. Also attached excel sheet and output.
code:
from pandas import DataFrame
import pandas as pd
open_file = pd.read_excel('data.xlsx', sheet_name=0)
df = list(open_file['Country'])
print(df)
Output:
[nan, 'Great Britain', 'China ', 'Russia', 'United States', 'Korea', 'Japan', 'Germany']
Process finished with exit code 0
In the output i can see 'nan' because in the sheet two cells are merged into one. How to avoid this?
nanbecause columnA1:Ahas no data.