From f4310f8763da31689036d1527706d620f5bbd3ca Mon Sep 17 00:00:00 2001 From: Zhenyong Zhu Date: Sat, 20 Feb 2021 15:54:09 -0500 Subject: [PATCH 1/3] set rollForward to major --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index bb2b7111..380031d4 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { "version": "3.0.100", - "rollForward": "minor" + "rollForward": "major" } } From c93909d9656bc6bcf646d24d293ea6ea0b540036 Mon Sep 17 00:00:00 2001 From: Zhenyong Zhu Date: Sat, 20 Feb 2021 15:54:26 -0500 Subject: [PATCH 2/3] update fake-cli and paket version --- .config/dotnet-tools.json | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 8599247f..827f0561 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,16 +3,12 @@ "isRoot": true, "tools": { "fake-cli": { - "version": "5.19.0", - "commands": [ - "fake" - ] + "version": "5.20.3", + "commands": ["fake"] }, "paket": { - "version": "5.241.6", - "commands": [ - "paket" - ] + "version": "6.0.0-beta8", + "commands": ["paket"] } } -} \ No newline at end of file +} From 71e7594de4f43bb7a421a347e894cea3325f46ef Mon Sep 17 00:00:00 2001 From: Zhenyong Zhu Date: Sat, 20 Feb 2021 16:30:58 -0500 Subject: [PATCH 3/3] add C# test cases for slicing columns and rows --- tests/Deedle.CSharp.Tests/Frame.cs | 44 +++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/tests/Deedle.CSharp.Tests/Frame.cs b/tests/Deedle.CSharp.Tests/Frame.cs index 166575f4..c59b7442 100644 --- a/tests/Deedle.CSharp.Tests/Frame.cs +++ b/tests/Deedle.CSharp.Tests/Frame.cs @@ -8,16 +8,13 @@ namespace Deedle.CSharp.Tests { - /* ---------------------------------------------------------------------------------- - * Test calling Frame.Zip from C# - * --------------------------------------------------------------------------------*/ - public class FrameZipTests - { - public static Frame LoadMSFT([CallerFilePath] string source = "") - { - var file = Path.Combine(Path.GetDirectoryName(source), "..", "Deedle.Tests", "data", "MSFT.csv"); - return Frame.ReadCsv(file, inferRows:10); - } + public class Common + { + public static Frame LoadMSFT([CallerFilePath] string source = "") + { + var file = Path.Combine(Path.GetDirectoryName(source), "..", "Deedle.Tests", "data", "MSFT.csv"); + return Frame.ReadCsv(file, inferRows: 10); + } public static Frame LoadMSFTStream([CallerFilePath] string source = "") { @@ -27,11 +24,16 @@ public static Frame LoadMSFTStream([CallerFilePath] string source = sr.Close(); return csv; } - + } + /* ---------------------------------------------------------------------------------- + * Test calling Frame.Zip from C# + * --------------------------------------------------------------------------------*/ + public class FrameZipTests + { [Test] public static void CanSubtractNumericalValues() { - var df = LoadMSFT(); + var df = Common.LoadMSFT(); var actual = df.Zip(df, (n1, n2) => n1 - n2).GetAllValues().Sum(); Assert.AreEqual(0.0, actual); } @@ -39,7 +41,7 @@ public static void CanSubtractNumericalValues() [Test] public static void CanSubtractNumericalValuesStream() { - var df = LoadMSFTStream(); + var df = Common.LoadMSFTStream(); var actual = df.Zip(df, (n1, n2) => n1 - n2).GetAllValues().Sum(); Assert.AreEqual(0.0, actual); } @@ -149,6 +151,22 @@ public static void DropSparseRowsFromRecords() Assert.AreEqual(1.0, b[0].Value); Assert.AreEqual(3.0, b[1].Value); } + + [Test] + public static void CanSliceRows() + { + var df = Common.LoadMSFT(); + var actual = df.Rows[new int[] { 0, 1, 2, 3, 4 }]; + Assert.AreEqual(5, actual.RowCount); + } + + [Test] + public static void CanSliceCols() + { + var df = Common.LoadMSFT(); + var actual = df.Columns[new string[] { "Open", "High" }]; + Assert.AreEqual(2, actual.ColumnCount); + } } /* ----------------------------------------------------------------------------------