Advertisement
Fhernd

salida_json.py

Aug 16th, 2019
506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. import pandas as pd
  2. import numpy as np
  3.  
  4. nombre = ['Oliva', 'Daniela', 'Juan', 'Germán', 'Edward', 'Alex', 'Julio',
  5.           'Edgar', 'Angie', 'Irlesa']
  6. puntaje = [11.5, 8, 15.5, np.nan, 8, 19, 13.5, np.nan, 8, 18]
  7. intentos = [1, 3, 2, 3, 2, 3, 1, 1, 2, 1]
  8. califico = ['Sí', 'No', 'Sí', 'No', 'No', 'Sí', 'Sí', 'No', 'No', 'Sí']
  9.  
  10. indices = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
  11.  
  12. jugadores = {'nombre': nombre, 'puntaje': puntaje, 'intentos': intentos,
  13.              'califico': califico}
  14.  
  15. df = pd.DataFrame(data=jugadores, index=indices)
  16.  
  17. with open('output.json', 'w', encoding='utf-8') as f:
  18.     df.to_json(f, force_ascii=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement