- 博客(30)
- 收藏
- 关注
原创 使用虚拟机以及安装hadoop集群时所遇到的问题和解决
安装hadoop集群时所遇到的问题当我执行下面代码时发现,只有namenode和secondarynamenode启动起来了,说明出现错误,于是改用另一个启动hadoop的代码start-all.sh,发现成功了,resourcemanager启动。最后单独执行mr-jobhistory-daemon.sh start historyserver,终于四个都启动起来。但是发生这个错误的原因始终不太明白。执行:start-dfs.shstart-yarn.shmr-jobhistory-daemon
2021-06-21 19:30:18
5433
原创 numpy3.30上课
Numpy的“增”操作import numpy as np### 新建数组 ndarray()arr1 = np.array([1,2,3,4])arr1 #一维array([1, 2, 3, 4])arr2 = np.array([[1,2,3,4],[4,5,6,7],[7,8,9,10]])arr2 #二维array([[ 1, 2, 3, 4], [ 4, 5, 6, 7], [ 7, 8, 9, 10]])np.linspac
2021-03-30 16:25:51
505
原创 Untitled (1)
import pandas as pdimport numpy as npt = pd.read_csv('C:/Users/user/Desktop/train.csv')T = t.set_index('Loan_ID')T.head(10) Gender Married Dependents Education Self_Employed ApplicantIncome C
2021-03-23 16:40:57
537
原创 Untitled
import pandas as pdimport numpy as npt = pd.read_csv('C:/Users/user/Desktop/train.csv')T = t.set_index('Loan_ID')T.head(10) Gender Married Dependents Education Self_Employed ApplicantIncome C
2021-03-23 14:41:59
444
原创 Pandas数据操作练习
使用Pandas、Numpy等工具库,完成以下数据操作一、CSV数据读入从指定路径下读取CSV数据文件,并将Loan_ID设为Index数据文件train.csv在"./data/"路径下打印输出前该数据集10行 Gender Married Dependents Education Self_Employed ApplicantIncome CoapplicantInco
2021-03-23 14:41:39
334
原创 卷1 抓兔子
import randomn = int(input("请输入洞口的个数:"))m = int(input("请输入玩家游戏次数:"))t = 1tuzi = int(random.random()*n + 1)while t<=m: wanjia = int(input("你觉得兔子在几号洞口?")) if tuzi ==1: tuzi = tuzi + 1 elif tuzi == n: tuzi = tuzi - 1 el
2021-01-02 12:58:15
69
原创 卷2 抽奖
import randomm = 0a = 0b = 0c = 0while m < 10000: n = random.random()*361 if n>=0 and n<10: a = a + 1 m = m + 1 elif n>=10 and n<120: b = b + 1 m = m + 1 else: c = c + 1 m
2020-12-31 11:08:31
64
原创 猜数字gui版本(2)
import tkinterimport tkinter.messageboxroot = tkinter.Tk()root.title("猜数字")tkinter.Label(root, text="你猜的数字:").grid(row=0, column=0)entry = tkinter.Entry(root)entry.place(x=50, y=0, width=150, height=20)var_num = tkinter.StringVar()var_num.set('')
2020-12-23 23:14:42
459
1
原创 猜数字gui版本(1)
import tkinter as timport randomfrom tkinter import messageboxclass app: def __init__(self, root): self.rec_text = t.StringVar() root.geometry('400x200') t.Button(root, text="点击生成随机数", command=self.change).pack(pady=20,ancho
2020-12-23 23:14:10
352
原创 猜数字界面版
import tkinterimport randomroot = tkinter.Tk()tkinter.Label(root, text="请输入你猜的数字").grid(row=0, column=0)entry1 = tkinter.Entry(root) entry1.grid(row=0, column=1, padx=10, pady=10)jieguo = tkinter.StringVar()n=int(random.random()*50+1)def caishuz
2020-12-16 22:08:33
526
1
原创 BMI计算和健康状况评估界面版
import tkinterroot = tkinter.Tk()tkinter.Label(root, text="体重(kg):").grid(row=0, column=0)tkinter.Label(root, text="身高(m):").grid(row=1, column=0)entry1 = tkinter.Entry(root) entry2 = tkinter.Entry(root)entry1.grid(row=0, column=1, padx=10, pady=10
2020-12-16 21:06:40
267
原创 12.10上课(2)
import tkinter#import tkinter.ttkimport tkinter.messagebox#import tkinter.simdef msgbox(): tkinter.messagebox.showinfo(title="xuehao",message=xuehao.get()) root = tkinter.Tk() #创建主窗口程序button = tkinter.Button(root,text='点击弹出',command=msgbox)
2020-12-10 10:18:22
87
原创 12.10上课(1)
class BMI: def __init__(self,name,age,weight,height): self.name = name self.age = age self.weight = weight self.height = height self.bmi = self.weight/(self.height*self.height) self.bmi = round(self.bmi,2
2020-12-10 09:35:48
93
原创 关于BMI函数定义计算和健康状态评估
class BMI: def __init__(self,xingming,nianling,tizhong,shengao): self.xingming = xingming self.nianling = nianling self.tizhong = tizhong self.shengao = shengao self.bmi = tizhong/(shengao*shengao) t = se
2020-12-08 19:17:23
511
原创 12.3上课(2)
本地新建文件夹(本地仓库2),从远程仓库更新代码到本地git pull http://.git本地仓库2中添加一个文件,提交到本地仓库2更新本地仓库2至远程仓库# 定义Student类class Student: def __init__(self,name,xuehao,phone): self.name = name self.xuehao = xuehao self.phone = phone self.__pass
2020-12-03 12:12:43
84
原创 11.26上课(2)
def qiuhe(x,y): """ 用于求和的函数。 Input: x:接收1个实数; y:接收1个实数。 Output: 返回x+y的计算结果 """ z = x + y return zresult = qiuhe(1,2) # 函数的调用qiuhe(y=1,x=2)3def play(players,step,alive): players = int(input("总共几人
2020-11-26 11:29:07
81
原创 11.26上课(1)
def qiuhe(x,y): """ 用于求和的函数。 Input: x:接收1个实数; y:接收1个实数。 Output: 返回x+y的计算结果 """ z = x + y return zresult = qiuhe(1,2) # 函数的调用qiuhe(y=1,x=2)3t = [i for i in range(1,51)]k = 0while len(t)>3: i
2020-11-26 10:22:10
96
原创 11.19上课(2)
# 打开并读取文件file = open(r'C:\Users\Administrator\Desktop\stu.csv','r')lines = file.readlines()# 给每行添加行号 如#1,#2# 用#对齐# 求最长行的长度max_len = 0for line in lines: if len(line) > max_len: max_len = len(line)print(max_len)line_num = 0new_lines
2020-11-19 12:17:07
89
原创 11.19上课(1)
代码整合猜数字%%writefile guess.pyimport randomn=int(random.random()*50+1)i=1while i <= 5: t=int(input("请输入你猜的数字:")) if(t < n): print("你输入的数小了") i = i + 1 elif(t > n): print("你输入的数大了") i = i + 1 else
2020-11-19 11:26:20
100
原创 行号
line_max = 0 # 定初值lines = 1 # 定初值s = open("demo.py","r").readlines() # 打开并按行读取内容,相当于列表t = open("demo_new.py","w") # 打开并写入for i in s: # 循环找出最大行 if line_max < len(i): line_max = len(i)for i in s:
2020-11-18 16:43:06
120
原创 英文文档词频排序
text = open('Walden.txt').read()words = text.split()t = {}for word in words: if word in t: t[word]=t[word]+1 elif word not in t: t[word]=1sorted(t.items(), key=lambda item:item[1], reverse=True)[('the', 6928), (
2020-11-17 21:12:23
215
原创 找同学 字典 11.12
dict = {1:'张三',2:'李四',3:'san',4:'si',5:'wu'}t = int(input('输入随机抽取几名同学:'))i=1import randomwhile i<=t: s = random.randint(1,5) i = i + 1 print("dict[s]:",dict[s])输入随机抽取几名同学:1dict[s]: 张三...
2020-11-12 10:32:10
218
原创 数三去一循环
t = [i for i in range(1,40)]t[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, 32, 33, 34, 35, 36, 37, 38, 39]k = 0while len(t)>2: i = 0
2020-11-11 21:40:46
67
原创 1-50猜数字游戏
import randomn=int(random.random()*50+1)i=1while i <= 5: t=int(input("请输入你猜的数字:")) if(t < n): print("你输入的数小了") i = i + 1 elif(t > n): print("你输入的数大了") i = i + 1 else: print("恭喜你猜对了")
2020-11-11 21:36:19
2423
原创 while中continue和break区别
while中continue和break区别continue终止当次循环,不执行下面的代码,而是直接进入下一次循环t = 0while t < 100: if t == 5: print(t) t += 1 continue5↑以上t的值到5终止增加breakbreak跳出整个循环,直接执行下面的代码t = 0while t < 100: if t== 5: break t += 1 prin
2020-11-11 20:14:33
106
原创 字典 元组 集合的增删改查
字典增dict1 = {'one':1,'two':2,'three':3}dict1{'one': 1, 'two': 2, 'three': 3}dict1['four']= "4"dict1{'one': 1, 'two': 2, 'three': 3, 'four': '4'}删del dict1['four']dict1{'one': 1, 'two': 2, 'three': 3}改dict1 = {'one':1,'two':2,'three':4}d
2020-11-11 19:12:11
595
1
原创 Untitled11.5第一节
list1 = ['a','b','c',4,5,6]list1.append(8)list1['a', 'b', 'c', 4, 5, 6, 8]list1.insert(1,'f')list1['a', 'f', 'b', 'c', 4, 5, 6, 8]list1.[0] = hello wordlist1 File "<ipython-input-7-70b30079e571>", line 1 list1.[0] = hello word
2020-11-05 10:03:26
65
原创 git
第一步:输入你的github账户邮箱和用户名命令:$ git config --global user.email “you@example.com”命令:$ git config --global user.name “Your Name”第二步:锁定代码文件所在的本地文件夹路径命令:$ cd 文件路径第三步:将该文件夹设定为本地库命令:$ git init第四步:将代码文件预载入命令:$ git add 文件名命令:$ git commit -m ‘描述’第五步:选择分支命令:$
2020-11-05 08:16:47
85
原创 循环
all_in_list=[“1”,“2”,“3”,“4”,“5”,“6”,“7”,“8”,“9”,“10”]all_in_list[2]all_in_listdel all_in_list[0]del all_in_list[0]del all_in_list[0]all_in_listall_in_list.append(“1 2”)all_in_listdel all_in_list[0]del all_in_list[0]del all_in_list[0]all_in_lis
2020-11-05 08:14:47
69
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人