I stumbled accross this question and was wondering why i cannot do this:
# this does not work
pipeline = {
{"resample" : {"type" : "trans", "name" : "resample", "kwargs" : {"rule" : "1min"}}}
}
pipeline
As it gives:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-7305ba79e664> in <module>
1 pipeline = {
----> 2 {"resample" : {"type" : "trans", "name" : "resample", "kwargs" : {"rule" : "1min"}}}
3 }
4 pipeline
TypeError: unhashable type: 'dict'
But i can do this:
# this does work
pipeline = dict()
pipeline["resample"] = {"type" : "trans", "name" : "resample", "kwargs" : {"rule" : "1min"}}
pipeline
which gives:
{'resample': {'type': 'trans', 'name': 'resample', 'kwargs': {'rule': '1min'}}}
I was just curious more then anything as it feels like i'm doing same thing in terms of end result but just not sure why first approach fails but 2nd one is ok.