Skip to content

Commit d64cd2e

Browse files
committed
Merge with refs/remotes/origin/master
2 parents 80ff875 + 271d6e5 commit d64cd2e

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

README.md

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,38 +31,19 @@ series keys: #(k1 k2 k3).
3131
```
3232

3333
### Creating a DataFrame
34-
There are four ways of creating a data frame:
35-
1. Creating an empty data frame, then filling it with data
36-
2. Creating a data frame from an array of rows
37-
3. Creating a data frame from an array of columns
38-
4. Reading data from a file
39-
40-
#### Creating an empty DataFrame
41-
You can create an empty instance of `DataFrame` using the `new` message
42-
43-
```smalltalk
44-
df := DataFrame new.
45-
```
46-
The data can be added later using the `add:` message.
47-
```smalltalk
48-
df add: #('Barcelona' 1.609 true).
49-
```
50-
51-
#### Creating a DataFrame from an array of rows
52-
This way is the best for creating simple examples for testing since you can see how the data will be arranged in your data frame.
34+
The easiest way to create an object of `DataFrame` class is by passing it an array of rows or columns (an array of arrays). Creating a DataFrame from rows allows us to see how the data will be arranged in a table. It's very readable and can be handy if we need to write some simple examples for testing
5335

5436
```smalltalk
55-
df := DataFrame rows: #(
37+
df := DataFrame fromRows: #(
5638
('Barcelona' 1.609 true)
5739
('Dubai' 2.789 true)
5840
('London' 8.788 false)).
5941
```
6042

61-
#### Creating a DataFrame from an array of columns
6243
We can do the same by passing an array of columns
6344

6445
```smalltalk
65-
df := DataFrame rows: #(
46+
df := DataFrame fromColumns: #(
6647
('Barcelona' 'Dubai' 'London')
6748
(1.609 2.789 8.788)
6849
(true true false)).

0 commit comments

Comments
 (0)