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

Problem 0.4.4 #12

Closed lassearpe closed 3 years ago

lassearpe commented 3 years ago

Hi everyone,

I seem to have a great deal of trouble trying to figure out how to add decimals to values in a column.

According to my reading of the readme.txt file, degress celsius should be reported with decimals in the tens.

As of now I am trying df_select.round({'obs_value': 2}) without any luck.

Also.. since all of the values are reported as integers, all the decimal values would just be ".00", right?...

All help appreciated, Lasse

lassearpe commented 3 years ago

Follow up: since they all are integers, should they be transformed to floats then?

joachimkrasmussen commented 3 years ago

Hi Lasse,

I am not 100% sure what you are doing here and what the core of the issue is, but let me try and provide some context and hints. Hopefully, it will help you - otherwise, let me know!

First, you should notice that the data do not come in the appropriate celcius format. You need to transform the data in a way similar to df['A'] = df['A']*x, where x is an appropriate scale.

Then you need to make a second transformation to Fahrenheit. Here, you should do something similar to df['B'] = df['A']*b+a. Does this make sense?

Best, Joachim

lassearpe commented 3 years ago

Yes it does!

Thanks. Lasse