Skip to content

Commit

Permalink
Merge pull request #125 from FAST-HEP/BK_fix_explode_second_chunk
Browse files Browse the repository at this point in the history
Fix explode function for second and subsequent chunks
  • Loading branch information
benkrikler authored Jun 16, 2020
2 parents 7f887b9 + 9b9ff29 commit 3e87041
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.18.1] - 2020-06-17
### Fixed
- Fix binned_dataframe.explode for object-level and non-initial data chunks, PR #125

## [0.18.0] - 2020-06-17
### Added
Expand Down
2 changes: 1 addition & 1 deletion fast_carpenter/summary/binned_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def explode(df):
# get the list columns
lst_cols = [col for col, dtype in df.dtypes.items() if is_object_dtype(dtype)]
# Be more specific about which objects are ok
lst_cols = [col for col in lst_cols if isinstance(df[col][0], _explodable_types)]
lst_cols = [col for col in lst_cols if isinstance(df[col].iloc[0], _explodable_types)]
if not lst_cols:
return df

Expand Down
2 changes: 1 addition & 1 deletion fast_carpenter/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ def split_version(version):
return tuple(result)


__version__ = '0.18.0'
__version__ = '0.18.1'
version_info = split_version(__version__) # noqa
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.18.0
current_version = 0.18.1
commit = True
tag = False

Expand Down
5 changes: 5 additions & 0 deletions tests/summary/test_binned_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ def test_explode():
exploded = bdf.explode(pd.DataFrame(columns=["one", "two", "3"]))
assert exploded.empty is True

df.index = np.arange(len(df)) + 100
exploded = bdf.explode(df)
assert len(exploded) == 1 + 8 + 3
assert np.array_equal(exploded.list, [0, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2])


def test_densify_dataframe_integers():
index = [("one", 1), ("one", 3), ("two", 2), ("three", 1), ("three", 2)]
Expand Down

0 comments on commit 3e87041

Please sign in to comment.