Skip to content

Commit f777dfd

Browse files
risenWgitbook-bot
authored andcommitted
GitBook: [master] 65 pages modified
1 parent 8178b54 commit f777dfd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+946
-1740
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ D**anfo.js** is heavily inspired by the [Pandas](https://pandas.pydata.org/panda
1111

1212
## Main Features
1313

14-
* Danfo.js is fast. It is built on[ Tensorflow.js](https://js.tensorflow.org/), and supports tensors out of the box. This means you can [convert Danfo.js ](api-reference/dataframe/)DataFrames to Tensors, and vice versa.
14+
* Danfo.js is fast. It is built on[ Tensorflow.js](https://js.tensorflow.org/), and supports tensors out of the box. This means you can [convert danfo data structure](api-reference/dataframe/) to Tensors.
1515
* Easy handling of missing ****data \(represented as `NaN`\) in floating point as well as non-floating point data
1616
* Size mutability: columns can be inserted/deleted from DataFrame
1717
* Automatic and explicit alignment: objects can be explicitly aligned to a set of labels, or the user can simply ignore the labels and let [`Series`](api-reference/series/), [`DataFrame`](api-reference/dataframe/), etc. automatically align the data for you in computations
18-
* Powerful, flexible, [groupby](api-reference/groupby/) functionality to perform split-apply-combine operations on data sets, for both aggregating and transforming data
19-
* Make it easy to convert Arrays, JSONs, List or Objects, Tensors, and differently-indexed data structures into DataFrame objects
18+
* Powerful, flexible [groupby](api-reference/groupby/) functionality to perform split-apply-combine operations on data sets, for both aggregating and transforming data
19+
* Make it easy to convert Arrays, JSONs, List or Objects, Tensors and differently-indexed data structures into DataFrame objects
2020
* Intelligent label-based slicing, fancy indexing, and querying of large data sets
2121
* Intuitive [merging](api-reference/general-functions/danfo.merge.md) and [joining](api-reference/general-functions/danfo.concat.md) data sets
22-
* Robust IO tools for loading data from [flat-files](api-reference/input-output/danfo.read_csv.md) \(CSV and delimited\), Excel, and JSON data format.
23-
* Powerful, flexible, and intiutive API for [plotting](https://app.gitbook.com/@jsdata/s/danfojs/~/drafts/-MESZnq3_VBU0EW71MxS/api-reference/plotting) DataFrames and Series interactively.
22+
* Robust IO tools for loading data from [flat-files](api-reference/input-output/danfo.read_csv.md) \(CSV and delimited\) and JSON data format.
23+
* Powerful, flexible and intutive API for [plotting](https://app.gitbook.com/@jsdata/s/danfojs/~/drafts/-MESZnq3_VBU0EW71MxS/api-reference/plotting) DataFrames and Series interactively.
2424
* Timeseries-specific functionality: date range generation and date and time properties.
2525
* Robust data preprocessing functions like [OneHotEncoders](api-reference/general-functions/danfo.onehotencoder.md), [LabelEncoders](api-reference/general-functions/danfo.labelencoder.md), and scalers like [StandardScaler](api-reference/general-functions/danfo.standardscaler.md) and [MinMaxScaler](api-reference/general-functions/danfo.minmaxscaler.md) are supported on DataFrame and Series
2626

2727
## Getting Started
2828

29-
New to Danfo? Check out the getting started guides. It contains a quick introduction to D_anfo's_ main concepts and links to additional content.
29+
New to danfo? Check out the getting started guides. They contain an introduction to _danfo's_ main concepts and links to additional contents.
3030

3131
{% page-ref page="getting-started.md" %}
3232

api-reference/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description: >-
99
* [General Functions](general-functions/)
1010
* [Data manipulations](general-functions/#data-manipulations)
1111
* [Data Processing/Normalization](general-functions/#data-processing-normalization)
12-
* [Top-level dealing with datetime like](general-functions/#top-level-dealing-with-datetime)
12+
* [Top-level dealing with datetimelike](general-functions/#top-level-dealing-with-datetime)
1313
* [Input/output](input-output/)
1414
* [CSV](input-output/#csv)
1515
* [JSON](input-output/#json)

api-reference/dataframe/danfo.dataframe.addcolumn.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ danfo.DataFrame.**addColumn**\(kwargs\) \[[source](https://github.com/opensource
2121
<td style="text-align:left">Object</td>
2222
<td style="text-align:left">
2323
<p>{<b>column</b> : str, name of the column to add</p>
24-
<p> <b>values:</b> Series<b>,</b> Array of new values to add
25-
<br /> <b>inplace</b>: Default to false.</p>
26-
<p>}</p>
24+
<p><b> value: </b>Series<b>, </b>Array. New values to add }</p>
2725
</td>
2826
<td style="text-align:left"></td>
2927
</tr>
@@ -32,11 +30,13 @@ danfo.DataFrame.**addColumn**\(kwargs\) \[[source](https://github.com/opensource
3230

3331
**Returns:**
3432

33+
****return **Null**
34+
3535
## **Examples**
3636

3737
## **Add Array as a new column to DataFrame**
3838

39-
New columns get added at the end of the DataFrame, and this happens so returns nothing,
39+
New columns get added at the end of the DataFrame, and this happens so returns nothing,
4040

4141
{% tabs %}
4242
{% tab title="Node" %}
@@ -53,11 +53,12 @@ let new_col = [1, 2, 3, 4]
5353
df.addColumn({ "column": "D", "values": new_col, inplace: true });
5454

5555
df.print()
56+
5657
```
5758
{% endtab %}
5859

5960
{% tab title="Browser" %}
60-
```text
61+
```
6162
6263
```
6364
{% endtab %}
@@ -111,11 +112,12 @@ let s = new dfd.Series([1, 2, 3, 4])
111112
df.addColumn({ "column": "D", "values": s, inplace: true });
112113

113114
df.print()
115+
114116
```
115117
{% endtab %}
116118

117119
{% tab title="Browser" %}
118-
```text
120+
```
119121
120122
```
121123
{% endtab %}
@@ -124,6 +126,7 @@ df.print()
124126
{% tabs %}
125127
{% tab title="Output" %}
126128
```text
129+
127130
╔═══╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╗
128131
║ │ A │ B │ C │ D ║
129132
╟───┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢

api-reference/dataframe/dataframe.set_index.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ danfo.DataFrame.**set\_index**\(kwargs\) \[[source](https://github.com/opensourc
3737

3838
**Returns:**
3939

40-
```text
41-
****return **DataFrame**
42-
```
40+
****return **DataFrame**
4341

4442
## **Examples**
4543

@@ -48,6 +46,7 @@ danfo.DataFrame.**set\_index**\(kwargs\) \[[source](https://github.com/opensourc
4846
{% tabs %}
4947
{% tab title="Node" %}
5048
```javascript
49+
5150
const dfd = require("danfojs-node")
5251

5352
let data = { "A": [-20, 30, 47.3],
@@ -60,11 +59,12 @@ df.print()
6059

6160
df.set_index({column: "A", inplace: true})
6261
df.print()
62+
6363
```
6464
{% endtab %}
6565

6666
{% tab title="Browser" %}
67-
```text
67+
```
6868
6969
```
7070
{% endtab %}
@@ -73,6 +73,7 @@ df.print()
7373
{% tabs %}
7474
{% tab title="Output" %}
7575
```text
76+
7677
╔═══╤═══════════════════╤═══════════════════╤═══════════════════╗
7778
║ │ A │ B │ C ║
7879
╟───┼───────────────────┼───────────────────┼───────────────────╢
@@ -117,11 +118,12 @@ df.print()
117118
let new_index = ["a", "b", "a"]
118119
df.set_index({column: new_index, inplace: true})
119120
df.print()
121+
120122
```
121123
{% endtab %}
122124

123125
{% tab title="Browser" %}
124-
```text
126+
```
125127
126128
```
127129
{% endtab %}
@@ -130,6 +132,7 @@ df.print()
130132
{% tabs %}
131133
{% tab title="Output" %}
132134
```text
135+
133136
╔═══╤═══════════════════╤═══════════════════╤═══════════════════╗
134137
║ │ A │ B │ C ║
135138
╟───┼───────────────────┼───────────────────┼───────────────────╢
@@ -156,5 +159,5 @@ df.print()
156159
{% endtab %}
157160
{% endtabs %}
158161

159-
**Note:** To reset an index to the default values, use the [DataFrame.reset\_index](dataframe.reset_index.md).
162+
**Note:** To reset an index to the default values, use the [DataFrame.reset\_index](dataframe.reset_index.md).
160163

api-reference/general-functions/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ description: Top level functions that can be called from the Danfo namespace
2222

2323
### Top-level dealing with datetime
2424

25-
| [`toDateTime`](danfo.to_datetime.md) | Convert argument to datetime. |
25+
| [`to_datetime`](danfo.to_datetime.md) | Convert argument to datetime. |
2626
| :--- | :--- |
2727
| [`date_range`](danfo.date_range.md) | Return a fixed frequency DatetimeIndex. |
2828

api-reference/general-functions/danfo.get_dummies.md

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,18 @@ danfo.**get\_dummies**\(kwargs\) \[[source](https://github.com/opensource9ja/dan
1717
</thead>
1818
<tbody>
1919
<tr>
20-
<td style="text-align:left">data</td>
21-
<td style="text-align:left">Series or Dataframe</td>
22-
<td style="text-align:left">The data to dummify</td>
23-
<td style="text-align:left"></td>
24-
</tr>
25-
<tr>
26-
<td style="text-align:left"><b>options</b>
20+
<td style="text-align:left"><b>kwargs</b>
2721
</td>
2822
<td style="text-align:left">Object</td>
2923
<td style="text-align:left">
3024
<p>{</p>
31-
<p><b>columns</b>: Array of column names to dummify. If not specified, all
32-
categorical columns are encoded.</p>
33-
<p><b>prefixSeparator</b>: String separator for created columns e.g &quot;_&quot;,</p>
25+
<p><b>data</b>: Array | Series | DataFrame</p>
26+
<p><b>prefix_sep</b>: String separator for created columns e.g &quot;_&quot;,</p>
3427
<p><b>prefix</b>: String | Array of String, of column names</p>
28+
<p><b>columns</b>: [Array] columns to be encoded in DataFrame.</p>
3529
<p>}</p>
3630
</td>
37-
<td style="text-align:left">{<b>prefixSeparator</b>: &quot;_&quot;}</td>
31+
<td style="text-align:left">{<b>prefix_sep</b>: &quot;_&quot;}</td>
3832
</tr>
3933
</tbody>
4034
</table>
@@ -55,7 +49,7 @@ const dfd = require("danfojs-node")
5549
let datasf = ['pear', 'mango', "pawpaw", "mango", "bean"]
5650
let sf1 = new dfd.Series(datasf)
5751

58-
let dum_df = dfd.get_dummies(sf1, { prefix: "fruit" })
52+
let dum_df = dfd.get_dummies({data: sf1, prefix:"fruit"})
5953
dum_df.print()
6054
```
6155
{% endtab %}
@@ -71,19 +65,19 @@ dum_df.print()
7165
{% tab title="Output" %}
7266
```text
7367
74-
╔════════════╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╗
75-
│ fruit_pear │ fruit_mango │ fruit_pawpaw │ fruit_bean ║
76-
╟────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
77-
║ 0 │ 1 │ 0 │ 0 │ 0 ║
78-
╟────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
79-
║ 1 │ 0 │ 1 │ 0 │ 0 ║
80-
╟────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
81-
║ 2 │ 0 │ 0 │ 1 │ 0 ║
82-
╟────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
83-
║ 3 │ 0 │ 1 │ 0 │ 0 ║
84-
╟────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
85-
║ 4 │ 0 │ 0 │ 0 │ 1 ║
86-
╚════════════╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╝
68+
╔═══╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╗
69+
║ │ fruit_pear │ fruit_mango │ fruit_pawpaw │ fruit_bean ║
70+
╟───┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
71+
║ 0 │ 1 │ 0 │ 0 │ 0 ║
72+
╟───┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
73+
║ 1 │ 0 │ 1 │ 0 │ 0 ║
74+
╟───┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
75+
║ 2 │ 0 │ 0 │ 1 │ 0 ║
76+
╟───┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
77+
║ 3 │ 0 │ 1 │ 0 │ 0 ║
78+
╟───┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
79+
║ 4 │ 0 │ 0 │ 0 │ 1 ║
80+
╚═══╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╝
8781
```
8882
{% endtab %}
8983
{% endtabs %}
@@ -102,7 +96,7 @@ let data = { fruits: ['pear', 'mango', "pawpaw", "mango", "bean"],
10296
let df = new dfd.DataFrame(data)
10397
df.print()
10498

105-
let dum_df = dfd.get_dummies(df)
99+
let dum_df = dfd.get_dummies({ data: df })
106100
dum_df.print()
107101
```
108102
{% endtab %}
@@ -165,7 +159,7 @@ let data = { fruits: ['pear', 'mango', "pawpaw", "mango", "bean"],
165159
let df = new dfd.DataFrame(data)
166160
df.print()
167161

168-
let dum_df = dfd.get_dummies(df, { columns: ['fruits']})
162+
let dum_df = dfd.get_dummies({ data: df, columns: ['fruits']})
169163
dum_df.print()
170164
```
171165
{% endtab %}

api-reference/general-functions/danfo.onehotencoder.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ description: Encode categorical features as a one-hot numeric array.
44

55
# danfo.OneHotEncoder
66

7-
class danfo.**OneHotEncoder** \[[source](https://github.com/opensource9ja/danfojs/blob/e25010c26d9c423412613d820015a48ad03d5c6d/danfojs-node/src/preprocessing/encodings.js#L6)\]
7+
class danfo.**OneHotEncoder** \[[source](https://github.com/opensource9ja/danfojs/blob/fe56860b0a303d218d60ba71dee6abf594401556/danfojs/src/core/frame.js#L254)\]
88

99
danfo.js provides the OneHotEncoder class for encoding values in Series and Arrays to one-hot numeric arrays. This is mostly used as a preprocessing step before most machine learning tasks.
1010

11-
The API is similar to scikit-learn's [OneHotEncoder](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html?highlight=onehotencoder#sklearn.preprocessing.OneHotEncoder), and provides a fit and transform method.
11+
The API is similar to sklearn's [OneHotEncoder](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html?highlight=onehotencoder#sklearn.preprocessing.OneHotEncoder), and provides a fit and transform method.
1212

1313
## **Examples**
1414

api-reference/general-functions/danfo.standardscaler.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: Standardize features by removing the mean and scaling to unit varia
66

77
class danfo.**StandScaler** \[[source](https://github.com/opensource9ja/danfojs/blob/fe56860b0a303d218d60ba71dee6abf594401556/danfojs/src/core/frame.js#L254)\]
88

9-
danfo.js provides the StandardScaler class for the standardization of DataFrame and Series. The standard score of a sample `x` is calculated as:
9+
danfo.js provides the StandardScaler class for standardization of DataFrame and Series. The standard score of a sample `x` is calculated as:
1010

1111
> z = \(x - u\) / s
1212

0 commit comments

Comments
 (0)