| 48 | * @param options.config General configuration object for extending or setting Series behavior. |
| 49 | */ |
| 50 | export default class Series extends NDframe implements SeriesInterface { |
| 51 | |
| 52 | constructor(data: any = [], options: BaseDataOptionType = {}) { |
| 53 | const { index, columns, dtypes, config } = options; |
| 54 | if (Array.isArray(data[0]) || utils.isObject(data[0])) { |
| 55 | data = utils.convert2DArrayToSeriesArray(data); |
| 56 | super({ |
| 57 | data, |
| 58 | index, |
| 59 | columns, |
| 60 | dtypes, |
| 61 | config, |
| 62 | isSeries: true |
| 63 | }); |
| 64 | } else { |
| 65 | super({ |
| 66 | data, |
| 67 | index, |
| 68 | columns, |
| 69 | dtypes, |
| 70 | config, |
| 71 | isSeries: true |
| 72 | }); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Purely integer-location based indexing for selection by position. |
| 78 | * ``.iloc`` is primarily integer position based (from ``0`` to |
| 79 | * ``length-1`` of the axis), but may also be used with a boolean array. |
| 80 | * |
| 81 | * @param rows Array of row indexes |
| 82 | * |
| 83 | * Allowed inputs are in rows and columns params are: |
| 84 | * |
| 85 | * - An array of single integer, e.g. ``[5]``. |
| 86 | * - A list or array of integers, e.g. ``[4, 3, 0]``. |
| 87 | * - A slice array string with ints, e.g. ``["1:7"]``. |
| 88 | * - A boolean array. |
| 89 | * - A ``callable`` function with one argument (the calling Series or |
| 90 | * DataFrame) and that returns valid output for indexing (one of the above). |
| 91 | * This is useful in method chains, when you don't have a reference to the |
| 92 | * calling object, but would like to base your selection on some value. |
| 93 | * |
| 94 | * ``.iloc`` will raise ``IndexError`` if a requested indexer is |
| 95 | * out-of-bounds. |
| 96 | * |
| 97 | * @example |
| 98 | * ``` |
| 99 | * const sf = new Series([1, 2, 3, 4, 5, 6], { index: ['a', 'b', 'c', 'd', 'e', 'f'] }); |
| 100 | * const sf2 = sf.iloc([0, 2, 4]); |
| 101 | * sf2.print(); |
| 102 | * ``` |
| 103 | */ |
| 104 | iloc(rows: Array<string | number | boolean>): Series { |
| 105 | return _iloc({ ndFrame: this, rows }) as Series |
| 106 | } |
| 107 |
nothing calls this directly
no outgoing calls
no test coverage detected