Skip to content

Commit f1b0812

Browse files
committed
MIN Slightly more explicit code
1 parent 515f2f9 commit f1b0812

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ch04/wikitopics_plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
topics = np.load('topics.npy', mmap_mode='r')
3232

3333
# Compute the number of topics mentioned in each document
34-
lens = (topics > 0).sum(1)
34+
lens = (topics > 0).sum(axis=1)
3535
print('Mean number of topics mentioned: {0:.3}'.format(np.mean(lens)))
3636
print('Percentage of articles mentioning less than 10 topics: {0:.1%}'.format(np.mean(lens <= 10)))
3737

0 commit comments

Comments
 (0)