Skip to content

float(’25’) works but int(‘25.2’) doesn’t. Why?

Why do I get an error on int(‘25.2′) and don’t get one on float(’25’)? Answer Python is trying to prevent you from accidentally losing the information after the decimal point by converting a string to an integer when you should have converted it to a float. However, it does allow…

Create rolling average pandas

I have a dataset of esports data like this: (done using pd.to_clipboard() I want to create a dataframe that essentially, for each team, every week, creates a rolling X game average of their points scored. (X could be 2, 3, 4, etc). A few notes: This example only shows points, the actual data has about 10 feat…