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

Dataframe containing a Segarray .__str__() bug #3158

Closed
stress-tess opened this issue May 6, 2024 · 0 comments · Fixed by #3161
Closed

Dataframe containing a Segarray .__str__() bug #3158

stress-tess opened this issue May 6, 2024 · 0 comments · Fixed by #3161
Assignees
Labels
bug Something isn't working

Comments

@stress-tess
Copy link
Member

stress-tess commented May 6, 2024

attempting to print a dataframe containing a segarray results in AttributeError: 'SegArray' object has no attribute 'nbytes'

df_dict = dict()
num_rows = 10
val_size = num_rows
first_last_empty_vals = ak.randint(-2**10, 2**10, val_size)
first_last_empty_segs = ak.concatenate([ak.array([0,0,0]), ak.sort(ak.randint(0, val_size, num_rows-6)), ak.array([val_size, val_size, val_size])])
sa = ak.SegArray(first_last_empty_segs, first_last_empty_vals)
df_dict['all_in_first'] = sa

# this works
print(ak.DataFrame(df_dict).__repr__())

# this doesn't
print(ak.DataFrame(df_dict).__str__())
@stress-tess stress-tess self-assigned this May 6, 2024
@stress-tess stress-tess added the bug Something isn't working label May 6, 2024
@stress-tess stress-tess changed the title printing dataframe containing a segarray bug dataframe containing a segarray .__str__() bug May 6, 2024
@stress-tess stress-tess changed the title dataframe containing a segarray .__str__() bug Dataframe containing a Segarray .__str__() bug May 6, 2024
stress-tess added a commit to stress-tess/arkouda that referenced this issue May 6, 2024
… bug

This PR (closes Bears-R-Us#3158) fixes bug when printing a dataframe containing a segarray. To handle this I added an `nbytes` attribute to segarray which just wraps the underlying values. I also modified the series init to not assume that when `data` is a list that it contains 2 elements (the first being the data and the second being the index) when the `index` is provided.
github-merge-queue bot pushed a commit that referenced this issue May 6, 2024
This PR (closes #3158) fixes bug when printing a dataframe containing a segarray. To handle this I added an `nbytes` attribute to segarray which just wraps the underlying values. I also modified the series init to not assume that when `data` is a list that it contains 2 elements (the first being the data and the second being the index) when the `index` is provided.

Co-authored-by: Tess Hayes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant