printing product headers that have 0 as a value in a separate header GUI

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

printing product headers that have 0 as a value in a separate header GUI



For my code, I have to find a certain product and the values associated with it for a specific date( that are headers in the csv file) and take those numbers and manipulate them. However, there are blank values for many of the products ( because those products are not produced for those specific months), thus the reason I produced my current code, because I did not want to display adjusted values for numbers that were either blank or 0.


import pandas as pd
import csv
import numpy as np
import os
from tkinter import*


master = Tk()

fileVar = StringVar()
fileLabel = Label(master, textvariable=fileVar, font=('Consolas', 9))
fileLabel.grid(row=8, column=1)

fileVar2 = StringVar()
fileLabel2 = Label(master, textvariable=fileVar2, font=('Consolas', 9))
fileLabel2.grid(row=8, column=2)

readfile = pd.read_csv('50.csv')
filevalues= readfile.loc[readfile['Customer'].str.contains('Lam Dep', na=False), 'Jul-18nQty']
filevalues = filevalues.replace(" ", "", regex=True)
filevalues.replace("", np.nan, inplace=True)
filevalues.dropna(inplace=True)
int_series = filevalues.astype(int)
productheader = readfile.loc[readfile['Customer'].str.contains('Lam Dep', na=False), 'Product']
calculated_series = int_series.apply(lambda x: x*(1/1.2))


fileVar.set(productheader)
fileVar2.set(calculated_series)

mainloop()



However, now when I display the information on GUI, it comes out like this:



enter image description here



It seems that all the product headers are printing out, understandably, even though there is no value associated with it. How can I specify and only print The productheaders that have values associated with them ( which is stored as calculated_series)



In addition this is a dummy version of my csv file:



enter image description here









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

Executable numpy error

PySpark count values by condition

Trying to Print Gridster Items to PDF without overlapping contents