File size: 1,748 Bytes
de3fbe1 4767d76 de3fbe1 4767d76 de3fbe1 4767d76 de3fbe1 4767d76 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | import streamlit as st
import pandas as pd
from PIL import Image
image = Image.open('KYB.png')
st.image(image, caption='Powered by TedCas')
uploaded_file = st.file_uploader("Choose product file", type="csv")
if uploaded_file:
df = pd.read_csv(uploaded_file, delimiter=';', encoding='utf8')
import numpy as np
#select only the numeric columns in the DataFrame
dfnumeric=df.select_dtypes(include=np.number)
def write_excel(data,date):
# Python3 code to select
# data from excel
import xlwings as xw
# Specifying a sheet
ws = xw.Book("07-253-b Estudio capacidad (con grafico).xls").sheets['DATOS']
# Selecting data from
# a single cell
v1 = ws.range("A1:A7").value
# v2 = ws.range("F5").value
print("Result:", v1)
length=len(data)
for i in range(len(date)):
#ws.range(9+i,0).value = date[i]
#ws.range(9+i,1).value = data[i]
#ws.range(1,0).value = "pepe"
ws.range("A"+str(9+i)).value = date[i]
ws.range("B"+str(9+i)).value = data[i]
def KYBConvert(df,make_choice):
#INPUT FILE
df.to_excel('export.xlsx',index=False)
date=pd.to_datetime(df.iloc[:,1], format="%y%m%d-%H:%M")
#data=pd.Series(df.iloc[:,4],dtype="int")
data=pd.Series(df.loc[:,make_choice],dtype="int")
write_excel(data,date)
if uploaded_file:
st.dataframe(dfnumeric)
makes = df.select_dtypes([np.number]).columns
make_choice = st.sidebar.selectbox('Select cathegory:', makes)
print(make_choice)
if make_choice!='ID':
KYBConvert(df,make_choice)
st.write("Puedes encontrar tu excel en: C:/Users/15572890/Desktop/I+D/ProyectosPython/KYB/07-253-b Estudio capacidad (con grafico).xls")
|