1# Df with a coulmn (dims) that contain list
2key1 = 'site channel fiscal_week'.split()
3key2 = 'site dude fiscal_week'.split()
4key3 = 'site eng fiscal_week'.split()
5
6keys = pd.DataFrame({'key': [1,2,3],
7 'dims': [key1,key2,key3]})
8
9# Output
10 dims key
11[site, channel, fiscal_week] 1
12[site, dude, fiscal_week] 2
13[site, eng, fiscal_week] 3
14
15
16# Solution
17keys['reduced_dims'] = keys['dims'].apply(
18 lambda row: [val for val in row if val != 'fiscal_week']
19)
20