5

I use to_stata() to exporting my DataFrame

AppliedTariff.to_stata('Applied%s.dta' % name, write_index = False)

raise ValueError('Writing general object arrays is not supported')

I do not know how to continue.

1
  • when I use to_csv() to do this, it works ok. but I want to obain the dta version. Commented Mar 24, 2018 at 9:58

1 Answer 1

3

See the answer via this link.

Find out which columns are of the object type:

list(df.select_dtypes(include=['object']).columns)

Convert them to something else: df['col'] = df['col'].astype(str)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.