isdsucph / isds2021

Introduction to Social Data Science 2021 - a summer school course https://isdsucph.github.io/isds2021/
MIT License
22 stars 37 forks source link

Ex. 0.4.3 #7

Open Cxf461 opened 3 years ago

Cxf461 commented 3 years ago

Hi,

I do not know how to solve Ex. 0.4.3 as I do not know how to select ITE00100550 and maximum temperature with loc or iloc.

Should I just skip it, or can this be taught somewhere?

joachimkrasmussen commented 3 years ago

Hi,

I just found a guide (link here) that describes this fairly well. Pay particular attention to the section Select DataFrame Rows Based on multiple conditions on columns.

Does this help you?

Best, Joachim

Konstantin-Babayan commented 2 years ago

Hey Joachim

I have tried to use your link together with this one: https://thispointer.com/pandas-find-maximum-values-position-in-columns-or-rows-of-a-dataframe/

I end up with this answer:

df_select = df_sub_weather[ (df_sub_weather["station"] == "ITE00100550") & (df_sub_weather["obs_value"].max())]

df_select

with the output: Screenshot 2021-07-24 at 13 49 10

can you explain what I am doing wrong her?

Best

Konstantin

joachimkrasmussen commented 2 years ago

Try and take a closer look at your dataframe (i.e. print different sets of rows with the iloc method). What values are contained in the row _obstype? What do these mean? And finally, how can you use this knowledge in the line of code above?

Best, Joachim

Konstantin-Babayan commented 2 years ago

Thank you Joachim, I have figured it out!