Trying to only use python installed libraries and pandas library because I am a complete novice. I am wrapping up a 6 week python foundations course.
For a final project, I am making a plant buying guide. Based on a series of questions I am asking the user, I am parsing out a data frame containing 60 entries. To give you an idea, the first section of my question created a filtered data frame using this code
care_df = df.loc[
lambda x:
(x['sunlight'].str.lower().str.contains(user_sunlight_pref.lower()))
& (x['watering_levels'].str.lower().str.contains(user_water_pref.lower()))
& (x['humidity_preference'].str.lower().str.contains(user_humidity_pref.lower()))
]
where user_sunlight_pref stored user input (ie maybe they chose 'Indirect light' as their sunlight preference).
NOW, I am on my second section of questions where I begin to ask about height and spread. The data frame columns I will be searching for have this format of entry: '1.00 to 2.00 feet'.
MY QUESTION/PROBLEM: For the user questions, I've tried to make descriptive ranges that I present to the user as possible options that they submit as their input:
"Desk range- plants that are appropriate for desks and surfaces, like short bookshelves or corner areas."
" These plants will not block eyesight."
On the back end, I want to create a numeric range, like 'desk range' = anything between 0.25 to 1.50,that I could then use to search through my data frame. am having trouble thinking through what type(s) to use, how to create a range for my dataframe column values (like 1.00 to 2.00)feet......
***or the cop-out would be I manually categorize the plant entries into their appropriate descriptive range, but then I run into a similar issue: I could do something like:
if user_height_pref == 'Desk range'
user_height_pref = [0.25 to 1.00 feet, 0.25 to 0.75 feet, 1.00 to 1.50 feet...]
but then how do I search through through my dataframe height column? Unsure of how to search/match elements of this list to my dataframe column (using a similar code as care_df)