[英]Is a pandas dataframe a list of lists?
I just learned some basics of pandas today, and I notice that pandas dataframes look very similar to when you run the same csv file using the csv module (which I recall can be treated as a list of lists).我今天刚刚学习了一些 Pandas 的基础知识,我注意到当你使用 csv 模块运行相同的 csv 文件时,pandas 数据帧看起来非常相似(我记得可以将其视为列表列表)。 I can't seem to slice a pandas dataframe like a list of lists, but the dataframe['column name'] resembles what you do to extract values from dictionaries.我似乎无法像列表列表那样对 Pandas 数据框进行切片,但是 dataframe['column name'] 类似于您从字典中提取值的操作。 So are pandas dataframes like dictionaries, but the values of its keys are lists?那么pandas 数据框是否像字典一样,但其键的值是列表?
As i said in my comment section, In general, you could say that the Pandas DataFrame consists of three main components: the data, the index, and the columns dictionaries of one-dimensional ndarray(structured or homogeneous)'s, lists, dictionaries or Series.正如我在评论部分所说,一般来说,你可以说 Pandas DataFrame 由三个主要组件组成:数据、索引和一维 ndarray(结构化或同构)、列表、字典的列字典或系列。
DataFrame数据框
Dict can contain Series, arrays, constants, or list-like objects Dict 可以包含系列、数组、常量或类似列表的对象
Changed in version 0.23.0: If data is a dict, argument order is maintained for Python 3.6 and later.在 0.23.0 版更改:如果数据是字典,则为 Python 3.6 及更高版本维护参数顺序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.