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

Skip to content

Commit d82de88

Browse files
committed
Use floordiv as sugested by QuLogic
1 parent 58a27bf commit d82de88

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

examples/pylab_examples/centered_ticklabels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@
4545
tick.tick2line.set_markersize(0)
4646
tick.label1.set_horizontalalignment('center')
4747

48-
imid = int(len(r)/2)
48+
imid = len(r)//2
4949
ax.set_xlabel(str(r.date[imid].year))
5050
plt.show()

examples/pylab_examples/data_helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ def get_two_stock_data():
1717
file2 = cbook.get_sample_data('AAPL.dat.gz')
1818
M1 = fromstring(file1.read(), '<d')
1919

20-
M1 = resize(M1, (int(M1.shape[0]/2), 2))
20+
M1 = resize(M1, (M1.shape[0]//2, 2))
2121

2222
M2 = fromstring(file2.read(), '<d')
23-
M2 = resize(M2, (int(M2.shape[0]/2), 2))
23+
M2 = resize(M2, (M2.shape[0]//2, 2))
2424

2525
d1, p1 = M1[:, 0], M1[:, 1]
2626
d2, p2 = M2[:, 0], M2[:, 1]

examples/pylab_examples/image_slices_viewer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ def __init__(self, ax, X):
1010

1111
self.X = X
1212
rows, cols, self.slices = X.shape
13-
self.ind = int(self.slices/2)
13+
self.ind = self.slices//2
1414

1515
self.im = ax.imshow(self.X[:, :, self.ind])
1616
self.update()
1717

1818
def onscroll(self, event):
1919
print("%s %s" % (event.button, event.step))
2020
if event.button == 'up':
21-
self.ind = int(numpy.clip(self.ind + 1, 0, self.slices - 1))
21+
self.ind = numpy.clip(self.ind + 1, 0, self.slices - 1)
2222
else:
23-
self.ind = int(numpy.clip(self.ind - 1, 0, self.slices - 1))
23+
self.ind = numpy.clip(self.ind - 1, 0, self.slices - 1)
2424
self.update()
2525

2626
def update(self):

examples/pylab_examples/quiver_demo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@
7575
# 6
7676
plt.figure()
7777
M = np.zeros(U.shape, dtype='bool')
78-
XMaskStart = int(U.shape[0]/3)
79-
YMaskStart = int(U.shape[1]/3)
80-
XMaskStop = int(2*U.shape[0]/3)
81-
YMaskStop = int(2*U.shape[1]/3)
78+
XMaskStart = U.shape[0]//3
79+
YMaskStart = U.shape[1]//3
80+
XMaskStop = 2*U.shape[0]//3
81+
YMaskStop = 2*U.shape[1]//3
8282

8383
M[XMaskStart:XMaskStop,
8484
YMaskStart:YMaskStop] = True

0 commit comments

Comments
 (0)