파이썬 희소 행렬 요소에 액세스하는 방법은 무엇입니까?
type(A) A.shape (8529, 60877) print A[0,:] (0, 25) 1.0 (0, 7422) 1.0 (0, 26062) 1.0 (0, 31804) 1.0 (0, 41602) 1.0 (0, 43791) 1.0 print A[1,:] (0, 7044) 1.0 (0, 31418) 1.0 (0, 42341) 1.0 (0, 47125) 1.0 (0, 54376) 1.0 print A[:,0] #nothing returned 이제 내가 이해하지 못하는 것은 A [1, :] 가 두 번째 행에서 요소를 선택해야하지만 print A [1, :] . 또한 print A [:, 0] 는 첫 번째 열을 반환해야하지만 아무것도 인쇄되지 않습니다. 왜? 해결 방법 A [1, :] 자체는 모양 (1, 608..
2021. 1. 25.
파이썬 How to print a list more nicely?
foolist = ['exiv2-devel', 'mingw-libs', 'tcltk-demos', 'fcgi', 'netcdf', 'pdcurses-devel', 'msvcrt', 'gdal-grass', 'iconv', 'qgis-devel', 'qgis1.1', 'php_mapscript'] evenNicerPrint(foolist) 원하는 결과 : exiv2-devel msvcrt mingw-libs gdal-grass tcltk-demos iconv fcgi qgis-devel netcdf qgis1.1 pdcurses-devel php_mapscript 감사! 해결 방법 단순한: l = ['exiv2-devel', 'mingw-libs', 'tcltk-demos', 'fcgi', 'netcdf'..
2021. 1. 24.