
工作札记
文章平均质量分 61
阳光快乐普信男
这个作者很懒,什么都没留下…
展开
-
【Python笔记】spark.read.csv
1 问题发现from pyspark.sql.types import StructField, StructType, StringType# 定义 spark df 的表结构schema = StructType( [ StructField('ip', StringType(), True), StructField('city', StringType(), True) ])ip_city_path = job+'/abcdefg'ip_转载 2021-06-16 15:22:16 · 6909 阅读 · 0 评论 -
【Python笔记】Spark Sql max+structの作用
疑问:max+struct的作用?test.map(x => tester(x._1, x._2, x._3, x._4, x._5)) .toDS .select($"ac", $"sk", struct($"num1", struct($"time", $"num1")).as("grp")) .groupBy($"ac", $"sk") .agg(max($"grp")).show(false)解答:Struct结构用于按字典顺序排序,从左往右地按字段比较原创 2021-05-31 17:07:08 · 781 阅读 · 0 评论 -
【Python笔记】jupyter notebook文件批量下载
第一步:把需要打包下载的文件放在一个文件夹中第二步:在该文件夹内新建一个ipynb,复制并运行以下代码import osimport tarfiledef recursive_files(dir_name='.', ignore=None): for dir_name,subdirs,files in os.walk(dir_name): if ignore and os.path.basename(dir_name) in ignore: c.原创 2021-05-27 17:32:19 · 5236 阅读 · 1 评论 -
【Python笔记】Parquet介绍及简单使用
https://www.cnblogs.com/sandea/p/11919376.html原创 2021-05-25 22:58:49 · 11134 阅读 · 0 评论 -
【Python笔记】Pandas自定义排序
Method1:Mapimport pandas as pddf = pd.DataFrame({ 'cloth_id': [1001, 1002, 1003, 1004, 1005, 1006], 'size': ['S', 'XL', 'M', 'XS', 'L', 'S'],}) cloth_id size 0 1001 S转载 2021-05-25 15:29:04 · 1896 阅读 · 0 评论