原创 MySQL統計函數記錄——按月、按季度、按日、時間段統計以及MySQL日期時間函數大全

MySQL日期時間函數大全DAYOFWEEK(date)  返回日期date是星期幾(1=星期天,2=星期一,……7=星期六,ODBC標準)mysql> select DAYOFWEEK('1998-02-03');   -> 3 WEE

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

hive要打開,另一邊root@hadoop-virtual-machine:/# hdfs dfs -ls /user/hive查看hdfs上都有些什麼, 然後把數據文件導入到hdfs上 ,root@hadoop-virtual-mac

原创 hive中select語法

Select語法 SELECT [ALL | DISTINCT] select_expr, select_expr, ... FROM table_reference [WHERE where_condition] [GROUP

原创 [Leetcode]迴文數(python版)

判斷一個整數是否是迴文數。迴文數是指正序(從左向右)和倒序(從右向左)讀都是一樣的整數。 示例1: 輸入: 121 輸出: true 示例2: 輸入: -121 輸出: false 解釋: 從左向右讀, 爲 -121 。 從右向左讀

原创 [Leetcode]整數反轉(python版)

給出一個 32 位的有符號整數,你需要將這個整數中每位上的數字進行反轉。   示例1: 輸入: 123 輸出: 321 示例2: 輸入: -123 輸出: -321 示例3: 輸入: 120 輸出: 21 注意:假設我們的環境只能存

原创 hive的UDF 函數

hive的UDF 函數 Hive內部自定義函數UDF HIVE UDF整理(一) 關係運算 等值比較: = 語法:A = B  操作類型: 所有基本類型 描述: 如果表達式A與表達式B相等,則爲TRUE;否則爲FALSE 舉例:

原创 [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 y

原创 解決安裝配置hive時出錯Caused by: com.mysql.cj.core.exceptions.CJCommunicationsException: Communications link

當我按照教程配置好後出現打開hive出現了這樣的錯誤 Caused by: java.sql.SQLException: Unable to ope

原创 解決 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:\Us

原创 hive日期總結

1.日期函數 to_date(string expr) 返回類型:string 描述:返回時間字符串日期部分 to_date(expr) - Extracts the date part of the date or dateti

原创 python文件夾遍歷,文件操作,獲取文件修改創建時間

在Python中,文件操作主要來自os模塊,主要方法如下: os.listdir(dirname):列出dirname下的目錄和文件 os.getcwd():獲得當前工作目錄 os.curdir:返回當前目錄('.') os.chdi

原创 hive中count函數用法總結

count(*):所有行進行統計,包括NULL行 count(1):所有行進行統計,包括NULL行 count(column):對column中非NULL進行統計 count(distinct column):對column中非NULL進

原创 Win10 64位系統下安裝Python3及pip3

在windows下,TensorFlow只支持python3,因此先安裝Python3。 1. 官網下載並安裝python3.5,注意路徑裏不要含空格,因此我安裝在了C盤根目錄下C:\Python35。安裝是可以勾選Adding to P

原创 [Leetcode]Reverse String

Write a function that takes a string as input and returns the string reversed. Example: Given s = “hello”, return “oll

原创 python pandas stack和unstack函數

在用pandas進行數據重排時,經常用到stack和unstack兩個函數。stack的意思是堆疊,堆積,unstack即“不要堆疊”,我對兩個函數是這樣理解和區分的。  常見的數據的層次化結構有兩種,一種是表格,一種是“花括號”,即下面