Differences between revisions 6 and 7
Revision 6 as of 2024-01-16 03:46:59
Size: 2844
Comment: Added attrs
Revision 7 as of 2025-12-23 05:17:40
Size: 0
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Python Pandas DataFrame =

A '''`DataFrame`''' is a 2-dimensional array of columnar data.

The [[Python/Pandas/Types|type]] is fully specified as `pandas.core.frame.DataFrame`.

<<TableOfContents>>

----



== Example ==

----



== Data Model ==



=== DType ===

A column without significant consistency of data types will initialize with a [[Python/NumPy/Types#ObjectDType|dtype]] of `object`. Alternatives include:

 * `int64`
 * `float64`
 * `datetime64`
 * `bool`
 * `category`

----



== Attrbibutes ==

||'''Method'''||'''Meaning''' ||
||`axes` ||[[Python/Builtins/Types#List|list]] containing the values of the `index` and `columns` attributed ||
||`columns` ||[[Python/Pandas/Types#Index|Index]] listing the column names ||
||`dtypes` ||[[Python/Pandas/Series|Series]] listing the [[Python/NumPy/Types#ObjectDType|dtype]] of each column ||
||`iloc` ||[[Python/Pandas/Types#A_ILocIndexer|indexable accessor of member values]] ||
||`index` ||[[Python/Pandas/Types|RangeIndex]] containing the member indices ||
||`loc` ||[[Python/Pandas/Types#A_LocIndexer|indexable accessor of member values]] ||
||`shape` ||[[Python/Builtins/Types#Tuple|tuple]] of 2 [[Python/Builtins/Types#Int|ints]] representing number of rows and columns||
||`size` ||`int` count of member values ||
||`values` ||nested [[Python/NumPy/Types#NDArray|numpy.ndarray]] containing the member values ||

----



== Methods ==

These methods return [[Python/NumPy/Types#Float64|numpy.float64]] values unless otherwise specified.

||'''Method'''||'''Meaning''' ||'''Example''' ||
||`head` ||return a new `DataFrame` of the first N rows ||`df.head(5)` ||
||`info` ||print information including types and null values || ||
||`squeeze` ||return a [[Python/Pandas/Series|Series]] view of the frame|| ||
||`sum` ||return a `Series` of sums for each row or column ||`df.sum(axis="columns"); df.sum(axis="index")`||
||`tail` ||return a new `DataFrame` of the last N rows ||`df.tail(5)` ||



----
CategoryRicottone