1305 references to Columns
Microsoft.Data.Analysis (283)
DataFrame.Arrow.cs (6)
146ret.Columns.Insert(ret.Columns.Count, dataFrameColumn); 177int columnCount = Columns.Count; 180DataFrameColumn column = Columns[i]; 197DataFrameColumn column = Columns[i]; 202DataFrameColumn column = Columns[i];
DataFrame.BinaryOperations.cs (116)
18if (values.Count != Columns.Count) 24for (int i = 0; i < Columns.Count; i++) 29retDataFrame.Columns[i] = newColumn; 31retDataFrame.Columns.Insert(i, newColumn); 43for (int i = 0; i < Columns.Count; i++) 48retDataFrame.Columns[i] = newColumn; 50retDataFrame.Columns.Insert(i, newColumn); 57if (values.Count != Columns.Count) 63for (int i = 0; i < Columns.Count; i++) 68retDataFrame.Columns[i] = newColumn; 70retDataFrame.Columns.Insert(i, newColumn); 82for (int i = 0; i < Columns.Count; i++) 87retDataFrame.Columns[i] = newColumn; 89retDataFrame.Columns.Insert(i, newColumn); 96if (values.Count != Columns.Count) 102for (int i = 0; i < Columns.Count; i++) 107retDataFrame.Columns[i] = newColumn; 109retDataFrame.Columns.Insert(i, newColumn); 121for (int i = 0; i < Columns.Count; i++) 126retDataFrame.Columns[i] = newColumn; 128retDataFrame.Columns.Insert(i, newColumn); 135if (values.Count != Columns.Count) 141for (int i = 0; i < Columns.Count; i++) 146retDataFrame.Columns[i] = newColumn; 148retDataFrame.Columns.Insert(i, newColumn); 160for (int i = 0; i < Columns.Count; i++) 165retDataFrame.Columns[i] = newColumn; 167retDataFrame.Columns.Insert(i, newColumn); 174if (values.Count != Columns.Count) 180for (int i = 0; i < Columns.Count; i++) 185retDataFrame.Columns[i] = newColumn; 187retDataFrame.Columns.Insert(i, newColumn); 199for (int i = 0; i < Columns.Count; i++) 204retDataFrame.Columns[i] = newColumn; 206retDataFrame.Columns.Insert(i, newColumn); 212if (values.Count != Columns.Count) 218for (int i = 0; i < Columns.Count; i++) 223retDataFrame.Columns[i] = newColumn; 225retDataFrame.Columns.Insert(i, newColumn); 236for (int i = 0; i < Columns.Count; i++) 241retDataFrame.Columns[i] = newColumn; 243retDataFrame.Columns.Insert(i, newColumn); 249if (values.Count != Columns.Count) 255for (int i = 0; i < Columns.Count; i++) 260retDataFrame.Columns[i] = newColumn; 262retDataFrame.Columns.Insert(i, newColumn); 273for (int i = 0; i < Columns.Count; i++) 278retDataFrame.Columns[i] = newColumn; 280retDataFrame.Columns.Insert(i, newColumn); 286if (values.Count != Columns.Count) 292for (int i = 0; i < Columns.Count; i++) 297retDataFrame.Columns[i] = newColumn; 299retDataFrame.Columns.Insert(i, newColumn); 310for (int i = 0; i < Columns.Count; i++) 315retDataFrame.Columns[i] = newColumn; 317retDataFrame.Columns.Insert(i, newColumn); 328for (int i = 0; i < Columns.Count; i++) 333retDataFrame.Columns[i] = newColumn; 335retDataFrame.Columns.Insert(i, newColumn); 346for (int i = 0; i < Columns.Count; i++) 351retDataFrame.Columns[i] = newColumn; 353retDataFrame.Columns.Insert(i, newColumn); 360if (values.Count != Columns.Count) 366for (int i = 0; i < Columns.Count; i++) 370retDataFrame.Columns.Insert(i, newColumn); 382for (int i = 0; i < Columns.Count; i++) 386retDataFrame.Columns.Insert(i, newColumn); 393if (values.Count != Columns.Count) 399for (int i = 0; i < Columns.Count; i++) 403retDataFrame.Columns.Insert(i, newColumn); 415for (int i = 0; i < Columns.Count; i++) 419retDataFrame.Columns.Insert(i, newColumn); 426if (values.Count != Columns.Count) 432for (int i = 0; i < Columns.Count; i++) 436retDataFrame.Columns.Insert(i, newColumn); 448for (int i = 0; i < Columns.Count; i++) 452retDataFrame.Columns.Insert(i, newColumn); 459if (values.Count != Columns.Count) 465for (int i = 0; i < Columns.Count; i++) 469retDataFrame.Columns.Insert(i, newColumn); 481for (int i = 0; i < Columns.Count; i++) 485retDataFrame.Columns.Insert(i, newColumn); 492if (values.Count != Columns.Count) 498for (int i = 0; i < Columns.Count; i++) 502retDataFrame.Columns.Insert(i, newColumn); 514for (int i = 0; i < Columns.Count; i++) 518retDataFrame.Columns.Insert(i, newColumn); 525if (values.Count != Columns.Count) 531for (int i = 0; i < Columns.Count; i++) 535retDataFrame.Columns.Insert(i, newColumn); 547for (int i = 0; i < Columns.Count; i++) 551retDataFrame.Columns.Insert(i, newColumn); 563for (int i = 0; i < Columns.Count; i++) 568retDataFrame.Columns[i] = newColumn; 570retDataFrame.Columns.Insert(i, newColumn); 581for (int i = 0; i < Columns.Count; i++) 586retDataFrame.Columns[i] = newColumn; 588retDataFrame.Columns.Insert(i, newColumn); 599for (int i = 0; i < Columns.Count; i++) 604retDataFrame.Columns[i] = newColumn; 606retDataFrame.Columns.Insert(i, newColumn); 617for (int i = 0; i < Columns.Count; i++) 622retDataFrame.Columns[i] = newColumn; 624retDataFrame.Columns.Insert(i, newColumn); 635for (int i = 0; i < Columns.Count; i++) 640retDataFrame.Columns[i] = newColumn; 642retDataFrame.Columns.Insert(i, newColumn); 652for (int i = 0; i < Columns.Count; i++) 657retDataFrame.Columns[i] = newColumn; 659retDataFrame.Columns.Insert(i, newColumn); 669for (int i = 0; i < Columns.Count; i++) 674retDataFrame.Columns[i] = newColumn; 676retDataFrame.Columns.Insert(i, newColumn); 686for (int i = 0; i < Columns.Count; i++) 691retDataFrame.Columns[i] = newColumn; 693retDataFrame.Columns.Insert(i, newColumn);
DataFrame.cs (45)
161get => Columns[columnName]; 162set => Columns[columnName] = value; 200List<DataFrameColumn> newColumns = new List<DataFrameColumn>(Columns.Count); 201for (int i = 0; i < Columns.Count; i++) 203newColumns.Add(Columns[i].Clone(mapIndices)); 216foreach (DataFrameColumn column in Columns) 224ret.Columns.Add(strColumn); 226ret.Columns.Add(column.Info()); 239foreach (DataFrameColumn column in Columns) 253ret.Columns.Add(stringColumn); 255ret.Columns.Add(column.Description()); 292for (int i = 0; i < ret.Columns.Count; i++) 294DataFrameColumn column = ret.Columns[i]; 307for (int i = 0; i < df.Columns.Count; i++) 309DataFrameColumn column = df.Columns[i]; 322for (int i = 0; i < df.Columns.Count; i++) 324DataFrameColumn column = df.Columns[i]; 400for (int i = 0; i < Columns.Count; i++) 402if (Columns[i].Length != rowCount) 403throw new ArgumentException(String.Format("{0} {1}", Strings.MismatchedRowCount, Columns[i].Name)); 421foreach (var column in Columns) 441foreach (var column in Columns) 468for (int i = 0; i < ret.Columns.Count; i++) 470ret.Columns[i].FillNulls(value, inPlace: true); 483if (values.Count != Columns.Count) 487for (int i = 0; i < ret.Columns.Count; i++) 489Columns[i].FillNulls(values[i], inPlace: true); 536IEnumerator<DataFrameColumn> columnEnumerator = ret.Columns.GetEnumerator(); 575throw new ArgumentException(string.Format(Strings.ExceedsNumberOfColumns, Columns.Count), nameof(row)); 578columnEnumerator = ret.Columns.GetEnumerator(); 600ret.Columns.RowCount++; 628int index = ret.Columns.IndexOf(columnName); 634DataFrameColumn column = ret.Columns[index]; 651int index = ret.Columns.IndexOf(columnName); 653DataFrameColumn column = ret.Columns[index]; 659foreach (DataFrameColumn column in ret.Columns) 666ret.Columns.RowCount++; 680DataFrameColumn column = Columns[columnName]; 683List<DataFrameColumn> newColumns = new List<DataFrameColumn>(Columns.Count); 684for (int i = 0; i < Columns.Count; i++) 686DataFrameColumn oldColumn = Columns[i]; 709for (int i = 0; i < Columns.Count; i++) 711longestColumnName = Math.Max(longestColumnName, Columns[i].Name.Length); 715for (int i = 0; i < Columns.Count; i++) 718sb.Append(string.Format(Columns[i].Name.PadRight(padding)));
DataFrame.IDataView.cs (3)
29for (int i = 0; i < Columns.Count; i++) 31DataFrameColumn baseColumn = Columns[i]; 110DataFrameColumn column = _dataFrame.Columns[col];
DataFrame.IO.cs (5)
144var columnsCount = Columns.Count; 148foreach (var column in Columns) 159if (table.Columns[c].DataType != Columns[c].DataType) 479ret.Columns.Insert(0, indexColumn); 677SaveHeader(csvFile, dataFrame.Columns.GetColumnNames(), separator);
DataFrame.Join.cs (48)
32DataFrameColumn existingColumn = dataFrame.Columns[index]; 52for (int i = 0; i < Columns.Count; i++) 54DataFrameColumn newColumn = Columns[i].Clone(); 55ret.Columns.Insert(ret.Columns.Count, newColumn); 63for (int i = 0; i < other.Columns.Count; i++) 68newColumn = other.Columns[i].Clone(numberOfNullsToAppend: Rows.Count - other.Rows.Count); 72newColumn = other.Columns[i].Clone(mapIndices); 75ret.Columns.Insert(ret.Columns.Count, newColumn); 86for (int i = 0; i < Columns.Count; i++) 91newColumn = Columns[i].Clone(numberOfNullsToAppend: other.Rows.Count - Rows.Count); 95newColumn = Columns[i].Clone(mapIndices); 97ret.Columns.Insert(ret.Columns.Count, newColumn); 99for (int i = 0; i < other.Columns.Count; i++) 101DataFrameColumn newColumn = other.Columns[i].Clone(); 103ret.Columns.Insert(ret.Columns.Count, newColumn); 110for (int i = 0; i < Columns.Count; i++) 112DataFrameColumn newColumn = Columns[i].Clone(numberOfNullsToAppend: numberOfNulls); 113ret.Columns.Insert(ret.Columns.Count, newColumn); 116for (int i = 0; i < other.Columns.Count; i++) 118DataFrameColumn newColumn = other.Columns[i].Clone(numberOfNullsToAppend: numberOfNulls); 120ret.Columns.Insert(ret.Columns.Count, newColumn); 131for (int i = 0; i < Columns.Count; i++) 133DataFrameColumn newColumn = Columns[i].Clone(mapIndices); 134ret.Columns.Insert(ret.Columns.Count, newColumn); 136for (int i = 0; i < other.Columns.Count; i++) 138DataFrameColumn newColumn = other.Columns[i].Clone(mapIndices); 140ret.Columns.Insert(ret.Columns.Count, newColumn); 204DataFrameColumn shrinkedRetainedColumn = retainedDataFrame.Columns[retainedJoinColumnNames[colNameIndex]]; 228DataFrameColumn supplementaryColumn = supplementaryDataFrame.Columns[supplemetaryJoinColumnNames[colNameIndex]]; 285var retainJoinColumns = retainedJoinColumnNames.Select(name => retainedDataFrame.Columns[name]).ToArray(); 287for (long i = 0; i < retainedDataFrame.Columns.RowCount; i++) 388for (long i = 0; i < supplementaryDataFrame.Columns.RowCount; i++) 390var columns = supplementaryJoinColumns.Select(name => supplementaryDataFrame.Columns[name]).ToArray(); 410for (int i = 0; i < this.Columns.Count; i++) 412ret.Columns.Insert(i, this.Columns[i].Clone(mapIndicesLeft)); 416for (int i = 0; i < other.Columns.Count; i++) 418DataFrameColumn column = other.Columns[i].Clone(mapIndicesRight); 421ret.Columns.Insert(ret.Columns.Count, column);
DataFrameRow.cs (5)
24Debug.Assert(rowIndex < df.Columns.RowCount); 34foreach (DataFrameColumn column in _dataFrame.Columns) 42return _dataFrame.Columns.Select(col => new KeyValuePair<string, object>(col.Name, col[_rowIndex])); 54return _dataFrame.Columns[index][_rowIndex]; 58_dataFrame.Columns[index][_rowIndex] = value;
DataFrameRowCollection.cs (1)
52public long Count => _dataFrame.Columns.RowCount;
GroupBy.cs (54)
110if (dataFrame.Columns.Count < groupByColumnIndex || groupByColumnIndex < 0) 133int columnIndex = _dataFrame.Columns.IndexOf(columnName); 146DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); 147ret.Columns.Insert(ret.Columns.Count, firstColumn); 157DataFrameColumn column = _dataFrame.Columns[columnIndex]; 168ret.Columns.Insert(ret.Columns.Count, retColumn); 173retColumn = ret.Columns[column.Name]; 189DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); 190ret.Columns.Insert(ret.Columns.Count, firstColumn); 202DataFrameColumn column = _dataFrame.Columns[columnIndex]; 209ret.Columns.Insert(ret.Columns.Count, retColumn); 214retColumn = ret.Columns[column.Name]; 231DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); 232ret.Columns.Insert(ret.Columns.Count, firstColumn); 242DataFrameColumn column = _dataFrame.Columns[columnIndex]; 254ret.Columns.Insert(ret.Columns.Count, retColumn); 259retColumn = ret.Columns[column.Name]; 285DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); 286ret.Columns.Insert(ret.Columns.Count, firstColumn); 296DataFrameColumn column = _dataFrame.Columns[columnIndex]; 310ret.Columns.Insert(ret.Columns.Count, retColumn); 315retColumn = ret.Columns[column.Name]; 339DataFrameColumn column = _dataFrame.Columns[columnIndex]; 344ret.Columns.Insert(ret.Columns.Count, retColumn); 349retColumn = ret.Columns[column.Name]; 359DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); 360ret.Columns.Insert(ret.Columns.Count, firstColumn); 373retColumn[rowIndex] = _dataFrame.Columns[columnIndex].Max(rowEnumerable); 387DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); 388ret.Columns.Insert(ret.Columns.Count, firstColumn); 401retColumn[rowIndex] = _dataFrame.Columns[columnIndex].Min(rowEnumerable); 415DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); 416ret.Columns.Insert(ret.Columns.Count, firstColumn); 429retColumn[rowIndex] = _dataFrame.Columns[columnIndex].Product(rowEnumerable); 443DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); 444ret.Columns.Insert(ret.Columns.Count, firstColumn); 457retColumn[rowIndex] = _dataFrame.Columns[columnIndex].Sum(rowEnumerable); 471DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); 472ret.Columns.Insert(ret.Columns.Count, firstColumn); 486retColumn[rowIndex] = (double)Convert.ChangeType(_dataFrame.Columns[columnIndex].Sum(rowEnumerable), typeof(double)) / rowEnumerable.Count;
Microsoft.Data.Analysis.Interactive (6)
DataFrameKernelExtension.cs (2)
48header.AddRange(df.Columns.Select(c => (IHtmlContent)th(c.Name))); 101tfoot(tr(td[colspan: df.Columns.Count + 1, style: "text-align: center;"](footer)))
TabularDataResourceExtensions.cs (4)
42dataFrame.Columns.Add(new DoubleDataFrameColumn(fieldDescriptor.Name, column.Select(Convert.ToDouble))); 45dataFrame.Columns.Add(new Int64DataFrameColumn(fieldDescriptor.Name, column.Select(Convert.ToInt64))); 48dataFrame.Columns.Add(new BooleanDataFrameColumn(fieldDescriptor.Name, column.Select(Convert.ToBoolean))); 51dataFrame.Columns.Add(new StringDataFrameColumn(fieldDescriptor.Name, column.Select(Convert.ToString)));
Microsoft.Data.Analysis.Interactive.Tests (3)
DataFrameInteractiveTests.cs (3)
30dataFrame.Columns.Insert(0, dataFrameColumn1); 31dataFrame.Columns.Insert(1, dataFrameColumn2); 92Assert.Equal(dataFrame.Columns.Select(c => c.Name).ToArray(), new[] { "TrueOrFalse", "Integer", "Double", "Text" });
Microsoft.Data.Analysis.Tests (1013)
ArrowIntegrationTests.cs (17)
177Assert.Equal(1, df.Columns["Column1"][1]); 178df.Columns["Column1"][1] = 100; 179Assert.Equal(100, df.Columns["Column1"][1]); 180Assert.Equal(0, df.Columns["Column1"].NullCount); 199Assert.Equal(0, df.Columns["EmptyNullBitMapColumn"].NullCount); 200Assert.Equal(10, df.Columns["EmptyNullBitMapColumn"].Length); 201df.Columns["EmptyNullBitMapColumn"][9] = null; 202Assert.Equal(1, df.Columns["EmptyNullBitMapColumn"].NullCount); 203Assert.Equal(10, df.Columns["EmptyDataColumn"].NullCount); 204Assert.Equal(10, df.Columns["EmptyDataColumn"].Length); 205df.Columns["EmptyDataColumn"][9] = 9; 206Assert.Equal(9, df.Columns["EmptyDataColumn"].NullCount); 207Assert.Equal(10, df.Columns["EmptyDataColumn"].Length); 210Assert.Equal(i, (int)df.Columns["EmptyNullBitMapColumn"][i]); 211Assert.Null(df.Columns["EmptyDataColumn"][i]); 218Assert.Equal(0, emptyDataFrame.Columns["EmptyDataAndNullColumns"].Length); 219Assert.Equal(0, emptyDataFrame.Columns["EmptyDataAndNullColumns"].NullCount);
DataFrame.IOTests.cs (151)
33foreach (DataFrameColumn column in df.Columns) 163Assert.Equal(7, df.Columns.Count); 164Assert.Equal(verifyCMT, df.Columns["vendor_id"][3]); 175Assert.Equal(7, reducedRows.Columns.Count); 176Assert.Equal(verifyCMT, reducedRows.Columns["vendor_id"][2]); 197Assert.Equal(7, df.Columns.Count); 247Assert.Equal(9, df.Columns.Count); 248Assert.Equal("CMT", df.Columns["vendor_id"][3]); 250Assert.Equal("payment_type", df.Columns[5].Name); 251Assert.Equal("payment_type.1", df.Columns[6].Name); 252Assert.Equal("payment_type.2", df.Columns[7].Name); 254Assert.Equal("CRD", df.Columns["payment_type"][0]); 255Assert.Equal("CRD_1", df.Columns["payment_type.1"][0]); 256Assert.Equal("Test", df.Columns["payment_type.2"][0]); 276Assert.Equal(7, df.Columns.Count); 277Assert.Equal(verifyCMT, df.Columns["Column0"][3]); 289Assert.Equal(7, reducedRows.Columns.Count); 290Assert.Equal(verifyCMT, reducedRows.Columns["Column0"][2]); 315Assert.Equal(7, df.Columns.Count); 316Assert.Equal(verifyCMT, df.Columns["Column0"][3]); 328Assert.Equal(7, reducedRows.Columns.Count); 329Assert.Equal(verifyCMT, reducedRows.Columns["Column0"][2]); 342Assert.Equal(7, df.Columns.Count); 346Assert.True(typeof(string) == df.Columns[0].DataType); 347Assert.True(typeof(short) == df.Columns[1].DataType); 348Assert.True(typeof(int) == df.Columns[2].DataType); 349Assert.True(typeof(long) == df.Columns[3].DataType); 350Assert.True(typeof(float) == df.Columns[4].DataType); 351Assert.True(typeof(string) == df.Columns[5].DataType); 352Assert.True(typeof(double) == df.Columns[6].DataType); 357Assert.Equal("vendor_id", df.Columns[0].Name); 358Assert.Equal("rate_code", df.Columns[1].Name); 359Assert.Equal("passenger_count", df.Columns[2].Name); 360Assert.Equal("trip_time_in_secs", df.Columns[3].Name); 361Assert.Equal("trip_distance", df.Columns[4].Name); 362Assert.Equal("payment_type", df.Columns[5].Name); 363Assert.Equal("fare_amount", df.Columns[6].Name); 368foreach (var column in df.Columns) 455Assert.Equal(7, df.Columns.Count); 457Assert.True(typeof(string) == df.Columns[0].DataType); 458Assert.True(typeof(short) == df.Columns[1].DataType); 459Assert.True(typeof(int) == df.Columns[2].DataType); 460Assert.True(typeof(long) == df.Columns[3].DataType); 461Assert.True(typeof(float) == df.Columns[4].DataType); 462Assert.True(typeof(string) == df.Columns[5].DataType); 463Assert.True(typeof(double) == df.Columns[6].DataType); 465Assert.Equal("vendor_id", df.Columns[0].Name); 466Assert.Equal("rate_code", df.Columns[1].Name); 467Assert.Equal("passenger_count", df.Columns[2].Name); 468Assert.Equal("trip_time_in_secs", df.Columns[3].Name); 469Assert.Equal("trip_distance", df.Columns[4].Name); 470Assert.Equal("payment_type", df.Columns[5].Name); 471Assert.Equal("fare_amount", df.Columns[6].Name); 474foreach (var column in df.Columns) 514Assert.Equal(8, df.Columns.Count); 518Assert.True(typeof(string) == df.Columns[0].DataType); 519Assert.True(typeof(short) == df.Columns[1].DataType); 520Assert.True(typeof(int) == df.Columns[2].DataType); 521Assert.True(typeof(long) == df.Columns[3].DataType); 522Assert.True(typeof(float) == df.Columns[4].DataType); 523Assert.True(typeof(string) == df.Columns[5].DataType); 524Assert.True(typeof(double) == df.Columns[6].DataType); 525Assert.True(typeof(DateTime) == df.Columns[7].DataType); 528Assert.Equal("vendor_id", df.Columns[0].Name); 529Assert.Equal("rate_code", df.Columns[1].Name); 530Assert.Equal("passenger_count", df.Columns[2].Name); 531Assert.Equal("trip_time_in_secs", df.Columns[3].Name); 532Assert.Equal("trip_distance", df.Columns[4].Name); 533Assert.Equal("payment_type", df.Columns[5].Name); 534Assert.Equal("fare_amount", df.Columns[6].Name); 535Assert.Equal("date", df.Columns[7].Name); 538foreach (var column in df.Columns) 559var dateTimeColumn = df.Columns["date"]; 591Assert.Equal(7, df.Columns.Count); 592Assert.Equal("CMT", df.Columns["vendor_id"][4]); 597Assert.Equal(7, reducedRows.Columns.Count); 598Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); 630Assert.Equal(7, df.Columns.Count); 631Assert.Equal("CMT", df.Columns["vendor_id"][4]); 636Assert.Equal(7, reducedRows.Columns.Count); 637Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); 668Assert.Equal(7, df.Columns.Count); 669Assert.Equal("CMT", df.Columns["vendor_id"][3]); 674Assert.Equal(7, reducedRows.Columns.Count); 675Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); 695var columnName = df.Columns.Select(c => c.Name); 710var columnName = df.Columns.Select(c => c.Name); 734Assert.Equal(2, dataFrame.Columns.Count); 735Assert.Equal("IndexColumn", dataFrame.Columns[0].Name); 736Assert.Equal(3, dataFrame.Columns[0].Length); 738for (long i = 0; i < dataFrame.Columns[0].Length; i++) 739Assert.Equal(i, dataFrame.Columns[0][i]); 767Assert.Equal(6, df.Columns.Count); 768Assert.Equal("CMT", df.Columns["vendor_id"][3]); 773Assert.Equal(6, reducedRows.Columns.Count); 774Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); 798Assert.Equal(4, df.Columns.Count); 800Assert.True(typeof(string) == df.Columns[0].DataType); 801Assert.True(typeof(string) == df.Columns[1].DataType); 802Assert.True(typeof(string) == df.Columns[2].DataType); 803Assert.True(typeof(string) == df.Columns[3].DataType); 805Assert.Equal("vendor_id", df.Columns[0].Name); 806Assert.Equal("rate_code", df.Columns[1].Name); 807Assert.Equal("passenger_count", df.Columns[2].Name); 808Assert.Equal("trip_time_in_secs", df.Columns[3].Name); 811foreach (var column in df.Columns) 841Assert.Equal(4, df.Columns.Count); 843Assert.True(typeof(string) == df.Columns[0].DataType); 844Assert.True(typeof(short) == df.Columns[1].DataType); 845Assert.True(typeof(int) == df.Columns[2].DataType); 846Assert.True(typeof(long) == df.Columns[3].DataType); 848Assert.Equal("vendor_id", df.Columns[0].Name); 849Assert.Equal("rate_code", df.Columns[1].Name); 850Assert.Equal("passenger_count", df.Columns[2].Name); 851Assert.Equal("trip_time_in_secs", df.Columns[3].Name); 854foreach (var column in df.Columns) 903Assert.Equal(4, df.Columns.Count); 905Assert.True(typeof(string) == df.Columns[0].DataType); 906Assert.True(typeof(float) == df.Columns[1].DataType); 907Assert.True(typeof(float) == df.Columns[2].DataType); 908Assert.True(typeof(float) == df.Columns[3].DataType); 910Assert.Equal("vendor_id", df.Columns[0].Name); 911Assert.Equal("rate_code", df.Columns[1].Name); 912Assert.Equal("passenger_count", df.Columns[2].Name); 913Assert.Equal("trip_time_in_secs", df.Columns[3].Name); 916foreach (var column in df.Columns) 972Assert.Equal(dataFrame.Columns.Count, readIn.Columns.Count); 974Assert.Equal(typeof(string), readIn.Columns[0].DataType); 992Assert.Equal(dataFrame.Columns.Count, readIn.Columns.Count); 1023Assert.Equal(dataFrame.Columns.Count, readIn.Columns.Count); 1056Assert.Equal(dataFrame.Columns.Count, readIn.Columns.Count); 1094Assert.Equal(dataFrame.Columns.Count, readIn.Columns.Count); 1121Assert.Equal(dataFrame.Columns.Count, readIn.Columns.Count); 1148Assert.Equal(2, df.Columns.Count); 1150Assert.True(typeof(string) == df.Columns[0].DataType); 1151Assert.True(typeof(string) == df.Columns[1].DataType); 1153Assert.Equal("vendor_id", df.Columns[0].Name); 1154Assert.Equal("empty", df.Columns[1].Name); 1156Assert.Equal(2, df.Columns[0].NullCount); 1157Assert.Equal(0, df.Columns[1].NullCount); 1168StringDataFrameColumn emptyColumn = (StringDataFrameColumn)df.Columns[1]; 1228var resColumns = dataFrame.Columns.Select(column => (column.Name, column.DataType)).ToArray(); 1309Assert.Equal(_columnCount, df.Columns.Count); 1313Assert.True(_columnTypes[j] == df.Columns[j].DataType); 1314Assert.Equal(_columnNames[j], df.Columns[j].Name);
DataFrameGroupByTests.cs (5)
74int numberColumnsCount = df.Columns.Count - 2; //except "Parity" and "Tens" columns 115df.Columns.Insert(df.Columns.Count, parityColumn); 116df.Columns.Insert(df.Columns.Count, tensColumn);
DataFrameIDataViewTests.cs (42)
112df.Columns.Remove("Bool"); 117df.Columns.Insert(0, boolColumn); 124df.Columns[1] = boolClone; 260df.Columns.Remove("Char"); // Because chars are returned as uint16 by IDataView, so end up comparing CharDataFrameColumn to UInt16DataFrameColumn and fail asserts 264Assert.Equal(dfAsIDataView.Schema.Count, newDf.Columns.Count); 265for (int i = 0; i < df.Columns.Count; i++) 267Assert.True(df.Columns[i].ElementwiseEquals(newDf.Columns[i]).All()); 278Assert.Equal(2, newDf.Columns.Count); 279Assert.True(df.Columns["Int"].ElementwiseEquals(newDf.Columns["Int"]).All()); 280Assert.True(df.Columns["Double"].ElementwiseEquals(newDf.Columns["Double"]).All()); 290df.Columns.Remove("Char"); // Because chars are returned as uint16 by DataViewSchema, so end up comparing CharDataFrameColumn to UInt16DataFrameColumn and fail asserts 291df.Columns.Remove("Decimal"); // Because decimal is returned as double by DataViewSchema, so end up comparing DecimalDataFrameColumn to DoubleDataFrameColumn and fail asserts 308Assert.Equal(df.Columns.Count, newDf.Columns.Count); 309for (int i = 0; i < newDf.Columns.Count; i++) 311Assert.Equal(rowSize, newDf.Columns[i].Length); 312Assert.Equal(df.Columns[i].Name, newDf.Columns[i].Name); 314Assert.Equal(dfAsIDataView.Schema.Count, newDf.Columns.Count); 315for (int c = 0; c < df.Columns.Count; c++) 319Assert.Equal(df.Columns[c][r], newDf.Columns[c][r]); 331for (int i = 0; i < newDf.Columns.Count; i++) 333Assert.Equal(5, newDf.Columns[i].Length); 335Assert.Equal(2, newDf.Columns.Count); 338Assert.Equal(df.Columns["Int"][r], newDf.Columns["Int"][r]); 339Assert.Equal(df.Columns["Double"][r], newDf.Columns["Double"][r]); 379Assert.Equal(value, df.Columns[columnName][cc++]); 389Assert.Equal(3, df.Columns.Count); 390foreach (var column in df.Columns) 406Assert.Equal(2, df.Columns.Count); 407foreach (var column in df.Columns) 424Assert.Equal(3, df.Columns.Count); 425foreach (var column in df.Columns) 441Assert.Equal(2, df.Columns.Count); 442foreach (var column in df.Columns) 491Assert.Equal(12, df.Columns.Count);
DataFrameTests.BinaryOperations.cs (63)
102for (int i = 0; i < df1.Columns.Count; i++) 104newColumn = df1.Columns[df1.Columns[i].Name] + df2.Columns[df2.Columns[i].Name]; 105verify = newColumn.ElementwiseEquals(df1.Columns[i] * 2); 108newColumn = df1.Columns[df1.Columns[i].Name] - df2.Columns[df2.Columns[i].Name]; 112newColumn = df1.Columns[df1.Columns[i].Name] * df2.Columns[df2.Columns[i].Name]; 113verify = newColumn.ElementwiseEquals(df1.Columns[i] * df1.Columns[i]); 116var df1Column = df1.Columns[i] + 1; 117var df2Column = df2.Columns[i] + 1; 126verify = df1.Columns[df1.Columns[i].Name].ElementwiseEquals(df2.Columns[df2.Columns[i].Name]); 129verify = df1.Columns[df1.Columns[i].Name].ElementwiseNotEquals(df2.Columns[df2.Columns[i].Name]); 132verify = df1.Columns[df1.Columns[i].Name].ElementwiseGreaterThanOrEqual(df2.Columns[df2.Columns[i].Name]); 135verify = df1.Columns[df1.Columns[i].Name].ElementwiseLessThanOrEqual(df2.Columns[df2.Columns[i].Name]); 138verify = df1.Columns[df1.Columns[i].Name].ElementwiseGreaterThan(df2.Columns[df2.Columns[i].Name]); 141verify = df1.Columns[df1.Columns[i].Name].ElementwiseLessThan(df2.Columns[df2.Columns[i].Name]); 153var dtype = dfd.Columns[0].DataType; 158dtype = dfm.Columns[0].DataType; 165df.Columns[0] = dataFrameColumn1; 176df.Columns.Insert(0, dataFrameColumn1); 177df.Columns.Insert(1, dataFrameColumn2); 210df.Columns.Insert(0, dataFrameColumn1); 211df.Columns.Insert(1, dataFrameColumn2); 256df.Columns.Insert(0, stringColumn); 305df.Columns.Insert(0, stringColumn); 369Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); 375Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); 381Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); 387Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); 393Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); 401Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); 407Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); 413Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); 422Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); 428Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); 448Int32DataFrameColumn ints = df.Columns["Int"] as Int32DataFrameColumn; 474BooleanDataFrameColumn bools = df.Columns["Bool"] as BooleanDataFrameColumn;
DataFrameTests.Computations.cs (145)
23Assert.Equal(-10, df.Columns["Int"][0]); 25DataFrameColumn absColumn = df.Columns["Int"].Abs(); 27Assert.Equal(-10, df.Columns["Int"][0]); 28df.Columns["Int"].Abs(true); 29Assert.Equal(10, df.Columns["Int"][0]); 31Assert.Throws<NotSupportedException>(() => df.Columns["Byte"].All()); 32Assert.Throws<NotSupportedException>(() => df.Columns["Byte"].Any()); 33Assert.Throws<NotSupportedException>(() => df.Columns["Char"].All()); 34Assert.Throws<NotSupportedException>(() => df.Columns["Char"].Any()); 35Assert.Throws<NotSupportedException>(() => df.Columns["DateTime"].All()); 36Assert.Throws<NotSupportedException>(() => df.Columns["DateTime"].Any()); 37Assert.Throws<NotSupportedException>(() => df.Columns["Decimal"].All()); 38Assert.Throws<NotSupportedException>(() => df.Columns["Decimal"].Any()); 39Assert.Throws<NotSupportedException>(() => df.Columns["Double"].All()); 40Assert.Throws<NotSupportedException>(() => df.Columns["Double"].Any()); 41Assert.Throws<NotSupportedException>(() => df.Columns["Float"].All()); 42Assert.Throws<NotSupportedException>(() => df.Columns["Float"].Any()); 43Assert.Throws<NotSupportedException>(() => df.Columns["Int"].All()); 44Assert.Throws<NotSupportedException>(() => df.Columns["Int"].Any()); 45Assert.Throws<NotSupportedException>(() => df.Columns["Long"].All()); 46Assert.Throws<NotSupportedException>(() => df.Columns["Long"].Any()); 47Assert.Throws<NotSupportedException>(() => df.Columns["Sbyte"].All()); 48Assert.Throws<NotSupportedException>(() => df.Columns["Sbyte"].Any()); 49Assert.Throws<NotSupportedException>(() => df.Columns["Short"].All()); 50Assert.Throws<NotSupportedException>(() => df.Columns["Short"].Any()); 51Assert.Throws<NotSupportedException>(() => df.Columns["Uint"].All()); 52Assert.Throws<NotSupportedException>(() => df.Columns["Uint"].Any()); 53Assert.Throws<NotSupportedException>(() => df.Columns["Ulong"].All()); 54Assert.Throws<NotSupportedException>(() => df.Columns["Ulong"].Any()); 55Assert.Throws<NotSupportedException>(() => df.Columns["Ushort"].All()); 56Assert.Throws<NotSupportedException>(() => df.Columns["Ushort"].Any()); 58bool any = df.Columns["Bool"].Any(); 59bool all = df.Columns["Bool"].All(); 64df.Columns["Double"][0] = 100.0; 65DataFrameColumn doubleColumn = df.Columns["Double"].CumulativeMax(); 73Assert.Equal(1.0, df.Columns["Double"][1]); 74df.Columns["Double"].CumulativeMax(true); 75for (int i = 0; i < df.Columns["Double"].Length; i++) 78Assert.Null(df.Columns["Double"][i]); 80Assert.Equal(100.0, (double)df.Columns["Double"][i]); 83df.Columns["Float"][0] = -10.0f; 84DataFrameColumn floatColumn = df.Columns["Float"].CumulativeMin(); 92Assert.Equal(9.0f, df.Columns["Float"][9]); 93df.Columns["Float"].CumulativeMin(true); 94for (int i = 0; i < df.Columns["Float"].Length; i++) 97Assert.Null(df.Columns["Float"][i]); 99Assert.Equal(-10.0f, (float)df.Columns["Float"][i]); 102DataFrameColumn uintColumn = df.Columns["Uint"].CumulativeProduct(); 104Assert.Equal((uint)8, df.Columns["Uint"][8]); 105df.Columns["Uint"].CumulativeProduct(true); 106Assert.Equal((uint)0, df.Columns["Uint"][9]); 108DataFrameColumn ushortColumn = df.Columns["Ushort"].CumulativeSum(); 110Assert.Equal((ushort)9, df.Columns["Ushort"][9]); 111df.Columns["Ushort"].CumulativeSum(true); 112Assert.Equal((ushort)40, df.Columns["Ushort"][9]); 114Assert.Equal(100.0, df.Columns["Double"].Max()); 115Assert.Equal(-10.0f, df.Columns["Float"].Min()); 116Assert.Equal((uint)0, df.Columns["Uint"].Product()); 117Assert.Equal((ushort)130, df.Columns["Ushort"].Sum()); 119df.Columns["Double"][0] = 100.1; 120Assert.Equal(100.1, df.Columns["Double"][0]); 121DataFrameColumn roundColumn = df.Columns["Double"].Round(); 123Assert.Equal(100.1, df.Columns["Double"][0]); 124df.Columns["Double"].Round(true); 125Assert.Equal(100.0, df.Columns["Double"][0]); 128for (int i = 0; i < df.Columns.Count; i++) 130DataFrameColumn column = df.Columns[i]; 185Assert.Equal(-10, df.Columns["Int"][0]); 187DataFrameColumn absColumn = df.Columns["Int"].Abs(); 189Assert.Equal(-10, df.Columns["Int"][0]); 190df.Columns["Int"].Abs(true); 191Assert.Equal(10, df.Columns["Int"][0]); 193Assert.Throws<NotSupportedException>(() => df.Columns["Byte"].All()); 194Assert.Throws<NotSupportedException>(() => df.Columns["Byte"].Any()); 195Assert.Throws<NotSupportedException>(() => df.Columns["Char"].All()); 196Assert.Throws<NotSupportedException>(() => df.Columns["Char"].Any()); 197Assert.Throws<NotSupportedException>(() => df.Columns["Decimal"].All()); 198Assert.Throws<NotSupportedException>(() => df.Columns["Decimal"].Any()); 199Assert.Throws<NotSupportedException>(() => df.Columns["Double"].All()); 200Assert.Throws<NotSupportedException>(() => df.Columns["Double"].Any()); 201Assert.Throws<NotSupportedException>(() => df.Columns["Float"].All()); 202Assert.Throws<NotSupportedException>(() => df.Columns["Float"].Any()); 203Assert.Throws<NotSupportedException>(() => df.Columns["Int"].All()); 204Assert.Throws<NotSupportedException>(() => df.Columns["Int"].Any()); 205Assert.Throws<NotSupportedException>(() => df.Columns["Long"].All()); 206Assert.Throws<NotSupportedException>(() => df.Columns["Long"].Any()); 207Assert.Throws<NotSupportedException>(() => df.Columns["Sbyte"].All()); 208Assert.Throws<NotSupportedException>(() => df.Columns["Sbyte"].Any()); 209Assert.Throws<NotSupportedException>(() => df.Columns["Short"].All()); 210Assert.Throws<NotSupportedException>(() => df.Columns["Short"].Any()); 211Assert.Throws<NotSupportedException>(() => df.Columns["Uint"].All()); 212Assert.Throws<NotSupportedException>(() => df.Columns["Uint"].Any()); 213Assert.Throws<NotSupportedException>(() => df.Columns["Ulong"].All()); 214Assert.Throws<NotSupportedException>(() => df.Columns["Ulong"].Any()); 215Assert.Throws<NotSupportedException>(() => df.Columns["Ushort"].All()); 216Assert.Throws<NotSupportedException>(() => df.Columns["Ushort"].Any()); 217Assert.Throws<NotSupportedException>(() => df.Columns["DateTime"].All()); 218Assert.Throws<NotSupportedException>(() => df.Columns["DateTime"].Any()); 222df.Columns["DateTime"][0] = maxDate; 223DataFrameColumn dateTimeColumn = df.Columns["DateTime"].CumulativeMax(); 233df.Columns["Double"][0] = 100.0; 234DataFrameColumn doubleColumn = df.Columns["Double"].CumulativeMax(); 242Assert.Equal(1.0, df.Columns["Double"][1]); 243df.Columns["Double"].CumulativeMax(true); 244for (int i = 0; i < df.Columns["Double"].Length; i++) 247Assert.Null(df.Columns["Double"][i]); 249Assert.Equal(100.0, (double)df.Columns["Double"][i]); 252df.Columns["Float"][0] = -10.0f; 253DataFrameColumn floatColumn = df.Columns["Float"].CumulativeMin(); 261Assert.Equal(9.0f, df.Columns["Float"][9]); 262df.Columns["Float"].CumulativeMin(true); 263for (int i = 0; i < df.Columns["Float"].Length; i++) 266Assert.Null(df.Columns["Float"][i]); 268Assert.Equal(-10.0f, (float)df.Columns["Float"][i]); 271DataFrameColumn uintColumn = df.Columns["Uint"].CumulativeProduct(); 273Assert.Equal((uint)8, df.Columns["Uint"][8]); 274df.Columns["Uint"].CumulativeProduct(true); 275Assert.Equal((uint)0, df.Columns["Uint"][9]); 277DataFrameColumn ushortColumn = df.Columns["Ushort"].CumulativeSum(); 279Assert.Equal((ushort)9, df.Columns["Ushort"][9]); 280df.Columns["Ushort"].CumulativeSum(true); 281Assert.Equal((ushort)40, df.Columns["Ushort"][9]); 283Assert.Equal(100.0, df.Columns["Double"].Max()); 284Assert.Equal(-10.0f, df.Columns["Float"].Min()); 285Assert.Equal((uint)0, df.Columns["Uint"].Product()); 286Assert.Equal((ushort)130, df.Columns["Ushort"].Sum()); 288df.Columns["Double"][0] = 100.1; 289Assert.Equal(100.1, df.Columns["Double"][0]); 290DataFrameColumn roundColumn = df.Columns["Double"].Round(); 292Assert.Equal(100.1, df.Columns["Double"][0]); 293df.Columns["Double"].Round(true); 294Assert.Equal(100.0, df.Columns["Double"][0]); 297for (int i = 0; i < df.Columns.Count; i++) 299DataFrameColumn column = df.Columns[i]; 424var byteColumn = (PrimitiveDataFrameColumn<byte>)df.Columns["Byte"]; 425var decimalColumn = (PrimitiveDataFrameColumn<decimal>)df.Columns["Decimal"]; 426var doubleColumn = (PrimitiveDataFrameColumn<double>)df.Columns["Double"]; 427var floatColumn = (PrimitiveDataFrameColumn<float>)df.Columns["Float"]; 428var intColumn = (PrimitiveDataFrameColumn<int>)df.Columns["Int"]; 429var longColumn = (PrimitiveDataFrameColumn<long>)df.Columns["Long"]; 430var sbyteColumn = (PrimitiveDataFrameColumn<sbyte>)df.Columns["Sbyte"]; 431var shortColumn = (PrimitiveDataFrameColumn<short>)df.Columns["Short"]; 432var uintColumn = (PrimitiveDataFrameColumn<uint>)df.Columns["Uint"]; 433var ulongColumn = (PrimitiveDataFrameColumn<ulong>)df.Columns["Ulong"]; 434var ushortColumn = (PrimitiveDataFrameColumn<ushort>)df.Columns["Ushort"];
DataFrameTests.cs (308)
26Assert.Equal(2, dataFrame.Columns.Count); 27Assert.Equal("Int1", dataFrame.Columns[0].Name); 54df.Columns.Insert(0, dc0); 55var dc = df.Columns["a1"]; 66dataFrame.Columns.Insert(0, intColumn); 67dataFrame.Columns.Insert(1, floatColumn); 69Assert.Equal(2, dataFrame.Columns.Count); 70Assert.Equal(2, dataFrame.Columns.LongCount()); 71Assert.Equal(rowCount, dataFrame.Columns[0].Length); 72Assert.Equal("IntColumn", dataFrame.Columns[0].Name); 73Assert.Equal(rowCount, dataFrame.Columns[1].Length); 74Assert.Equal("FloatColumn", dataFrame.Columns[1].Name); 78Assert.Throws<ArgumentException>(() => dataFrame.Columns.Insert(2, bigColumn)); 79Assert.Throws<ArgumentException>(() => dataFrame.Columns.Add(bigColumn)); 83Assert.Throws<ArgumentException>(() => dataFrame.Columns.Insert(2, smallColumn)); 84Assert.Throws<ArgumentException>(() => dataFrame.Columns.Add(smallColumn)); 88Assert.Throws<ArgumentException>(() => dataFrame.Columns.Insert(2, repeatedName)); 92var columnCount = dataFrame.Columns.Count; 93Assert.Throws<ArgumentOutOfRangeException>(() => dataFrame.Columns.Insert(columnCount + 1, repeatedName)); 95Assert.Equal(2, dataFrame.Columns.Count); 97Assert.Throws<ArgumentException>(() => dataFrame.Columns[1] = intColumnCopy); 100dataFrame.Columns[1] = differentIntColumn; 101Assert.True(object.ReferenceEquals(differentIntColumn, dataFrame.Columns[1])); 103dataFrame.Columns.RemoveAt(1); 104Assert.Single(dataFrame.Columns); 105Assert.True(ReferenceEquals(intColumn, dataFrame.Columns[0])); 109Assert.Equal(2, dataFrame1.Columns.Count); 110Assert.Equal(intColumn, dataFrame1.Columns[0]); 111Assert.Equal(floatColumn, dataFrame1.Columns[1]); 120int columnCount = dataFrame.Columns.Count; 121DataFrameColumn originalLastColumn = dataFrame.Columns[columnCount - 1]; 124dataFrame.Columns.Insert(columnCount, intColumn); 125Assert.Equal(columnCount + 1, dataFrame.Columns.Count); 128dataFrame.Columns.RemoveAt(0); 129Assert.Equal(columnCount, dataFrame.Columns.Count); 132DataFrameColumn intColumn_1 = dataFrame.Columns["NewIntColumn"]; 136DataFrameColumn lastColumn_1 = dataFrame.Columns[originalLastColumn.Name]; 140int newIndex = dataFrame.Columns.IndexOf("NewIntColumn"); 144int newIndexForOriginalLastColumn = dataFrame.Columns.IndexOf(originalLastColumn.Name); 154dataFrame.Columns.Add(intColumn); 155Assert.Single(dataFrame.Columns); 158dataFrame.Columns.Remove(intColumn); 159Assert.Empty(dataFrame.Columns); 170dataFrame.Columns.Clear(); 173Assert.Empty(dataFrame.Columns); 176Assert.Equal(0, dataFrame.Columns.LongCount()); 207dataframe.Columns.RenameColumn("City", "Town"); 231df["Int3"] = df.Columns["Int1"] * 2 + df.Columns["Int2"]; 232Assert.Equal(16, df.Columns["Int3"][2]); 239df.Columns["Int"][0] = 100; 240df.Columns["Int"][19] = -1; 241df.Columns["Int"][5] = 2000; 245Assert.Null(sortedDf.Columns["Int"][19]); 246Assert.Equal(-1, sortedDf.Columns["Int"][0]); 247Assert.Equal(100, sortedDf.Columns["Int"][17]); 248Assert.Equal(2000, sortedDf.Columns["Int"][18]); 252Assert.Null(sortedDf.Columns["Int"][19]); 253Assert.Equal(-1, sortedDf.Columns["Int"][18]); 254Assert.Equal(100, sortedDf.Columns["Int"][1]); 255Assert.Equal(2000, sortedDf.Columns["Int"][0]); 259Assert.Null(sortedDf.Columns["Int"][0]); 260Assert.Equal(-1, sortedDf.Columns["Int"][1]); 261Assert.Equal(100, sortedDf.Columns["Int"][18]); 262Assert.Equal(2000, sortedDf.Columns["Int"][19]); 266Assert.Null(sortedDf.Columns["Int"][0]); 267Assert.Equal(-1, sortedDf.Columns["Int"][19]); 268Assert.Equal(100, sortedDf.Columns["Int"][2]); 269Assert.Equal(2000, sortedDf.Columns["Int"][1]); 273Assert.Null(sortedDf.Columns["Int"][19]); 274Assert.Equal(1, sortedDf.Columns["Int"][1]); 275Assert.Equal(8, sortedDf.Columns["Int"][17]); 276Assert.Equal(9, sortedDf.Columns["Int"][18]); 280Assert.Null(sortedDf.Columns["Int"][19]); 281Assert.Equal(8, sortedDf.Columns["Int"][1]); 282Assert.Equal(9, sortedDf.Columns["Int"][0]); 286Assert.Null(sortedDf.Columns["Int"][0]); 287Assert.Equal(1, sortedDf.Columns["Int"][2]); 288Assert.Equal(8, sortedDf.Columns["Int"][18]); 289Assert.Equal(9, sortedDf.Columns["Int"][19]); 293Assert.Null(sortedDf.Columns["Int"][0]); 294Assert.Equal(8, sortedDf.Columns["Int"][2]); 295Assert.Equal(9, sortedDf.Columns["Int"][1]); 304Assert.Equal((long)5, count.Columns["Int"][0]); 305Assert.Equal((long)4, count.Columns["Decimal"][1]); 308for (int c = 1; c < count.Columns.Count; c++) 310Assert.Equal((long)(r == 0 ? 5 : 4), count.Columns[c][r]); 318for (int c = 0; c < count.Columns.Count; c++) 320DataFrameColumn originalColumn = df.Columns[c]; 321DataFrameColumn firstColumn = first.Columns[originalColumn.Name]; 330for (int c = 0; c < count.Columns.Count; c++) 332DataFrameColumn originalColumn = df.Columns[c]; 333DataFrameColumn headColumn = head.Columns[originalColumn.Name]; 337for (int c = 0; c < count.Columns.Count; c++) 339DataFrameColumn originalColumn = df.Columns[c]; 342DataFrameColumn headColumn = head.Columns[originalColumn.Name]; 353for (int c = 0; c < count.Columns.Count; c++) 355DataFrameColumn originalColumn = df.Columns[c]; 356DataFrameColumn tailColumn = tail.Columns[originalColumn.Name]; 365for (int c = 0; c < count.Columns.Count; c++) 367DataFrameColumn originalColumn = df.Columns[c]; 370DataFrameColumn maxColumn = max.Columns[originalColumn.Name]; 388for (int c = 0; c < count.Columns.Count; c++) 390DataFrameColumn originalColumn = df.Columns[c]; 393DataFrameColumn minColumn = min.Columns[originalColumn.Name]; 396DataFrameColumn productColumn = product.Columns[originalColumn.Name]; 399DataFrameColumn sumColumn = sum.Columns[originalColumn.Name]; 405Assert.Equal(2, columnSum.Columns.Count); 406Assert.Equal(20, columnSum.Columns["Int"][0]); 407Assert.Equal(20, columnSum.Columns["Int"][1]); 409Assert.Equal(2, columnMax.Columns.Count); 410Assert.Equal(8, columnMax.Columns["Int"][0]); 411Assert.Equal(9, columnMax.Columns["Int"][1]); 413Assert.Equal(2, columnProduct.Columns.Count); 414Assert.Equal(0, columnProduct.Columns["Int"][0]); 415Assert.Equal(0, columnProduct.Columns["Int"][1]); 417Assert.Equal(2, columnMin.Columns.Count); 418Assert.Equal(0, columnMin.Columns["Int"][0]); 419Assert.Equal(1, columnMin.Columns["Int"][1]); 422Assert.Equal(2, countIntColumn.Columns.Count); 424Assert.Equal((long)5, countIntColumn.Columns["Int"][0]); 425Assert.Equal((long)4, countIntColumn.Columns["Int"][1]); 428Assert.Equal(2, firstDecimalColumn.Columns.Count); 430Assert.Equal((decimal)0, firstDecimalColumn.Columns["Decimal"][0]); 431Assert.Equal((decimal)1, firstDecimalColumn.Columns["Decimal"][1]); 486for (int i = 0; i < df.Columns.Count; i++) 488DataFrameColumn baseColumn = df.Columns[i]; 494Assert.Equal(10 * df.Columns.Count, totalValueCount); 498StringDataFrameColumn stringColumn = (StringDataFrameColumn)df.Columns["String"]; 513ArrowStringDataFrameColumn arrowStringColumn = (ArrowStringDataFrameColumn)df.Columns["ArrowString"]; 528SingleDataFrameColumn floatColumn = (SingleDataFrameColumn)df.Columns["Float"]; 543Int32DataFrameColumn intColumn = (Int32DataFrameColumn)df.Columns["Int"]; 564DataFrameColumn clamped = df.Columns["Int"].Clamp(3, 7); 566Assert.Equal(0, df.Columns["Int"][0]); 568Assert.Equal(1, df.Columns["Int"][1]); 570Assert.Equal(2, df.Columns["Int"][2]); 572Assert.Equal(3, df.Columns["Int"][3]); 574Assert.Equal(4, df.Columns["Int"][4]); 576Assert.Null(df.Columns["Int"][5]); 578Assert.Equal(6, df.Columns["Int"][6]); 580Assert.Equal(7, df.Columns["Int"][7]); 582Assert.Equal(8, df.Columns["Int"][8]); 584Assert.Equal(9, df.Columns["Int"][9]); 587df.Columns["Int"].Clamp(3, 7, true); 588Assert.Equal(3, df.Columns["Int"][0]); 589Assert.Equal(3, df.Columns["Int"][1]); 590Assert.Equal(3, df.Columns["Int"][2]); 591Assert.Equal(3, df.Columns["Int"][3]); 592Assert.Equal(4, df.Columns["Int"][4]); 593Assert.Null(df.Columns["Int"][5]); 594Assert.Equal(6, df.Columns["Int"][6]); 595Assert.Equal(7, df.Columns["Int"][7]); 596Assert.Equal(7, df.Columns["Int"][8]); 597Assert.Equal(7, df.Columns["Int"][9]); 610Assert.Equal(df.Columns.Count, clampedColumn.Columns.Count); 612for (int c = 0; c < df.Columns.Count; c++) 614DataFrameColumn column = clampedColumn.Columns[c]; 633var colD = df.Columns[c][i]; 635Assert.Equal(df.Columns[c][i], column[i]); 647Assert.Equal(i, df.Columns["Int"][i]); 649Assert.Null(df.Columns["Int"][5]); 709Assert.Equal(df.Columns.Count, sampled.Columns.Count); 713foreach (int? value in sampled.Columns["Int"]) 729DataFrameColumn descriptionColumn = description.Columns[0]; 735for (int i = 1; i < description.Columns.Count - 1; i++) 737DataFrameColumn column = description.Columns[i]; 738Assert.Equal(df.Columns[i - 1].Name, column.Name); 747DataFrameColumn dateTimeColumn = description.Columns[description.Columns.Count - 1]; 767df.Columns.Add(dateTimes); 770DataFrameColumn infoColumn = Info.Columns[0]; 775for (int i = 1; i < Info.Columns.Count; i++) 777DataFrameColumn column = Info.Columns[i]; 778Assert.Equal(df.Columns[i - 1].DataType.ToString(), column[0].ToString()); 802df.Columns.Insert(0, dataFrameColumn1); 806Assert.Throws<ArgumentException>(() => df.Columns.Insert(1, new Int32DataFrameColumn("Int2", Enumerable.Range(0, 5).Select(x => x)))); 861DataFrame valueCounts = df.Columns["Bool"].ValueCounts(); 863Assert.Equal((long)5, valueCounts.Columns["Counts"][0]); 864Assert.Equal((long)5, valueCounts.Columns["Counts"][1]); 872Int32DataFrameColumn column = df.Columns["Int1"] as Int32DataFrameColumn; 917Int32DataFrameColumn intColumn = intDf.Columns["Int1"] as Int32DataFrameColumn; 920Assert.Equal(df.Columns.Count, clone.Columns.Count); 921for (int i = 0; i < df.Columns.Count; i++) 923DataFrameColumn dfColumn = df.Columns[i]; 924DataFrameColumn cloneColumn = clone.Columns[i]; 936BooleanDataFrameColumn bigInts = new BooleanDataFrameColumn("BigInts", df.Columns["Int"].ElementwiseGreaterThan(5)); 950IReadOnlyList<DataFrameColumn> columns = df.Columns; 952Assert.Equal(columns.Count, df.Columns.Count); 955Assert.Equal(dataFrameColumn, df.Columns[i++]); 975Assert.Equal(df.Columns[columnIndex][rowCount], value); 983int intColumnIndex = df.Columns.IndexOf("Int"); 984Assert.Equal(1, df.Columns[intColumnIndex].NullCount); 986Assert.Equal(0, df.Columns[intColumnIndex].NullCount); 988Assert.Equal(1, df.Columns[intColumnIndex].NullCount); 999for (int i = 0; i < df.Columns.Count; i++) 1001DataFrameColumn column = df.Columns[i]; 1006foreach (var column in df.Columns) 1021Assert.Equal(1, df.Columns[0].NullCount); 1022Assert.Equal(1, df.Columns[1].NullCount); 1026Assert.Equal(1, df.Columns[0].NullCount); 1027Assert.Equal(1, df.Columns[1].NullCount); 1034Assert.Equal(2, ret.Columns[0].NullCount); 1035Assert.Equal(2, ret.Columns[1].NullCount); 1039for (int j = 0; j < check1.Columns.Count; j++) 1074Assert.Equal(3, resultDataFrame.Columns.Count); 1093Assert.Equal(1, df.Columns[0].NullCount); 1094Assert.Equal(1, df.Columns[1].NullCount); 1098Assert.Equal(1, ret.Columns[0].NullCount); 1099Assert.Equal(1, ret.Columns[1].NullCount); 1103Assert.Equal(1, df.Columns[0].NullCount); 1104Assert.Equal(2, df.Columns[1].NullCount); 1108Assert.Equal(1, ret.Columns[0].NullCount); 1109Assert.Equal(3, ret.Columns[1].NullCount); 1113Assert.Equal(2, df.Columns[0].NullCount); 1114Assert.Equal(3, df.Columns[1].NullCount); 1117Assert.Equal(3, ret.Columns[0].NullCount); 1118Assert.Equal(4, ret.Columns[1].NullCount); 1122Assert.Equal(2, df.Columns[0].NullCount); 1123Assert.Equal(3, df.Columns[1].NullCount); 1126Assert.Equal(2, ret.Columns[0].NullCount); 1127Assert.Equal(3, ret.Columns[1].NullCount); 1132Assert.Equal(15, df.Columns["Column1"].Length); 1133Assert.Equal(15, df.Columns["Column2"].Length); 1134Assert.Equal(2, df.Columns[0].NullCount); 1135Assert.Equal(4, df.Columns[1].NullCount); 1139Assert.Equal(16, ret.Columns["Column1"].Length); 1140Assert.Equal(16, ret.Columns["Column2"].Length); 1141Assert.Equal(2, ret.Columns[0].NullCount); 1142Assert.Equal(5, ret.Columns[1].NullCount); 1146Assert.Equal(16, df.Columns["Column1"].Length); 1147Assert.Equal(16, df.Columns["Column2"].Length); 1148Assert.Equal(3, df.Columns[0].NullCount); 1149Assert.Equal(4, df.Columns[1].NullCount); 1152Assert.Equal(17, ret.Columns["Column1"].Length); 1153Assert.Equal(17, ret.Columns["Column2"].Length); 1154Assert.Equal(4, ret.Columns[0].NullCount); 1155Assert.Equal(4, ret.Columns[1].NullCount); 1159Assert.Equal(17, df.Columns["Column1"].Length); 1160Assert.Equal(17, df.Columns["Column2"].Length); 1161Assert.Equal(4, df.Columns[0].NullCount); 1162Assert.Equal(5, df.Columns[1].NullCount); 1165Assert.Equal(18, ret.Columns["Column1"].Length); 1166Assert.Equal(18, ret.Columns["Column2"].Length); 1167Assert.Equal(5, ret.Columns[0].NullCount); 1168Assert.Equal(6, ret.Columns[1].NullCount); 1177Assert.Equal(18, df.Columns["Column1"].Length); 1178Assert.Equal(18, df.Columns["Column2"].Length); 1179Assert.Equal(5, df.Columns[0].NullCount); 1180Assert.Equal(6, df.Columns[1].NullCount); 1184Assert.Equal(18, df.Columns["Column1"].Length); 1185Assert.Equal(18, df.Columns["Column2"].Length); 1186Assert.Equal(5, df.Columns[0].NullCount); 1187Assert.Equal(6, df.Columns[1].NullCount); 1189Assert.Equal(19, ret.Columns["Column1"].Length); 1190Assert.Equal(19, ret.Columns["Column2"].Length); 1191Assert.Equal(6, ret.Columns[0].NullCount); 1192Assert.Equal(7, ret.Columns[1].NullCount); 1201Assert.Equal(2, df.Columns[0].NullCount); 1202Assert.Equal(1, df.Columns[1].NullCount); 1205df.Columns.Add(column); 1209Assert.Equal(2, df.Columns[0].NullCount); 1210Assert.Equal(1, df.Columns[1].NullCount); 1211Assert.Equal(0, df.Columns[2].NullCount); 1215Assert.Equal(1, df.Columns[2].NullCount); 1280PrimitiveDataFrameColumn<int> primitiveInts = dataFrame.Columns.GetPrimitiveColumn<int>("Int"); 1282Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetPrimitiveColumn<float>("Int")); 1284StringDataFrameColumn strings = dataFrame.Columns.GetStringColumn("String"); 1286Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetStringColumn("ArrowString")); 1288ArrowStringDataFrameColumn arrowStrings = dataFrame.Columns.GetArrowStringColumn("ArrowString"); 1290Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetArrowStringColumn("String")); 1292ByteDataFrameColumn bytes = dataFrame.Columns.GetByteColumn("Byte"); 1294Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Byte")); 1296Int32DataFrameColumn ints = dataFrame.Columns.GetInt32Column("Int"); 1298Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Int")); 1300BooleanDataFrameColumn bools = dataFrame.Columns.GetBooleanColumn("Bool"); 1302Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Bool")); 1304CharDataFrameColumn chars = dataFrame.Columns.GetCharColumn("Char"); 1306Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Char")); 1308DecimalDataFrameColumn decimals = dataFrame.Columns.GetDecimalColumn("Decimal"); 1310Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Decimal")); 1312DoubleDataFrameColumn doubles = dataFrame.Columns.GetDoubleColumn("Double"); 1314Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Double")); 1316SingleDataFrameColumn singles = dataFrame.Columns.GetSingleColumn("Float"); 1318Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetDoubleColumn("Float")); 1320Int64DataFrameColumn longs = dataFrame.Columns.GetInt64Column("Long"); 1322Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Long")); 1324SByteDataFrameColumn sbytes = dataFrame.Columns.GetSByteColumn("Sbyte"); 1326Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Sbyte")); 1328Int16DataFrameColumn shorts = dataFrame.Columns.GetInt16Column("Short"); 1330Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Short")); 1332UInt32DataFrameColumn uints = dataFrame.Columns.GetUInt32Column("Uint"); 1334Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Uint")); 1336UInt64DataFrameColumn ulongs = dataFrame.Columns.GetUInt64Column("Ulong"); 1338Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Ulong")); 1340UInt16DataFrameColumn ushorts = dataFrame.Columns.GetUInt16Column("Ushort"); 1342Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Ushort")); 1370Assert.True(filteredNullDf.Columns.IndexOf("col") >= 0); 1371Assert.Equal(3, filteredNullDf.Columns["col"].Length); 1373Assert.Equal("One", filteredNullDf.Columns["col"][0]); 1374Assert.Equal("Two", filteredNullDf.Columns["col"][1]); 1375Assert.Equal("Three", filteredNullDf.Columns["col"][2]); 1387Assert.True(filteredNullDf.Columns.IndexOf("col") >= 0); 1388Assert.True(filteredNullDf.Columns.IndexOf("index") >= 0); 1392Assert.Equal(2, filteredNullDf.Columns["index"][0]); 1393Assert.Equal(5, filteredNullDf.Columns["index"][1]);
DataFrameTests.Filter.cs (15)
20DataFrameColumn filtered = df.Columns["Int"].Filter(3, 7); 32DataFrame boolColumnFiltered = df[df.Columns["Bool"].ElementwiseEquals(true)]; 35for (int i = 0; i < boolColumnFiltered.Columns.Count; i++) 37DataFrameColumn column = boolColumnFiltered.Columns[i]; 48Assert.Equal(intEnumerableFiltered.Columns.Count, df.Columns.Count); 49Assert.Equal(boolEnumerableFiltered.Columns.Count, df.Columns.Count); 50Assert.Equal(longEnumerableFiltered.Columns.Count, df.Columns.Count); 51for (int i = 0; i < intEnumerableFiltered.Columns.Count; i++) 53DataFrameColumn intFilteredColumn = intEnumerableFiltered.Columns[i]; 54DataFrameColumn dfColumn = df.Columns[i]; 55DataFrameColumn boolFilteredColumn = boolEnumerableFiltered.Columns[i]; 56DataFrameColumn longFilteredColumn = longEnumerableFiltered.Columns[i];
DataFrameTests.Join.cs (58)
26Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); 27Assert.Null(join.Columns["Int_right"][6]); 33Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); 34Assert.Equal(join.Columns["Int_right"][3], right.Columns["Int"][3]); 35Assert.Null(join.Columns["Int_right"][2]); 41Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); 42Assert.Null(join.Columns["Int_right"][6]); 48Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); 49Assert.Equal(join.Columns["Int_right"][3], right.Columns["Int"][3]); 50Assert.Null(join.Columns["Int_right"][2]); 58Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); 59Assert.Equal(join.Columns["Int_right"][6], right.Columns["Int"][6]); 65Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); 66Assert.Equal(join.Columns["Int_right"][2], right.Columns["Int"][2]); 67Assert.Null(join.Columns["Int_left"][12]); 73Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); 74Assert.Null(join.Columns["Int_left"][12]); 80Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); 81Assert.Equal(join.Columns["Int_right"][2], right.Columns["Int"][2]); 92for (int i = 0; i < join.Columns.Count; i++) 94DataFrameColumn joinColumn = join.Columns[i]; 99if (i < left.Columns.Count) 101DataFrameColumn leftColumn = left.Columns[i]; 106int columnIndex = i - left.Columns.Count; 107DataFrameColumn rightColumn = right.Columns[columnIndex]; 114if (i < left.Columns.Count) 116DataFrameColumn leftColumn = left.Columns[i]; 122int columnIndex = i - left.Columns.Count; 123DataFrameColumn rightColumn = right.Columns[columnIndex]; 129if (i < left.Columns.Count) 131DataFrameColumn leftColumn = left.Columns[i]; 136int columnIndex = i - left.Columns.Count; 137DataFrameColumn rightColumn = right.Columns[columnIndex]; 143if (i < left.Columns.Count) 145DataFrameColumn leftColumn = left.Columns[i]; 150int columnIndex = i - left.Columns.Count; 151DataFrameColumn rightColumn = right.Columns[columnIndex];
DataFrameTests.Merge.cs (171)
23left.Columns.Insert(left.Columns.Count, leftStringColumn); 27right.Columns.Insert(right.Columns.Count, rightStringColumn); 31Assert.Equal("Left", (string)merge.Columns["String_left"][0]); 32Assert.Equal("Right", (string)merge.Columns["String_right"][0]); 45Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 46Assert.Null(merge.Columns["Int_right"][6]); 47Assert.Null(merge.Columns["Int_left"][5]); 53Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 54Assert.Equal(merge.Columns["Int_right"][3], right.Columns["Int"][3]); 55Assert.Null(merge.Columns["Int_right"][2]); 61Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 62Assert.Null(merge.Columns["Int_right"][6]); 68Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 69Assert.Equal(merge.Columns["Int_right"][2], right.Columns["Int"][3]); 70Assert.Null(merge.Columns["Int_right"][4]); 78Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 79Assert.Equal(merge.Columns["Int_right"][6], right.Columns["Int"][6]); 85Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 86Assert.Equal(merge.Columns["Int_right"][2], right.Columns["Int"][2]); 87Assert.Null(merge.Columns["Int_left"][12]); 93Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 94Assert.Null(merge.Columns["Int_left"][12]); 95Assert.Null(merge.Columns["Int_left"][15]); 101Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 102Assert.Equal(merge.Columns["Int_right"][2], right.Columns["Int"][2]); 108Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 114if (columnIndex < left.Columns.Count) 123int rightColumnIndex = columnIndex - left.Columns.Count; 152Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 210Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 260Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 299left.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2, 3, 4, 5 })); 300left.Columns.Add(new Int32DataFrameColumn("G1", new[] { 0, 1, 1, 2, 2, 3 })); 301left.Columns.Add(new Int32DataFrameColumn("G2", new[] { 3, 1, 2, 1, 2, 1 })); 304right.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2, 3 })); 305right.Columns.Add(new Int32DataFrameColumn("G1", new[] { 1, 1, 1, 2 })); 306right.Columns.Add(new Int32DataFrameColumn("G2", new[] { 1, 2, 1, 1 })); 349Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 365left.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2 })); 366left.Columns.Add(new Int32DataFrameColumn("G1", new[] { 1, 1, 3 })); 367left.Columns.Add(new Int32DataFrameColumn("G2", new[] { 1, 1, 3 })); 370right.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2 })); 371right.Columns.Add(new Int32DataFrameColumn("G1", new[] { 1, 1, 0 })); 372right.Columns.Add(new Int32DataFrameColumn("G2", new[] { 1, 1, 0 })); 408Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 423left.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2 })); 424left.Columns.Add(new Int32DataFrameColumn("G1", new[] { 1, 1, 3 })); 425left.Columns.Add(new Int32DataFrameColumn("G2", new[] { 1, 1, 3 })); 428right.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2 })); 429right.Columns.Add(new Int32DataFrameColumn("G1", new[] { 1, 1, 0 })); 430right.Columns.Add(new Int32DataFrameColumn("G2", new[] { 1, 1, 0 })); 466Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 481left.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2 })); 482left.Columns.Add(new Int32DataFrameColumn("G1", new[] { 1, 1, 3 })); 483left.Columns.Add(new Int32DataFrameColumn("G2", new[] { 1, 1, 3 })); 486right.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2 })); 487right.Columns.Add(new Int32DataFrameColumn("G1", new[] { 1, 1, 0 })); 488right.Columns.Add(new Int32DataFrameColumn("G2", new[] { 1, 1, 0 })); 522Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 537left.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2 })); 538left.Columns.Add(new Int32DataFrameColumn("G1", new[] { 1, 1, 3 })); 539left.Columns.Add(new Int32DataFrameColumn("G2", new[] { 1, 1, 3 })); 542right.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2 })); 543right.Columns.Add(new Int32DataFrameColumn("G1", new[] { 1, 1, 0 })); 544right.Columns.Add(new Int32DataFrameColumn("G2", new[] { 1, 1, 0 })); 582Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 597left.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2 })); 598left.Columns.Add(new Int32DataFrameColumn("G1", new[] { 1, 1, 2 })); 599left.Columns.Add(new Int32DataFrameColumn("G2", new[] { 1, 2, 1 })); 600left.Columns.Add(new StringDataFrameColumn("G3", new[] { "A", "B", "C" })); 603right.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2 })); 604right.Columns.Add(new Int32DataFrameColumn("G1", new[] { 0, 1, 1 })); 605right.Columns.Add(new Int32DataFrameColumn("G2", new[] { 1, 1, 2 })); 606right.Columns.Add(new StringDataFrameColumn("G3", new[] { "Z", "Y", "B" })); 638Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 653left.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2 })); 654left.Columns.Add(new Int32DataFrameColumn("G1", new[] { 1, 1, 2 })); 655left.Columns.Add(new Int32DataFrameColumn("G2", new[] { 1, 2, 1 })); 656left.Columns.Add(new StringDataFrameColumn("G3", new[] { "A", "B", "C" })); 659right.Columns.Add(new Int32DataFrameColumn("Index", new[] { 0, 1, 2 })); 660right.Columns.Add(new Int32DataFrameColumn("G1", new[] { 0, 1, 1 })); 661right.Columns.Add(new Int32DataFrameColumn("G2", new[] { 1, 1, 2 })); 662right.Columns.Add(new StringDataFrameColumn("G3", new[] { "Z", "Y", "B" })); 694Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); 711Assert.Equal(0, (int)merge.Columns["Int_left"][0]); 712Assert.Equal(1, (int)merge.Columns["Int_left"][1]); 726Assert.NotNull(merge.Columns.GetBooleanColumn("Bool_left")); 727Assert.NotNull(merge.Columns.GetBooleanColumn("Bool_right")); 729Assert.NotNull(merge.Columns.GetDecimalColumn("Decimal_left")); 730Assert.NotNull(merge.Columns.GetDecimalColumn("Decimal_right")); 732Assert.NotNull(merge.Columns.GetSingleColumn("Float_left")); 733Assert.NotNull(merge.Columns.GetSingleColumn("Float_right")); 735Assert.NotNull(merge.Columns.GetDoubleColumn("Double_left")); 736Assert.NotNull(merge.Columns.GetDoubleColumn("Double_right")); 738Assert.NotNull(merge.Columns.GetByteColumn("Byte_left")); 739Assert.NotNull(merge.Columns.GetByteColumn("Byte_right")); 741Assert.NotNull(merge.Columns.GetCharColumn("Char_left")); 742Assert.NotNull(merge.Columns.GetCharColumn("Char_right")); 744Assert.NotNull(merge.Columns.GetInt16Column("Short_left")); 745Assert.NotNull(merge.Columns.GetInt16Column("Short_right")); 747Assert.NotNull(merge.Columns.GetUInt16Column("Ushort_left")); 748Assert.NotNull(merge.Columns.GetUInt16Column("Ushort_right")); 750Assert.NotNull(merge.Columns.GetInt32Column("Int_left")); 751Assert.NotNull(merge.Columns.GetInt32Column("Int_right")); 753Assert.NotNull(merge.Columns.GetUInt32Column("Uint_left")); 754Assert.NotNull(merge.Columns.GetUInt32Column("Uint_right")); 756Assert.NotNull(merge.Columns.GetInt64Column("Long_left")); 757Assert.NotNull(merge.Columns.GetInt64Column("Long_right")); 759Assert.NotNull(merge.Columns.GetUInt64Column("Ulong_left")); 760Assert.NotNull(merge.Columns.GetUInt64Column("Ulong_right")); 762Assert.NotNull(merge.Columns.GetDateTimeColumn("DateTime_left")); 763Assert.NotNull(merge.Columns.GetDateTimeColumn("DateTime_right")); 771for (int i = 0; i < merge.Columns["Int_left"].Length; i++) 773if (merge.Columns["Int_left"][i] == null) 775intersection.Add((int)merge.Columns["Int_left"][i]); 777for (int i = 0; i < left.Columns["Int"].Length; i++) 779if (left.Columns["Int"][i] != null && intersection.Contains((int)left.Columns["Int"][i])) 780intersection.Remove((int)left.Columns["Int"][i]); 787for (int i = 0; i < merge.Columns["Int_right"].Length; i++) 789if (merge.Columns["Int_right"][i] == null) 791intersection.Add((int)merge.Columns["Int_right"][i]); 793for (int i = 0; i < right.Columns["Int"].Length; i++) 795if (right.Columns["Int"][i] != null && intersection.Contains((int)right.Columns["Int"][i])) 796intersection.Remove((int)right.Columns["Int"][i]);
DataFrameTests.Sort.cs (9)
20df.Columns["Int"][0] = 100000; 21df.Columns["Int"][df.Rows.Count - 1] = -1; 22df.Columns["Int"][5] = 200000; 28Assert.Null(sortedDf.Columns["Int"][sortedDf.Rows.Count - 1]); 29Assert.Equal(1, sortedDf.Columns["Int"][0]); 30Assert.Equal(100000, sortedDf.Columns["Int"][sortedDf.Rows.Count - 3]); 31Assert.Equal(200000, sortedDf.Columns["Int"][sortedDf.Rows.Count - 2]); 119for (int i = 0; i < sortedDataFrame.Columns.Count; i++) 121string columnName = sortedDataFrame.Columns[i].Name;
DataFrameTests.Utils.cs (20)
27dataFrame.Columns.Insert(0, dataFrameColumn1); 28dataFrame.Columns.Insert(1, dataFrameColumn2); 88df.Columns.Insert(df.Columns.Count, vBufferColumn); 97df.Columns.Insert(df.Columns.Count, arrowStringColumn); 106df.Columns.Insert(df.Columns.Count, boolColumn); 118df.Columns.Insert(df.Columns.Count, boolColumn); 130df.Columns.Insert(df.Columns.Count, stringColumn); 137df.Columns.Insert(df.Columns.Count, charColumn); 151df.Columns.Insert(df.Columns.Count, dateTimeColumn); 194for (var i = 0; i < dataFrame.Columns.Count; i++) 196dataFrame.Columns[i][length / 2] = null; 213for (int i = 0; i < dataFrame.Columns.Count; i++) 215dataFrame.Columns[i][length / 2] = null;
PrimitiveDataFrameColumnTests.cs (9)
503Assert.True(filteredNullDf.Columns.IndexOf("col") >= 0); 504Assert.Equal(3, filteredNullDf.Columns["col"].Length); 506Assert.Equal(1.23, filteredNullDf.Columns["col"][0]); 507Assert.Equal(2.0, filteredNullDf.Columns["col"][1]); 508Assert.Equal(3.0, filteredNullDf.Columns["col"][2]); 520Assert.True(filteredNullDf.Columns.IndexOf("col") >= 0); 521Assert.True(filteredNullDf.Columns.IndexOf("index") >= 0); 525Assert.Equal(2, filteredNullDf.Columns["index"][0]); 526Assert.Equal(5, filteredNullDf.Columns["index"][1]);