May-15-2018, 05:41 PM
(This post was last modified: May-15-2018, 05:41 PM by Jack_Sparrow.)
Hi there
I have followed error:
It is all about this line: if weekday != 'all': and this one: if month != 'all':
in this statement:
I have followed error:
Indentationerror: unindent does not match any outer indentation level
It is all about this line: if weekday != 'all': and this one: if month != 'all':
in this statement:
df = pd.read_csv(CITY_DATA[city])
def main():
while True: city, month, weekday
#For weekday
df = load_data(city, month, weekday)
# TO DO: display the most common month
#convert start time into datetime
df['Start Time'] = pd.to_datetime(df['Start Time'])
#create a month column
df['month'] = df['Start Time'].dt.month
df['day_of_week'] = df['Start Time'].dt.weekday_name
if weekday != 'all':
# filter by day of week to create the new dataframe
df = df[df['day_of_week'] == weekday.title()]
# filter by month if applicable
if month != 'all':
# use the index of the months list to get the corresponding int
months = ['January', 'February', 'March', 'April', 'May', 'June']
month = months.index(month) + 1
if __name__ == "__main__":
main()How can I fix this?
