Earlier, we could get mismatches with rounded floats. For example, in the example below, the 2 frames would not be considered equal
import pandas as pd
from pandas.testing import assert_frame_equal
df1 = pd.DataFrame([[1,2.123,"abc"], [2, 3.123, "xyz"]])
df2 = pd.DataFrame([[1,2.1234,"abc"], [2, 3.1234, "xyz"]])
assert_frame_equal(df1, df2) # throws an error
However, there are instances where we want to specify a float rounding limit beyond which both values are considered equal. In pandas, can do this with df.round(n), where n refers to the number of decimal points. The function takes care of only rounding floats, and not modifying int, bool, object columns
import pandas as pd
from pandas.testing import assert_frame_equal
df1 = pd.DataFrame([[1,2.123,"abc"], [2, 3.123, "xyz"]])
df2 = pd.DataFrame([[1,2.1234,"abc"], [2, 3.1234, "xyz"]])
assert_frame_equal(df1.round(3), df2.round(3)) # runs fine
This PR enabled a new, optional, decimal_points argument for rounding floats. This has been implemented for all runners. Here is an example specifying this for the OpenAI runner
Earlier, we could get mismatches with rounded floats. For example, in the example below, the 2 frames would not be considered equal
However, there are instances where we want to specify a float rounding limit beyond which both values are considered equal. In
pandas
, can do this withdf.round(n)
, wheren
refers to the number of decimal points. The function takes care of only rounding floats, and not modifyingint
,bool
,object
columnsThis PR enabled a new, optional,
decimal_points
argument for rounding floats. This has been implemented for all runners. Here is an example specifying this for the OpenAI runner