Question: Python import time import pandas as pd import numpy as np import datetime as dt def get_city(): # Ask the user for a city and
Python
import time import pandas as pd import numpy as np import datetime as dt def get_city():
# Ask the user for a city and returns the filename for that city's citylist=[ 'Texas', 'California' , 'Washington'] while name in citylist: city= input( 'Hello! Let\'s explore some US bikeshare data! Would you like to see data for Texas, California, or Washington? ') if name=='Texas': return 'texas.csv' elif name == 'California': return 'california.csv' elif name == 'Washington': return 'washington.csv' else: print('Try again') def statistics():
# Filter by city ('Texas', 'California' , 'Washington') city= get_city() print(' Loading data') df=pd.read.csv(city,parse_dates= ['Start Time' , 'End Time']) restart = input(' Would you like to restart? Enter yes or no. ') while restart.lower() != 'yes': break if __name__ == "__main__": statistics()
What am I doing wrong in Python code?
Wish someone help me to find the answer.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
