コード例 #1
0
        /// <summary>
        /// Performs an element-wise subtraction on each column
        /// </summary>
        public DataFrame Subtract <T>(T value, bool inPlace = false)
            where T : unmanaged
        {
            DataFrame retDataFrame = inPlace ? this : new DataFrame();

            for (int i = 0; i < Columns.Count; i++)
            {
                DataFrameColumn baseColumn = _columnCollection[i];
                DataFrameColumn newColumn  = baseColumn.Subtract(value, inPlace);
                if (inPlace)
                {
                    retDataFrame.Columns[i] = newColumn;
                }
                else
                {
                    retDataFrame.Columns.Insert(i, newColumn);
                }
            }
            return(retDataFrame);
        }
コード例 #2
0
        public DataFrame Subtract <T>(IReadOnlyList <T> values, bool inPlace = false)
            where T : unmanaged
        {
            if (values.Count != Columns.Count)
            {
                throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values));
            }
            DataFrame retDataFrame = inPlace ? this : new DataFrame();

            for (int i = 0; i < Columns.Count; i++)
            {
                DataFrameColumn baseColumn = _columnCollection[i];
                DataFrameColumn newColumn  = baseColumn.Subtract(values[i], inPlace);
                if (inPlace)
                {
                    retDataFrame.Columns[i] = newColumn;
                }
                else
                {
                    retDataFrame.Columns.Insert(i, newColumn);
                }
            }
            return(retDataFrame);
        }