notebooks/common.py
def tokenise_dates(dates: pd.Series) -> pd.Series:
    """Return the date as a list of tokens."""
    if type(dates) is pd.DataFrame:
        dates = dates[dates.columns[0]] # WTF?
    
    return (
        dates
        .str.replace('\[\d+\]$', '', regex=True) # footnotes
        .str.replace(endash, hyphen)
        .str.replace(emdash, hyphen)
        .str.replace(minus, hyphen)
        .str.replace('c. ', '', regex=False)
        .str.split(r'[\-,\s\/]+')
    )
Return the date as a list of tokens.
Return the date as a list of tokens.
Return the date as a list of tokens .
def tokenise_dates(dates: pd.Series) -> pd.Series:
    if type(dates) is pd.DataFrame:
        dates = dates[dates.columns[0]] 
    return (
        dates
        .str.replace('\[\d+\]$', '', regex=True) 
        .str.replace(endash, hyphen)
        .str.replace(emdash, hyphen)
        .str.replace(minus, hyphen)
        .str.replace('c. ', '', regex=False)
        .str.split(r'[\-,\s\/]+')
    )
def tokenise_dates ( dates : pd . Series ) -> pd . Series : if type ( dates ) is pd . DataFrame : dates = dates [ dates . columns [ 0 ] ] return ( dates . str . replace ( '\[\d+\]$' , '' , regex = True ) . str . replace ( endash , hyphen ) . str . replace ( emdash , hyphen ) . str . replace ( minus , hyphen ) . str . replace ( 'c. ' , '' , regex = False ) . str . split ( r'[\-,\s\/]+' ) )
Return the date as a list of tokens.
Return the date as a list of tokens .
"""Return the date as a list of tokens.""" # WTF? # footnotes
dates
pd.Series