
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Apply Function to 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