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

Unable to change values in awkward-typed dataframe column (NotImplementedError) #43

Open dorianjaubert opened 9 months ago

dorianjaubert commented 9 months ago

Hello!

I have just discovered awkward and awkward-pandas, and they happen to be perfectly what I have been needing for quite long. I am processing some tests to replace my old list-based implementation with them, but unfortunately, a basic assignment through pandas .loc seems not being supported.

The traceback is pointing towards the following method in array.py: def __setitem__(self, key, value): raise NotImplementedError

Is there any reason for that feature not being implemented or is it planned to implement in the future? It would be very nice if it could be, because the ability of changing values inside awkward columns sounds to be part of the basic set of operations one can expect !

martindurant commented 9 months ago

awkward arrays are immutable in principle, although the buffers they contain are (usually) numpy. You probably want to use ak.where to merge old and new values on a condition. We could enable setting values for primitive types, but you can imagine how things could go wrong with setting whole variable/nested structures.