0

I need to write a function to ask the user to enter the region and the property type, and then return all properties that are in the specified region and of the type the user requested. I can do this using normal text files, but I have no idea how to search for these conditions inside a pandas data frame as I have little knowledge of the pandas library.

I looked at examples online and tried this with no success:

property_types(propType, region):
    df2 = df.loc[:, 'Region Code':'propertyType']

    result = pd.concat([df2], axis=1, join='inner').where(df2["Region"] == region).where(df2["propertyType"] == propType)
    result = pd.DataFrames(result)
    result.dropna(inplace=True)
    print(result)type here

This should return all columns in the correct region and of the correct property types but the else statement is returned instead.

0 Answers0