Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Python :: playsound moudle python 
Python :: plot python x axis range 
Python :: python loop through list 
Python :: how to execute a cmd command in python 
Python :: godot string format 
Python :: dot product python 
Python :: rename columns in datarame pandas 
Python :: python change cmd title 
Python :: gspread send dataframe to sheet 
Python :: python previous answer 
Python :: web server python 
Python :: parquet pyspark 
Python :: how to replace nan values with 0 in pandas 
Python :: location of python in cmd 
Python :: all possible combinations of parameters 
Python :: How to get the current user email from the account logged in? odoo 
Python :: first day of the month python 
Python :: how to clear a pickle file 
Python :: how to show webcam in opencv 
Python :: how to find duplicate numbers in list in python 
Python :: how to pick a random english word from a list 
Python :: python range backward 
Python :: dropping columns in pandas 
Python :: python convert remove spaces from beginning of string 
Python :: save a seaborn heatmap 
Python :: python read from txt file 
Python :: The `.create()` method does not support writable nested fields by default. Write an explicit `.create()` method for serializer `room_api.serializers.roomSerializer`, or set `read_only=True` on nested serializer fields. 
Python :: nan float python 
Python :: remove outliers numpy array 
Python :: how to delete nan values in python 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =