Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

all select first value in column list pandas

df['new_col'] = df.A.apply(lambda x: x[0])
print df
        A  new_col
0  [1, 2]        1
1  [3, 4]        3
2  [8, 9]        8
3  [2, 6]        2
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #select #column #list #pandas
ADD COMMENT
Topic
Name
9+6 =