Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assistance needed #53

Open
GefenPuravida opened this issue Aug 13, 2019 · 0 comments
Open

Assistance needed #53

GefenPuravida opened this issue Aug 13, 2019 · 0 comments

Comments

@GefenPuravida
Copy link

GefenPuravida commented Aug 13, 2019

Sorry to bother.. not really an issue. just an "almost there".

Wondering if someone have a moment to guide me.

I have this data:

in []:

dfc=dfb['entities']
dfc
out []:

0    [{'name': 'Shop', 'type': 'LOCATION', 'salienc...
1    [{'name': 'Shop', 'type': 'LOCATION', 'salienc...
Name: entities, dtype: object
in []:

dfTodict = dfc.to_dict()
dfTodict
out []:

{0: [{'name': 'Shop',
   'type': 'LOCATION',
   'salience': 0.034899305552244186,
   'wikipedia_url': '-'},
  {'name': 'Brand',
   'type': 'ORGANIZATION',
   'salience': 0.019303809851408005,
   'wikipedia_url': 'https://en.wikipedia.org/wiki/Brand'},
......
 {'name': '57', 'type': 'NUMBER', 'salience': 0.0, 'wikipedia_url': '-'}],
 1: [{'name': 'Shop',
   'type': 'LOCATION',
   'salience': 0.054236818104982376,
   'wikipedia_url': '-'},
  {'name': 'Brand',
   'type': 'ORGANIZATION',
   'salience': 0.023990564048290253,
   'wikipedia_url': 'https://en.wikipedia.org/wiki/Brand'},
......

I want to preform the seconed flatten format from the readme:

dic_flattened = (flatten(d) for d in dfTodict)

but then i get a generator object which is difficult for me to understand how to make it a dataframe.

<generator object <genexpr> at 0x0000022301C025E8>

Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant