Durante 5 años ayudamos a las empresas a alcanzar sus objetivos de mercado y de marca. Millennial es una empresa especializada en tecnología.

Galleria

Contactos

Enrique Palacios 360, Oficina 313, Miraflores - Lima

+51-975-113-510

Blog Business Analytics
Obtención de datos a través de la API en Python

Como usar un API en Python para obtener datos

 

 

#Import the required package
import pandas as pd
# intialise data of lists.
data = {'Name':['India', 'China', 'USA', 'Russia'], 'Population (In crores)':[133.92, 138.64, 32.72, 14.45]}
# Create DataFrame
df = pd.DataFrame(data)
df.head()
Prueba de la hoja de cálculo de Google FIle
#Import Pygsheets Python package.
import pygsheets

#Authorization
gc = pygsheets.authorize(service_file='pygsheets.json')

#Open the google spreadsheet
sh = gc.open('Test Google Sheet')

#Define which sheet to open in the file
wks = sh[0]

#Get the data from the Sheet into python as DF
read = wks.get_as_df()

#Print the head of the datframe
read.head()
Salida de datos leídos
#In order to clear all the data in the sheet.
wks.clear()
#We will use set_dataframe() in pygsheets to write df data into GS
wks.set_dataframe(df,(1,1)) #(Row_Number, Column_Number)
#Get the data from the Sheet into python as DF
read = wks.get_as_df()

#Print the head of the datframe
read.head()
El resultado de los datos escritos

 

Mas contenido en http://millev.com/blog

Ayudamos a las empresas a elevar su valor con el aporte de especialistas en Analítica, 
Diseño y Desarrollo de Soluciones, Control de Calidad y Consultoría Tecnologica.

Ayudamos a las empresas a elevar su valor con el aporte de especialistas en Analítica, 
Diseño y Desarrollo de Soluciones, Control de Calidad y Consultoría Tecnologica.