Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'OverflowError: Maximum recursion level reached' while exporting to json from pandas

I have a pandas pf with these types:

id                   14 non-null int64
class                14 non-null int64
action.start         6 non-null float64
action.end           6 non-null float64
action.text          6 non-null object
action.lemma         6 non-null object

When I run df.to_json('output.json',orient='index') (tried any orient option) it keeps crashing and with the error:

OverflowError: Maximum recursion level reached

Any ideas how to resolve this?

like image 408
Roy Granit Avatar asked Oct 20 '25 12:10

Roy Granit


1 Answers

Turns out I had some weird object type in the dataframe:

action.text <class 'spacy.tokens.span.Span'>

Turning this into text solved the issue

like image 55
Roy Granit Avatar answered Oct 23 '25 01:10

Roy Granit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!