Python入门
Lynne98
一个菜鸡
展开
-
数据分析笔试题
数据分析笔试题数据:raw_data = {'platform': ['pcnews', 'pcnews', 'pcnews', 'pcnews', 'news', 'news', 'news', 'news', 'video', 'video', 'video', 'video'], 'order_num': ['1st', '1st', '2nd', '2nd', '1st', '1st', '2nd', '2nd','1st', '1st', '2nd', '2nd'],原创 2021-06-06 19:57:47 · 347 阅读 · 0 评论 -
Python中lambda的用法
a = lambda x,y,z:(x+8)*y-zprint(a(5,6,8))lambda匿名函数的格式:冒号前是参数,可以有多个,用逗号隔开,冒号右边的为表达式。其实lambda返回值是一个函数的地址,也就是函数对象。res = lambda 参数1,参数2,参数n:表达式匿名函数lambda:是指一类无需定义标识符(函数名)的函数或子程序。lambda 函数可以接收任意多个参数 (包括可选参数) 并且返回单个表达式的值。...原创 2021-06-06 19:55:07 · 149 阅读 · 0 评论 -
tf.expand_dims()用法详解
axis = x就是在第x维扩展,直接用例子来演示current = np.array([ [0, 7, 1, 2, 2], [1, 7, 3, 4, 3], [2, 7, 5, 6, 6], [3, 7, 7, 8, 7], [4, 7, 7, 8, 7], [5, 7, 7, 8, 7]])current = array(current)current = tf.constant(current)points_e0 = tf.expand_d原创 2021-04-14 17:31:22 · 456 阅读 · 0 评论 -
Keras搭建CNN模型基础
Keras神经网络基础导包import tensorflow as tffrom tensorflow.keras.layers import Densefrom tensorflow.keras import Modelfrom sklearn import datasetsimport numpy as np神经网络基础结构:模型搭建&实例化class 网名(Model):def init(self):super(网名, self).init()self.原创 2021-01-19 17:08:04 · 627 阅读 · 0 评论 -
Python入门————02 (未完)
1 列表列表通常包含多个元素,用方括号[] 来表示列表可以对列表元素调用字符串的操作方法string = ['abc','bcd','cde','def']print(string[0])>>> abcprint(string[1].title())>>> Bcd1.1访问列表索引从0开始, 如指定返回-1 则是返回最后...原创 2020-01-02 21:29:14 · 79 阅读 · 0 评论 -
Python入门————01 字符串&数字
1、字符串用引号括起的都是字符串,其中引号可以是单引or双引 这种灵活的方式可以让字符串中包含引号1.1 使用方法修改字符串大小写1.1.1 title() 以首字母大写的方式显示每个单词(将每个单词首字母都改成大写)name="ada lovelace"print(name.title())#输出:Ada Lovelace1.1.2 字符串全部改为大写...原创 2020-01-02 21:22:03 · 168 阅读 · 0 评论 -
Python入门笔记(一)
# -*- coding: UTF-8 -*-print "hello world"# ====多行语句====sums = 1 + \ 2 + \ 3print(sums)days = ['monday', 'Tuesday', 'Monday']print(days)# =====等待用户输入======# raw_input("按下...原创 2018-07-11 12:35:15 · 290 阅读 · 0 评论 -
Python学习笔记(二)
# -*- coding: UTF-8 -*-print "============数字============"import cmathvar1 = 1del var1# 删除了对象的引用,相当于取消了对var1的定义。如果这里不重新赋值的话,就会报错。var1 = 3print(var1)print "============字符串=============="strs ...原创 2018-07-12 11:35:36 · 149 阅读 · 0 评论 -
爬虫
import requests# 这里必须在cmd里pip install requests一下,不然会报错import reimport randomr = requests.get("http://www.baidu.com")print(r.status_code) # 访问状态码,如果是200表示访问成功print(r.encoding) # 从header中猜测的响应...原创 2018-08-02 10:15:31 · 146 阅读 · 0 评论