intake / akimbo

For when your data won't fit in your dataframe
https://akimbo.readthedocs.io
BSD 3-Clause "New" or "Revised" License
30 stars 6 forks source link

Add array property to accessor #22

Closed douglasdavis closed 1 year ago

martindurant commented 1 year ago

+1

douglasdavis commented 1 year ago

Adding a way to grab the "raw" awkward array from the accessor.

With:

>>> import awkward as ak
>>> import awkward_pandas
>>> import pandas as pd
>>> a = ak.from_iter([[1, 2, 3], [4, 5], [6]])
>>> s = pd.Series(awkward_pandas.AwkwardExtensionArray(a))

With the difference between

>>> s.ak.array[0]
<Array [1, 2, 3] type='3 * int64'>

and

>>> s.ak[0]
0    1
1    2
2    3
dtype: awkward

being that the array getitem of course returns an awkward array, while using getitem through the pandas Series accessor provides an interface for doing an awkward getitem call, but will post-process back into a pandas object before returning

@jpivarski