I have a dataframe like this:
TechId Rating Category LateNight Weekend Weekdays
001 5 Teacher 1 1 0
002 4 Student 0 1 1
003 3 Driver 1 0 1
004 1 Teacher 1 0 1
005 1 Student 1 1 0
006 0 Teacher 1 1 1
007 2 Teacher 0 0 1
I wanted to find if the Category = Teacher is available on Weekdays, that should display TechID 003,006 & 007 in the output.
I tried this code,
Category = int(input("Enter the Trade ID you want technicians in:"))
Latenight = int(input("Press 1 if you want technicians in Latenight/else press 0:"))
Weekends = int(input("Press 1 if you want technicians in Weekends/else press 0:"))
WeekDays = int(input("Press 1 if you want technicians in WeekDays/else press 0:"))
df2 = df1_new[(df1_new['Category'] == Category) &(df1_new['Weekends'] == Weekends) & (df1_new['LateNight'] == Latenight)]
df2 = df1_new[(df1_new['Category'] == Category) &(df1_new['WeekDays'] == WeekDays) & (df1_new['LateNight'] == Latenight)]
df2 = df1_new[(df1_new['Category'] == Category) &(df1_new['WeekDays'] == WeekDays) & (df1_new['LateNight'] == Latenight) & (df1_new['Weekends'] == Weekends)]
df2_new= df2.sort_values(by=['divcount'], ascending=False)
df2_new.head()
Enter the Category you want : Teacher
Press 1 if you want technicians in Latenight/else press 0:0
Press 1 if you want technicians in Weekends/else press 0:0
Press 1 if you want technicians in WeekDays/else press 0:1
But this displays only TechID 007 row. Some TechID might be available on both Weekend & weekdays. That should also be considered. Can anyone help me out?