dotnet / machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
https://dot.net/ml
MIT License
9.05k stars 1.88k forks source link

Accessing data by column after adding columns to a DataFrame returns error data #7136

Closed feiyun0112 closed 6 months ago

feiyun0112 commented 7 months ago

fix #7135

Describe the bug Accessing data by column after adding columns to a DataFrame returns error data

var df = DataFrame.LoadCsvFromString("a1,a2\n1,2\n3,4");
var dc0 = DataFrameColumn.Create("a0", new int[] { 0, 0 });
df.Columns.Insert(0, dc0);
var dc1 = df["a1"];
Console.WriteLine(dc1.ToString());

This code expected print: a1: 1 3 But it print: a0: 0 0

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 68.55%. Comparing base (72cfdf6) to head (2fb52cd).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #7136 +/- ## ========================================== - Coverage 68.55% 68.55% -0.01% ========================================== Files 1259 1259 Lines 255844 255851 +7 Branches 26434 26434 ========================================== - Hits 175392 175391 -1 - Misses 73717 73722 +5 - Partials 6735 6738 +3 ``` | [Flag](https://app.codecov.io/gh/dotnet/machinelearning/pull/7136/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | Coverage Δ | | |---|---|---| | [Debug](https://app.codecov.io/gh/dotnet/machinelearning/pull/7136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | `68.55% <100.00%> (-0.01%)` | :arrow_down: | | [production](https://app.codecov.io/gh/dotnet/machinelearning/pull/7136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | `62.89% <100.00%> (-0.01%)` | :arrow_down: | | [test](https://app.codecov.io/gh/dotnet/machinelearning/pull/7136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | `88.70% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/dotnet/machinelearning/pull/7136?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | Coverage Δ | | |---|---|---| | [...crosoft.Data.Analysis/DataFrameColumnCollection.cs](https://app.codecov.io/gh/dotnet/machinelearning/pull/7136?src=pr&el=tree&filepath=src%2FMicrosoft.Data.Analysis%2FDataFrameColumnCollection.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet#diff-c3JjL01pY3Jvc29mdC5EYXRhLkFuYWx5c2lzL0RhdGFGcmFtZUNvbHVtbkNvbGxlY3Rpb24uY3M=) | `81.06% <100.00%> (ø)` | | | [...st/Microsoft.Data.Analysis.Tests/DataFrameTests.cs](https://app.codecov.io/gh/dotnet/machinelearning/pull/7136?src=pr&el=tree&filepath=test%2FMicrosoft.Data.Analysis.Tests%2FDataFrameTests.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet#diff-dGVzdC9NaWNyb3NvZnQuRGF0YS5BbmFseXNpcy5UZXN0cy9EYXRhRnJhbWVUZXN0cy5jcw==) | `99.90% <100.00%> (+<0.01%)` | :arrow_up: | ... and [4 files with indirect coverage changes](https://app.codecov.io/gh/dotnet/machinelearning/pull/7136/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet)