datajoint/table.py: smarter dataframe conversion (#666)#776
Conversation
|
@dimitri-yatsenko / @eywalker / @guzman-raphael - |
There was a problem hiding this comment.
I would use not isinstance(rows.index, pd.MultiIndex), since the dataframe fetched from datajoint are always multiindex and it is possible that users pass dataframes with a pd.Int64Index for example depending how they constructed the dataframe. Another option would be to test if the index names correspond to the primary keys, such as: set(self.primary_key) == set(rows.index.names)
|
Thanks for the feedback @gucky92
correct? |
|
@ixcat Yes, that is what i meant. |
|
Simpler and more in alignment with what we actually want to check is whether there is any "named" index/indices. Given this, a good check would be The default case of an unnamed index will have |
|
back to 'WIP' until unit test |
|
Ah sorry I removed WIP as this was set as Draft and figured that suffice to indicate the WIP status. |
to address #666
needs further discussion/confirmation with those more familiar with pandas