Python 데이터 분석 및 전시 노트 정리

데이터
1.     :     ——       

	*   :        
	*   :        
2.                     ——    
3.     :           (json)

2. NumPy 방송 기능 함수 1. axis (데이터 의 차원) 와 rank (축의 수량) 2. 대상 속성
	* .ndim   rank
	* .shape
	* .size     
	* .dtype
	* .itemsize                
3.      

	* bool
	* intc    int
	* intp
	* int8-64
	* uint8-64
	* float16-64
	* complex64-128
4.       

	* np.array(list)      
	* .arange()   range    0-n-1
	* .ones(shape)    1   ,shape      (a,b,c)
	* .zeros
	* .full(shape,val)      val,   shape   
	* .eye(n)       n*n    ,    1,   0
	* .ones-like(a)        a  1   
	* .zeros_like(a)
	* .full_like(a,val)
	* .linspace(first,last,     ,endpoint=True/False?            :   )                 
	* .concatenate()                
5.        

	* .reshape(shape)         
	* .resize(shape)          
	* .swapaxes(ax1,ax2)    
	* .flatten()       ,          
6.        

	* astype()        
7.         

	* .tolist()
8.         

	* a[begin:last:step]
	*    a[:,1:3,:]           
	* a[:,:,::2]             
9.           

	* .mean()   
	* .abs()         
	* .fabs()        
	* .sqrt        
	* square       
	* log,log10,log2     ,10   
	* ceil   floor
	* rint             
	* modf                          
	* cos,cosh
	* exp       
	* sign             1(+),0,-1(-)
10.              

	* maximum(x,y) fmax()          

		* >> np.maximum([-2, -1, 0, 1, 2], 0)
		* array([0, 0, 0, 1, 2])
	* mod(x,y)       
	* copysign(x,y)    y       x
	* <>        
11.     

	1. sum(a,axis=None)     axis    a      
	2. mean
	3. average(a,axis=None,weight=None)weight    ,       [1,2,3]
	4. std
	5. var
	6. min,max
	7. argmin     a           
	8. unravel_index(index,shape)  shape     index       
	9. ptp               
	10. median     a       
12.     

	1. gradient

3. 데이터 저장 1. CSV 파일 액세스
	* CSV          ,comma-separated Value
	*           
		* .savetxt(frame,array,fmt="'%.18e",delimiter=None)
			* frame:  、       
			* array:       
			* fmt        
			*      ,       ,     ?
		* .loadtxt(frame,dype=np.float,delimiter=None,unpace=False)
			* dtype:    
			* unpack:  True,             
	*        
		* tofile(frame,sep=‘’,format='')
		* fromfile(frame,dytpe=float,count=-1,sep='')
			* count        ,-1    
			* sep         ,    ,        
	*     
		* save(frame,array)   savez
			* frame     .npy
		* load(frame)
3.       
	* .rand(shape)       ,   [0,1)
	* randn(shape)       
	* randint(low,high,shape)
	* seed(s)     
	* shuffle(a)    a  1       a,    a
	* permutation(a)    a  1           ,     a
	* choice(a,size,replace,p)
		*      a    p      ,
		* replace        ,      a          
	* uniform(low,high,size)      
	* normal(loc,scale,size)
		* loc  
		* scale   
		* size  
	* poisson(lam,size)
		*        
		*   

4. Matplotlib. pyplot
1. pyplot    
	* plt.subplot(nrows,ncols,plot_number)
		*     ,
		*        
2. plot  
	1. plot(x,y,format_string,**kwargs)
		1. format_string        
			1.   :‘b’,'g','r',‘0.8’   
			2.     :‘-’,‘-·’
			3.     ‘x’
			4.     :markerfacecolor
		2. **kwargs   plot
3.     
	1. rcParams['font,family']='SimHei'     
		1. font.family
		2. font.style
		3. font.size
	2. fontproperties,fontsize
4.     
	1. xlabel
	2. ylabel
	3. title
	4. annotate(  ,xy=(),xytext=())           
			1.        ,    (      )
			2. 2,1    
	5. grid  
	6. text(2,1,  ,fontsize)          
5.      
	1. subplot2grid((3,3),(1,0),(colspan=2))    ,    ,    
	2. subplot(gs[0,:])
6.       
	1. plot(x,y,format_string)     
	2. boxplot(data,notch,postion)   
	3. bar(left,hegiht,width,bottom)   
	4. barh(width,bottom,left,height)     
	5. polar(theta,r)
	6. pie(data,explode)
	7. hist   
	8. scatter(x,y)   

5. Pandas
1. ​Series
	1.              
	2. Series   
		1. Python  
		2.    
			1. pd.Series(25,index=['a','b'])       index,  25 Series
		3.    index          
			1. pd.Series({},index=[])    ,  index       ,  NaN  
		4. ndarray       ndarray    
			1. pd.Series(np.arange())
			2. pd.Series(np.arrange(),index=np.arange(9,4,-1))
		5.      range()
	3. Series    
		1. index,values
			1. Series(value,index)
			2. b.index
			3. .values
			4. b['c','b']       Series
		2.   ndarray
			1. 【】  
			2. b[b>b.median()]
		3.   Python
			1.      
			2.    in
			3. .get(key,   )
	4.     
		1.              
		2. .name 
			* .name
			* .index.name
2. DataFrame
	1.      column index
	2.   
		1.   ndarray
			* .DataFrame(np.arange(10).reshape(2,5))
		2.    ndarray      
			* dt={'one':pd.Series([1,2,3],index=['a','b','c'])}
			* d=DataFrame(dt,index=[])
	3.      
		1. .reindex(index[])
			1.       index    
		2. .reindex(column=[])
			1.       column    
		3.     
			1. fill_value         
			2. method     
				* ffill    
				* bfill    
				*         
			3. limit      
			4. copy 
				1. True       
				2. False        
		4.          .index
			1. .append(idx)      index    index  
			2. .diff(a)     ,    index
			3. .intersection(a)    
			4. .union(a)     
			5. .delete(x)     x   
			6. .insert(a,b) a        b 
	4.   
		1. drop(axis=0,'')
			1.     axis    
	5.     
		1. add(b,  )
		2. sub(b)
		3. mul(b)
		4. div(b)
		5.        ,axis,    NANfiill_value

좋은 웹페이지 즐겨찾기