自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

數(shù)據(jù)分析崗Python筆試題

大數(shù)據(jù) 數(shù)據(jù)分析
我整理了數(shù)據(jù)分析師崗的Python筆試題,主要涉及到用Python完成數(shù)據(jù)處理和分析的內(nèi)容。自己做了一遍,供大家學習思考。

我整理了數(shù)據(jù)分析師崗的Python筆試題,主要涉及到用Python完成數(shù)據(jù)處理和分析的內(nèi)容。自己做了一遍,供大家學習思考。

[[333643]]

一、數(shù)據(jù)處理題

1.將Excel工作簿 “Test.xlsx” 作為dataframe導入 Jupyter Notebook,并將dataframe命名為a. 導入后dataframe x應為如下: 輸出結(jié)果 

數(shù)據(jù)分析崗Python筆試題
  1. import pandas as pd 
  2. import numpy as np 
  3. a = pd.read_excel('Test.xlsx' 
數(shù)據(jù)分析崗Python筆試題

第1題

2.dataframe a 中, class1-class5 指總共5門課,每個學生選兩門,列出期中(midterm)、期末(final)成績(A/B/C)。請用Python語言處理表格,將class1-class5列去除,并增加 class 和 grade 兩列,使新dataframe的值與原dataframe對應,并將新dataframe命名為b. 輸出結(jié)果應為如下: 輸出結(jié)果 

數(shù)據(jù)分析崗Python筆試題

 

  1. #1.先設(shè)置索引列——復合索引,用列表 
  2. #2.stack()旋轉(zhuǎn)列為行,默認是旋轉(zhuǎn)最內(nèi)層,并且刪除空值 
  3. #3.重置索引 
  4. #4.更改列名 
  5. b = a.set_index(["name","test"]).stack().reset_index()   
  6. b.columns=['name','test','class','grade'

用Python語言將dataframe b 的test列分成midterm和final兩列,這兩列的值是選的兩門課的成績。將新dataframe命名為c。輸出結(jié)果應為如下: 輸出結(jié)果 

數(shù)據(jù)分析崗Python筆試題
  1. c = b.set_index(['name','class','test']).unstack()  
數(shù)據(jù)分析崗Python筆試題

第2題

4.如下為dataframe d 和 dataframe e DataFrame d and e 

數(shù)據(jù)分析崗Python筆試題

請用Python語言將dataframe d 和 dataframe e 匹配, 輸出結(jié)果應為如下: 輸出結(jié)果 

數(shù)據(jù)分析崗Python筆試題
  1. #水果價格信息表 
  2. d = pd.DataFrame({'水果':['apple','apple','banana','banana','orange','orange'], 
  3.              '個頭':['high','low']*3, 
  4.              '單價':[5,3,4,2,7,5]}) 
  5. #水果訂單 
  6. e = pd.DataFrame({'水果':['apple','banana','orange']*2, 
  7.              '個頭':['high','low']*3, 
  8.              '重量':np.random.randint(1,15,6)}) 
  9. pd.merge(d,e,how='inner'

如下是dataframe f DataFrame f 

數(shù)據(jù)分析崗Python筆試題

請用python語言得出每節(jié)課(class)和每個年級 (grade) 下, 學生的數(shù)量和平均成績。輸出結(jié)果應為如下: 輸出結(jié)果 

數(shù)據(jù)分析崗Python筆試題
  1. f = pd.DataFrame(['Sally','David',"Jon",'Jon'],columns=['name']) 
  2. f['score']=[95,99,80,83] 
  3. f['class']=['A','A','A','B'
  4. f['grade']=['grade 1','grade 2','grade 1','grade 2'
  5. #方法一:使用groupby 
  6. f.groupby(['class','grade']).agg({'name':'count','score':'mean'}) 
  7. #方二:使用pivot_table 
  8. f.pivot_table(index=['class','grade'],values=['name','score'],aggfunc={'name':'count','score':'mean'}) 

6.如下是dataframe h DataFrame h 

數(shù)據(jù)分析崗Python筆試題

請用Python語言得出每行最小值除以每行最大值的商。輸出結(jié)果應為如下: 輸出結(jié)果 

數(shù)據(jù)分析崗Python筆試題
  1. np.random.seed(10) 
  2. h=pd.DataFrame(np.random.randint(1,100,80).reshape(8,-1)) 
  3. min_by_max=h.min(axis=1)/h.max(axis=1) 
  4. min_by_max 

7.如下是dataframe i DataFrame i 

數(shù)據(jù)分析崗Python筆試題

請用Python語言將dataframe i 里Min. Price 列中的NaN值替換成Min. Price 列的平均值, 并將 Max.Price 列中的NaN值替換成Max.Price列的中位數(shù)。輸出結(jié)果應為如下(未截全): 輸出結(jié)果 

數(shù)據(jù)分析崗Python筆試題

 

  1. i=pd.read_csv('https://raw.githubusercontent.com/selva86/datasets/master/Cars93_miss.csv'
  2. i.head() 
  3. i['Min.Price'].fillna(i['Min.Price'].mean(),inplace=True
  4. i['Max.Price'].fillna(i['Max.Price'].median(),inplace=True
  5. i.isnull().sum() 

 

 

責任編輯:未麗燕 來源: 今日頭條
相關(guān)推薦

2018-12-03 16:50:23

數(shù)據(jù)可視化數(shù)據(jù)分析薪水

2018-01-02 09:23:38

數(shù)據(jù)分析算法阿里巴巴

2020-05-13 11:32:28

數(shù)據(jù)分析數(shù)值分析

2015-08-14 10:28:09

大數(shù)據(jù)

2019-05-15 15:57:15

Python數(shù)據(jù)分析爬蟲

2023-11-24 08:47:36

ScipyPython

2016-12-16 12:32:50

阿里數(shù)據(jù)分析職業(yè)要求

2017-02-16 10:00:26

python數(shù)據(jù)加載

2020-08-16 12:44:59

小費數(shù)據(jù)集Python數(shù)據(jù)分析

2017-04-11 09:08:02

數(shù)據(jù)分析Python

2009-06-22 13:43:00

java算法

2017-11-27 16:37:42

Python大數(shù)據(jù)數(shù)據(jù)分析

2019-01-15 14:21:13

Python數(shù)據(jù)分析數(shù)據(jù)

2022-11-14 10:36:55

數(shù)據(jù)科學數(shù)據(jù)分析

2020-04-30 16:38:21

數(shù)據(jù)分析可視化代碼

2015-10-26 10:41:10

數(shù)據(jù)分析思想指南

2015-08-11 15:52:52

大數(shù)據(jù)數(shù)據(jù)分析

2009-06-15 17:18:25

Java筆試題

2017-07-06 15:44:33

2019-11-06 10:56:59

Python數(shù)據(jù)分析TGI
點贊
收藏

51CTO技術(shù)棧公眾號