Skip to content

Commit a7c5130

Browse files
update json doctests
1 parent 4435762 commit a7c5130

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pandas/io/json/_json.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,9 @@ def read_json(
746746
>>> df.to_json(orient='table')
747747
'\
748748
{{"schema":{{"fields":[\
749-
{{"name":"index","type":"string"}},\
750-
{{"name":"col 1","type":"string"}},\
751-
{{"name":"col 2","type":"string"}}],\
749+
{{"name":"index","type":"string","extDtype":"str"}},\
750+
{{"name":"col 1","type":"string","extDtype":"str"}},\
751+
{{"name":"col 2","type":"string","extDtype":"str"}}],\
752752
"primaryKey":["index"],\
753753
"pandas_version":"1.4.0"}},\
754754
"data":[\

pandas/io/json/_table_schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def convert_json_field_to_pandas_type(field) -> str | CategoricalDtype:
183183
... "ordered": True,
184184
... }
185185
... )
186-
CategoricalDtype(categories=['a', 'b', 'c'], ordered=True, categories_dtype=object)
186+
CategoricalDtype(categories=['a', 'b', 'c'], ordered=True, categories_dtype=str)
187187
188188
>>> convert_json_field_to_pandas_type({"name": "a_datetime", "type": "datetime"})
189189
'datetime64[ns]'
@@ -292,7 +292,7 @@ def build_table_schema(
292292
{'fields': \
293293
[{'name': 'idx', 'type': 'integer'}, \
294294
{'name': 'A', 'type': 'integer'}, \
295-
{'name': 'B', 'type': 'string'}, \
295+
{'name': 'B', 'type': 'string', 'extDtype': 'str'}, \
296296
{'name': 'C', 'type': 'datetime'}], \
297297
'primaryKey': ['idx'], \
298298
'pandas_version': '1.4.0'}

0 commit comments

Comments
 (0)