Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for converting pyarrow DataFrame to numpy #98

Merged
merged 6 commits into from
Jul 29, 2024
Merged

Conversation

DanielAvdar
Copy link
Owner

Introduced a new function convert_to_numpy to reverse convert pyarrow DataFrame to numpy dtypes. Added a unit test to ensure the conversions are accurate and consistent with expected numpy dtypes.

Introduced a new function `convert_to_numpy` to reverse convert pyarrow DataFrame to numpy dtypes. Added a unit test to ensure the conversions are accurate and consistent with expected numpy dtypes.

Signed-off-by: DanielAvdar <66269169+DanielAvdar@users.noreply.github.com>
Included convert_to_numpy in __all__ for module exports and updated relevant imports in tests. This change ensures convert_to_numpy is accessible and properly tested across the library.

Signed-off-by: DanielAvdar <66269169+DanielAvdar@users.noreply.github.com>
Previously, strings were not explicitly handled in the reverse converter, which could lead to inconsistencies. This commit ensures that columns with string dtype are converted to object type, improving the dtype consistency and compatibility.

Signed-off-by: DanielAvdar <66269169+DanielAvdar@users.noreply.github.com>
Ensure the conversion from pandas to numpy via pyarrow is idempotent by asserting the result is unchanged on a second conversion. Additionally, check that the original dataframe remains unaltered during the process.

Signed-off-by: DanielAvdar <66269169+DanielAvdar@users.noreply.github.com>
Copy link

codecov bot commented Jul 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (6ce80bc) to head (e7220c0).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #98   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         8    +1     
  Lines           59        77   +18     
=========================================
+ Hits            59        77   +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Changed the paths in the Codecov workflow configuration to ensure it only runs when relevant files, including the codecov.yml, are modified. This improves the efficiency of our CI/CD pipeline by reducing unnecessary runs.

Signed-off-by: DanielAvdar <66269169+DanielAvdar@users.noreply.github.com>
Created tests for converting data back from PyArrow to Numpy. These tests ensure the correct data types after conversion for timestamps, half floats, durations, and strings. They validate that PyArrow types do not persist in the resulting Numpy dataframes.

Signed-off-by: DanielAvdar <66269169+DanielAvdar@users.noreply.github.com>
@DanielAvdar DanielAvdar merged commit 22b9078 into main Jul 29, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant