Arrays | NumPy | Python Methods and Functions

** **

** numpy.bitwise_or() ** is used to calculate the bitwise

Syntax:numpy.bitwise_or (arr1, arr2, /, out = None, *, where = True, casting = `same_kind`, order = `K`, dtype = None, ufunc `bitwise_or`)

Parameters:

arr1: [array_like] Input array.

arr2:[array_like] Input array.

out:[ndarray, optional] A location into which the result is stored.

- & gt; If provided, it must have a shape that the inputs broadcast to.

- & gt; If not provided or None, a freshly-allocated array is returned.

** kwargs:allows you to pass keyword variable length of argument to a function. It is used when we want to handle named argument in a function.

where:[array_like, optional] True value means to calculate the universal functions (ufunc) at that position, False value means to leave the value in the output alone.

Return:[ndarray or scalar] Result. This is a scalar if both x1 and x2 are scalars.

** Code # 1: Work **

` `

` ` ` # Python program explaining `

` # bitwise_or () function `

` `

` import `

` numpy as geek `

` in_num1 `

` = `

` 10 `

` in_num2 `

` = `

` 11 `

` print `

` (`

` "Input number1:" `

`, in_num1) `

` print `

` (`

` "Input number2:" `

`, in_num2) `

` `

` out_num `

` = `

` geek.bitwise_or (in_num1, in_num2) `

` print `

` (`

` "bitwise_or of 10 and 11:" `

`, out_num) `

` `

` `

** Output: **

Input number1: 10 Input number2: 11 bitwise_or of 10 and 11: 11

** Code # 2: **

** Output: **

Input array1: [2, 8, 125] Input array2: [3, 3, 115] Output array after bitwise_or: [3 11 127]

** Code # 3: **

` `

` ` |

` ` |

` `

` `

** Output: **

Input array1: [True, False, True, False] Input array2: [False, False, True, True] Output array after bitwise_or: [True False True True]

Python Workout isn’t designed to teach you Python, although I hope and expect that you’ll learn quite a bit along the way. It is meant to help you improve your understand- ing of Python and how to...

23/09/2020

Managing and analyzing data have always offered the greatest benefits and the greatest challenges for organizations of all sizes and across all industries. Businesses have long struggled with finding ...

10/07/2020

Learning Correct Cryptography by Example. The interconnected world of the current era has drastically changed everything, including banking, entertainment, and even statecraft. Despite difference...

23/09/2020

You should understand the basics of development and usage atop Apache Spark. This book will not be covering introductory material. There are numerous books, forums, and resources available that cover ...

10/07/2020

X
# Submit new EBook