Description
When attempting to export a dataframe to a Stata data file, I hit the following error due to my dataframe including variables of the Int64 dtype.
import pandas as pd
# CREATE DATAFRAME
s1 = pd.Series(2**33, dtype='Int64')
s2 = pd.Series("ABC", dtype=object)
df = pd.DataFrame({'col1': s1, 'col2': s2})
df = df.append({'col1': None, 'col2': "DEF"}, ignore_index=True)
# EXPORT TO STATA
df.to_stata('df.dta', version=117)
Error message:
NotImplementedError: Data type Int64 not supported.
My expectation is columns of dtype Int64 (i.e., a nullible INT) would end up as byte, int or float in the dta file depending on values therein.
Output of pd.show_versions()
INSTALLED VERSIONS
commit : 67a3d42
python : 3.8.6.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.14393
machine : AMD64
processor : Intel64 Family 6 Model 61 Stepping 2, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en
LOCALE : English_United States.1252
pandas : 1.1.4
numpy : 1.19.4
pytz : 2020.4
dateutil : 2.8.1
pip : 20.2.4
setuptools : 50.3.1.post20201107
Cython : None
pytest : None
hypothesis : None
sphinx : 3.4.3
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.19.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.3
numexpr : None
odfpy : None
openpyxl : 3.0.5
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.3
sqlalchemy : 1.3.20
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
xlwt : None
numba : None