自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(33)
  • 资源 (1)
  • 收藏
  • 关注

原创 [Leetcode]回文数(python版)

判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。示例1:输入: 121输出: true示例2:输入: -121输出: false解释: 从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。示例3:输入: 10输出: false解释: 从右向左读, 为 01 。因此它不是一个回文数。class Solution(object): def isPalindrome(self, x):

2020-05-22 09:54:50 217 1

原创 [Leetcode]整数反转(python版)

给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转。示例1:输入: 123输出: 321示例2:输入: -123输出: -321示例3:输入: 120输出: 21注意:假设我们的环境只能存储得下 32 位的有符号整数,则其数值范围为[−231, 231− 1]。请根据这个假设,如果反转后整数溢出那么就返回 0。class Solution(object): def reverse(self, x): """...

2020-05-22 09:49:57 162

转载 sklearn.model_selection.train_test_split

数据集划分:sklearn.model_selection.train_test_split(*arrays, **options)主要参数说明:*arrays:可以是列表、numpy数组、scipy稀疏矩阵或pandas的数据框test_size:可以为浮点、整数或None,默认为None①若为浮点时,表示测试集占总样本的百分比②若为整数时,表示测试样本样本数③若为None时,test size...

2018-07-02 11:30:37 497

转载 MySQL统计函数记录——按月、按季度、按日、时间段统计以及MySQL日期时间函数大全

按年汇总,统计:select sum(mymoney) as totalmoney, count(*) as sheets from mytable group by date_format(col, '%Y');按月汇总,统计: select sum(mymoney) as totalmoney, count(*) as sheets from mytable group by date_for...

2018-06-08 11:55:29 6441 1

转载 转载:《七周成为数据分析师》

百日计划第一周总结1. 计划1.彻底结束之前预定暑假完成的天善学院课程《七周数据分析师》2.总结《七周数据分析师》。2. 完成情况1.完成《七周成为数据分析师》任务2.周总结与《七周数据分析师》一起完成。《七周数据分析师》总结第一周:数据分析思维1.核心数据分析思维结构化公式化业务化2.数据分析思维七大技巧象限法多维法假设法指数法80/20法则(帕累托法则)对比法漏斗法3.数据分析思维锻炼方法好奇...

2018-06-07 18:19:14 5456 2

转载 Python中numpy库unique函数解析

a = np.unique(A)对于一维数组或者列表,unique函数去除其中重复的元素,并按元素由大到小返回一个新的无元素重复的元组或者列表[python] view plain copyimport numpy as np  A = [1, 2, 2, 5,3, 4, 3]  a = np.unique(A)  B= (1, 2, 2,5, 3, 4, 3)  b= np.unique(B) ...

2018-06-04 15:26:19 1862

转载 python pandas stack和unstack函数

在用pandas进行数据重排时,经常用到stack和unstack两个函数。stack的意思是堆叠,堆积,unstack即“不要堆叠”,我对两个函数是这样理解和区分的。  常见的数据的层次化结构有两种,一种是表格,一种是“花括号”,即下面这样的l两种形式: store1store2store3street1123street2456                                 ...

2018-06-04 14:54:14 6151

转载 python pandas (ix & iloc &loc) 的区别

loc——通过行标签索引行数据 iloc——通过行号索引行数据 ix——通过行标签或者行号索引行数据(基于loc和iloc 的混合) 同理,索引列数据也是如此!举例说明: 1、分别使用loc、iloc、ix 索引第一行的数据: (1)locimport pandas as pddata=[[1,2,3],[4,5,6]]index=['a','b']#行号columns=['c','d','...

2018-05-28 17:29:40 407

转载 MovieLens数据集

MovieLens数据集是一个关于电影评分的数据集,里面包含了从IMDB, The Movie DataBase上面得到的用户对电影的评分信息,详细请看下面的介绍。介绍:links.csv:文件里面的内容是帮助你如何通过网站id在对应网站上找到对应的电影链接的。数据格式如下: movieId, imdbId, tmdbId movieId:表示这部电影在movielens上的id,可以通过链接ht...

2018-05-28 17:28:23 15032 2

转载 hive中的with用法

hive 可以通过with查询来提高查询性能,因为先通过with语法将数据查询到内存,然后后面其它查询可以直接使用 with q1 as ( select key from src where key = '5')select *from q1; -- from stylewith q1 as (select * from src where key= '5')from q1select *; -...

2018-05-17 16:22:57 30460 1

转载 oracle 11g如何完全卸载

1.停用oracle服务:进入计算机管理,在服务中,找到oracle开头的所有服务,右击选择停止步骤阅读步骤阅读2.在开始菜单中,找到Universal Installer,运行Oracle Universal Installer,单击卸载产品步骤阅读步骤阅读3.在产品清单窗口中,单击全部展开,除了OraDb1

2018-05-08 15:47:46 146

转载 Oracle11g数据库win8.1系统安装配置图文教程

1. Oracle11g安装http://pan.baidu.com/s/1gfa3e63;这里是我在Oracle官网下载好了Windows系统64位的安装包,有2个zip文件。不想去官网找下载地址的童鞋可以直接用这个百度云盘的下载链接。1.去www.oracle.com下载最新的oracle11g安装包的压缩文件,有2个压缩文件,都需要下载,下载完成以后需要解压缩在同一个目录

2018-05-08 14:58:03 689

转载 IPython与IPython Notebook安装及使用

1.安装IPython和IPython Notebook,相关包在python环境变量路径下的命令行中分别输入pip指令安装:pip install IPythonpip install urllib3 (安装IPython Notebook的依赖)pip install jupyter (安装IPython Notebook)pip install numpypip inst

2018-02-06 16:47:50 746

转载 【Python】不用numpy用纯python求极差、平均数、中位数、众数与方差,python的打印到控制台

python作为数据分析的利器,求极差、平均数、中位数、众数与方差是很常用的,然而,在python进行统计往往要使用外部的python库numpy,这个库不难装,然而,如果单纯只是求极差、平均数、中位数、众数与方差,还是自己写比较好,因为,给一个.py程序别人的机器,别人的机器上没有python库numpy,又要别人折腾一番,这很不好。不过看情况咯,如果你要处理上亿级的数据,还是配置一下外部的py

2017-12-08 10:30:42 12485

转载 Python-NumPy

网上查到的个人认为最简洁的大纲,如果你有Python基础,又有些数学基础,看这个就够了。看不懂的地方敲一遍,这篇文章能告诉我们numpy是什么、它能做什么、怎么做。NumPy  NumPy是高性能科学计算和数据分析的基础包。部分功能如下:ndarray, 具有矢量算术运算和复杂广播能力的快速且节省空间的多维数组。用于对整组数据进行快速运算的标准数学函数(无需编写循环)。用于

2017-12-08 10:28:12 822

转载 《python数据分析与挖掘实战》笔记-3.1代码问题

问题今天看到《python数据分析与挖掘实战》这本书的第三章的第一份代码,照着书上的代码敲了一遍,发现在异常值处理的部分会报错。x = p['fliers'][0].get_xdata()y = p['fliers'][0].get_ydata()12报错信息:TypeError: 'AxesSubplot' object is not subscriptable1

2017-12-08 10:01:18 612

转载 【Leetcode】ZigZag Conversion

题目描述题目原文: The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) (我们将输入的字符串以zig

2017-09-02 15:50:30 233

原创 [Leetcode]Median of Two Sorted Arrays

There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1: nums1 = [1, 3] num

2017-08-26 21:28:50 185

原创 [Leetcode]Roman to Integer

Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999. 将一个罗马数值字符串转化为相应的int。 此题跟Integer to Roman有异曲同工之蛋疼,对于不熟悉罗马数字的童鞋就是一个噩梦。整体来说,罗马数字中的字符代表的数值大小,一般是

2017-08-25 16:46:30 146

原创 [Leetcode]Single Number

Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. > Could you implement it without using extra

2017-08-25 16:04:55 137

原创 [Leetcode]Add Two Numbers链表数相加

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it

2017-08-25 14:10:31 284

原创 [Leetcode]Reverse String

Write a function that takes a string as input and returns the string reversed.Example: Given s = “hello”, return “olleh”. 我最开始是这么写的class Solution(object): def reverseString(self, s): """

2017-08-10 19:16:15 137

原创 [Leetcode]Nim Game

You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the

2017-08-10 17:29:59 218

原创 【LeetCode】Two Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same ele

2017-08-10 16:46:44 134

原创 hive中count函数用法总结

count(*):所有行进行统计,包括NULL行count(1):所有行进行统计,包括NULL行count(column):对column中非NULL进行统计count(distinct column):对column中非NULL进行去重统计count(distinct col1,col2,...):对col1、col2,...多个字段同时去重并统计。count(CASE

2017-08-03 16:36:10 15201

转载 hive中select语法

Select语法SELECT [ALL | DISTINCT] select_expr, select_expr, ...FROM table_reference[WHERE where_condition][GROUP BY col_list][CLUSTER BY col_list | [DISTRIBUTE BY col_list] [SORT BY col_

2017-08-03 16:34:22 1381

转载 hive的UDF 函数

hive的UDF 函数Hive内部自定义函数UDFHIVE UDF整理(一)关系运算等值比较: =语法:A = B 操作类型: 所有基本类型描述: 如果表达式A与表达式B相等,则为TRUE;否则为FALSE举例:hive> select 1 from dual where 1=1;1不等值比较: 语法: A 操作类型: 所有基本类型描述:

2017-08-03 11:07:32 1356

转载 hive日期总结

1.日期函数 to_date(string expr)返回类型:string描述:返回时间字符串日期部分to_date(expr) - Extracts the date part of the date or datetime expression expr实例:Hive> select to_date('2014-09-16 15:50:08.119')

2017-08-01 10:55:27 525

原创 使用在hdfs上的文件导入到hive中

hive要打开,另一边root@hadoop-virtual-machine:/# hdfs dfs -ls /user/hive查看hdfs上都有些什么,然后把数据文件导入到hdfs上 ,root@hadoop-virtual-machine:/# hdfs dfs -put /opt/os.txt /user/hive/hive那边用show databases;查看当前都有什么数据库

2017-07-31 20:00:31 14672 1

原创 解决安装配置hive时出错Caused by: com.mysql.cj.core.exceptions.CJCommunicationsException: Communications link

当我按照教程配置好后出现打开hive出现了这样的错误Caused by: java.sql.SQLException: Unable to open a test connection to the given database. JDBC url = jdbc:mysql://hadoop-virtual-machine:3306/hive?CreateDatabaseIfNotExist=

2017-07-31 19:42:19 8771 3

转载 解决 win10 pycurl安装出错 Command "python setup.py egg_info" failed with error code 10

今天在win10下python3.6.0下 利用pip 安装pyspider时出现以下错误:Command "Python setup.py egg_info" failed with error code 10 in C:\Users\Auser\AppData\Local\Temp\pip-build-57obphna\pycurl\解决办法: 利用wheel安装对应的py

2017-07-11 19:33:16 5210 1

转载 python文件夹遍历,文件操作,获取文件修改创建时间

在Python中,文件操作主要来自os模块,主要方法如下:os.listdir(dirname):列出dirname下的目录和文件os.getcwd():获得当前工作目录os.curdir:返回当前目录('.')os.chdir(dirname):改变工作目录到dirnameos.path.isdir(name):判断name是不是一个目录,name不是目录就返回fal

2017-07-11 16:08:30 513

转载 Win10 64位系统下安装Python3及pip3

在windows下,TensorFlow只支持python3,因此先安装Python3。 1. 官网下载并安装python3.5,注意路径里不要含空格,因此我安装在了C盘根目录下C:\Python35。安装是可以勾选Adding to PATH选项,这样安装程序会自动将C:\Python35及C:\Python35\Scripts加入Path变量。也可以在安装后手动添加。 2. 将C:\P

2017-07-10 21:50:22 2376

Kaggle give me some credit数据集

Give Me Some Credit是Kaggle上关于信用评分的项目,通过改进信用评分技术,预测未来两年借款人会遇到财务困境的可能性。银行在市场经济中发挥关键作用。 他们决定谁可以获得融资,以及以何种条件进行投资决策。 为了市场和社会的运作,个人和公司需要获得信贷。信用评分算法可以猜测违约概率,这是银行用于确定是否应授予贷款的方法。目标是建立一个借款人可以用来帮助做出最佳财务决策的模型。

2020-05-21

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除