Code:
price_dict["Price"] = price_dict["Price"].apply(lambda x : dict(eval(x)) )
df = price_dict['Price'].apply(pd.Series)
Can anyone explain to me the above equations?
Code:
price_dict["Price"] = price_dict["Price"].apply(lambda x : dict(eval(x)) )
df = price_dict['Price'].apply(pd.Series)
Can anyone explain to me the above equations?
eval
basically runs python code from a written (string) expression, and dict
turns that result (whatever it is) into a python dictionary object, assuming that's possible.
You simple google and will find nicely explained Answers:
For eval read this linke
For dict read this link
dict() - The Python dict() is a built-in function that returns a dictionary object or simply creates a dictionary in Python.
eval() - eval() evaluates the passed string as a Python expression and returns the result. For example, eval("1 + 1") interprets and executes the expression "1 + 1" and returns the result (2)