After research, I did not find similar questions on this or any other forum.
I group the MultiIndex framework by its internal level. The thing is, after grouping, I still want to know what the "selected values" were for this internal index.
So I have something like
df = pd.DataFrame([['A', 1, 3],
['A', 2, 4],
['A', 3, 6],
['B', 1, 9],
['B', 2, 10],
['B', 4, 6]],
columns=pd.Index(['Name', 'Date', 'Value'], name='ColumnName')
).set_index(['Name', 'Date'])
ColumnName Value
Name Date
A 1 3
2 4
3 6
B 1 9
2 10
4 6
I wanted
ColumnName Value
Name Date
A 3 6
B 4 6
What I could do was use this command:
df.groupby(level=('Name')).last()
retrieved this:
ColumnName Value
Name
A 6
B 6
Or using this command:
df.groupby(level=('Name','Date')).last()
error extraction.
Keep in mind that this is a performance sensitive application.
Thoughts?
EDIT: Meanwhile, I sent a function request to GitHub