Question: What are the key attributes of a DataFrame?
Answer: Pandas DataFrame can be characterized along several attributes, such as:
- Shape
- Size
- Number of dimensions
- Set of column names
- Set of case indices
A convenient way to access multiple DataFrame’s attributes in a row is by using the .info method. Per the code snippet below (see lines 18-26), we know that df has three entries and as many indices, two columns (an object, country, and a float gdp_pc), and occupies circa 176 bytes in memory.
The bottom section of the code snippet shows how to access the individual attributes of a DataFrame using .shape, .size, .ndim, and .memory_usage.