示例#1
0
        protected virtual void CreateRowIndex()
        {
            DataIndex index = null;

            if (_rawIndex == null)
            {
                index = new DataIndex(np.arange(_rowSize));
            }
            else
            {
                if (_rawIndex.Count != _rowSize)
                {
                    throw new ArgumentException("传入的行标签与传入的行数不一致!");
                }
                Type indexType = typeof(TIndex);
                switch (indexType.Name)
                {
                case ("Int32"):
                    index = new DataIndex(_rawIndex.Select(x => Convert.ToInt32(x)).ToArray());
                    break;

                case "String":
                    index = new DataIndex(_rawIndex.Select(x => x.ToString()).ToArray());
                    break;

                case "Object":
                    index = new DataIndex(_rawIndex.Select(x => x).ToArray());
                    break;
                }
            }
            Index = index;
        }
示例#2
0
        protected virtual void CreateColumnIndex()
        {
            DataIndex index = null;

            if (_rawColumns == null)
            {
                index = new DataIndex(np.arange(Values.shape.Length));
            }
            else
            {
                index = new DataIndex(_rawColumns.Select(x => x.ToString()).ToArray());
            }
            Columns = index;
        }