У меня есть json объект с одним из ключей:
"transcript": "The universe is bustling with matter and energy. Even in the vast apparent emptiness of intergalactic space, there's one hydrogen atom per cubic meter. That's not the mention a barrage of particles and electromagnetic radiation passing every which way from stars, galaxies, and into black holes. There's even radiation left over from the Big Bang...
Загрузка фрейма данных:
#initialize dataframe for the universe transcript
dfJson = pd.read_json('test1.json')
Вот мой код для попытки извлечь его.
dfJsonTranscript = dfJson.get('transcript').to_string()
pprint.pprint(dfJsonTranscript)
text_file = open("sample.txt", "wt")
n = text_file.write(dfJsonTranscript)
text_file.close()
Мой вывод
0 The universe is bustling with matter and energ...
1 The universe is bustling with matter and energ...
2 The universe is bustling with matter and energ...
3 The universe is bustling with matter and energ...
4 The universe is bustling with matter and energ...
5 The universe is bustling with matter and energ...
6 The universe is bustling with matter and energ...
7 The universe is bustling with matter and energ...
8 The universe is bustling with matter and energ...
Оригинал JSON:
"transcript": "The universe is bustling with matter and energy. Even in the vast apparent emptiness of intergalactic space, there's one hydrogen atom per cubic meter. That's not the mention a barrage of particles and electromagnetic radiation passing every which way from stars, galaxies, and into black holes. There's even radiation left over from the Big Bang... universe. ",
"words": [
{
"alignedWord": "the",
"case": "success",
"end": 6.31,
"endOffset": 3,
"phones": [
{
"duration": 0.09,
"phone": "dh_B"
},
{
"duration": 0.05,
"phone": "iy_E"
}
],
"start": 6.17,
"startOffset": 0,
"word": "The"
},
{
"alignedWord": "universe",
"case": "success",
"end": 6.83,
"endOffset": 12,
"phones": [
{
"duration": 0.08,
"phone": "y_B"
},
Почему я теряю исходное значение моего ключа при запуске toString ( ) метод на это. Я теряю это, потому что я превращаю это в массив данных через pandas?