Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
How do I apply some function to a Python meshgrid?
Meshgrid − Coordinate matrices from coordinate vectors.
Let's take an example to see how we can apply a function to a Python meshgrid. We can consider two lists, x and y, using numpy vectorized decorator.
Example
import numpy as np
@np.vectorize
def foo(a, b):
return a + b
x = [0.0, 0.5, 1.0]
y = [0.0, 1.0, 8.0]
print("Function Output: ", foo(x, y))
Output
Function Output: [0. 1.5 9. ]
Advertisements
