Python-Data-Wrangling-Legacy icon indicating copy to clipboard operation
Python-Data-Wrangling-Legacy copied to clipboard

Explain `.round()`

Open tomvannuenen opened this issue 3 years ago • 0 comments

Using .round() in Manipulating Columns needs to be explained. If we don’t use it, we will not get to a full integer and then calling int() will truncate. Compare ((unemployment['year_month'] - unemployment['year']) * 100).astype(int) and ((unemployment['year_month'] - unemployment['year']) * 100).round(0).astype(int) - the first starts at 0, second starts at 1

tomvannuenen avatar Oct 25 '22 00:10 tomvannuenen