I am trying to create a new column in my pandas dataframe that is the result of a basic mathematical equation performed on other columns in the dataset. The problem now is that the values captured in the column are extremely rounded up and does not represent the true values.
2.5364 should not be rounded off to 2.5 and 3.775 should not be rounded off to 3.8
I have tried to declare the denominators as floats in a bid to trick the system to supply values that look like that. ie 12/3.00 should be 4.00 but this is still returning 4.0 instead.
This is currently what I am doing:
normal_load = 3
df['FirstPart_GPA'] = ((df[first_part].sum(axis = 1, skipna = True))/(normal_load*5.00))
I set skipna to true because sometimes a column might not have any value but I still want to be able to calculate the GPA without the system throwing out any errors since any number plus NAN would give NAN.
I am working with a dataframe that looks like this:
dict = {'course1': [15,12],
'course2': [9,6],
'course3': [12,15],
'course4': [15,3],
'course5': [15,9],
'course6': [9,12]}
df = pd.DataFrame(dict)
Note that the dataframe I have contains some null values because some courses are electives. Please help me out. I am out of ideas.