Computer scienceData scienceInstrumentsPandasStoring data with pandas

Accessing data in a DataFrame

Air Force hierarchy

Report a typo

We have a DataFrame containing the U.S. Air Force Skill Groups:

afcs = pd.DataFrame({'code': [1, 3, 5, 7, 9],
                     'skill_level': ['helper', 'apprentice', 'journeyman', 'craftsman', 'superintendent']})
afcs.head()
+----+--------+----------------+
|    |   code | skill_level    |
|----+--------+----------------|
|  0 |      1 | helper         |
|  1 |      3 | apprentice     |
|  2 |      5 | journeyman     |
|  3 |      7 | craftsman      |
|  4 |      9 | superintendent |
+----+--------+----------------+

We set the code column as index:

afcs.set_index('code', inplace=True)
afcs.head()

Output:

+--------+----------------+
|        | skill_level    |
|--------+----------------|
|   code |                |
|--------+----------------|
|      1 | helper         |
|      3 | apprentice     |
|      5 | journeyman     |
|      7 | craftsman      |
|      9 | superintendent |
+--------+----------------+

What will the output of afcs.index be?

Note that this task assumes the usage of pandas≥2.0.0
Select one option from the list
___

Create a free account to access the full topic