<jupyter_start><jupyter_text>(pandas_date_time)= Creating date-time stamps``` {index} Pandas: date-time stamps```Let's create columns with hours, minutes and seconds from utc_time column (contains strings) in format:    HH:MM:SS    by splitting the strings with a colon and creating float columns.Let's load New Zealand earthquake data:<jupyter_code>import pandas as pd

nz_eqs = pd.read_csv("../../geosciences/data/nz_largest_eq_since_1970.csv")
nz_eqs.head(4)
nz_eqs["hour"] = nz_eqs["utc_time"].str.split(':').str.get(0).astype(float)
nz_eqs["minute"] = nz_eqs["utc_time"].str.split(':').str.get(1).astype(float)
nz_eqs["second"] = nz_eqs["utc_time"].str.split(':').str.get(2).astype(float)<jupyter_output><empty_output><jupyter_text>With to_datetime() function, we can easily create date time stamp used by pandas:<jupyter_code>nz_eqs["datetime"] = pd.to_datetime(nz_eqs[['year', 'month', 'day', 'hour', 'minute', 'second']])
nz_eqs.head(4)<jupyter_output><empty_output><jupyter_text>The datetime column is not yet recognised as index so we can simply use:<jupyter_code>nz_eqs = nz_eqs.set_index('datetime')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15775635407537247, 'fraction_numerical': 0.007887817703768623, 'mean_word_length': 7.852713178294573, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '101164', 'license': 'MIT', 'n_tokens_mistral': 446, 'n_tokens_neox': 417, 'n_words': 84, 'path': 'notebooks/b_coding/Pandas/5_time_stamps.ipynb', 'repo_name': 'primer-computational-mathematics/book', 'size': '1141'}