0

Disclaimer: Please pardon me if this comes out to be too basic or a stupid question. I am a complete noob trying to figure out Python on the job. Now since that's out of the way, here is my problem.

I have 2 columns, Date and Sales. I need to split the Sales data based on a date Condition, thereby creating a new Column for Eg,

if Date >= 6/1/2022 then Sales_H2 = Sales
else Sales_H2 = 0

I have the SAS Code with me, but I need to convert the Code into Python. I could use Pandas, Numpy, or any other library. Below is the SAS Code

data input.&dat.;
set input.&dat.;
if Period ge '6JUN2022'd then
Sales_H222=Sales;
else
Sales_H222=0;
Dirk Horsten
  • 3,753
  • 4
  • 20
  • 37

0 Answers0