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