Helper method to read a dataframe from a csv file. By default this is well suited for a dataframe with
    headers in the first row, for example a parameter dataframe.

    :param desired_type:
    :param file_path:
    :param encoding:
    :param logger:
    :param kwargs:
    :return:

def read_df_or_series_from_csv(desired_type: Type[pd.DataFrame], file_path: str, encoding: str,
                               logger: Logger, **kwargs) -> pd.DataFrame:
    """
    Helper method to read a dataframe from a csv file. By default this is well suited for a dataframe with
    headers in the first row, for example a parameter dataframe.

    :param desired_type:
    :param file_path:
    :param encoding:
    :param logger:
    :param kwargs:
    :return:
    """
    if desired_type is pd.Series:
        # as recommended in http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.from_csv.html
        # and from http://stackoverflow.com/questions/15760856/how-to-read-a-pandas-series-from-a-csv-file

        # TODO there should be a way to decide between row-oriented (squeeze=True) and col-oriented (index_col=0)
        # note : squeeze=true only works for row-oriented, so we dont use it. We rather expect that a row-oriented
        # dataframe would be convertible to a series using the df to series converter below
        if 'index_col' not in kwargs.keys():
            one_col_df = pd.read_csv(file_path, encoding=encoding, index_col=0, **kwargs)
        else:
            one_col_df = pd.read_csv(file_path, encoding=encoding, **kwargs)

        if one_col_df.shape[1] == 1:
            return one_col_df[one_col_df.columns[0]]
        else:
            raise Exception('Cannot build a series from this csv: it has more than two columns (one index + one value).'
                            ' Probably the parsing chain $read_df_or_series_from_csv => single_row_or_col_df_to_series$'
                            'will work, though.')
    else:
        return pd.read_csv(file_path, encoding=encoding, **kwargs)