|
|
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 |
|
|
|
|
|
|
|
|
dfnumeric=df.select_dtypes(include=np.number) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def write_excel(data,date): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import xlwings as xw |
|
|
|
|
|
|
|
|
ws = xw.Book("07-253-b Estudio capacidad (con grafico).xls").sheets['DATOS'] |
|
|
|
|
|
|
|
|
|
|
|
v1 = ws.range("A1:A7").value |
|
|
|
|
|
print("Result:", v1) |
|
|
length=len(data) |
|
|
for i in range(len(date)): |
|
|
|
|
|
|
|
|
|
|
|
ws.range("A"+str(9+i)).value = date[i] |
|
|
ws.range("B"+str(9+i)).value = data[i] |
|
|
|
|
|
def KYBConvert(df,make_choice): |
|
|
|
|
|
|
|
|
df.to_excel('export.xlsx',index=False) |
|
|
|
|
|
date=pd.to_datetime(df.iloc[:,1], format="%y%m%d-%H:%M") |
|
|
|
|
|
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") |
|
|
|