我有两个json文件,我想连接成一个。有什么方法来结合这些json?
json1 = {
"105912": {
"name": "Avatar - Tocasia, Dig Site Mentor",
"cardset": "VAN",
"rarity": "Rare",
"foil": 0,
"price": 0.05
},
"105911": {
"name": "Avatar - Yotian Frontliner",
"cardset": "VAN",
"rarity": "Rare",
"foil": 0,
"price": 0.05
}
}
json2 = {
"105912": {
"name": "Avatar - Tocasia, Dig Site Mentor",
"cardset": "VAN",
"rarity": "Rare",
"foil": 0,
"price": 0.0007
},
"105911": {
"name": "Avatar - Yotian Frontliner",
"cardset": "VAN",
"rarity": "Rare",
"foil": 0,
"price": 0.0007
}
}
import pandas as pd
from glob import glob
arquivos = sorted(glob('price-history\*.json'))
todos_dados = pd.concat((pd.read_json(cont, lines=True, orient='records') for cont in
arquivos))
print(todos_dados)
返回的错误是ValueError: Expected object or value
预期输出将是能够过滤数据的 Dataframe 。
2条答案
按热度按时间anauzrmj1#
试试看:
印刷品:
5f0d552i2#