Skip to content

ValueError: Data type datetime64[ns] not currently understood. Please report an error to the developers. #12259

Closed
@randomgambit

Description

@randomgambit

I do what I am told to do ;-)

I have a big dataframe with the following columns

daily_news.dtypes
Out[11]: 
stock_ric                       object
obs_day                 datetime64[ns]
next_dayfirst           datetime64[ns]
sentimentmean                  float32
sentimentcount                   int64
companyNamefirst                object
timestamp_localfirst    datetime64[ns]
tickerfirst                     object
text                      object
dtype: object

and I try to save it using pd.to_stata

daily_news.to_stata( "mypath/data.dta",convert_dates= {'obs_day' : 'td'})

and I get

daily_news.to_stata( "python_news.dta",convert_dates= {'obs_day' : 'td'})
Traceback (most recent call last):

  File "<ipython-input-9-3d9426807f61>", line 1, in <module>
    daily_news.to_stata( "python_news.dta",convert_dates= {'obs_day' : 'td'})

  File "C:\Users\m1hxb02\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\core\frame.py", line 1456, in to_stata
    write_index=write_index)

  File "C:\Users\m1hxb02\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\io\stata.py", line 1859, in __init__
    self._prepare_pandas(data)

  File "C:\Users\m1hxb02\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\io\stata.py", line 2043, in _prepare_pandas
    self.fmtlist.append(_dtype_to_default_stata_fmt(dtype, data[col]))

  File "C:\Users\m1hxb02\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\io\stata.py", line 1802, in _dtype_to_default_stata_fmt
    "Please report an error to the developers." % dtype)

ValueError: Data type datetime64[ns] not currently understood. Please report an error to the developers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Error ReportingIncorrect or improved errors from pandasIO Stataread_stata, to_stata

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions