Skip to content

API/ENH: stata export should better support np.datetime64 based times #4558

Closed
@wuan

Description

@wuan

The following code exporting a dataframe with a timeseries index with np.datetime64 type

import numpy as np
import pandas as pd

timestamps = pd.date_range(np.datetime64('2013-01-01 11:00:00.123456'), periods=5, freq='123U')
dataframe = pd.DataFrame(np.random.randn(len(timestamps)), index=timestamps)
dataframe.to_stata('out')

throws a

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

It would be very nice if np.datetime64 (and thus pd.Timestamp as well) would be supported here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignDtype ConversionsUnexpected or buggy dtype conversionsIO DataIO issues that don't fit into a more specific label

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions