10 2019 档案

FAILED: SemanticException Unable to determine if hdfs://tmaster:8020/user/root/words.db/test_t2 is encrypted
摘要:使用hive时,建立数据库,建表,写数据; 读数据:select * from test_t2; 报错SemanticException 原因:建表时使用了其他路径,或者在另一个路径的数据库(建立数据库时指定了location参数:create database words_db location 阅读全文

posted @ 2019-10-31 16:42 落日峡谷 阅读(2064) 评论(0) 推荐(0) 编辑

Pyspark读取csv文件
摘要:#_*_coding:utf-8_*_ # spark读取csv文件 #指定schema: schema = StructType([ # true代表不为null StructField("column_1", StringType(), True), # nullable=True, this 阅读全文

posted @ 2019-10-31 15:30 落日峡谷 阅读(12235) 评论(2) 推荐(1) 编辑

Pyspark:AssertionError: dataType should be DataType
摘要:1. schema参数,AssertionError: dataType should be DataType # AssertionError: dataType should be DataType schema = StructType([ # true代表不为空 StructField("c 阅读全文

posted @ 2019-10-31 11:46 落日峡谷 阅读(1980) 评论(0) 推荐(0) 编辑

Pyspark显示中文、ImportError: cannot import name 'Col' from 'pyspark.sql.functions'、Exception: Python in worker has different version、pip is configured with locations that require TLS/SSL
摘要:1. pyspark读csv文件后无法显示中文 #pyspark读取csv格式时,不能显示中文 df = spark.read.csv(r"hdfs://mymaster:8020/user/root/data_spark.csv", schema=schema) #解决方法,加入encoding= 阅读全文

posted @ 2019-10-30 21:37 落日峡谷 阅读(2170) 评论(0) 推荐(0) 编辑

Mysql:[Err] 1630
摘要:Mysql错误 [Err] 1630 1. 错误 1630 [SQL]select date_format(now (),'%Y%m%d'); [Err] 1630 - FUNCTION db.now does not exist. Check the 'Function Name Parsing 阅读全文

posted @ 2019-10-30 10:43 落日峡谷 阅读(1884) 评论(0) 推荐(0) 编辑

AttributeError: 'NoneType' object has no attribute 'extend'
摘要:Python使用中可能遇到的小问题 AttributeError: 'NoneType' object has no attribute 'extend' 或者AttributeError: 'NoneType' object has no attribute 'append' 原因:这两种方法都是 阅读全文

posted @ 2019-10-28 16:34 落日峡谷 阅读(14658) 评论(0) 推荐(1) 编辑

Python安装package_name包
摘要:官网:https://packaging.python.org/tutorials/installing-packages/ 首先查看已安装的包: 1. 命令行模式输入:pydoc modules 2. python解释器输入:help("modules") ## 目前常用的是pip和easy_in 阅读全文

posted @ 2019-10-23 21:47 落日峡谷 阅读(2282) 评论(0) 推荐(0) 编辑

Linux之ubuntu下载
摘要:(转载) ubuntu 16.04国内下载地址: 中科大源 http://mirrors.ustc.edu.cn/ubuntu-releases/16.04/ 阿里云开源镜像站 http://mirrors.aliyun.com/ubuntu-releases/16.04/ 兰州大学开源镜像站 ht 阅读全文

posted @ 2019-10-23 19:46 落日峡谷 阅读(1178) 评论(0) 推荐(0) 编辑

Python使用jieba分词
摘要:# -*- coding: utf-8 -*- # Spyder (python 3.7) import pandas as pd import jieba import jieba.analyse as anls if __name__ == '__main__': data = pd.read_ 阅读全文

posted @ 2019-10-16 23:56 落日峡谷 阅读(2632) 评论(0) 推荐(0) 编辑

Python统计字符出现次数(Counter包)以及txt文件写入
摘要:1. 统计字符(可以在jieba分词之后使用) 2. 多次覆盖,循环写入文件 比如,循环两次的结果是: 3. 一次性写入文件,中间不会覆盖和多次写入;但是如果重复运行代码,则会覆盖之前的全部内容,一次性重新写入所有新内容 阅读全文

posted @ 2019-10-16 22:33 落日峡谷 阅读(5727) 评论(0) 推荐(0) 编辑

Python绘制混淆矩阵,汉字显示label
摘要:1. 在计算出混淆矩阵之后,想自己绘制图形(并且在图形上显示汉字),可用 #coding=utf-8 import matplotlib.pyplot as plt import numpy as np confusion = np.array(([91,0,0],[0,92,1],[0,0,95] 阅读全文

posted @ 2019-10-15 09:09 落日峡谷 阅读(17269) 评论(2) 推荐(0) 编辑

不同操作系统的换行符
摘要:回车+换行 回车 \r 本义是光标重新回到本行开头,r的英文return,控制字符为CR,即Carriage Return; 换行 \n 本义是光标往下一行(不一定到下一行行首),n的英文newline,控制字符为LF,即Line Feed; 换行的ASCII码是10,回车的ASCII码是13。 然 阅读全文

posted @ 2019-10-14 22:42 落日峡谷 阅读(1329) 评论(0) 推荐(0) 编辑

Python将字符串转换成字典
摘要:1. ast包 2. 通过json格式转换 3. 通过eval函数转换 阅读全文

posted @ 2019-10-14 21:07 落日峡谷 阅读(13212) 评论(0) 推荐(0) 编辑

Anaconda基础使用
摘要:Windows下Anaconda操作:在Anaconda Prompt下执行 1. Anaconda 更新 conda update conda conda update anaconda conda update python conda update --all #更新包 2. 包管理 cond 阅读全文

posted @ 2019-10-14 20:41 落日峡谷 阅读(605) 评论(0) 推荐(0) 编辑

xlsxwriter写入Excel文件
摘要:#coding=utf-8 import xlsxwriter #加载包 myWorkbook = xlsxwriter.Workbook(opath+'/'+file_name+'.xlsx') #opath为目录名,file_name为excel文件名,表示在某路径下创建一个excel文件 sh 阅读全文

posted @ 2019-10-14 19:39 落日峡谷 阅读(3186) 评论(0) 推荐(0) 编辑

Python使用xlrd、pandas包从Excel读取数据
摘要:#coding=utf-8 # pip install xlrd import xlrd def read_from_xls(filepath,index_col_list): #filepath:读取文件路径,例如:filepath = r'D:/Python_workspace/test.xls 阅读全文

posted @ 2019-10-14 17:49 落日峡谷 阅读(5308) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示