Skip to content

Instantly share code, notes, and snippets.

@ZackStone
Last active January 20, 2026 12:56
Show Gist options
  • Select an option

  • Save ZackStone/8f14277cf2f896ecbfd446e582e3752e to your computer and use it in GitHub Desktop.

Select an option

Save ZackStone/8f14277cf2f896ecbfd446e582e3752e to your computer and use it in GitHub Desktop.
Exportar dados do bot para planilha
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 21 10:32:59 2017
@author: zackstone
Extrair as intenções identificadas e os textos digitados pelos usuários e exportar para uma planilha.
"""
import pandas as pd
import json
FILENAME = 'chatbot-ti.json'
#%%
with open(FILENAME, encoding='utf-8') as file:
bot_json = json.load(file)
#%%
obj = pd.DataFrame.from_dict(bot_json, orient='index')
json_hist = obj.loc['utterances'][0]
#%%
df_out = pd.DataFrame.from_dict(json_hist)
writer = pd.ExcelWriter('chatbot-ti.xlsx')
df_out.to_excel(writer,'Sheet1')
writer.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment