features.df_functions¶
Functions
convert_time (data[, column_name]) |
Formats the time column to length of 4. |
str_pad (time_stamp) |
Pads the begining of string with 0 until length 4 is reached. |
-
features.df_functions.
convert_time
(data, column_name='Time Occurred')[source]¶ Formats the time column to length of 4.
Pads the begining of Time stamp to length of 4. Converts column_name to string. Creates a new column with full stamp as a timestamp index.
Parameters: - data (pandas.DataFrame) – dataframe to modify
- column_name (string (optional)) – column containing hourly data
Returns: data – Original dataframe with Chicago crime time stamps as DateTimeIndex.
Return type: pandas.DataFrame
-
features.df_functions.
str_pad
(time_stamp)[source]¶ Pads the begining of string with 0 until length 4 is reached.
If string is less than four characters, than a 0 is appended to head of string. This is done until string is at least 4 digits long.
Parameters: time_stamp (string) – string for Returns: new_string – padded string or original string Return type: string