使用pandas读取csv的第0行并将其保存到lis中

2024-04-26 23:31:29 发布

您现在位置:Python中文网/ 问答频道 /正文

这是我的数据帧:-你知道吗

A            B            C           D
1            23           34          23
3            23           21           4
4            5            6            7

what i want to do is read 0th row and add it into a list like this [A,B,C,D]

(here this column name can be anything)

我用过

data = pd.read_csv(file_path, nrows=0)

但我无法将其添加/存储到列表中

怎么做?你知道吗


Tags: andto数据addreadisitthis