how to instantiate saqc object with existing flags that are not float
I could not get saqc to generate an object from dataset with existing simple-schemed flags.
From my understanding, if i have data flagged UNFLAGGED or BAD, i should be able to initialise a SaQC object without having to translate the flags to float values by myself by using the simple scheme - since thats the point of the scheme.
I could not find no documentation on how to do that anywhere and i tried the following variants, that i thought should all be valid, but all throw errors instead of SaQC objects:
data = pd.Series([1,2], index=pd.date_range('2000',periods=2,freq='D'), name='data')
flags = ['GOOD', 'BAD']
qc = saqc.SaQC(data=data, flags=flags, scheme='simple')
Doesnt work (AttributeError: 'str' object has no attribute 'items'
), i thought maybe its because flags are passed as a list (wich actually is allowed by the signature)
data = pd.Series([1,2], index=pd.date_range('2000',periods=2,freq='D'), name='data')
flags = pd.DataFrame(['BAD', 'UNFLAGGED'], index=data.index, columns=['data'])
qc = saqc.SaQC(data=data, flags=flags, scheme='simple')
That fails with ValueError: dtype must be float or categorical
, so i tried:
data = pd.Series([1,2], index=pd.date_range('2000',periods=2,freq='D'), name='data')
flags = pd.DataFrame(['BAD', 'UNFLAGGED'], index=data.index, columns=['data'], dtype='category')
qc = saqc.SaQC(data=data, flags=flags, scheme='simple')
And that fails with: ValueError: Cannot cast object dtype to float64
-> of course, replacing 'BAD' and 'UNFLAGGED' by floats, than works: but i thought the whole point of the schemes is that one does not have to know/care for the inner representation of the schemes flagging values, so that seems to be a little pointless to me.
Also, if there is an easy solution to getting that done, it should be documented more prominently (for example in a documentaiton o the SaQC
object itself) - since this is a quite prominently advertised feature and one should not have to try out different interpretations of the errormessages to get the result.