首页
学习
活动
专区
工具
TVP
发布

数据处理

专栏作者
97
文章
147892
阅读量
33
订阅数
pandas操作一列数据
def tt(x): if x.name == "distribution": return [el[0:10] for el in x.values] else: return x test1 = test.apply(tt)
用户1733462
2018-12-05
1.9K0
hive sql练习1
参考 DROP TABLE student; create TEMPORARY TABLE student ( sid string, sname string, sage int, ssex string ); INSERT into student values("01","zhaolei",19900101,"M"); INSERT into student values("02","qiandian",19901221,"M"); INSERT into student values
用户1733462
2018-10-10
6610
hive sql练习
参考 -- 创建学生表,学号,姓名,性别,年龄,班级 DROP TABLE student; CREATE TEMPORARY TABLE student( Sno int, Sname VARCHAR(20), Sex VARCHAR(20), Sage int, Sdept VARCHAR(20) ); -- 创建 课程表, 课程编号,课程名称 DROP TABLE course; create TEMPORARY TABLE course( Cno int, Cname
用户1733462
2018-10-10
2.7K0
回归
看一下损失函数的导函数tanh(x),当x偏离0时,tanh(x)趋向+1或者-1
用户1733462
2018-09-20
3710
Home Depot Product Search Relevance
kaggle赛题链接Home Depot Product Search Relevance,这个题目关键点就是特征提取,给的数据需要观察处理
用户1733462
2018-08-13
5800
Bagging与Boosting
加载数据 import pandas as pd df_wine = pd.read_csv('http://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data', header=None) df_wine.columns = ['Class label', 'Alcohol', 'Malic acid', 'Ash', 'Alcalinity of
用户1733462
2018-07-04
2870
149. Max Points on a Line - 草稿
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 这个题目难不是很难,建立一个dict,斜率:该斜率上点的个数,算斜率特别要注意,如果使用Fraction(3,4),则会非常影响性能,使用np.longdouble(1)满足要求,真是坑爹。 from fractions import Fraction from collections import defau
用户1733462
2018-06-07
2460
制图之一
""" ======================================================= Controlling style of text and labels using a dictionary ======================================================= This example shows how to share parameters across many text objects and labels by c
用户1733462
2018-06-07
3380
图片RGB三维矩阵的表示
一个图片有三个通道RGB,每个通道就是一层数据 以一个图片为例子,从图片数据,再由数据到图片转化过程,理解数据与图形以及表示的关系 兔子 from PIL import Image #打开图片 im
用户1733462
2018-06-07
5.7K0
tensorflow动态加载文件
如果把文件全部加载到内存中,对大数据量来说,是不可行的,tensorflow使用列队,通过多线程来操作队列进出。举例子来说明> tf.train.slice_input_producer是一个tensor生成器,作用是按照设定,每次从一个tensor列表中按顺序或者随机抽取出一个tensor放入文件名队列。 下面这个例子是将文件名加入到队列中,每次从列队中只能取出一个tensor,然后读取图片数据,还是频繁io操作, import tensorflow as tf import matplotlib.
用户1733462
2018-06-07
1.3K0
函数与反函数
import numpy as np import matplotlib.pyplot as plt def h(x): return np.exp(x) def g(x): return np.log(x) g_start, g_end = 0.1, 4 h_start, h_end = g(g_start), g(g_end) numbers = 100 h_x = np.linspace(h_start, h_end, numbers) g_x = np.linspace(g_sta
用户1733462
2018-06-01
1K0
图片操作
from PIL import Image I = Image.open('1111.jpg') #I.show() # RGB 转换为灰度图 L = I.convert('L') im_array = np.array(L) print im_array print im_array.shape L.show() from PIL import Image import matplotlib.pyplot as plt img=Image.open('1111.jpg') im_array = np.ar
用户1733462
2018-06-01
5430
信息
一、如何度量信息 信息量是对信息的度量,香农不仅对信息作了定性描述,还进行了定量分析。 信源发出的信息常常是随机的,具有不确定性。如果信源中某一消息的不确定性越大,一旦发生,并为收信者接到,消除的不
用户1733462
2018-06-01
5660
re正则表格式
# coding=utf-8 # "正则表达式学习" import re # "match方法的工作方式是只有当被搜索字符串的开头匹配模式的时候它才能找到匹配对象" match = re.match(r'dog', 'dogsdf cat dog') print match.group() # "开头没有匹配cat,将返回None" match = re.match(r'cat', 'dog cat dog') print match # "使用re.search查找匹配任意位置,search方法不会
用户1733462
2018-06-01
6070
kaggle-识别手写数字
下载数据到本地,加载数据 import numpy as np import csv import pandas as pd def load_data(csv): lines = csv.reader(open(csv)) l = [] for line in lines: l.append(line) return l l = load_data('train.csv') l = np.array(l[1:], dtype=float) train =
用户1733462
2018-06-01
9870
梯度下降求损失函数Minimizing cost functions with gradient descent
损失函数与梯度,从上图可以看出梯度向下, 偏导数 可以看出计算样本y误差向量乘以样本x列向量,算出w需要使用所有的样本,然后再次迭代 import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt df = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data', header
用户1733462
2018-06-01
5100
笔记一python代码
import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt df = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data', header=None) y = df.iloc[0:100, 4].values y = np.where(y=='Iris-setosa',1
用户1733462
2018-06-01
5500
碰运气的约会-几何概率
甲乙2人相约中午12点至1点钟见面,并约定“第一人到达后可以在等第二人10分钟后不见人来就可离去。甲乙2人在12点到1点到达时间是等概率的,假设甲到达时间是x,乙到达时间是y,则见面的必有 |x-y|<=10,0<=x<=60,0<=y<=60 变成一个线性规划问题 import matplotlib.pyplot as plt import numpy as np x = np.linspace(0,60,60) y1 = [min(max(xi-10,0),60) for xi in x] y2
用户1733462
2018-06-01
4410
Guess Number Higher or Lower II
Guess Number Higher or Lower II 这个题目还是蛮有意思的 给定整数n,假定我选中的数1到n中的C,我只提示你猜的数与C的大小关系,这样你就可以缩小范围,继续猜测,但是你猜错数字,就要支付等值的美元,我为了获得更多的美元,会通过高低引导你,比如 n = 10 1,2,3,4,5,6,7,8,9,10 这时候如果你第一次选中9,我要是提示你猜小了,则你下一个就可以猜出10,因为只有一个数可以选择,那么我只能得到9美元,如果我告诉你猜高了,还有很多数字可选,这样我也可以获得更
用户1733462
2018-06-01
5140
scipy算积分有bug
import scipy as sp import numpy as np from sympy import * import matplotlib.pyplot as plt def fun(x): return [np.sin(el)/el for el in x] end = 100 trap = 10000 x = np.linspace(0.001, end, trap) y = fun(x) #分割近似求积分 print sum(y)*end/trap*2 print scipy
用户1733462
2018-06-01
5610
点击加载更多
社区活动
腾讯技术创作狂欢月
“码”上创作 21 天,分 10000 元奖品池!
Python精品学习库
代码在线跑,知识轻松学
博客搬家 | 分享价值百万资源包
自行/邀约他人一键搬运博客,速成社区影响力并领取好礼
技术创作特训营·精选知识专栏
往期视频·千货材料·成员作品 最新动态
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档