Python Forum
How to check spec table in another df
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to check spec table in another df
#1
Hi,
I have data frame as below:

group subgroup category name   T    S     P     R
A1      W           1           MAK     2    5.1  2     6 
A1      L            2           RAL      2    5     2     8
C1      L            2           GAH     2    6     1.2  6
C1      W           1           JKA      2    5     2     6
S5      W           1           NMP     2    5     2     6
S5      W           2           NMP     2    5     2     6
C1      W           2           AAA      2    5     2     6
A1      W           2           TTY      2    5.1  2    4  


Spec_df:
group subgroup category    T      S     P     R
A1      W           1               1.2  4.3   2.6    6 
A1      L            2                2    2.3   2     6
C1      L            2                2    6     1.2   6
C1      W           1                2    5     2     6
S5      W           1                1.5  5     2     6
S5      W           2                2     5     2     6
C1      W           2                2     5     2     6
A1      W           2                0.3  3.6   1.3   4 

I want to check  the spec for each "T, S,P" column based on group, subgroup, category. Any fast way to do this?  I did this using df.iterrows, and separte each condition based on  group, subgroup, category, which is become too big loop. 

if value in df > spec in spec_df, then mark as 1, else 0 for (T_F, S_F, P_F)
for example:

group subgroup category name   T_F    S _F    P_F   R
A1      W           1           MAK      1       0         0     6
A1      L            2           RAL       0        0        0     8
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Check table exists in Database ARV 0 1,911 Oct-03-2019, 02:37 PM
Last Post: ARV
  Python code to check SQL table for current date PYTHONDUDE 3 2,886 May-16-2018, 02:27 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020