README.md in red_amber-0.1.1 vs README.md in red_amber-0.1.2
- old
+ new
@@ -6,12 +6,12 @@
- Simple API similar to [Rover-df](https://github.com/ankane/rover)
## Requirements
```ruby
-gem 'red-arrow', '~> 7.0.0'
-gem 'red-parquet', '~> 7.0.0' # if you use IO from/to parquet
+gem 'red-arrow', '>= 7.0.0'
+gem 'red-parquet', '>= 7.0.0' # if you use IO from/to parquet
gem 'rover-df', '~> 0.3.0' # if you use IO from/to Rover::DataFrame
```
## Installation
@@ -87,15 +87,18 @@
- [x] `column_names`, `keys`
Returns num of column names by an Array.
-- [x] `types(class_name: false)`
+- [x] `types`
- Returns types of columns by an Array.
- If `class_name: true` returns an Array of `Arrow::DataType`.
+ Returns types of columns by an Array of Symbols.
+- [x] `data_types`
+
+ Returns types of columns by an Array of `Arrow::DataType`.
+
- [x] `vectors`
Returns an Array of Vectors.
- [x] `to_h`
@@ -126,25 +129,55 @@
- [x] `inspect(tally_level: 5, max_element: 5)`
Shows some information about self.
+```ruby
+hash = {a: [1, 2, 3], b: %w[A B C], c: [1.0, 2, 3]}
+RedAmber::DataFrame.new(hash)
+# =>
+RedAmber::DataFrame : 3 observations(rows) of 3 variables(columns)
+Variables : 2 numeric, 1 string
+# key type level data_preview
+1 :a uint8 3 [1, 2, 3]
+2 :b string 3 [A, B, C]
+3 :c double 3 [1.0, 2.0, 3.0]
+```
+
- tally_level: max level to use tally mode
- max_element: max num of element to show values in each row
### Selecting
-- [x] Selecting columns by `[]`
+- [x] Select columns by `[]` as `[key]`, `[keys]`, `[keys[index]]`
+ - Key in a Symbol: `df[:symbol]`
+ - Key in a String: `df["string"]`
+ - Keys in an Array: `df[:symbol1`, `"string"`, `:symbol2`
+ - Keys in indeces: `df[df.keys[0]`, `df[df.keys[1,2]]`, `df[df.keys[1..]]`
+ - Keys in a Range:
+ A end-less Range can be used to represent keys.
+```ruby
+hash = {a: [1, 2, 3], b: %w[A B C], c: [1.0, 2, 3]}
+df = RedAmber::DataFrame.new(hash)
+df[:b..:c, "a"]
+# =>
+RedAmber::DataFrame : 3 observations(rows) of 3 variables(columns)
+Variables : 2 numeric, 1 string
+# key type level data_preview
+1 :b string 3 [A, B, C]
+2 :c double 3 [1.0, 2.0, 3.0]
+3 :a uint8 3 [1, 2, 3]
+```
- `[key]`, `[keys]`, `[keys[index]]`
+- [x] Select rows by `[]` as `[index]`, `[range]`, `[array]`
+ - Select a row by index: `df[0]`
+ - Select rows by indeces in a Range: `df[1..2]`
+ - Select rows by indeces in an Array: `df[1, 2]`
+ - Mixed case: `df[2, 0..]`
-- [x] Selecting rows by `[]`
+- [x] Select rows from top or bottom
- `[index]`, `[range]`, `[array]`
-
-- [x] Selecting rows from top or bottom
-
`head(n=5)`, `tail(n=5)`, `first(n=1)`, `last(n=1)`
- [ ] slice
### Updating
@@ -211,10 +244,12 @@
- [x] `size`, `length`, `n_rows`, `nrow`
- [x] `type`
+- [x] `data_type`
+
- [ ] `each`
- [ ] `chunked?`
- [ ] `n_chunks`
@@ -322,10 +357,10 @@
### DSL in a block for faster calculation ?
## Development
-```
+```shell
git clone https://github.com/heronshoes/red_amber.git
cd red_amber
bundle install
bundle exec rake test
```