Closed ekwan closed 10 months ago
Good question, I never tested or checked this purposefully. I wouldn't have expected it to modify the data, but the warning is worrying. I will check at some point... For now just in case you want to be sure, provide the x and y coordinates as copies, I guess.
/Users/kwaneu/sw/miniconda/miniconda3/envs/python/lib/python3.11/site-packages/adjustText/__init__.py:377: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
xp, yp = x[j], y[j]
I have adjustText 0.8 and this was triggered by:
adjust_text(texts, x = df.C, y = df.H)
I can certainly get around this by making copies, but it does look like the underlying df is altered, and with the DeprecationWarning, this behavior doesn't seem optimal.
I just tried it with the latest version from github and didn't get a warning and the data are not altered... So perhaps this is fixed now. Feel free to reopen if you can get reproduce this issue with the master version!
Does adjustText change the backing data for the graph? If those data are provided as a DataFrame, you can get a SettingWithCopyWarning.