You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-21Lines changed: 26 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,10 +88,11 @@ df := DataFrame loadHousing.
88
88
If we print (Ctrl+P) the data frame that was created from an array of rows or columns as described in previous sections, we will see the following table
89
89
90
90
```
91
-
1 2 3
92
-
1 'Barcelona' 1.609 true
93
-
2 'Dubai' 2.789 true
94
-
3 'London' 8.788 false
91
+
| 1 2 3
92
+
---+-------------------------
93
+
1 | Barcelona 1.609 true
94
+
2 | Dubai 2.789 true
95
+
3 | London 8.788 false
95
96
```
96
97
97
98
As you can see, both row and column names were automatically set to numeric sequences. We can using change them by passing an array of new names. This array must be of the same size as the number of rows and columns.
@@ -104,10 +105,11 @@ df rowNames: #(A B C).
104
105
Now if we print our data frame, it will look like this
105
106
106
107
```
107
-
City Population SomeBool
108
-
A 'Barcelona' 1.609 true
109
-
B 'Dubai' 2.789 true
110
-
C 'London' 8.788 false
108
+
| City Population SomeBool
109
+
---+---------------------------------
110
+
A | Barcelona 1.609 true
111
+
B | Dubai 2.789 true
112
+
C | London 8.788 false
111
113
```
112
114
113
115
To get the dimensions of a data frame, its rows, and columns, we can say
@@ -142,12 +144,13 @@ df tail.
142
144
Data frame responds to these messages with another `DataFrame` object containing the requested rows. Here is the example output of the `df head` message
143
145
144
146
```
145
-
RM LSTAT PTRATIO MDEV
146
-
1 6.575 4.98 15.3 504000.0
147
-
2 6.421 9.14 17.8 453600.0
148
-
3 7.185 4.03 17.8 728700.0
149
-
4 6.998 2.94 18.7 701400.0
150
-
5 7.147 5.33 18.7 760200.0
147
+
| RM LSTAT PTRATIO MDEV
148
+
---+---------------------------------
149
+
1 | 6.575 4.98 15.3 504000.0
150
+
2 | 6.421 9.14 17.8 453600.0
151
+
3 | 7.185 4.03 17.8 728700.0
152
+
4 | 6.998 2.94 18.7 701400.0
153
+
5 | 7.147 5.33 18.7 760200.0
151
154
```
152
155
153
156
It is also possible to specify the number of rows that must be printed
@@ -166,9 +169,10 @@ The same messages are also supported by the objects of `DataSeries` class. This
166
169
The result will be another series
167
170
168
171
```
169
-
[LSTAT]
170
-
1 4.98
171
-
2 9.14
172
+
| LSTAT
173
+
---+-------
174
+
1 | 4.98
175
+
2 | 9.14
172
176
```
173
177
174
178
### Accessing rows and columns
@@ -189,8 +193,9 @@ df columnAt: 2.
189
193
The important feature of a `DataFrame` is that whenever we ask for a specific row or column, it responds with a `DataSeries` object that preserves the same indexing. So, for example, if you take row _'B'_ of a data frame described above, you will get a series named _'B'_ with keys _'City'_, _'Population'_, and _'SomeBool'_.
0 commit comments