Pandas DataFrame: Difference between revisions
Jump to navigation
Jump to search
(→iloc[]) |
|||
Line 21: | Line 21: | ||
=Accessing Elements of a DataFrame= | =Accessing Elements of a DataFrame= | ||
==<tt>iloc[]</tt>== | ==<tt>iloc[]</tt>== | ||
A property that allows integer-based access (indexing). | A property that allows integer-based access (indexing). | ||
==<tt>loc[]</tt>== | ==<tt>loc[]</tt>== | ||
A property that allows label-based access (indexing). | A property that allows label-based access (indexing). |
Revision as of 18:33, 8 October 2023
External
- https://pandas.pydata.org/docs/user_guide/dsintro.html#dataframe
- https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html#pandas.DataFrame
Internal
Overview
A DataFrame is a two-dimensional data structure with columns of potentially different types. The data structure also contains labeled axes, for both rows and columns.
Can be thought of as a dict-like container for Series objects, where each column is a Series. The dimensionality of the DataFrame is given by its shape
property.
Shape
shape
is a property of the DataFrame, containing a tuple that returns the dimensionality of the DataFrame: rows, columns.
Create a DataFrame
Create a DataFrame from a CSV File
Accessing Elements of a DataFrame
iloc[]
A property that allows integer-based access (indexing).
loc[]
A property that allows label-based access (indexing).