Commit 402a2a24 authored by Bruno Duyé's avatar Bruno Duyé

Convert - fix #446: invalid periods format

parent e50ac397
Pipeline #56006 failed with stage
in 54 seconds
......@@ -222,13 +222,13 @@ def iterate_dataset(filepath):
'half year'), "unexpected time dimension: {!r}".format(time_dimension_lower)
if time_dimension_lower == 'month':
# "2014M01" => "2014-01"
dataframe.replace({time_dimension.label: {r'(\d{4})M(\d{2})': r'\1-\2'}}, regex=True, inplace=True)
dataframe.replace({time_dimension.label: {r'(\d{4})[Mm](\d{2})': r'\1-\2'}}, regex=True, inplace=True)
elif time_dimension_lower == 'quarter':
# "2014Q1" => "2014-Q1"
dataframe.replace({time_dimension.label: {r'(\d{4})Q(\d)': r'\1-Q\2'}}, regex=True, inplace=True)
dataframe.replace({time_dimension.label: {r'(\d{4})[Qq](\d)': r'\1-Q\2'}}, regex=True, inplace=True)
elif time_dimension_lower == 'half year':
# "2014H1" => "2014-S1"
df.replace({time_dimension.label: {r'(\d{4})H(\d)': r'\1-S\2'}}, regex=True, inplace=True)
df.replace({time_dimension.label: {r'(\d{4})[Hh](\d)': r'\1-S\2'}}, regex=True, inplace=True)
def iterate_series(dataframe, time_dimension, real_dimensions_codes):
"""Iterate through dataset series and yield dicts like:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment