Fhernd icon

salida_json.py

Fhernd | PRO | 08/16/19 10:27:14 AM UTC | 0 ⭐ | 1636 👁️ | Never ⏰ | []
Python |

650 B

|

None

|

0 👍

/

0 👎

import pandas as pd
import numpy as np
 
nombre = ['Oliva', 'Daniela', 'Juan', 'Germán', 'Edward', 'Alex', 'Julio', 
          'Edgar', 'Angie', 'Irlesa']
puntaje = [11.5, 8, 15.5, np.nan, 8, 19, 13.5, np.nan, 8, 18]
intentos = [1, 3, 2, 3, 2, 3, 1, 1, 2, 1]
califico = ['Sí', 'No', 'Sí', 'No', 'No', 'Sí', 'Sí', 'No', 'No', 'Sí']
 
indices = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
 
jugadores = {'nombre': nombre, 'puntaje': puntaje, 'intentos': intentos, 
             'califico': califico}
 
df = pd.DataFrame(data=jugadores, index=indices)
 
with open('output.json', 'w', encoding='utf-8') as f:
    df.to_json(f, force_ascii=False)

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎