Share a commonly used pandas script for processing data.
import numpy as np
import pandas as pd
df = pd.read_excel(".xlsx",usecols=[0])#skiprows=2#读取表格的一列
df_arr = np.asarray(df.stack())#Dataframe类型堆叠变成Series类型再转成numpy数组
cls_list = df_arr.tolist()#转list
print(cls_list)
pd.read_excel is used to read a certain column in the table, the parameter usecols is used to set the index of the column to be read, the parameter skiprows allows you to start reading from a certain row of a certain column, and the read information is Dataframe type
Use the stack() function to change the format and finally convert it into a numpy array
Finally, it is converted into a list by tolist