<jupyter_start><jupyter_text>ToDatetimeTransformerThis notebook shows the functionality of the `ToDatetimeTransformer` class. This transformer converts a specified column to datetime type. The transformer simply uses the `pd.to_datetime` method to do the conversion.<jupyter_code>import pandas as pd
import numpy as np
import tubular
from tubular.dates import ToDatetimeTransformer
tubular.__version__<jupyter_output><empty_output><jupyter_text>Load dummy dataset<jupyter_code>df = pd.DataFrame(
    {"a": [1950, 1960, 2000, 2001, np.NaN, 2010], "b": [1, 2, 3, 4, 5, np.NaN]}
)
df<jupyter_output><empty_output><jupyter_text>Simple usage  Initialising ToDatetimeTransformerThe user must specify the following;- `column` giving the column to convert to datetime- `new_column_name` giving the name of the column to assign the converted column toThe user can also optionally supply `to_datetime_kwargs` which is a dictionary of keyword arguments that will be passed to `pd.to_datetime` when it is called in the `transform` method. There are many useful arguments that can be found in the [documentation](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html).<jupyter_code>to_dt_1 = ToDatetimeTransformer(
    column = 'a', 
    new_column_name = 'a_dt',
    to_datetime_kwargs = {'format': '%Y'}
)<jupyter_output><empty_output><jupyter_text>ToDatetimeTransformer fitThere is not `fit` method for the `ToDatetimeTransformer` class, it does not learn anything from the input data `X`.  ToDatetimeTransformer transformA new column called 'a_dt' has been added to the input DataFrame after transform ran.<jupyter_code>df_2 = to_dt_1.transform(df)
df_2
df_2.dtypes<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08279883381924198, 'fraction_numerical': 0.01749271137026239, 'mean_word_length': 6.396551724137931, 'pattern_counts': {'":': 2, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 1, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '216344', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 553, 'n_tokens_neox': 518, 'n_words': 176, 'path': 'examples/dates/ToDatetimeTransformer.ipynb', 'repo_name': 'binti59/LV', 'size': '1715'}