You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@sanguineturtleDataFrame does not have a name attribute by default. As you probably know, though, Python objects have a __dict__ attribute which is the instance's namespace and that allows one to assign arbitrary attributes at runtime to an instance (or a class). The reason name is getting dropped from this particular DataFrame instance is just that, you've assigned an attribute to an instance of a class and thus when reorder_levels creates a new instance that new instance correspondingly has a new namespace. You can assign a class variable if you want. So, this is not really an issue so much as a feature (or bug if you're feeling pessimistic) of the Python object model/runtime.
I see. Agreed - this is more along the lines of a feature request. The reason I like to have the DataFrame name attribute propagate is that I am using pandas to track 'labelled' matrices. I have a function that takes a DataFrame converts it to a matrix for computation and the returns it as a DataFrame. Therefore, when I do relevant data manipulations (such as reorder_levels()), it would be helpful for the name label to persist as a label of the overall matrix data. (i.e. country-product level export data).
The main benefit is that the matrix data can then be sorted and matched with other relevant data sources along their relevant axis (axis=0 and axis=1). Is there a Features Register?
Using Pandas 0.11.0
A DataFrame with MultiIndex:
df = df.reorder_levels() drops the dataframe name attribute.
thus, df.name after the reorder_levels() has no attribute 'name'
The text was updated successfully, but these errors were encountered: