From f9edaa8bdf5b77c5c1470fecf1c5e0078713dc34 Mon Sep 17 00:00:00 2001 From: Dogan Kazakli Date: Fri, 25 Nov 2022 10:22:03 +0300 Subject: [PATCH 1/3] adds scalar overloads on datetime and timespan --- src/Deedle/Series.fs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Deedle/Series.fs b/src/Deedle/Series.fs index 4686fb28..49c5940c 100644 --- a/src/Deedle/Series.fs +++ b/src/Deedle/Series.fs @@ -930,6 +930,10 @@ and series.Select(fun (KeyValue(k, v)) -> op v) static member inline internal UnaryOperation<'T>(series:Series<'K, 'T>, op : 'T -> 'T) = series.Select(fun (KeyValue(k, v)) -> op v) + static member inline internal ScalarGenericOperationL<'T1, 'T2, 'T3>(series:Series<'K, 'T1>, scalar, op : 'T1 -> 'T2 -> 'T3) = + series.Select(fun (KeyValue(k, v)) -> op v scalar) + static member inline internal ScalarGenericOperationR<'T1, 'T2, 'T3>(scalar, series:Series<'K, 'T1>, op : 'T1 -> 'T2 -> 'T3) = + series.Select(fun (KeyValue(k, v)) -> op v scalar) static member inline internal ScalarOperationL<'T>(series:Series<'K, 'T>, scalar, op : 'T -> 'T -> 'T) = series.Select(fun (KeyValue(k, v)) -> op v scalar) static member inline internal ScalarOperationR<'T>(scalar, series:Series<'K, 'T>, op : 'T -> 'T -> 'T) = @@ -1005,6 +1009,24 @@ and /// [category:Operators] static member (/) (series, scalar) = Series<'K, _>.ScalarOperationL(series, scalar, (/)) + /// [category:Operators] + static member (+) (scalar, series) = Series<'K, _>.ScalarOperationR(scalar, series, (+)) + /// [category:Operators] + static member (+) (series, scalar) = Series<'K, _>.ScalarOperationL(series, scalar, (+)) + /// [category:Operators] + static member (-) (scalar, series) = Series<'K, _>.ScalarOperationR(scalar, series, (-)) + /// [category:Operators] + static member (-) (series, scalar) = Series<'K, _>.ScalarOperationL(series, scalar, (-)) + + /// [category:Operators] + static member (-) (scalar, series) = Series<'K, _>.ScalarGenericOperationR(scalar, series, (-)) + /// [category:Operators] + static member (-) (series, scalar) = Series<'K, _>.ScalarGenericOperationL(series, scalar, (-)) + /// [category:Operators] + static member (-) (series, scalar) = Series<'K, _>.ScalarGenericOperationL(series, scalar, (-)) + /// [category:Operators] + static member (+) (series, scalar) = Series<'K, _>.ScalarGenericOperationL(series, scalar, (+)) + /// [category:Operators] static member (+) (s1, s2) = Series<'K, _>.VectorOperation(s1, s2, (+)) /// [category:Operators] From a361a272374bf2cbceb0a0b26c9ef3d2253927ca Mon Sep 17 00:00:00 2001 From: Dogan Kazakli Date: Fri, 25 Nov 2022 10:22:32 +0300 Subject: [PATCH 2/3] adds vector overloads on timespan --- src/Deedle/Series.fs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Deedle/Series.fs b/src/Deedle/Series.fs index 49c5940c..75a2958c 100644 --- a/src/Deedle/Series.fs +++ b/src/Deedle/Series.fs @@ -1056,6 +1056,11 @@ and /// [category:Operators] static member (/) (s1, s2) = Series<'K, _>.VectorOperation(s1, s2, (/)) + /// [category:Operators] + static member (+) (s1, s2) = Series<'K, _>.VectorOperation(s1, s2, (+)) + /// [category:Operators] + static member (-) (s1, s2) = Series<'K, _>.VectorOperation(s1, s2, (-)) + /// [category:Operators] static member (+) (s1, s2) = Series<'K, _>.VectorOperation(s1, s2, (+)) /// [category:Operators] From 11505179e01e8a1a9a99cec6dd961781fe1783e7 Mon Sep 17 00:00:00 2001 From: Dogan Kazakli Date: Fri, 25 Nov 2022 22:18:49 +0300 Subject: [PATCH 3/3] adds op for TimeSpan + Series --- src/Deedle/Series.fs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Deedle/Series.fs b/src/Deedle/Series.fs index 75a2958c..c9588e35 100644 --- a/src/Deedle/Series.fs +++ b/src/Deedle/Series.fs @@ -930,9 +930,9 @@ and series.Select(fun (KeyValue(k, v)) -> op v) static member inline internal UnaryOperation<'T>(series:Series<'K, 'T>, op : 'T -> 'T) = series.Select(fun (KeyValue(k, v)) -> op v) - static member inline internal ScalarGenericOperationL<'T1, 'T2, 'T3>(series:Series<'K, 'T1>, scalar, op : 'T1 -> 'T2 -> 'T3) = + static member inline internal ScalarGenericOperationL<'T1, 'T2, 'T3>(series:Series<'K, 'T1>, scalar, op: 'T1 -> 'T2 -> 'T3) = series.Select(fun (KeyValue(k, v)) -> op v scalar) - static member inline internal ScalarGenericOperationR<'T1, 'T2, 'T3>(scalar, series:Series<'K, 'T1>, op : 'T1 -> 'T2 -> 'T3) = + static member inline internal ScalarGenericOperationR<'T1, 'T2, 'T3>(scalar, series:Series<'K, 'T1>, op: 'T1 -> 'T2 -> 'T3) = series.Select(fun (KeyValue(k, v)) -> op v scalar) static member inline internal ScalarOperationL<'T>(series:Series<'K, 'T>, scalar, op : 'T -> 'T -> 'T) = series.Select(fun (KeyValue(k, v)) -> op v scalar) @@ -1025,6 +1025,8 @@ and /// [category:Operators] static member (-) (series, scalar) = Series<'K, _>.ScalarGenericOperationL(series, scalar, (-)) /// [category:Operators] + static member (+) (scalar, series) = Series<'K, _>.ScalarGenericOperationR(scalar, series, (+)) + /// [category:Operators] static member (+) (series, scalar) = Series<'K, _>.ScalarGenericOperationL(series, scalar, (+)) /// [category:Operators]