1# Import modules
2import pandas as pd
3
4# Set ipython's max row display
5pd.set_option('display.max_row', 1000)
6
7# Set iPython's max column width to 50
8pd.set_option('display.max_columns', 50)
9# Create an example dataframe
10data = {'name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'],
11 'year': [2012, 2012, 2013, 2014, 2014],
12 'reports': [4, 24, 31, 2, 3]}
13df = pd.DataFrame(data, index = ['Cochice', 'Pima', 'Santa Cruz', 'Maricopa', 'Yuma'])
14df
15
16#List unique values in the df['name'] column
17df.name.unique()
1In [33]: df[df.columns[df.apply(lambda s: len(s.unique()) > 1)]]
2Out[33]:
3 A B
40 0 a
51 1 b
62 2 c
73 3 d
84 4 e
9