BRUNO DARIO TUPAC DAVILA

All generations.

generate functionMon, 29 May 2023

crear un archivo de excel con panda con 2 hojas

import pandas as pd # Create a Pandas dataframe from the data. df = pd.DataFrame({'Data': [10, 20, 30, 20, 15, 30, 45]}) # Create a Pandas Excel writer using XlsxWriter as the engine. writer = pd.ExcelWriter('pandas_simple.xlsx', engine='xlsxwriter') # Convert the dataframe to an XlsxWriter Excel object. df.to_excel(writer, sheet_name='Sheet1') # Close the Pandas Excel writer and output the Excel file. writer.save() # df2 = pd.DataFrame({'Data': [10, 20, 30, 20, 15, 30, 45]}) df2.to_excel(writer, sheet_name='Sheet2') # Close the Pandas Excel writer and output the Excel file. writer.save()

Python
View
generate functionMon, 29 May 2023

hacer con python 2 hojas de un excel

def read_excel(filename=None): #filename = './HW1_data.xlsx' df = pd.read_excel(filename).dropna() df.columns = ['country', 'population', 'area', 'density'] return df df = read_excel() df2 = read_excel('./HW1_data2.xlsx')

Python
View

Want to kickstart your project?Use the new AI Studio to create your code