'IF Condition || add Colum [duplicate]

I'm new in python thanks to support as i have excel sheet with data mostly number that imported to python pandas . column " Stuff time " which contain Number that need to make (if function) in it as if number is less than 14400 put 0 & if number >32400 put 32400 if not will put the exist number ex:

below how it's done in excel that i want in python

1-33181 = ( if(33181 <14400,0 ,if  33181 >32400,32400 , 33181 ) = 33181
2-12000 = ( if(12000 <14400,0 ,if  12000 >32400,32400 , 12000 ) = 12000 

i need to add column lets call it ( New Stuff time ) with cacaltion to be applied in raw more that 10000 rows

to put more clear view condition in excel if ( number )<1400 ,( Zero ) , if ( number )>32400 , 32400 , ( put the number that exist )



Solution 1:[1]

Use clip

df["new stuff time"] = df["stuff time"].clip(14400, 32400)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Stuart