Python Fit Function To Dataframe Function In R