adrian-pace / FROG-analytics

Metrics and visualizations on the behaviour of users in various online editors
1 stars 3 forks source link

warning in pandas #8

Closed adrian-pace closed 6 years ago

adrian-pace commented 6 years ago

I get the warning

C:\Users\pace\Anaconda3\lib\site-packages\pandas\plotting_core.py:1714: UserWarning: Pandas doesn't allow columns to be created via a new attribute name - see https://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute-access series.name = label

on pad : 753268753268753268753268753268753268

adrian-pace commented 6 years ago

@pykcel

The warning comes from :
df_add.columns += ' write/add' and df_del.columns += ' del'. I don't understand what you are trying to do. First you can't add column this way since you you are just changing the variable storing the columns names. Also you are actually trying to do str + list(str) which is only possible if you have list(str)+list(str) or str+str. Anyway, as I said, you are modifying the variable holding the columns name, not adding a column. If you want to add a column you can try something like : df['write/add'] = [0]*df.shape[0].
If you want to just have a list of columns with a new element, copy the variable and use append.
But I don't really understand what you are trying to do so I didn't touch that.

lbaligand commented 6 years ago

The idea here is that want to merge two dataframes in a way that they alternate for the palette colors of seaborn. I concatenate either write or del to every column names df_add.columns += ' write/add' and we finally sort them in alphabetic order. This way we have the column author_1 write/add followed by author_1 del and so on for all authors.

I didn't manage to get the warning but if the issue comes from df_add.columns += ' write/add', I can find another way to rename the columns

adrian-pace commented 6 years ago

I don't get the warning either with version 0.19.2 or 0.20.3 but I do with version 0.21.0. I suggest using pandas.DataFrame.rename

lbaligand commented 6 years ago

It should be fixed, you can confirm and close this issue

adrian-pace commented 6 years ago

nice work