I played a bit with it and got to the value. OutrageousSheep60 , please tell me if this helps you 🙂
` >>> task.set_user_properties(x=5)
True
y=task.get_user_properties()
y
{'x': {'section': 'properties', 'name': 'x', 'value': '5'}}
y["x"]["value"]
'5' `
You are getting a string
- '5'
I want to get an int
- 5
Yeah I see what you're saying. It doesn't keep it's type. This might be a bug.
OutrageousSheep60 , it looks like it's not a bug. Internally x
is stored as an int
, however get_user_properties()
casts it back as a string. You could open a github issue with a feature request for this 🙂
task.get_parameters
and task.get_parameters_as_dict
have the keyword argument cast
which attempts to convert values back to their original type, but interestingly doesn't seem to work for properties:
` task = Task.init()
task.set_user_properties(x=5)
task.connect({"a":5})
task.get_parameters_as_dict(cast=True)
{'General': {'a': 5}, 'properties': {'x': '5'}} Hopefully would be a relatively easy extension of
get_user_properties ` !
Thx for investigating - What is the use case for such behavior ?
How would you use the user properties
as part of an experiment?
How would you use the
user properties
as part of an experiment?
I'm guessing to get the properties. I'm guessing this really depends on your needs / use-case
exactly - (that is how I used it in my initial code) - but if you have to convert it back to the original data type then something is broken...