Export annotation results to pandas dataframe #3702
Replies: 4 comments
-
For efficiency, I think some helpers for pandas could be a nice spaCy plugin? We wouldn't want to ship anything that depends on pandas in the core library, but I can totally see a little helper library that depends on spaCy and pandas and includes useful functions to represent a spaCy I think a good basis would be the |
Beta Was this translation helpful? Give feedback.
-
Good thinking. It turns out what I was looking for was actually pretty simple:
For whatever reason, I didn't realize that the same list comprehension could be used to get multiple attributes. I had been using a As I progress with my project, if I spot an opportunity for more pandas helpers, I'll code them up. |
Beta Was this translation helpful? Give feedback.
-
Ah, that's nice to hear! 👍 I think this thread could also be a good place for other users to share their pandas helpers. And maybe some day, someone wants to go ahead and package them all into a mini library. |
Beta Was this translation helpful? Give feedback.
-
@hmswaffles, if you've found any new ones since your last post, could you share a use case or two of your pandas helpers? I'm interested in starting a small plugin for this :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Feature description
Consider the following use case:
A user is able to call nlp("").to_array(*attrs).to_dataframe(), which will produce an array that contains the string forms of the annotation features.
Currently, the way to get this behavior is to combine the results of many list comprehensions, a la:
The issue with
.to_array()
is that the mappings of the resulting numbers are not easy to find.Beta Was this translation helpful? Give feedback.
All reactions