Ejemplo n.º 1
0
        public void InsertColumn <T>(int columnIndex, IEnumerable <T> column, string columnName)
            where T : struct
        {
            column = column ?? throw new ArgumentNullException(nameof(column));
            if ((uint)columnIndex > _columns.Count)
            {
                throw new ArgumentException($"Invalid columnIndex {columnIndex} passed into Table.AddColumn");
            }
            BaseDataFrameColumn newColumn = new PrimitiveDataFrameColumn <T>(columnName, column);

            InsertColumn(columnIndex, newColumn);
        }
Ejemplo n.º 2
0
        public DataFrame Subtract <T>(T value)
            where T : struct
        {
            var newDataFrame = new DataFrame();

            for (int i = 0; i < ColumnCount; i++)
            {
                PrimitiveDataFrameColumn <T> column = _table.Column(i) as PrimitiveDataFrameColumn <T>;
                if (column != null)
                {
                    var newColumn = column.Clone();
                    newColumn._columnContainer.Subtract(value);
                    newDataFrame.InsertColumn(i, newColumn);
                }
            }
            return(newDataFrame);
        }
Ejemplo n.º 3
0
        public DataFrame LessThan <T>(T value)
            where T : struct
        {
            var newDataFrame = new DataFrame();

            for (int i = 0; i < ColumnCount; i++)
            {
                PrimitiveDataFrameColumn <T> column = _table.Column(i) as PrimitiveDataFrameColumn <T>;
                if (column != null)
                {
                    PrimitiveDataFrameColumn <bool> newColumn = column.CreateBoolColumnForCompareOps();
                    column._columnContainer.LessThan(value, newColumn._columnContainer);
                    newDataFrame.InsertColumn(i, newColumn);
                }
            }
            return(newDataFrame);
        }
Ejemplo n.º 4
0
        public DataFrame Multiply <T>(IReadOnlyList <T> values)
            where T : struct
        {
            if (values.Count != ColumnCount)
            {
                throw new ArgumentException($"values.Count {values.Count} must match the number of columns in the table", nameof(values));
            }
            var newDataFrame = new DataFrame();

            for (int i = 0; i < ColumnCount; i++)
            {
                PrimitiveDataFrameColumn <T> column = _table.Column(i) as PrimitiveDataFrameColumn <T>;
                if (column != null)
                {
                    var newColumn = column.Clone();
                    newColumn._columnContainer.Multiply(values[i]);
                    newDataFrame.InsertColumn(i, newColumn);
                }
            }
            return(newDataFrame);
        }
Ejemplo n.º 5
0
        public DataFrame LessThan <T>(IReadOnlyList <T> values)
            where T : struct
        {
            if (values.Count != ColumnCount)
            {
                throw new ArgumentException($"values.Count {values.Count} must match the number of columns in the table", nameof(values));
            }
            var newDataFrame = new DataFrame();

            for (int i = 0; i < ColumnCount; i++)
            {
                PrimitiveDataFrameColumn <T> column = _table.Column(i) as PrimitiveDataFrameColumn <T>;
                if (column != null)
                {
                    PrimitiveDataFrameColumn <bool> newColumn = column.CreateBoolColumnForCompareOps();
                    column._columnContainer.LessThan(values[i], newColumn._columnContainer);
                    newDataFrame.InsertColumn(i, newColumn);
                }
            }
            return(newDataFrame);
        }