Ordering columns

In [6]:
import numpy as np
import pandas as pd 

df = pd.read_csv("bank.csv", sep=';') 

# Showing first 5 rows
df[:5]
Out[6]:
age job marital education default balance housing loan contact day month duration campaign pdays previous poutcome y
0 30 unemployed married primary no 1787 no no cellular 19 oct 79 1 -1 0 unknown no
1 33 services NaN secondary no 4789 yes yes cellular 11 may 220 1 339 4 failure no
2 35 management single tertiary no 1350 yes no cellular 16 apr 185 1 330 1 failure no
3 30 management married tertiary no 1476 yes yes unknown 3 jun 199 4 -1 0 unknown no
4 59 blue-collar married secondary no 0 yes no unknown 5 may 226 1 -1 0 unknown no
In [7]:
df = df [['job', 'education', 'marital', 'age']]

df[:5]
Out[7]:
job education marital age
0 unemployed primary married 30
1 services secondary NaN 33
2 management tertiary single 35
3 management tertiary married 30
4 blue-collar secondary married 59
In [ ]: