Question: Python Pandas HELP!! I need help mapping values from a column in a pandas dataframe to binary (strings). For example, in the dataset below I

Python Pandas HELP!!

I need help mapping values from a column in a pandas dataframe to binary (strings). For example, in the dataset below

Python Pandas HELP!! I need help mapping values from a column in

I want to map values higher than 150 from column 'Sell' to 'Yes', and those less than 150 to 'No', so that the new 'Sell' column will look like:

a pandas dataframe to binary (strings). For example, in the dataset below

It is a large dataset so please provide a solution that is NOT MANUAL, but automatically maps all values to either 'Yes' or 'No'. Thanks!!!

In [2]: df.head() Out[2] : Sell "List" 0 142 160 1 175 180 2 129 132 3 138 140 4 232 240 In [2]: df.head() Out[2]: Sell "List" 0 No 160 1 Yes 180 N No 132 3 No 140 4 Yes 240

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!