-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from DanielAvdar/init
Add Support for Unsigned Integer Data Types and Expand Documentation.
- Loading branch information
Showing
9 changed files
with
94 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
from pandas_pyarrow.pda_converter import PandasArrowConverter | ||
from tests.unit.property_based.pb_sts import df_st | ||
from pandas_pyarrow import convert_to_pyarrow | ||
from tests.unit.property_based.pb_sts import COMMON_DTYPES_SAMPLE, UNCOMMON_DTYPES_SAMPLE, df_st | ||
|
||
import hypothesis as hp | ||
|
||
|
||
@hp.given(df=df_st()) | ||
@hp.settings(max_examples=500) | ||
def test_dtypes_hp(df): | ||
@hp.given(df=df_st(dtypes=COMMON_DTYPES_SAMPLE + UNCOMMON_DTYPES_SAMPLE)) | ||
def test_uncommon_dtypes_hp(df): | ||
df_copy = df.copy() | ||
sa = PandasArrowConverter() | ||
adf = sa(df) | ||
adf = convert_to_pyarrow(df) | ||
|
||
new_dtypes_names = [repr(i) for i in adf.dtypes.tolist()] | ||
is_arrows = ["[pyarrow]" in dtype for dtype in new_dtypes_names] | ||
assert all(is_arrows), "Some dtypes are not converted" | ||
assert not df.equals(adf), "The original df has been modified" | ||
assert df.equals(df_copy), "The original df has been modified" | ||
assert adf.equals(sa(adf)), "The conversion is not idempotent" | ||
assert adf.equals(convert_to_pyarrow(adf)), "The conversion is not idempotent" | ||
|
||
|
||
@hp.given(df=df_st(dtypes=COMMON_DTYPES_SAMPLE)) | ||
def test_common_dtypes_hp(df): | ||
adf_pd_api = df.convert_dtypes(dtype_backend="pyarrow") | ||
adf = convert_to_pyarrow(df) | ||
assert adf_pd_api.compare(adf).empty, "The conversion is not consistent with pandas api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters