A problem with slicing in subsampling
See original GitHub issueHi alchemlyb
developers,
Thank you all for the development of this package. I was using alchemlyb
to analyze some output files from the simulation performed by GROMACS. When using the function equilibrium_detection
with the input parameters df
and series
being the whole u_nk
matrix extracted from a *dhdl.xvg
file (by the function extract_u_nk
) and the first column of u_nk
(which is u_nk[(0.0, 0.0, 0.0, 0.0)]
), I got the following error:
KeyError: Index(['time'], dtype='object')
Tracing back the error, I found that this error indicated that there was no time
index in the series u_nk[(0.0, 0.0, 0.0, 0.0)]
. However, series.index
in this case did return time
as one of the names of the indices. I am not sure if this is an issue of data types. I tried turning the data type of u_nk[(0.0, 0.0, 0.0, 0.0)]
from Series into DataFrame, but same error occurred. Here I reproduced the error in a jupyter notebook, in which I also added some comments and explanations of the problem(alchemlyb_issue.zip).
To my understanding, the input parameter df
of the subsampling methods should be the matrix/DataFrame extracted from the xvg
file, while series
could be any time series/column of df
. I’m not sure if this understanding is correct, but it might be worthy to add more detailed explanations of these two parameters in the documentation.
Thanks a lot!
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Cool, thank you for this feedback @wehs7661! This helps me to prioritize effort appropriately. I’ll proceed with the refactor then.
Hi @dotsdl, no worries at all, and thanks for following up! So I just tried first upgrading my version of
pandas
(to version 1.11.0) and usingalchemlyb
on the master branch instead, but I still got the same error. (I was originally using the one on the branchrefactor-subsampling
and it worked for me.)