Index cleaning of input csv crashes
Bug report
Minimum working example
con_tc.index = con_tc.index.map(lambda x: float(x) if (x not in 'kxyz') else x)
Expected behavior
This is index cleaning to make sure that the time vector is a vector of floats.
Current behavior
Crash
TypeError: 'in <string>' requires string as left operand, not float
The part ‘x not in ‘kxyz’ requires x to be a string. However, index includes numbers (time vector) which explains the problem. The error only appeared at a high number of constraints, this can’t be explained as it should not depend on the number of constraints.
The first proposal for a solution would be : con_tc.index = con_tc.index.map(lambda x: float(x) if (x not in ['k','x','y','z']) else x)
This avoids a crash of the code but still shows an error message as having strings and floats in the same column of a dataframe is not ideal for pandas.
PyConTurb version
PyConTurb version: Editable installation? <Don't know>
Note that the version can be found by pip show pyconturb
.