Пример #1
0
        public DataFrame TJoin <T1, T2, T3>(IDataFrameView right, IEnumerable <int> colsLeft, IEnumerable <int> colsRight, string leftSuffix = null, string rightSuffix = null, JoinStrategy joinType = JoinStrategy.Inner, bool sort = true)
            where T1 : IEquatable <T1>, IComparable <T1>
            where T2 : IEquatable <T2>, IComparable <T2>
            where T3 : IEquatable <T3>, IComparable <T3>
        {
            int[] orderLeft    = _rows.Select(c => c).ToArray();
            int[] orderRight   = (right as DataFrame) is null ? (right as DataFrameView)._rows.Select(c => c).ToArray() : null;
            int[] columnsRight = (right as DataFrame) is null ? (right as DataFrameView)._columns : null;
            var   icolsLeft    = colsLeft.ToArray();
            var   icolsRight   = colsRight.ToArray();
            var   scolsLeft    = icolsLeft.Select(c => Schema.GetColumnName(c)).ToArray();
            var   scolsRight   = icolsRight.Select(c => right.Schema.GetColumnName(c)).ToArray();

            return(DataFrameJoining.TJoin(this, right,
                                          orderLeft, orderRight,
                                          _columns, columnsRight,
                                          icolsLeft, icolsRight, sort,
                                          leftSuffix, rightSuffix,
                                          joinType,
                                          GetMultiGetterAt <T1, T2, T3>(icolsLeft),
                                          right.GetMultiGetterAt <T1, T2, T3>(icolsRight),
                                          ke => ke.ToImTuple(),
                                          ke => DataFrameGroupKey.Create(scolsLeft, ke),
                                          ke => DataFrameGroupKey.Create(scolsRight, ke)));
        }
        public static   DataFrameGroupKey[] Create <T1>(string[] name, ImmutableTuple <T1> value)
            where T1 : IComparable <T1>, IEquatable <T1>
        {
            var res = new DataFrameGroupKey[1];

            res[0]._key   = name[0];
            res[0]._kind  = SchemaHelper.GetKind <T1>();
            res[0]._value = (object)value.Item1;
            return(res);
        }
Пример #3
0
        public DataFrameViewGroupResults <ImmutableTuple <T1> > TGroupBy <T1>(IEnumerable <int> cols, bool sort = true)
            where T1 : IEquatable <T1>, IComparable <T1>
        {
            int[] order = _rows.Select(c => c).ToArray();
            var   icols = cols.ToArray();
            var   scols = icols.Select(c => Schema.GetColumnName(c)).ToArray();

            return(DataFrameGrouping.TGroupBy(this, order, _columns, icols, true, GetMultiGetterAt <T1>(icols),
                                              ke => ke.ToImTuple(), ke => DataFrameGroupKey.Create(scols, ke)));
        }