Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas dataframe column based on another column

df['c2'] = np.where(df.c1 == 8,'T', 'F')

   c1  c2  c3
0   4   F   1
1   8   T   9
2   1   F   8
3   3   F   5
4   3   F   8
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #dataframe #column #based #column
ADD COMMENT
Topic
Name
7+7 =