When I write PySpark code, I use Jupyter notebook to test my code before submitting a job on the cluster. In this post, I will show you how to install and run PySpark locally in Jupyter Notebook on Windows. I've tested this guide on a dozen Windows 7…
KS,AUC 和 PSI 是风控算法中最常计算的几个指标,本文记录了多种工具计算这些指标的方法. 生成本文的测试数据: import pandas as pd import numpy as np import pyspark.sql.functions as F from pyspark.sql.window import Window from pyspark.sql.types import StringType, DoubleType from pyspark.sql import Sp…
import os import copy import codecs import operator import re from math import log from pyspark.sql import SQLContext,Row from pyspark.mllib.regression import LabeledPoint from pyspark import SparkContext, SparkConf from pyspark.sql import HiveContex…
http://blog.csdn.net/pipisorry/article/details/53320669 pyspark.sql.SQLContext Main entry point for DataFrame and SQL functionality. [pyspark.sql.SQLContext] 皮皮blog pyspark.sql.DataFrame A distributed collection of data grouped into named columns. sp…
原文链接:https://cloud.tencent.com/developer/article/1096712 在大神创作的基础上,学习了一些新知识,并加以注释. TARGET:将旧金山犯罪记录(San Francisco Crime Description)分类到33个类目中 源代码及数据集:之后提交. 一.载入数据集data import time from pyspark.sql import SQLContext from pyspark import SparkContext # 利…
测试是软件开发中的基础工作,它经常被数据开发者忽视,但是它很重要.在本文中会展示如何使用Python的uniittest.mock库对一段PySpark代码进行测试.笔者会从数据科学家的视角来进行描述,这意味着本文将不会深入某些软件开发的细节. 本文链接:https://www.cnblogs.com/hhelibeb/p/10508692.html 英文原文:Stop mocking me! Unit tests in PySpark using Python’s mock library 单…