python数据分析
通过python对数据进行操作,进而找到数据之间的规律
xiaoliyu00
Talk Is Cheap, Show Me The Code'。知易行难,知行合一难
展开
-
python基础相关操作复习
目录1.基本命令1.1 基本运算1.2 判断与循环1.3 函数2. 数据结构2.1 列表/元组2.2 字典2.3集合2.3 函数式编程1.基本命令1.1 基本运算#直接赋值,无需定义类型a = 2#多重赋值a,b,c = 2,3,4#字符串操作,直接赋值,无需定义类型s = 'I like pyhton's + 'hhhh'print(s)#out<<I like pyhton hhhh#将s以空格分隔,可以得到列表s.split(' ')#o原创 2020-09-16 21:34:47 · 187 阅读 · 1 评论 -
python数据分析-Seaborn相关操作复习2-4
目录2.Advance categorical plots in seaborn2.1Categorical scatterplots2.2 Categorical distribution plots2.3 Categorical estimate plots3.Density plots4.Pair plots2.Advance categorical plots in seaborn2.1Categorical scatterplots:stripplot() (with kin原创 2020-09-16 13:24:53 · 163 阅读 · 0 评论 -
python数据分析-Seaborn相关操作复习1
目录1.Createing basic plots2.Advance Categorical plots in Seaborn1.Createing basic plots# importing required librariesimport seaborn as snssns.set()sns.set(style = "darkgrid")import numpy as npimport pandas as pd# importing matplotlibimport ma原创 2020-09-15 21:35:01 · 191 阅读 · 0 评论 -
python数据分析-Matplotlib_v2相关操作复习3-4
目录3.load dataset4.chart3.load dataset# read the datasetdata_BM = pd.read_csv("bigmart_data.csv")#drop the null datadata_BM = data_BM.dropna(how = 'any')# view the top results#data_BM.head()4.chart4.1 Line chartprice_by_item = data_BM.groupby原创 2020-09-15 14:50:58 · 171 阅读 · 0 评论 -
python数据分析-Matplotlib_v2相关操作复习1-2
目录1.Setting up2.Matplotlib basics1.Setting up#import required librariesimport numpy as npimport pandas as pd#import matplotlibimport matplotlib.pyplot as plt#display plots in the notebook itself%matplotlib inline2.Matplotlib basics# set pl原创 2020-09-15 12:51:06 · 106 阅读 · 0 评论 -
python数据分析-pandas相关操作复习5
#目录5.Aggregating data5.Aggregating data#import required dictionaryimport pandas as pdimport numpy as np#read the datasetdata_BM = pd.read_csv('bigmart_data.csv')#drop the null valuesdata_BM = data_BM.dropna(how = "any")#reset index after dropp原创 2020-09-14 23:12:35 · 133 阅读 · 0 评论 -
pyhton数据分析-pandas相关操作复习3-4
目录3.Merging dataframes-merge()4.Apply function3.Merging dataframes-merge()# create dummy datadf_a = pd.DataFrame({ 'subject_id': ['1', '2', '3', '4', '5'], 'first_name': ['Alex', 'Amy', 'Allen', 'Alice', 'Ayoung'], 'last_nam原创 2020-09-14 22:53:00 · 156 阅读 · 0 评论 -
python数据分析-pandas相关操作复习1-2
目录1.Sorting dataframes2.Merging dataframes-concat()1.Sorting dataframesimport pandas as pdimport numpy as np#read the datasetdata_BM = pd.read_csv("bigmart_data.csv")#drop the null values data_BM = data_BM.dropna(how = "any")#view the resultsd原创 2020-09-14 22:10:25 · 292 阅读 · 0 评论 -
python数据分析-numpy相关操作复习7-8
目录7.文件输入输出8.练习题7.文件输入输出7.1 读取csv文件作为数组arr = np.loadtxt('path\\name.txt',delimiter = ',')print(arr)#out<<[[ 1. 2. 3. 4. 4. 5.] [ 1. 2. 3. 4. 5. 6.] [ 1. 2. 34. 5. 5. 5.]]7.2 数组文件读写arr = np.arange(50).reshape(2,5,5)print(a原创 2020-09-14 18:24:04 · 156 阅读 · 0 评论 -
python数据分析-numpy相关操作复习5-6
目录5.逻辑运算6.数组高级操作5.逻辑运算import numpy as npx_arr = np.array([1.1, 1.2, 1.3, 1.4, 1.5])y_arr = np.array([2.1, 2.2, 2.3, 2.4, 2.5])cond =np.array([True,False,True,True,False])#满足条件(condition),输出x,不满足输出yprint(np.where(cond,x_arr,y_arr))#out<<[原创 2020-09-13 22:14:00 · 122 阅读 · 0 评论 -
python数据分析-numpy相关操作复习3-4
目录3.数学运算4.broadcasting3.数学运算3.1逐个元素的运算:可以进行基本的加减乘除,这里只列举两种3.1.1逐个元素求和x = np.array([[1,2],[3,4]], dtype=np.float64)y = np.array([[5,6],[7,8]], dtype=np.float64)print(x)print(y)#out<<[[1. 2.] [3. 4.]][[5. 6.] [7. 8.]]#直接对应相加x + y#o原创 2020-09-12 22:31:57 · 264 阅读 · 0 评论 -
Python数据分析-numpy相关操作复习1-2
数据分析-numpy相关操作目录1.数组简介和数组的构造2. 数组的取值和赋值3.数学运算4.broadcasting5.逻辑运算6.数组高级操作7.文件输入输出8.练习题1.数组简介和数组的构造Arrays下面介绍一些常用函数,方便用来创建数组(矩阵)2.数组取值和赋值目录1.数组简介和数组的构造2. 数组的取值和赋值3.数学运算4.broadcasting5.逻辑运算6.数组高级操作7.文件输入输出8.练习题1.数组简介和数组的构造#导入numpy模块import numpy原创 2020-09-11 22:17:59 · 199 阅读 · 0 评论