Python Forum
CSV file challenges - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: CSV file challenges (/thread-10897.html)



CSV file challenges - catbend - Jun-12-2018

Hello, new to python programming but have an assignment that I have completed 99% of the requirements. The last part is driving me crazy--I have googled, searched in my notes, tried to find resources in the library (final resort).

I have a Dataframe that uses 3 different CSV files. One of the three is missing 2 columns of data (gender and birth year). However, I tried to write an If statement, a while statement, create a new file and import it when the conditions of the 2 other cities were met, but nothing is working for me.

I am not looking for the answer--just an idea of where I can look for it. This was my last attempt--it works for chicago and new york city, but I still get errors when I select washington.

anyhelp would be appreciated

city = get_filters
    if city == 'chicago' or city == 'new york city':
        print('\033[1m' + 'Calculating Gender and Age stats...\n' + '\033[0m')
        start_time = time.time()

        print('\nGender:\n')

        gender = df['Gender'].value_counts()
        print(gender)