Parts of a DataFrame
To better understand DataFrame objects, it's useful to know that they consist of three components, stored as attributes:
.values
: A two-dimensional NumPy array of values..columns
: An index of columns: the column names..index
: An index for the rows: either row numbers or row names.
You can usually think of indexes as a list of strings or numbers, though the pandas Index
data type allows for more sophisticated options. (These will be covered later in the course.)
homelessness
is available.
This exercise is part of the course
Data Manipulation with pandas
Exercise instructions
- Import
pandas
using the aliaspd
. - Print a 2D NumPy array of the values in
homelessness
. - Print the column names of
homelessness
. - Print the index of
homelessness
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import pandas using the alias pd
____
# Print the values of homelessness
____
# Print the column index of homelessness
____
# Print the row index of homelessness
____