Skip to main content

print2d : Replacement of `print()` for printing 2d array with readability.

Project description

print2d : Print 2d array with readability

PyPI version

Replacement of print() for printing 2d array with readability.

print2d(mat1, "*" ,mat2, "=", mult)

[[4.  3.  1.  1. ]  * [[1 2 3]  = [[26.  24.  39. ]  
 [6.  2.  4.  8. ]     [5 2 6]     [64.  84.  98. ]  
 [1.1 6.6 1.5 0.1]]    [2 3 1]     [37.6 20.6 45.2]] 
                       [5 7 8]]  

Available types

  • Python list
  • NumPy ndarray
  • PyTorch Tensor

Install

pip install print2d

Usage

Import this module

from print2d import *

print2d() function gets parameter separated with comma(,).

Python list

arr1 = [[1,2],[3,4], [5,6]]
arr2 = [[1, 2, 3], [4, 5, 6]]
print2d("arr1", arr1, "arr2", arr2)

arr1 [[1, 2]  arr2 [[1, 2, 3]  
      [3, 4]        [4, 5, 6]] 
      [5, 6]]                  

NumPy ndarray

np1 = np.array([[1,2],[3,4], [5,6]])
np2 = np.array([[1, 2, 3], [4, 5, 6]])
print2d("np1", np1, "np2", np2)

np1 [[1 2]  np2 [[1 2 3]  
     [3 4]       [4 5 6]] 
     [5 6]]        

PyTorch Tensor

tc1 = torch.tensor([[1,2],[3,4], [5,6]])
tc2 = torch.tensor([[1, 2, 3], [4, 5, 6]])
print2d("tc1", tc1, "tc2", tc2)

tc1 tensor([[1, 2],  tc2 tensor([[1, 2, 3],  
            [3, 4],              [4, 5, 6]]) 
            [5, 6]])    

Combination

arr1 = [[1,2],[3,4], [5,6]]
np2 = np.array([[1, 2, 3], [4, 5, 6]])
print2d("arr1", arr1, "np2", np2)

arr1 [[1, 2]  np2 [[1 2 3]  
      [3, 4]       [4 5 6]] 
      [5, 6]]               

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

print2d-0.2.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file print2d-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: print2d-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2

File hashes

Hashes for print2d-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5df4381820962cdae1b4d55c5d2df94ba45e73dd1aa4cc181f154d026cea2aa1
MD5 d64998a0e95e4f985dd9905d00765933
BLAKE2b-256 35b5b78c9fdedace727067fe3f9cf6f27c4f290afd5d64b6c944e02092191e88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page