- 博客(80)
- 收藏
- 关注
原创 Python中3中并发对比
如何在多线程编程中避免全局解释器锁(GIL)的影响?协程的并发和多线程、多进程的并发有什么区别?多进程并发和多线程并发有哪些相似之处?
2024-11-27 16:30:48
948
1
原创 shell基础教程
!/bin/bash# 1.判断传入的参数if [ ! -n "$1" ]then echo "you have not input a word!"elif [ "$1" == 1 ]then echo "the word you input is $1"fi# 2.判断shell内的参数a=10b=20if [ $a == $b ]then echo "a 等于 b"elif [ $a -gt $b ]then echo "a 大于.
2021-02-22 17:19:29
200
转载 hive中order by,sort by, distribute by, cluster by作用以及用法
转载自:https://blog.youkuaiyun.com/zhanglh046/article/details/78572939?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-2&spm=1001.2101.3001.4242一 ORDERBYORDERBY 跟传统数据库ORDERBY 一样,会对所有的数据进行排序,可能有很多个Map任务,但是只会由一个Reducer来进行排序,如果数据海量的话,会很影响性能,因为需要
2021-02-13 12:50:37
501
原创 linux中单箭头代表会覆盖,双箭头就是如果存在会追加
//如果这样每次重启的时候都会覆盖以前的日志,产生最新的日志。nohup bin/yanagishima-start.sh > y.log 2>&1 &//如果这样每次启动不会覆盖原来的老日志,日志会接着原来的日志继续写。nohup bin/yanagishima-start.sh >> y.log 2>&1 &...
2021-02-06 15:13:23
823
原创 pandas datetime utc to local timezone
经常遇到这种:'2021-01-27T09:38:40Z' UTC datetime格式,要转换成本地timezone格式 success_time = pd.Timestamp('2021-01-27T09:38:40Z'['completedAt'],tz="Asia/Shanghai").strftime("%Y-%m-%d %H:%M:%S") print(f"refresh done at {success_time}!")...
2021-01-27 17:40:09
509
原创 python 3d气泡图 python 3d 散点图
废话不说直接上代码:%matplotlib inlineimport numpy as npimport io,pandas as pdimport matplotlib.pyplot as pltmyString='''类别 订单量占比 门店数占比 交易额占比小龙虾 0.6 0.9 1.7川湘菜 4.5 4.8 6.5烤串 2.9 4.5 4.8面馆 3.8 8.0 3.1包子/粥 6.3 3.5 4.7西式快餐 7.9 7.5 9.2快餐简餐 22.1 16.3 18.8
2020-12-18 19:43:12
1452
1
原创 hive报错Loading data to table dwm.app_spider_detail partition (city_name=null) FAILED: Hive Internal E
hive报错:Loading data to table dwm.app_spider_detail partition (city_name=null)FAILED: Hive Internal Error: java.util.ConcurrentModificationException(null)是因为我insert into partition select form where not exists 返回空数据,导致分区表分区字段为null,所以报错。只要写个容错,确保i...
2020-11-23 14:22:34
1005
原创 mysql批量update死锁,因为提交太多,所以每隔100条commit一下就可以解决了,特此纪念!
mysql批量update死锁,因为提交太多,所以每隔100条commit一下就可以解决了,特此纪念!print("update started........")if df_new.shape[0]>0: for index,row in df_new.iterrows(): i += 1 print(i) #print(f"正在更新{row['shop_code']}") sql = f''' .
2020-11-17 15:46:34
1367
原创 <scala.version>2.12.12</scala.version>
spark3.0 read mysql 报错升级scala到最新版就好了!<scala.version>2.12.12</scala.version>
2020-10-28 16:38:35
544
原创 tabpy机器学习
#connect to tableau serverimport tabpy_clientclient = tabpy_client.Client('http://localhost:9004/')#def function #deploy 函数到tableaudef clustering(x, y): import numpy as np from sklearn.cluster import DBSCAN from sklearn.preprocessing .
2020-08-16 14:18:37
483
原创 pandas自带图表
# 1.pandas 窗口函数,三角窗import pandas as pdimport numpy as np%matplotlib inlinedf = pd.DataFrame({'B': [0, 1, 2, 1, 4,2,3,0]})df['windows']=df.rolling(2, win_type='triang').sum()df.plot(style='o-',figsize=(10,5));2.核密度图df4 = pd.DataFrame({'a': np
2020-06-14 19:38:14
421
原创 pandas图表,pandas自带图表
# 1.pandas 窗口函数,三角窗```pythonimport pandas as pdimport numpy as np%matplotlib inlinedf = pd.DataFrame({'B': [0, 1, 2, 1, 4,2,3,0]})df['windows']=df.rolling(2, win_type='triang').sum()df.plot(style='o-',figsize=(10,5));```![6c7ee66f2d33a8e4
2020-06-14 19:26:09
369
原创 解决windows server多个无名用户问题
taskkill /f /im winlogon.exe /t执行命令节后,所有的无名用户就全被杀死了,内存占用从68%降低到14%,以后设置成定时任务定期执行一遍即可。
2020-05-24 19:49:10
1926
1
原创 python自带数据sqlite3学习,pandas to jeson
python自带数据sqlite3学习,pandas to jesonimport pandas as pdfrom sqlalchemy import create_engineengine = create_engine('sqlite:///foo.db', echo=True)# 建表#engine.execute("create table t1(id int,name...
2020-04-30 14:24:31
337
原创 windows server2016忘记密码,windows重置密码,windows破解密码,win10忘记密码,win10破解密码,windows server2016破解密码
1.首先设置光盘启动(如果是虚拟机,比如vm,首先重置虚拟机,然后启动的时候进入bois,设置光盘启动),总之先进入boot manager,设置第一启动为DVD2.2.然后会进入这个界面:3.然后点repaire your computer4.然后点troubleshoot5.然后点command prompt6. 输入dis...
2020-04-19 07:28:22
22674
3
原创 linux查看并杀死端口进程
# Linux查看并杀死被占用的端口sudo apt-get install lsof //安装lsofsudo lsof -i:端口号 //查找对应的进程号sudo kill -9 进程号 //杀死对应的进程...
2019-11-22 12:51:03
591
1
原创 mysql json table
SELECT *FROM zichaxun t1inner join JSON_TABLE(CONCAT('["', REPLACE('1,2', ',', '","'), '"]'), "$[*]" COLUMNS (score2 varchar(20) PATH "$")) t2on JSON_CONTAINS(t2.score2, CAST(t1.score as JS...
2019-10-06 07:59:05
2932
4
原创 mysql造日期,mysql create calendar,mysql造日期表,mysql create date table,mysql create calendar table
SELECT @date := DATE_ADD(@date, INTERVAL 1 DAY) AS dates FROM mysql.help_relation, (SELECT @date := DATE_SUB('2019-08-01', INTERVAL 1 DAY)) d WHERE @date BETWEEN...
2019-09-03 13:31:21
818
原创 python sql多并发
import concurrent.futuresimport urllib.requestimport pandas as pdimport numpy as npfrom sqlalchemy import create_engineimport pymysqlengine2 = create_engine('mysql+pymysql://root:wxl3322335@loc...
2019-09-03 13:15:09
610
原创 Hive WITH clause example with the SELECT statement
Hive WITH clause example with the SELECT statementWITH t1 as (SELECT 1), t2 as (SELECT 2),t3 as (SELECT 3)SELECT * from t1 UNION ALLSELECT * from t2UNION ALL SELECT * from t3;Hive WITH Cla...
2019-07-10 20:14:42
169
原创 在Pycharm中自动添加时间日期作者等信息
1.pycharm→preference→Editor→File and code Templates右侧找到Python Script,如下图2.配置文件如下:##!/Users/wxl/anaconda3/bin/python3.7# -*- coding: utf-8 -*-# @Time : ${DATE} ${TIME}# @Author : Mr w...
2019-06-09 15:57:26
789
原创 Mysql 分区表
Mysql 分区表1)创建Range分区表1-1):以员工工资为依据做范围分区 create table emp(empno varchar(20) not null,empname varchar(20),deptno int,birthdate date,salary int)partition by range(salary)(partition p1 valu...
2019-05-16 07:20:56
273
原创 tableau正则表达式匹配指定字符前几位
1) tableau正则REGEXP_EXTRACT(str([score]),"(\d{4}/\d{1,2}/\d{1,2})")REGEXP_EXTRACT(str([score]),"(\d+(\.\d+)?)”2) tableau正则提取字符前两位前几位:REGEXP_EXTRACT("人教版八年级语文abcd","版(.+年级)")REGEXP_EXTRACT("人...
2019-05-15 17:52:16
10228
转载 win10定时任务报错:操作员或系统管理员拒绝了请求
转自:https://blog.youkuaiyun.com/qq_15230053win10定时任务报错:操作员或系统管理员拒绝了请求2019年01月15日 10:33:39andyguan01_2阅读数:749标签:windows定时任务更多个人分类:windowswin10定时任务报错:操作员或系统管理员拒绝了请求解决办法:打开“控制面板->管理工具-&...
2019-03-26 12:11:52
23726
5
转载 SQL中char、varchar、nvarchar的区别
转自:https://blog.youkuaiyun.com/qq_15230053SQL中char、varchar、nvarchar的区别char char是定长的,也就是当你输入的字符小于你指定的数目时,char(8),你输入的字符小于8时,它会再后面补空值。当你输入的字符大于指定的数时,它会截取超出的字符。nvarchar(n) 包含 n 个字符的可变长度 Unicode...
2019-03-26 11:30:25
147
转载 superset集成echarts
https://blog.youkuaiyun.com/qq_33172735/article/details/87977583
2019-03-21 17:28:49
1584
转载 Mysql各种索引区别
转自:https://www.cnblogs.com/chenhaoyu/p/8796146.htmlMysql索引概念:说说Mysql索引,看到一个很少比如:索引就好比一本书的目录,它会让你更快的找到内容,显然目录(索引)并不是越多越好,假如这本书1000页,有500也是目录,它当然效率低,目录是要占纸张的,而索引是要占磁盘空间的。Mysql索引主要有两种结构:B+树和hash....
2019-02-10 19:41:37
424
原创 mysql各种索引 & SQL_NO_CACHE
BTREE 适合连续读取数据RTREE 适合根据一条数据找附近的数据HASH 适合随机读取数据FULLTEXT SPATIAL Mysql中SQL_NO_CACHE的意思是:结果被会被缓存,如果你之前缓存了,会使用缓存。如果想不使用缓存,就先清理下:"FLUSH QUERY CACHE",清空一下query cache就行了。然后执行语句的时候带...
2019-02-09 16:18:32
221
原创 python生成器
生成器也是一种迭代器,但是你只能对其迭代一次。这是因为它们并没有把所有的值存在内存中,而是在运行时生成值。你通过遍历来使用它们,要么用一个“for”循环,要么将它们传递给任意可以进行迭代的函数和结构。大多数时候生成器是以函数来实现的。然而,它们并不返回一个值,而是yield(暂且译作“生出”)一个值。 一.python中的元组推导就是生成器:g=(x for x in range(5...
2019-01-08 15:33:31
117
原创 pandas逆透视
#pandas 透视表 pivot_table'''The function pandas.pivot_table can be used to create spreadsheet-style pivot tables.It takes a number of argumentsdata: A DataFrame object values: a column or a ...
2019-01-07 15:13:10
1175
原创 centos7安装vmtools
1.点击vm 虚拟机,安装vmtools,这是会出现一个文件夹tar2.解压 tar -zxvf filename.tar.gz3.cd 到解压的文件夹内,会有一个文件: vmware-install.pl4.然后 chmod +x vmware-install.pl 5. ./filename (这一步就是执行pl可执行文件了)6.然后一路yes 就好了...
2019-01-04 16:00:17
1956
原创 Python时间序列生成
#Python时间序列生成n=2dic=dict(zip([(pd.Timestamp("today")+ MonthBegin(n=-i-1)).strftime("%Y/%m/%d") for i in range(6)], [(pd.Timestamp("today")+ MonthBegin(n=-i)).strftime("%Y/%m/%d") fo...
2018-12-10 16:34:27
3534
原创 Spark SQL数据类型
Spark SQL数据类型数字类型 ByteType:代表一个字节的整数。范围是-128到127 ShortType:代表两个字节的整数。范围是-32768到32767 IntegerType:代表4个字节的整数。范围是-2147483648到2147483647 LongType:代表8个字节的整数。范围是-9223372036854775808到922337203685477...
2018-12-03 16:03:38
7937
原创 python鲜为人知的小技巧
python鲜为人知的小技巧1.字典合并 以d2为基准更新d1d1={"a":1} d2={"b":2,"a":10} d1.update(d2) print(d1) print(dict(d1.items()|d2.items())) 2.for elsea=[1,2,3,4,5] for i in a: if i==0: print(i)...
2018-12-03 13:02:48
221
原创 group by cumsum sql ,pandas,saprk,tableau
Editgroup by cumsum sql ,pandas,saprk,tableau直接干不就完了,造数据: drop table if exists group_by_cumsum; create table if not exists group_by_cumsum(create_time datetime,city VarChar(20),sales...
2018-11-25 12:19:22
497
原创 ubuntu17.04安装mysql 8
Editubuntu17.04安装mysql 8说明:到官网下载mysql8 deb 安装包:https://dev.mysql.com/downloads/repo/apt/或者在线下载:wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.debStep1:下载安装deb package...
2018-11-14 19:11:53
446
原创 pysaprk很多show()报错
pysaprk很多show()报错都是因为数据量很大,无法返回到驱动导致,只要在sql价格limit,或者df价格过滤就好了
2018-10-10 15:08:07
1240
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人