Python Pandas GroupBy Help

Question

I'm having a difficult time determining the solution to this question and could use some help/guidance on the way to tackle it:

Question: using group by methods (not pivot table), write code to display a list of only those customer IDs that have at least 1 business account and that are under 50 years of age.



Provided information:

#The lines of code below display two real-world data sets: the first contains customer ID and their
#corresponding accounts IDs, along with account tenure in months and account type (business or 
#consumer). The second contains customer IDs and their corresponding age in years.

import pandas as pd
df1=pd.DataFrame({'custID':[1,1,2,2,2,3,3,4,4],
                  'accountID':[1,2,1,2,3,1,2,1,2],
                  'tenure_mo':[2,3,4,4,5,6,6,6,7],
                 'account_type':['BusiNESS','CONSUMER',
                                'consumer',
                                'BUSINESS',
                                'BuSIness',
                                'CONSUmer',
                                'consumer',
                                'CONSUMER',
                                'BUSINESS']},columns=['custID','accountID','tenure_mo','account_type'])
print(df1)
df2=pd.DataFrame({'custID':[1,2,3,4],
                 'cust_age':[20,35,50,85]},columns=['custID','cust_age'])
print(df2)


Details
Purchase An Answer Below

Have a similar question?