GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • w3resource
  • Front End
  • HTML
  • CSS
  • JavaScript
  • HTML5
  • Schema.org
  • php.js
  • Twitter Bootstrap
  • Responsive Web Design tutorial
  • Zurb Foundation 3 tutorials
  • Pure CSS
  • HTML5 Canvas
  • JavaScript Course

This view

  • Original page
  • New address

GeezerVison is showing www.w3resource.com — NumPy Interoperability Exercises, Practice, Solutions

  • Home
  • Python Home
  • Python Exercises
  • ▼Python NumPy
  • NumPy Home
  • ▼Basic Operations and Arrays
  • NumPy Basic
  • NumPy Array
  • ▼Mathematics, Linear Algebra, and Statistics
  • NumPy Mathematics
  • NumPy Linear Algebra
  • NumPy Statistics
  • ▼Random Numbers
  • NumPy Random
  • ▼Sorting, Searching, and Indexing
  • Sorting and Searching
  • NumPy Advanced Indexing
  • ▼Datetime and String Operations
  • NumPy DateTime
  • NumPy String
  • ▼Broadcasting and Memory Layout
  • NumPy Broadcasting
  • NumPy Memory Layout
  • ▼Performance Optimization and Interoperability
  • NumPy Performance Optimization
  • NumPy Interoperability
  • ▼Input/Output (I/O) Operations
  • NumPy I/O Operations
  • ▼Functions and Masked Arrays
  • NumPy Universal Functions
  • NumPy Masked Arrays
  • ▼Structured Arrays and SciPy Integration
  • NumPy Structured Arrays
  • NumPy Integration with SciPy
  • ▼Advanced Topics and Mastery
  • Advanced NumPy
  • Mastering Numpy
  • ..More to come..

NumPy Interoperability Exercises, Practice, Solutions

Last update on March 27 2025 12:41:46 (UTC/GMT +8 hours)


This resource offers a total of 100 NumPy Interoperability problems for practice. It includes 20 main exercises, each accompanied by solutions, detailed explanations, and four related problems.

The following exercises cover NumPy's interoperability with Python data structures (lists, tuples, dictionaries) and external libraries like Pandas. You'll practice converting between arrays, DataFrames, Series, CSV files, and nested lists, improving your ability to integrate NumPy with other data-handling tools.

[An Editor is available at the bottom of the page to write and execute the scripts.]


1. List to Array Conversion

Write a NumPy program to convert a Python list to a NumPy array and print the array.

Click me to see the sample solution


2. Array to List Conversion

Write a NumPy program to convert a NumPy array to a native Python list and print the list.

Click me to see the sample solution


3. Tuple to Array Conversion

Write a NumPy program to convert a Python tuple to a NumPy array and print the array.

Click me to see the sample solution


4. Array to Tuple Conversion

Write a NumPy program to convert a NumPy array to a Python tuple and print the tuple.

Click me to see the sample solution


5. DataFrame to Array Conversion

Write a NumPy program to convert a Pandas DataFrame to a NumPy array and print the array.

Click me to see the sample solution


6. Array to DataFrame Conversion

Write a NumPy program to convert a NumPy array to a Pandas DataFrame and print the DataFrame.

Click me to see the sample solution


7. Dictionary to Array Conversion

Write a NumPy program to convert a dictionary with numeric values to a NumPy array and print the array.

Click me to see the sample solution


8. Array to Dictionary Conversion

Write a NumPy program to convert a NumPy array to a dictionary with indices as keys and array elements as values.

Click me to see the sample solution


9. Nested List to 2D Array Conversion

Write a NumPy program to convert a nested Python list to a 2D NumPy array and print the array.

Click me to see the sample solution


10. 2D Array to Nested List Conversion

Write a NumPy program to convert a 2D NumPy array to a nested Python list and print the list.

Click me to see the sample solution


11. Series to Array Conversion

Write a NumPy program to convert a Pandas Series to a NumPy array and print the array.

Click me to see the sample solution


12. Array to Series Conversion

Write a NumPy program to convert a NumPy array to a Pandas Series and print the Series.

Click me to see the sample solution


13. DataFrame Round-trip Conversion

Write a NumPy program to create a Pandas DataFrame, convert it to a NumPy array, and then convert it back to a DataFrame.

Click me to see the sample solution


14. Array to CSV Conversion

Write a NumPy program to save a NumPy array to a CSV file and verify the contents by reading the file.

Click me to see the sample solution


15. CSV to Array Conversion

Write a NumPy program to read a CSV file into a NumPy array and print the array.

Click me to see the sample solution


16. 3D Array to Nested List Conversion

Write a NumPy program to convert a 3D NumPy array to a list of lists of lists and print the result.

Click me to see the sample solution


17. Nested List to 3D Array Conversion

Write a NumPy program to convert a list of lists of lists to a 3D NumPy array and print the array.

Click me to see the sample solution


18. Mixed DataFrame to Array Conversion

Write a NumPy program to convert a Pandas DataFrame with mixed data types (numerics and strings) to a NumPy array.

Click me to see the sample solution


19. Array and DataFrame Combination

Write a NumPy program to combine a NumPy array and a Pandas DataFrame into a single DataFrame and print it.

Click me to see the sample solution


20. Array Append to List Conversion

Write a NumPy program to append a NumPy array to a Python list and print the result.

Click me to see the sample solution


Python-Numpy Code Editor:

More to Come !

Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.

Test your Python skills with w3resource's quiz



Follow us on Facebook and Twitter for latest update.


  • Daily Coding Challenges & Projects
  • Weekly Trends and Language Statistics



You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.