filmov
tv
Get List of Column Names Grouped by Data Type in Python (Example) | to_series() & groupby() Function
Показать описание
Python code of this video:
import pandas as pd # Import pandas library in Python
data = pd.DataFrame({'x1':['a', 'b', 'c', 'd', 'e'], # Create example DataFrame
'x2':range(6, 1, - 1),
'x3':[2, 5, 5, 8, 3],
'x4':['x', 'x', 'x', 'x', 'x'],
'x5':range(1, 6)})
print(data) # Print example DataFrame
# {int64: ['x2', 'x3', 'x5'], object: ['x1', 'x4']}
Follow me on Social Media:
import pandas as pd # Import pandas library in Python
data = pd.DataFrame({'x1':['a', 'b', 'c', 'd', 'e'], # Create example DataFrame
'x2':range(6, 1, - 1),
'x3':[2, 5, 5, 8, 3],
'x4':['x', 'x', 'x', 'x', 'x'],
'x5':range(1, 6)})
print(data) # Print example DataFrame
# {int64: ['x2', 'x3', 'x5'], object: ['x1', 'x4']}
Follow me on Social Media: