<commit_before>import pandas as pd


def date_features(input_df, datetime_column='tms_gmt'):
    """
    Given a datetime column, extracts useful date information
    (minute, hour, dow...)
    """
    df = input_df.copy()

    return (df.set_index(time_column)
              .assign(minute=lambda df: df.index.minute,
                      hour=lambda df: df.index.hour,
                      day=lambda df: df.index.day,
                      dow=lambda df: df.index.dayofweek,
                      month=lambda df: df.index.month,
                      week=lambda df: df.index.week,
                      woy=lambda df: df.index.weekofyear,
                      year=lambda df: df.index.year))<commit_msg>Add a datetime localization function<commit_after>import pandas as pd
import pytz


def date_features(input_df, datetime_column='tms_gmt'):
    """
    Given a datetime column, extracts useful date information
    (minute, hour, dow...)
    """
    df = input_df.copy()

    return (df.set_index(time_column)
              .assign(minute=lambda df: df.index.minute,
                      hour=lambda df: df.index.hour,
                      day=lambda df: df.index.day,
                      dow=lambda df: df.index.dayofweek,
                      month=lambda df: df.index.month,
                      week=lambda df: df.index.week,
                      woy=lambda df: df.index.weekofyear,
                      year=lambda df: df.index.year))


def localize_datetime(input_df, timezone='Europe/Paris',
                      datetime_column='tms_gmt'):
    """
    Convert datetime column from UTC to another timezone.
    """
    tmz = pytz.timezone(timezone)
    df = input_df.copy()
    return (df.set_index(datetime_column)
              .tz_localize(pytz.utc)  #  UTC time
              .tz_convert(tmz))  # Timezone time
{'fraction_non_alphanumeric': 0.10380434782608695, 'fraction_numerical': 0.0, 'mean_word_length': 1.8149847094801224, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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}}
{'dir': 'git-commits-cleaned', 'id': '6435672', 'n_tokens_mistral': 549, 'n_tokens_neox': 525, 'n_words': 121}