일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- 싱글셀 분석
- PYTHON
- Batch effect
- Git
- CUTandRUN
- 비타민 C
- julia
- python matplotlib
- javascript
- EdgeR
- cellranger
- scRNAseq
- single cell rnaseq
- CUT&RUN
- MACS2
- CSS
- DataFrame
- pandas
- single cell
- HTML
- drug development
- ChIPseq
- scRNAseq analysis
- js
- drug muggers
- single cell analysis
- matplotlib
- github
- Bioinformatics
- ngs
- Today
- Total
목록numpy (3)
바이오 대표
np.array_equal(A,B) Array A와 B의 형태(shape)과 요소들(elements)이 동일하다면 True 아니면 False 를 반환한다 (A == B).all( ) 해당 function을 이용할 수 도 있지만, 몇가지 특정 상황에서 두서없이 True 를 반환한다. 주의 사항: A 나 B 중 하나가 empty array 이고 다른 하나가 1개의 element 를 갖을 때 True 를 반환한다 A == B 는 empty array를 반환한다 A 와 B의 형태(shape)이 같지 않을때, error를 띄운다 # 다른 비교 방법 np.array_equal(A,B) # test if same shape, same elements values np.array_equiv(A,B) # test if ..
numpy 의 reshape 함수는 다음과 같이 사용된다 array.reshape(row, column) np.reshape(array, (row, column)) 1,2 차원에서의 변화 쉽게 1차원 배열을 생성하고 reshape 으로 재배열을 해보았다 첫번째는 array.reshape(row, column) 을 이용했고 , 두번째는 np.reshape(array, (row, column)) 를 이용했다. * reshape 에서 -1 은 정해진 행/열이 있으면 거기에 맞춰지는 열/행을 의미한다. 3 차원에서의 변화 1,2 차원에서의 재배열과 같다. 차원만 다르게 해주면 된다.
to .csv (ASCII) to .npy (binary) to .npz (compressed) Numpy arrary 를 csv 형태로 저장할 수 있는 방법에는 두가지가 있다. [1] pandas 이용해서 dataframe으로 변경 후 df.to_csv( ) [2] np.savetxt( ) [1] pandas 이용해서 dataframe으로 변경 후 df.to_csv( ) import pandas as pd # numpy array arr # numpy array to pandas dataframe df = pd.DataFrame(arr) df.to_csv("myArray.csv", index=Fase) [2] np.savetxt( ) import numpy as np np.savetxt("myArray..