Dataframe
Helpers for dealing with pandas.DataFrames
assert_frame_equal(left, right, **kwargs)
Asserts that two dataframes are equal regardless of their order of rows
Parameters:
Name | Type | Description | Default |
---|---|---|---|
left |
DataFrame
|
A dataframe, usually the result of a function under test |
required |
right |
DataFrame
|
Another dataframe, usually what we expect in a test |
required |
**kwargs |
Any
|
Keyword arguments of pandas.testing.assert_frame_equal https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.testing.assert_frame_equal.html |
{}
|
Source code in bquest/dataframe.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
standardize_frame_numerics(df, float_precision=2)
Standardizes numerics inside a dataframe to facilitate comparison between dataframes with respect to meaningful differences.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
Pandas dataframe to be standardized |
required |
float_precision |
int
|
level of precision for rounding floats |
2
|
Returns:
Type | Description |
---|---|
DataFrame
|
Standardized dataframe |
Source code in bquest/dataframe.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|