# 9.30:  Converting a DataFrame column/index to datetime.  View the below DataFrame and note the
# date column EST.  Use pd.to_datetime() or Series.astype() to convert the 'EST' series to
# Timestamps, then use .set_index() with the column name and drop=True to set the column as the
# index.  Check the dtype of the index.

import pandas as pd

df = pd.read_csv('../weather_newyork.csv')

df.EST = df.EST.astype('datetime64[ns]')

df = df.set_index('EST', drop=True)

print('df: ')
df

print('df.index.dtype')
print(df.index.dtype)

# If your dtype shows as '<M8[ns]' it means that the date is 'timezone-aware'; if it shows as
# 'datetime64[ns]' it signifies 'timezone-naive' (meaning it does not represent the time in a
# timezone).  Since timezone-aware timestamps know their timezone, they can be compared with other
# timezone-aware dates to do calculations and comparisons between timestamps in different timezones.

