Convert pandas DataFrame to Series in Python (Example) | Create from Row | Apply squeeze() Function

preview_player
Показать описание
Python code of this video:

import pandas as pd # Load pandas library

data = pd.DataFrame({'x1':[10], # Create pandas DataFrame
'x2':[20],
'x3':[30],
'x4':[40],
'x5':[50]})
print(data) # Print pandas DataFrame

print(my_series) # Print pandas Series
# x1 10
# x2 20
# x3 30
# x4 40
# x5 50
# Name: 0, dtype: int64

Follow me on Social Media:

Рекомендации по теме
Комментарии
Автор

Great video! What if I want to create multiple series from all columns?

yampol
Автор

That's good
Can we convert the whole titanic Data frame in series with this code?

kid_video_play_rec_food_clock