官术网_书友最值得收藏!

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, path names, dummy URLs, user input, and Twitter handles are shown as follows: "Now, you'll need to remember the path that we installed the JDK into, which in our case was C:\jdk." A block of code is set as follows:

from pyspark import SparkConf, SparkContext 
import collections

conf = SparkConf().setMaster("local").setAppName("RatingsHistogram")
sc = SparkContext(conf = conf)

lines = sc.textFile("file:///SparkCourse/ml-100k/u.data")
ratings = lines.map(lambda x: x.split()[2])
result = ratings.countByValue()

sortedResults = collections.OrderedDict(sorted(result.items()))
for key, value in sortedResults.items():
print("%s %i" % (key, value))

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

from pyspark import SparkConf, SparkContext 
import collections

conf = SparkConf().setMaster("local").setAppName("RatingsHistogram")
sc = SparkContext(conf = conf)

lines = sc.textFile("file:///SparkCourse/ml-100k/u.data")
ratings = lines.map(lambda x: x.split()[2])
result = ratings.countByValue()

sortedResults = collections.OrderedDict(sorted(result.items()))
for key, value in sortedResults.items():
print("%s %i" % (key, value))

Any command-line input or output is written as follows:

spark-submit ratings-counter.py

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Now, if you're on Windows, I want you to right-click on the Enthought Canopy icon, go to Properties and then to Compatibility (this is on Windows 10), and make sure Run this program as an administrator is checked"

Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
主站蜘蛛池模板: 郯城县| 平和县| 固镇县| 万源市| 中西区| 胶州市| 诏安县| 永济市| 万安县| 盐池县| 德格县| 疏附县| 南皮县| 宜兰市| 蓬莱市| 闽侯县| 乌鲁木齐县| 怀柔区| 安乡县| 潜江市| 昌江| 平舆县| 刚察县| 华安县| 崇仁县| 梁河县| 泾源县| 林芝县| 炎陵县| 海伦市| 湖州市| 苏尼特右旗| 根河市| 玛纳斯县| 马关县| 海兴县| 得荣县| 墨竹工卡县| 祁东县| 巴中市| 南康市|