Should we use pandas.compat.StringIO or Python 2/3 StringIO? Should we use pandas.compat.StringIO or Python 2/3 StringIO? pandas pandas

Should we use pandas.compat.StringIO or Python 2/3 StringIO?


I know this is an old question, but I followed breadcrumbs here, so perhaps still worth answering. It's not totally definitive, but current Pandas documentation suggests using the built in StringIO rather than it's own internal methods.

For examples that use the StringIO class, make sure you import it with from io import StringIO for Python 3.