本文整理汇总了C#中DataFrame.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# DataFrame.Equals方法的具体用法?C# DataFrame.Equals怎么用?C# DataFrame.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFrame
的用法示例。
在下文中一共展示了DataFrame.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_GetSubset_ByRows_UsingRowIndices
public void Test_GetSubset_ByRows_UsingRowIndices()
{
// Given
var newDataTable = new DataTable
{
Columns =
{
new DataColumn("Col1", typeof(string)),
new DataColumn("Col2", typeof(int)),
new DataColumn("Col3", typeof(string)),
new DataColumn("Col4", typeof(int))
},
Rows =
{
new object[] { "a1.1", 1, "b1.2", 2 },
new object[] { "a3.1", 5, "b3.2", 6 }
}
};
var expectedDataFrame = new DataFrame(newDataTable, new[] { 100, 102 });
// When
var actualDataFrame = _subject.GetSubsetByRows(new[] { 0, 2 });
// Then
Assert.IsTrue(expectedDataFrame.Equals(actualDataFrame));
}
示例2: Test_DataFrameFrom_Matrix_CustomColumnNames
public void Test_DataFrameFrom_Matrix_CustomColumnNames()
{
// Given
var baseMatrix =
Matrix<double>.Build.DenseOfArray(new double[,] { { 1, 2, 3, 4 }, { 5, 6, 666, 8 }, { 9, 10, 11, 12 } });
var columnNames = new[] { "Col1", "Col2", "Col3", "Col4" };
var dataTable = new DataTable("some")
{
Columns = {
"Col1", "Col2", "Col3", "Col4"
},
Rows = {
{ 1, 2, 3, 4 }, { 5, 6, 666, 8 }, { 9, 10, 11, 12 }
}
};
var expectedDataFrame = new DataFrame(dataTable);
// When
var actualDataFrame = new DataFrame(baseMatrix, columnNames);
// Then
Assert.IsTrue(expectedDataFrame.Equals(actualDataFrame));
}
示例3: Test_GetSubset_ByColumns_UsingColumnNames
public void Test_GetSubset_ByColumns_UsingColumnNames()
{
var vec = new DataVector<object>(new object[] { "aa", 50, "bb" }, new[] { "f1", "f2", "f3" });
vec.MemberwiseSet((string name, object val) => name == "f1" ? name.ToUpper() : name.ToUpper());
// Given
var newDataTable = new DataTable
{
Columns =
{
new DataColumn("Col1", typeof(string)),
new DataColumn("Col3", typeof(string))
},
Rows =
{
new object[] { "a1.1", "b1.2" },
new object[] { "a2.1", "b2.2" },
new object[] { "a3.1", "b3.2" }
}
};
var expectedDataFrame = new DataFrame(newDataTable, new[] { 100, 101, 102 });
// When
var actualDataFrame = _subject.GetSubsetByColumns(new[] { "Col1", "Col3" });
// Then
Assert.IsTrue(expectedDataFrame.Equals(actualDataFrame));
}