MritiYogan
MritiYogan

Reputation: 146

Pandas read_json - Stop convert index to datetime

I have the below data in a a.json file.

{
  "1000000000": {
    "TEST": 2
  }
}

import pandas as pd
df = pd.read_json(r"a.json", dtype= str, orient='index', convert_dates=False)
print(df)

Getting output as :

                TEST
2001-09-09 01:46:40    2

Expected :

                TEST
1000000000         2

Upvotes: 8

Views: 1027

Answers (1)

Abhik Sarkar
Abhik Sarkar

Reputation: 965

You need parameter convert_axes=False in read_json:

You can use it like this

import pandas as pd
df = pd.read_json("a.json", dtype= str, orient='index',convert_axes=False ,convert_dates=False)
print(df)

Upvotes: 9

Related Questions