示例#1
0
    def _format_datetime_col(self):
        time_srs = self["time"]
        if isinstance(time_srs.iloc[0], datetime):
            pass
        elif isinstance(time_srs.iloc[0], int):
            time_srs = [datetime(y, 1, 1) for y in to_int(time_srs)]
        else:
            time_srs = time_srs.apply(lambda x: convert_to_datetime(x))

        self["time"] = time_srs
示例#2
0
def test_convert_to_datetime_error(spoint):
    error_msg = "Your timestamps don't appear to be middle or start of month"
    with pytest.raises(ValueError, match=error_msg):
        convert_to_datetime(spoint)
示例#3
0
def test_convert_to_datetime(spoint, output):
    res = convert_to_datetime(spoint)
    assert res == output