Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6568b79

Browse files
committed
pandas updates
1 parent 5a1a63a commit 6568b79

File tree

67 files changed

+440
-452
lines changed

Some content is hidden

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

67 files changed

+440
-452
lines changed

_posts/pandas/3d-clusters/2015-07-15-alpha-shape.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
name: 3d clustering with alpha shapes
3-
plot_url: https://plot.ly/~jackp/10540/
3+
plot_url: https://plot.ly/~PlotBot/1009
44
language: pandas
55
suite: 3d-clusters
66
order: 0
77
sitemap: false
88
arrangement: horizontal
99
---
1010
import plotly.plotly as py
11-
from plotly.graph_objs import *
11+
import plotly.graph_objs as go
1212
import pandas as pd
1313
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/iris.csv')
1414
df.head()
@@ -45,19 +45,19 @@
4545
autosize=False,
4646
title='Iris dataset',
4747
scene=dict(
48-
xaxis=XAxis(
48+
xaxis=dict(
4949
gridcolor='rgb(255, 255, 255)',
5050
zerolinecolor='rgb(255, 255, 255)',
5151
showbackground=True,
5252
backgroundcolor='rgb(230, 230,230)'
5353
),
54-
yaxis=YAxis(
54+
yaxis=dict(
5555
gridcolor='rgb(255, 255, 255)',
5656
zerolinecolor='rgb(255, 255, 255)',
5757
showbackground=True,
5858
backgroundcolor='rgb(230, 230,230)'
5959
),
60-
zaxis=ZAxis(
60+
zaxis=dict(
6161
gridcolor='rgb(255, 255, 255)',
6262
zerolinecolor='rgb(255, 255, 255)',
6363
showbackground=True,

_posts/pandas/3d-filled-line/2015-04-09-3d-filled-line.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: 3D Filled Line Plot
3-
plot_url: https://plot.ly/~etpinard/5568
3+
plot_url: https://plot.ly/~PlotBot/770
44
language: pandas
55
suite: 3d-filled-line
66
order: 0

_posts/pandas/3d-line/2015-04-09-random-walk.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
arrangement: horizontal
1010
---
1111
import plotly.plotly as py
12-
from plotly.graph_objs import *
12+
import plotly.graph_objs as go
1313
import pandas as pd
1414
import numpy as np
1515

1616
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/iris.csv')
1717
df.head()
1818

19-
def brownian_motion(T = 1, N = 100, mu = 0.1, sigma = 0.01, S0 = 20):
19+
def brownian_motion(T = 1, N = 100, mu = 0.1, sigma = 0.01, S0 = 20):
2020
dt = float(T)/N
2121
t = np.linspace(0, T, N)
22-
W = np.random.standard_normal(size = N)
22+
W = np.random.standard_normal(size = N)
2323
W = np.cumsum(W)*np.sqrt(dt) # standard brownian motion
24-
X = (mu-0.5*sigma**2)*t + sigma*W
24+
X = (mu-0.5*sigma**2)*t + sigma*W
2525
S = S0*np.exp(X) # geometric brownian motion
2626
return S
2727

@@ -34,40 +34,40 @@
3434
z = pd.Series(
3535
brownian_motion(T, N, sigma=0.1, S0=start_price), index=dates)
3636

37-
trace = Scatter3d(
37+
trace = go.Scatter3d(
3838
x=dates, y=y, z=z,
39-
marker=Marker(
39+
marker=dict(
4040
size=4,
4141
color=z,
4242
colorscale='Viridis',
4343
),
44-
line=Line(
44+
line=dict(
4545
color='#1f77b4',
4646
width=1
4747
)
4848
)
4949

50-
data = Data([trace])
50+
data = [trace]
5151

5252
layout = dict(
5353
width=800,
5454
height=700,
5555
autosize=False,
5656
title='Iris dataset',
5757
scene=dict(
58-
xaxis=XAxis(
58+
xaxis=dict(
5959
gridcolor='rgb(255, 255, 255)',
6060
zerolinecolor='rgb(255, 255, 255)',
6161
showbackground=True,
6262
backgroundcolor='rgb(230, 230,230)'
6363
),
64-
yaxis=YAxis(
64+
yaxis=dict(
6565
gridcolor='rgb(255, 255, 255)',
6666
zerolinecolor='rgb(255, 255, 255)',
6767
showbackground=True,
6868
backgroundcolor='rgb(230, 230,230)'
6969
),
70-
zaxis=ZAxis(
70+
zaxis=dict(
7171
gridcolor='rgb(255, 255, 255)',
7272
zerolinecolor='rgb(255, 255, 255)',
7373
showbackground=True,
@@ -86,7 +86,7 @@
8686
)
8787
),
8888
aspectratio = dict( x=1, y=1, z=0.7 ),
89-
aspectmode = 'manual'
89+
aspectmode = 'manual'
9090
),
9191
)
9292

_posts/pandas/3d-scatter/2015-04-09-simple-3d-scatter.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: 3D Scatter Plot
3-
plot_url: https://plot.ly/~jackp/10689
3+
plot_url: https://plot.ly/~PlotBot/1011
44
language: pandas
55
suite: 3d-scatter
66
order: 0
@@ -11,7 +11,7 @@
1111
# Find your api_key here: https://plot.ly/settings/api
1212

1313
import plotly.plotly as py
14-
from plotly.graph_objs import *
14+
import plotly.graph_objs as go
1515
import pandas as pd
1616
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/iris.csv')
1717
df.head()
@@ -41,19 +41,19 @@
4141
autosize=False,
4242
title='Iris dataset',
4343
scene=dict(
44-
xaxis=XAxis(
44+
xaxis=dict(
4545
gridcolor='rgb(255, 255, 255)',
4646
zerolinecolor='rgb(255, 255, 255)',
4747
showbackground=True,
4848
backgroundcolor='rgb(230, 230,230)'
4949
),
50-
yaxis=YAxis(
50+
yaxis=dict(
5151
gridcolor='rgb(255, 255, 255)',
5252
zerolinecolor='rgb(255, 255, 255)',
5353
showbackground=True,
5454
backgroundcolor='rgb(230, 230,230)'
5555
),
56-
zaxis=ZAxis(
56+
zaxis=dict(
5757
gridcolor='rgb(255, 255, 255)',
5858
zerolinecolor='rgb(255, 255, 255)',
5959
showbackground=True,

_posts/pandas/3d-surface/2015-04-09-3d-surface-volcano.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,44 +11,44 @@
1111
# Find your api_key here: https://plot.ly/settings/api
1212

1313
import plotly.plotly as py
14-
from plotly.graph_objs import *
14+
import plotly.graph_objs as go
1515
import pandas as pd
1616
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/volcano.csv')
1717

18-
data = Data([Surface( z=df.values.tolist(), colorscale='Viridis' )])
18+
data = [go.Surface(z=df.values.tolist(), colorscale='Viridis')]
1919

20-
layout = dict(
20+
layout = go.Layout(
2121
width=800,
2222
height=700,
2323
autosize=False,
2424
title='Volcano dataset',
2525
scene=dict(
26-
xaxis=XAxis(
26+
xaxis=dict(
2727
gridcolor='rgb(255, 255, 255)',
2828
zerolinecolor='rgb(255, 255, 255)',
2929
showbackground=True,
3030
backgroundcolor='rgb(230, 230,230)'
3131
),
32-
yaxis=YAxis(
32+
yaxis=dict(
3333
gridcolor='rgb(255, 255, 255)',
3434
zerolinecolor='rgb(255, 255, 255)',
3535
showbackground=True,
3636
backgroundcolor='rgb(230, 230,230)'
3737
),
38-
zaxis=ZAxis(
38+
zaxis=dict(
3939
gridcolor='rgb(255, 255, 255)',
4040
zerolinecolor='rgb(255, 255, 255)',
4141
showbackground=True,
4242
backgroundcolor='rgb(230, 230,230)'
4343
),
4444
aspectratio = dict( x=1, y=1, z=0.7 ),
45-
aspectmode = 'manual'
46-
),
45+
aspectmode = 'manual'
46+
)
4747
)
4848

4949
fig = dict(data=data, layout=layout)
5050

5151
# IPython notebook
5252
# py.iplot(fig, filename='pandas-3d-surface', height=700, validate=False)
5353

54-
url = py.iplot(fig, filename='pandas-3d-surface', validate=False)
54+
url = py.iplot(fig, filename='pandas-3d-surface')

_posts/pandas/annotations/2015-04-09-hover-chart-basic.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010
# Find your api_key here: https://plot.ly/settings/api
1111

1212
import plotly.plotly as py
13-
from plotly.graph_objs import *
13+
import plotly.graph_objs as go
1414

15-
data = Data([
16-
Scatter(
15+
data = [
16+
go.Scatter(
1717
x=[0, 1, 2],
1818
y=[1, 3, 2],
1919
mode='markers',
2020
text=['Text A', 'Text B', 'Text C']
2121
)
22-
])
23-
layout = Layout(
22+
]
23+
layout = go.Layout(
2424
title='Hover over the points to see the text'
2525
)
26-
fig = Figure(data=data, layout=layout)
26+
fig = go.Figure(data=data, layout=layout)
2727
plot_url = py.plot(fig, filename='hover-chart-basic')

_posts/pandas/annotations/2015-04-09-multiple-annotation.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010
# Find your api_key here: https://plot.ly/settings/api
1111

1212
import plotly.plotly as py
13-
from plotly.graph_objs import *
13+
import plotly.graph_objs as go
1414

15-
trace1 = Scatter(
15+
trace1 = go.Scatter(
1616
x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
1717
y=[0, 1, 3, 2, 4, 3, 4, 6, 5]
1818
)
19-
trace2 = Scatter(
19+
trace2 = go.Scatter(
2020
x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
2121
y=[0, 4, 5, 1, 2, 2, 3, 4, 2]
2222
)
23-
data = Data([trace1, trace2])
24-
layout = Layout(
23+
data = [trace1, trace2]
24+
layout = go.Layout(
2525
showlegend=False,
26-
annotations=Annotations([
27-
Annotation(
26+
annotations=[
27+
dict(
2828
x=2,
2929
y=5,
3030
xref='x',
@@ -35,7 +35,7 @@
3535
ax=0,
3636
ay=-40
3737
),
38-
Annotation(
38+
dict(
3939
x=4,
4040
y=4,
4141
xref='x',
@@ -46,7 +46,7 @@
4646
ax=0,
4747
ay=-40
4848
)
49-
])
49+
]
5050
)
51-
fig = Figure(data=data, layout=layout)
51+
fig = go.Figure(data=data, layout=layout)
5252
plot_url = py.plot(fig, filename='multiple-annotation')

_posts/pandas/annotations/2015-04-09-simple-annotation.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,32 @@
1010
# Find your api_key here: https://plot.ly/settings/api
1111

1212
import plotly.plotly as py
13-
from plotly.graph_objs import *
13+
import plotly.graph_objs as go
1414

15-
trace1 = Scatter(
15+
trace1 = go.Scatter(
1616
x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
1717
y=[0, 1, 3, 2, 4, 3, 4, 6, 5]
1818
)
19-
trace2 = Scatter(
19+
trace2 = go.Scatter(
2020
x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
2121
y=[0, 4, 5, 1, 2, 2, 3, 4, 2]
2222
)
23-
data = Data([trace1, trace2])
24-
layout = Layout(
23+
data = [trace1, trace2]
24+
layout = go.Layout(
2525
showlegend=False,
26-
annotations=Annotations([
27-
Annotation(
26+
annotations=[
27+
dict(
2828
x=2,
2929
y=5,
3030
xref='x',
3131
yref='y',
32-
text='Annotation Text',
32+
text='dict Text',
3333
showarrow=True,
3434
arrowhead=7,
3535
ax=0,
3636
ay=-40
3737
)
38-
])
38+
]
3939
)
40-
fig = Figure(data=data, layout=layout)
40+
fig = go.Figure(data=data, layout=layout)
4141
plot_url = py.plot(fig, filename='simple-annotation')

_posts/pandas/annotations/2015-04-09-style-annotation.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@
1010
# Find your api_key here: https://plot.ly/settings/api
1111

1212
import plotly.plotly as py
13-
from plotly.graph_objs import *
13+
import plotly.graph_objs as go
1414

15-
trace1 = Scatter(
15+
trace1 = go.Scatter(
1616
x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
1717
y=[0, 1, 3, 2, 4, 3, 4, 6, 5]
1818
)
19-
trace2 = Scatter(
19+
trace2 = go.Scatter(
2020
x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
2121
y=[0, 4, 5, 1, 2, 2, 3, 4, 2]
2222
)
23-
data = Data([trace1, trace2])
24-
layout = Layout(
23+
data = [trace1, trace2]
24+
layout = go.Layout(
2525
showlegend=False,
26-
annotations=Annotations([
27-
Annotation(
26+
annotations=[
27+
dict(
2828
x=2,
2929
y=5,
3030
xref='x',
3131
yref='y',
3232
text='max=5',
3333
showarrow=True,
34-
font=Font(
34+
font=dict(
3535
family='Courier New, monospace',
3636
size=16,
3737
color='#ffffff'
@@ -49,7 +49,7 @@
4949
bgcolor='#ff7f0e',
5050
opacity=0.8
5151
)
52-
])
52+
]
5353
)
54-
fig = Figure(data=data, layout=layout)
54+
fig = go.Figure(data=data, layout=layout)
5555
plot_url = py.plot(fig, filename='style-annotation')

0 commit comments

Comments
 (0)