Skip to content

Commit a052146

Browse files
update interactive kernel version (dotnet#6836)
* update interactive kernel version * update * Update Microsoft.Data.Analysis.Interactive.Tests.csproj
1 parent 49824f3 commit a052146

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

eng/Versions.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
<LightGBMVersion>2.3.1</LightGBMVersion>
3636
<MicrosoftCodeAnalysisAnalyzersVersion>3.3.0</MicrosoftCodeAnalysisAnalyzersVersion>
3737
<MicrosoftCodeAnalysisCSharpVersion>3.9.0</MicrosoftCodeAnalysisCSharpVersion>
38-
<MicrosoftDotNetInteractiveFormattingVersion>1.0.0-beta.22504.6</MicrosoftDotNetInteractiveFormattingVersion>
39-
<MicrosoftDotNetInteractiveVersion>1.0.0-beta.22504.6</MicrosoftDotNetInteractiveVersion>
38+
<MicrosoftDotNetInteractiveFormattingVersion>1.0.0-beta.23461.4</MicrosoftDotNetInteractiveFormattingVersion>
39+
<MicrosoftDotNetInteractiveVersion>1.0.0-beta.23461.4</MicrosoftDotNetInteractiveVersion>
4040
<MicrosoftMLOnnxRuntimeVersion>1.14.0</MicrosoftMLOnnxRuntimeVersion>
4141
<MlNetMklDepsVersion>0.0.0.12</MlNetMklDepsVersion>
4242
<!--

src/Microsoft.Data.Analysis.Interactive/TabularDataResourceExtensions.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6+
using System.Collections.Generic;
67
using System.Linq;
78
using Microsoft.Data.Analysis;
89

@@ -22,19 +23,32 @@ public static DataFrame ToDataFrame(this TabularDataResource tabularDataResource
2223

2324
foreach (var fieldDescriptor in tabularDataResource.Schema.Fields)
2425
{
26+
var fieldName = fieldDescriptor.Name;
27+
var column = tabularDataResource.Data.Select(row =>
28+
{
29+
if (row is IDictionary<string, object> dictionary)
30+
{
31+
return dictionary[fieldName];
32+
}
33+
else
34+
{
35+
return row.FirstOrDefault(kvp => kvp.Key == fieldName).Value;
36+
}
37+
});
38+
2539
switch (fieldDescriptor.Type)
2640
{
2741
case TableSchemaFieldType.Number:
28-
dataFrame.Columns.Add(new DoubleDataFrameColumn(fieldDescriptor.Name, tabularDataResource.Data.Select(d => Convert.ToDouble(d[fieldDescriptor.Name]))));
42+
dataFrame.Columns.Add(new DoubleDataFrameColumn(fieldDescriptor.Name, column.Select(Convert.ToDouble)));
2943
break;
3044
case TableSchemaFieldType.Integer:
31-
dataFrame.Columns.Add(new Int64DataFrameColumn(fieldDescriptor.Name, tabularDataResource.Data.Select(d => Convert.ToInt64(d[fieldDescriptor.Name]))));
45+
dataFrame.Columns.Add(new Int64DataFrameColumn(fieldDescriptor.Name, column.Select(Convert.ToInt64)));
3246
break;
3347
case TableSchemaFieldType.Boolean:
34-
dataFrame.Columns.Add(new BooleanDataFrameColumn(fieldDescriptor.Name, tabularDataResource.Data.Select(d => Convert.ToBoolean(d[fieldDescriptor.Name]))));
48+
dataFrame.Columns.Add(new BooleanDataFrameColumn(fieldDescriptor.Name, column.Select(Convert.ToBoolean)));
3549
break;
3650
case TableSchemaFieldType.String:
37-
dataFrame.Columns.Add(new StringDataFrameColumn(fieldDescriptor.Name, tabularDataResource.Data.Select(d => Convert.ToString(d[fieldDescriptor.Name]))));
51+
dataFrame.Columns.Add(new StringDataFrameColumn(fieldDescriptor.Name, column.Select(Convert.ToString)));
3852
break;
3953
default:
4054
throw new ArgumentOutOfRangeException();

test/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
<ItemGroup>
88
<ProjectReference Include="..\..\src\Microsoft.Data.Analysis.Interactive\Microsoft.Data.Analysis.Interactive.csproj" />
9-
10-
<PackageReference Include=" System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebVersion)" />
119
</ItemGroup>
1210

1311
<!-- register for test discovery in Visual Studio -->

0 commit comments

Comments
 (0)