I have a directory where csv files are located. The code reads the files and creates histograms based on the data in the files.
However, I am trying to make it so that at the command line, I can enter one of the column headers in the csv file and the code will only make a graph of the specified command. Example: python histogram_maker.py "C:/Folder" Area.
I was able to do that, but I want to add a part that would create an error message in case the user enters a command that is not specified in the csv file. Example: Perimeter does not exist. What is wrong with my code? Even if something exists I get "does not exist" 20 times on the command prompt, but it still makes all the files that I need. How do I stop this repetition and make it so that the error only comes up if something is not in the csv file.
for column in df:
os.chdir(directory)
if len(sys.argv)>2:
for x in arguments:
if x.endswith(column):
#code for histogram
else:
print "does not exist"