How come the result of the .iloc is not a list?

Question

How come the result of the .iloc is not a list? Why does it show a series?

Answer

When using iloc in Pandas, it will return a specified row, but in the form of a Series.

The left column in the result is composed of indexes which are the column names from the dataframe. And the right column is composed of the values for each column in the row of data.

This is a helpful feature in Pandas because it displays all the information about the columns and values of a row in a clear way.

5 Likes

So basically, it takes the data from the list and creates a different series?

It creates a series from the table. The result set is called the Series, which is a form of the table that you choose to create.