/// <summary> /// Affected by <see cref="SimpleFrameGenerator.NonZeroesOnly"/> /// </summary> public static DFColumn[] CreateColumns(int rowCount, Type[] colTypes, string[] colNames) { DFColumn[] cols = new DFColumn[colTypes.Length]; for (int i = 0; i < cols.Length; i++) { if (colTypes[i] == typeof(int)) { cols[i] = CreateIntCol(colNames[i], rowCount); } else if (colTypes[i] == typeof(bool)) { cols[i] = CreateBoolCol(colNames[i], rowCount); } else if (colTypes[i] == typeof(float)) { cols[i] = CreateDoubleCol(colNames[i], rowCount); } else if (colTypes[i] == typeof(double)) { cols[i] = CreateDoubleCol(colNames[i], rowCount); } else if (colTypes[i] == typeof(string)) { cols[i] = CreateStringCol(colNames[i], rowCount); } else if (colTypes[i] == typeof(DateTime)) { cols[i] = CreateDateTimeCol(colNames[i], rowCount); } else { cols[i] = CreateGenericCol(colNames[i], rowCount); } } return cols; }
/// <summary> /// Returns a Frame with 2 cols: string, bool. /// </summary> /// <param name="rowCount"></param> /// <returns></returns> public static Frame CreateFrameWith2Cols(int rowCount) { DFColumn[] cols = new DFColumn[2]; cols[0] = CreateStringCol( string.Format("col {0}", 0), rowCount); cols[1] = CreateBoolCol( string.Format("col {0}", 1), rowCount); Frame frame = new Frame(Guid.NewGuid(), cols); return frame; }
/// <summary> /// Returns a Frame with 5 cols: int, double, string, bool, Guid. /// Affected by <see cref="SimpleFrameGenerator.NonZeroesOnly"/> /// </summary> public static Frame CreateFrameWith5Cols(int rowCount) { DFColumn[] cols = new DFColumn[5]; cols[0] = CreateIntCol( string.Format("col {0}", 0), rowCount); cols[1] = CreateDoubleCol( string.Format("col {0}", 1), rowCount); cols[2] = CreateStringCol( string.Format("col {0}", 2), rowCount); cols[3] = CreateBoolCol( string.Format("col {0}", 3), rowCount); cols[4] = CreateGenericCol( string.Format("col {0}", 4), rowCount); Frame frame = new Frame(Guid.NewGuid(), cols); return frame; }
/// <summary> /// Creates a <see cref="BlueSpider.Blob.Data.CSpace.Frame"/> with <paramref name="rowCount"/> number /// of rows and the number and types of columns specified by <paramref name="colTypes"/>. If <paramref name="nonZerosOnly"/> /// is true, then any numerical data generated will not include any zero values. /// Affected by <see cref="SimpleFrameGenerator.NonZeroesOnly"/> /// </summary> /// <param name="rowCount">Number of rows to generate</param> /// <param name="colTypes">Number and types of columns.</param> /// <param name="nonZerosOnly">True to ensure no zero values are generated for numerical data.</param> /// <returns>BlueSpider.Blob.Data.CSpace.Frame</returns> public static Frame CreateFrame(int rowCount, Type[] colTypes, bool nonZerosOnly) { NonZerosOnly = nonZerosOnly; DFColumn[] cols = new DFColumn[colTypes.Length]; for (int i = 0; i < cols.Length; i++) { if (colTypes[i] == typeof(int)) { cols[i] = CreateIntCol(string.Format("col {0}", i), rowCount); } else if (colTypes[i] == typeof(bool)) { cols[i] = CreateBoolCol(string.Format("col {0}", i), rowCount); } else if (colTypes[i] == typeof(double)) { cols[i] = CreateDoubleCol(string.Format("col {0}", i), rowCount); } else if (colTypes[i] == typeof(float)) { cols[i] = CreateDoubleCol(string.Format("col {0}", i), rowCount); } else if (colTypes[i] == typeof(string)) { cols[i] = CreateStringCol(string.Format("col {0}", i), rowCount); } else if (colTypes[i] == typeof(DateTime)) { cols[i] = CreateDateTimeCol(string.Format("col {0}", i), rowCount); } else { cols[i] = CreateGenericCol(string.Format("col {0}", i), rowCount); } } Frame frame = new Frame(Guid.NewGuid(), cols); return frame; }
public static Frame CreateFrame(int rowCount, Type[] colTypes, string[] colNames) { DFColumn[] cols = new DFColumn[colTypes.Length]; for (int i = 0; i < cols.Length; i++) { if (colTypes[i] == typeof(int)) { cols[i] = CreateIntCol(colNames[i], rowCount); } else if (colTypes[i] == typeof(bool)) { cols[i] = CreateBoolCol(colNames[i], rowCount); } else if (colTypes[i] == typeof(float)) { cols[i] = CreateDoubleCol(colNames[i], rowCount); } else if (colTypes[i] == typeof(double)) { cols[i] = CreateDoubleCol(colNames[i], rowCount); } else if (colTypes[i] == typeof(string)) { cols[i] = CreateStringCol(colNames[i], rowCount); } else if (colTypes[i] == typeof(DateTime)) { cols[i] = CreateDateTimeCol(colNames[i], rowCount); } else { cols[i] = CreateGenericCol(colNames[i], rowCount); } } Frame frame = new Frame(Guid.NewGuid(), cols); return frame; }
public static Frame CreateFrame(double[] values, bool[] values1, int[] values2) { DFColumn[] cols = new DFColumn[3]; cols[0] = new DFNumericColumn("col 0", values); cols[1] = new DFBoolColumn("col 1", values1); cols[2] = new DFIntColumn("col 2", values2); Frame frame = new Frame(Guid.NewGuid(), cols); return frame; }
public static Frame CreateFrame(DateTime[] values, string colName) { DFColumn[] cols = new DFColumn[1]; cols[0] = new DFDateTimeColumn(colName, values); Frame frame = new Frame(Guid.NewGuid(), cols); return frame; }
public static Frame CreateFrame(DateTime[] values, DateTime[] values2) { DFColumn[] cols = new DFColumn[2]; cols[0] = new DFDateTimeColumn("col 0", values); cols[1] = new DFDateTimeColumn("col 1", values2); Frame frame = new Frame(Guid.NewGuid(), cols); return frame; }
public static Frame CreateFrame(string[] values) { DFColumn[] cols = new DFColumn[1]; cols[0] = new DFStringColumn("col 0", values); Frame frame = new Frame(Guid.NewGuid(), cols); return frame; }
public static Frame CreateFrame(double[] values, double[] values2) { DFColumn[] cols = new DFColumn[2]; cols[0] = new DFNumericColumn("col 0", values); cols[1] = new DFNumericColumn("col 1", values2); Frame frame = new Frame(Guid.NewGuid(), cols); return frame; }