Am applying some method / property out of a custom lib in python mlfinlab
.
When I apply this calculation ( here is the link ). Under get_ema_dollar_imbalance_bars
, then am getting back an output with
<class 'tuple'>
as a type of the object, then towards the end of the output space I get the below
[4798 rows x 10 columns],
Empty DataFrame
Columns: []
Index: [] , dtype=object)
what am trying to do is to convert it into a pandas dataframe.
I have tried different methods around including transforming it first to a NumPy array then I can get in to pandas df format, but it is still not working.
Any help/guidance is appreciated and welcomed on your part.
I have included some snapshots as well.
best regards
First option:
lst = list(yourtuple)
df = pd.DataFrame(lst)
Second Option:
I can't see the formatting of your tuple, but assuming you need more than one column, and your tuple is structured in a way where it's ((col1,entry1,entry2),(col2,entry1,entry2)), you can do the following:
newdict = dict(yourtuple)
df = pd.DataFrame([newdict])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.