Closed kmdalton closed 2 years ago
This occurs because DataSet.stack_anomalous()
removes the suffixes from anomalous columns during this method. It then eventually calls ds["I"]
, which would ordinarily return a DataSeries
which has a from_friedel_dtype()
method. However, since there are now two columns with the label "I", this call now returns a DataSet
.
I'm considering this a bug, because it is certainly unexpected behavior. To resolve it, there are a few possible options in my mind:
DataSet
. This will likely cause downstream problems. ValueError
when this case is detected. This can then give a more sensible error message like "This operation will result in two or more columns with the same name"only_keep_friedels=True
flag that removes any non-Friedel columns with this operation. In the above example, this would drop the original "I" column, and output a DataSet
with an "I" column generated from "I(+)" and "I(-)". In the case of solution 2 (or perhaps 3 as well), I'd be happy to tackle this; it's similar to the change I made a little while back, and is still pretty fresh on my mind.
Awesome -- sounds good! Kevin's example will also make a good template for writing a test. Reach out if you run into trouble.
I'm inclined to suggest starting with (2), because (3) can currently be implemented by the user by dropping desired columns.
If Friedel columns share the same base name with non-Friedel columns,
stack_anomalous
will fail with a cryptic error message.Here is a minimal example
which outputs