Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d116e27

Browse files
committed
Fixed warnings and errors
1 parent 66208c6 commit d116e27

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

‎doc/python/3d-mesh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import plotly.graph_objects as go
4242
import numpy as np
4343

4444
# Download data set from plotly repo
45-
pts = np.loadtxt(np.DataSource().open('https://raw.githubusercontent.com/plotly/datasets/master/mesh_dataset.txt'))
45+
pts = np.loadtxt(np.lib.npyio.DataSource().open('https://raw.githubusercontent.com/plotly/datasets/master/mesh_dataset.txt'))
4646
x, y, z = pts.T
4747

4848
fig = go.Figure(data=[go.Mesh3d(x=x, y=y, z=z, color='lightpink', opacity=0.50)])
@@ -58,7 +58,7 @@ The `alphahull` parameter sets the shape of the mesh. If the value is -1 (defaul
5858
import plotly.graph_objects as go
5959
import numpy as np
6060

61-
pts = np.loadtxt(np.DataSource().open('https://raw.githubusercontent.com/plotly/datasets/master/mesh_dataset.txt'))
61+
pts = np.loadtxt(np.lib.npyio.DataSource().open('https://raw.githubusercontent.com/plotly/datasets/master/mesh_dataset.txt'))
6262
x, y, z = pts.T
6363

6464
fig = go.Figure(data=[go.Mesh3d(x=x, y=y, z=z,

‎doc/python/bar-charts.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ fig.show()
6868
```
6969

7070
```python
71+
import plotly.express as px
72+
73+
long_df = px.data.medals_long()
74+
7175
long_df
7276
```
7377

@@ -84,6 +88,10 @@ fig.show()
8488
```
8589

8690
```python
91+
import plotly.express as px
92+
93+
wide_df = px.data.medals_wide()
94+
8795
wide_df
8896
```
8997

‎doc/python/ml-knn.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ import plotly.express as px
264264
import plotly.graph_objects as go
265265
import numpy as np
266266
from sklearn.neighbors import KNeighborsClassifier
267+
from sklearn.model_selection import train_test_split
267268

268269
mesh_size = .02
269270
margin = 1

‎doc/python/ml-regression.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ y = df['petal_width']
491491
# Define and fit the grid
492492
model = DecisionTreeRegressor()
493493
param_grid = {
494-
'criterion': ['mse', 'friedman_mse', 'mae'],
494+
'criterion': ['squared_error', 'friedman_mse', 'absolute_error'],
495495
'max_depth': range(2, 5)
496496
}
497497
grid = GridSearchCV(model, param_grid, cv=N_FOLD)

‎doc/python/smoothing.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ TMA_i = \frac{SMA_i + ... + SMA_{i+n}}{n}
132132
$$
133133

134134
```python
135+
import plotly.graph_objects as go
136+
import numpy as np
137+
138+
np.random.seed(1)
139+
140+
x = np.linspace(0, 10, 100)
141+
y = np.sin(x)
142+
noise = 2 * np.random.random(len(x)) - 1 # uniformly distributed between -1 and 1
143+
y_noise = y + noise
144+
135145
def smoothTriangle(data, degree):
136146
triangle=np.concatenate((np.arange(degree + 1), np.arange(degree)[::-1])) # up then down
137147
smoothed=[]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /