- 博客(14)
- 收藏
- 关注
原创 python学习笔记--pandas库(二)
一、读写csv文件import pandas as pda=pd.read_csv(文件位置,index=True) #分隔 ,索引作为一列df.sort_index(axis,ascending=True为升序)#按索引排序df.sort_values(by=['score','Name'])#按值obj.describe()#描述...
2022-05-25 14:29:39
120
原创 python学习笔记--numpy库
一、数组函数arrayimport numpy as npnp.array([1,2,3,4],dtype=flaot,ndmin=2)print(a,a.ndim)np.arange(0,9,3) #等差# start,stop,step公差np.linspace(start,stop,size) #浮点数等差,分成size个np.logspace(0,9,3,base=2) #3个数组,公比是2 二、操作1.a=np.appe
2022-05-24 18:29:11
62
原创 python学习笔记——文件
一、文件1.打开变量名 = open("文件路径","模式") #打开f.write("嘿嘿") #写入了ls=["hh"]f.writelines(ls)f.seek(0) #回到文件开头s=f.read(2) #从当前指针开始到文件结尾,读出前2个字符长度二、csv文件...
2022-05-24 17:11:39
71
原创 python学习笔记-控制流程
1.条件分支if a>b: print(a)else: print(b)#下面是嵌套if a>b: print(a)elif a>10: print(b)else: print(c)2.循环while a>5: #直到a大于5 print(a) a=a+1else:print(b)break 跳出循环 continue 忽略本次循环剩余语句3.迭代for n in adic
2022-05-24 15:04:54
70
原创 pandas库学习笔记
一、基本操作s1 = pd.Series([2,4,-3,7])#创建s2 = pd.Series([2,4,-3,7],index=['a','v','w','e'])#制作标签二、二维数组d1 =pd.dataFrame(np.arrange(10).reshape(2,5)) #创建从0到9,重塑2行5排d12.字典形式d_dic={'name':['Alice','Bob']}d2 = pd.DataFrame(d_dic)3.算术运算c=a.mul(b
2022-05-18 19:11:03
322
原创 A5升级建筑
1.放置工地construction site2.建筑虫Game.spawns['Spawn1'].spawnCreep( [WORK, CARRY, MOVE], 'Builder1', { memory: { role: 'builder' } } );3.role.builder模块var roleBuilder = { /** @param {Creep} creep **/ run: function(creep) { if(creep.m
2022-05-14 11:50:13
75
原创 A5防御工事
1.安全模式Game.spawns['Spawn1'].room.controller.activateSafeMode();2.放置塔楼Game.spawns['Spawn1'].room.createConstructionSite( 23, 22, STRUCTURE_TOWER );3.采集者给塔楼供能role.harvester模块var roleHarvester = { /** @param {Creep} creep **/ run: func
2022-05-13 22:28:46
95
原创 A4creep自动生成
1.自动生成mainvar roleHarvester = require('role.harvester');var roleUpgrader = require('role.upgrader');module.exports.loop = function () { var harvesters = _.filter(Game.creeps, (creep) => creep.memory.role == 'harvester'); console.log('Harv
2022-05-13 22:10:09
76
原创 A2升级控制器.sreeps教程代码解析
A2.1创建升级虫Game.spawns['Spawn1'].spawnCreep( [WORK, CARRY, MOVE], 'Upgrader1' );2.写入内存,区别职业Game.creeps['Harvester1'].memory.role = 'harvester';Game.creeps['Upgrader1'].memory.role = 'upgrader';3.role.upgrader模块var roleUpgrader = { /** @par
2022-05-13 17:57:46
286
1
原创 A1Sreeps教程代码解析
1.section1基本挖矿:1.鼠标点击建立自己的基地2.生成你的creepss采集能源虫Game.spawns['Spawn1'].spawnCreep([WORK,CARRY,MOVE],'Harvester1');3.主函数module.exports.loop = function () {//主程序入口 for(var name in Game.creeps) {//遍历所有工人,Game.creeps会返回所有游戏中的工人 var creep
2022-05-13 17:47:29
144
原创 matplotlib条形图只显示一列
import matplotlib.pyplot as pltimport numpy as np #引入了数组import matplotlib.pyplot as pltdatedata = np.loadtxt("D:\python作业\ydl.csv",dtype=np.int32,delimiter=',',skiprows=1)month = data[:,0]ydl_1 = data[:,1]ydl_2 = data[:,2]ydl_3 = data[:,3].
2022-05-11 21:02:53
437
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人