- 博客(21)
- 收藏
- 关注
原创 集群安装和遇到的问题
Hadoop集群安装步骤选定一台机器作为 Master在 Master 节点上配置 hadoop 用户、安装 SSH server、安装 Java 环境在 Master 节点上安装 Hadoop,并完成配置在其他 Slave 节点上配置 hadoop 用户、安装 SSH server、安装 Java 环境将 Master 节点上的 /usr/local/hadoop 目录复制到其他 Slave 节点上在 Master 节点上开启 Hadoop打开虚拟网络编辑器新建网络适配器(由于之前新
2021-06-24 23:15:06
280
2
原创 Leetcode 小白刷题之旅 -8 1827. 最少操作使数组递增
给你一个整数数组 nums (下标从 0 开始)。每一次操作中,你可以选择数组中一个元素,并将它增加 1 。比方说,如果 nums = [1,2,3] ,你可以选择增加 nums[1] 得到 nums = [1,3,3] 。请你返回使 nums 严格递增 的 最少 操作次数。我们称数组 nums 是 严格递增的 ,当它满足对于所有的 0 <= i < nums.length - 1 都有 nums[i] < nums[i+1] 。一个长度为 1 的数组是严格递增的一种特殊情况。
2021-04-29 19:57:40
302
原创 Leetcode 小白刷题之旅 -6 1614. 括号的最大嵌套深度
如果字符串满足以下条件之一,则可以称之为 有效括号字符串(valid parentheses string,可以简写为 VPS):字符串是一个空字符串 "",或者是一个不为 "(" 或 ")" 的单字符。字符串可以写为 AB(A 与 B 字符串连接),其中 A 和 B 都是 有效括号字符串 。字符串可以写为 (A),其中 A 是一个 有效括号字符串 。类似地,可以定义任何有效括号字符串 S 的 嵌套深度 depth(S):depth("") = 0depth(C) = 0,其中 C 是单个字
2021-04-28 19:34:03
287
原创 Leetcode 小白刷题之旅 -5 1365. 有多少小于当前数字的数字
给你一个数组 nums,对于其中每个元素 nums[i],请你统计数组中比它小的所有数字的数目。换而言之,对于每个 nums[i] 你必须计算出有效的 j 的数量,其中 j 满足 j != i 且 nums[j] < nums[i] 。以数组形式返回答案。class Solution: def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]: put = [] anss .
2021-04-26 19:51:20
155
原创 Leetcode 小白刷题之旅 -4 1684. 统计一致字符串的数目
给你一个由不同字符组成的字符串 allowed 和一个字符串数组 words 。如果一个字符串的每一个字符都在 allowed中,就称这个字符串是 一致字符串 。请你返回 words 数组中 一致字符串 的数目。class Solution: def countConsistentStrings(self, allowed: str, words: List[str]) -> int: ans = 0 allowed = set(allowed) .
2021-04-26 19:36:39
139
原创 Leetcode 小白刷题之旅 -3 1313. 解压缩编码列表
给你一个以行程长度编码压缩的整数列表 nums 。考虑每对相邻的两个元素 [freq, val] = [nums[2i], nums[2i+1]] (其中 i >= 0),每一对都表示解压后子列表中有 freq 个值为 val 的元素,你需要从左到右连接所有子列表以生成解压后的列表。请你返回解压后的列表。class Solution: def decompressRLElist(self, nums: List[int]) -> List[int]: PUT .
2021-04-26 19:32:32
185
2
原创 Leetcode 小白刷题之旅 -2 1678. 设计 Goal 解析器
请你设计一个可以解释字符串 command 的 Goal 解析器 。command 由 “G”、"()" 和/或 “(al)”按某种顺序组成。Goal 解析器会将 “G” 解释为字符串 “G”、"()" 解释为字符串 “o” ,"(al)" 解释为字符串 “al”。然后,按原顺序将经解释得到的字符串连接成一个字符串。给你字符串 command ,返回 Goal 解析器 对 command 的解释结果。class Solution: def interpret(self, command:.
2021-04-26 19:30:14
192
原创 Python 散点图的数据分析
python 具有强大的数据分析能力库 matplotlibimport numpy as npimport pandas as pdimport matplotlib.pyplot as plt# 读取数据data_gpu = pd.read_csv(r'C:\Users\wangxinmin\Desktop\晶体管数据分析及可视化\gpu_transcount.csv')data = pd.read_csv(r'C:\Users\wangxinmin\Desktop\晶体管数据分析及可视化
2021-04-26 19:21:35
380
原创 Hbase单机安装教程
自行下载Hbase安装包解压到/usr/localsudo tar -zxf ~/下载/hbase-1.1.2-bin.tar.gz -C /usr/local重命名sudo mv /usr/local/hbase-1.1.2 /usr/local/hbase配置环境变量vi ~/.bashrc使配置生效source ~/.bashrc或者使用PATH变量export PATH=$PATH:/usr/local/hbase/bin添加HBase权限cd /usr/loca
2021-04-26 19:12:54
311
原创 Hadoop安装教程
创建hadoop用户sudo useradd -m hadoop -s /bin/bash接着使用如下命令设置密码,可简单设置为 hadoop,按提示输入两次密码:sudo passwd hadoop可为 hadoop 用户增加管理员权限,方便部署,避免一些对新手来说比较棘手的权限问题:sudo adduser hadoop sudo安装vimsudo apt-get install vim集群、单节点模式都需要用到 SSH 登陆(类似于远程登陆,你可以登录某台 Linux 主机,并
2021-04-26 18:56:26
440
原创 numpy数据分析
import numpy as nparr_1 = np.array([[1,2,3,4],[5,8,7,7],[19,10,11,12]])arr_2 = np.array([[23,342,342,55]])print(arr_1.sort(axis=0))print(arr_2.argsort())nm = ('A','B','C','D')dv = ('a','b','c','d')ind = np.lexsort((dv,nm)) #下标print([nm[i] + ',' +
2021-03-30 16:24:53
124
原创 nump使用
import numpy as nparr1 = np.array([1, 2, 3, 4])print(arr1)arr2 = np.array([[1, 2, 3, 1], [4, 5, 6, 3], [4, 8, 9, 10]])print(arr2)np_linspace = np.linspace(0, 1, 12)print(np_linspace)#矩阵的生成np_zeros = np.zeros((2, 3))print(np_zeros)np_eye = np.ey
2021-03-30 15:39:13
500
4
原创 约瑟夫死亡游戏
def yueshefu(total,step,rest): a=list(range(1,total+1)) while len(a)>rest: print(f'{a[step-1]}号下船了') a=a[step:] + a[:step-1] print(a)yueshefu(50,4,3)4号下船了[5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2020-11-26 10:33:57
212
原创 随机抽取学生
# 创建字典student,keyx学好file = open(r'C:\\Users\\Administrator\\Desktop\\stdent.csv','r')# 读取文件lines = file.readlines()student = {}for line in lines: tmp_list = line.split(',') xuehao = tmp_list[0] xingming = tmp_list[1] student[xuehao]=xi
2020-11-19 11:49:49
816
原创 统计文章中的单词数量
#打开并读取文件file = open(r"C:\Users\Administrator\Desktop\Walden.txt","r")lines = file.readlines()# 把每行拆成单词words = []for line in lines: tmp_list = line.split(" ") for word in tmp_list: words.append(word.lower())words['\n', 'walden\n',
2020-11-19 11:22:08
1045
原创 统计文章单词数量
import collectionsf=open("D:\python\Walden.txt","r").read()f=f.replace(',','').replace('.','').replace('"','').replace(':','')f=f.split()r=collections.Counter(f)print(r)---------------------------------------------------------------------------Fil
2020-11-19 09:34:32
241
原创 猜数字
while True:i=1n=random.randint(0, 100)a = int(input(‘输入一个大于0小于100的数:’))if (a>n) :print(‘你输入的数太大了’)i=i+1else(a<n) :print(‘你输入的数太小了’)i=i+1if (i>=5) and (a==n)break...
2020-11-19 09:15:37
144
原创 行号添加
lines_maxlenth = 0line_numbers = 1cc_in = open("demo.py","r").readlines()cc_out = open("demo_new.py","w")for i in cc_in: if(lines_maxlenth<len(i)): lines_maxlenth = len(i)for i in cc_in: i = i.ljust(lines_maxlenth+1).replace('\n','
2020-11-17 21:54:25
114
原创 Python字典,元组,集合增,删,改,查的应用
Python字典,元组,集合增,删,改,查的应用字典1.创建方式1:dic = dict(((‘one’, 1),(‘two’, 2),(‘three’, 3)))print(dic) # {‘one’: 1, ‘two’: 2, ‘three’: 3}方式2:dic = dict(one=1,two=2,three=3)print(dic) # {‘one’: 1, ‘two’: 2, ‘three’: 3}方式3:dic = dict({‘one’: 1, ‘two’: 2, ‘
2020-11-08 15:50:01
163
原创 Markdown使用说明
Mackdown使用的说明(1)基本说明【1】Mackdown是一种轻量级标记语言,他允许人们使用易读易写的纯文本格式编写文档。【2】 >>>Markdowm可以使用Typora编译器来讲解Mackdown的语法,Typora支持多种平台,支持导出HTML,PDF,Word,图片等多种类型文件。 >>> 这是引用百度(2)应用【1】Markdown能被用来撰写电子书或者发博客。【2】制作图片图表和列表类如:姓名爱好民族张三读
2020-10-23 15:24:40
109
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅