Creating a Pandas Data Frame Series 1

Creating a Pandas Data Frame Series

In [5]: ages = pd.Series([22, 35, 58], name="Age")

In [6]: ages
Out[6]: 
0    22
1    35
2    58
Name: Age, dtype: int64

Here is what the above code is Doing:
1. We create a list of ages, and then convert it to a Series.
2. We give the Series a name, which is “Age”.
3. We print the Series.

Similar Posts