gjoseph92 / soundDB

Query and load NSNSD acoustic data into Python, minimize pain
Other
5 stars 1 forks source link

More robust combining than concatenation when grouping #15

Open gjoseph92 opened 7 years ago

gjoseph92 commented 7 years ago

concat_maybe() might need to use the same logic as combine() to promote data when possible. This is especially relevant for panels (which combine() could handle better anyway).

Consider a couple examples:

soundDB.loudevents(ds).group("year")["above"].median(axis=0).combine()

Here, loudevents returns panels, which don't seem to concatenate well. But it works as

soundDB.loudevents(ds)["above"].group("year").median().combine()

because by immediately slicing into the "above" item, it drops down to DataFrames, which concatenate nicely.

Also,

soundDB.loudevents(ds)["above"].median(axis=0).group("year").combine()

This one's a bit odd, because it might not be a valid use case anyway (not sure what it is suppose dto actually mean). But, the input Series to the group() all have the same indicies, so perhaps they should become a DataFrame instead. (But what are the columns? concat_maybe would need the Entry as well.)