Python Data Science Jobs & Interviews
20.3K subscribers
187 photos
4 videos
25 files
325 links
Your go-to hub for Python and Data Science—featuring questions, answers, quizzes, and interview tips to sharpen your skills and boost your career in the data-driven world.

Admin: @Hussein_Sheikho
Download Telegram
Interview question :
What is NumPy, and why is it essential for scientific computing in Python?

Interview question :
How do arrays in NumPy differ from Python lists?

Interview question :
What is the purpose of ndarray in NumPy?

Interview question :
How can you create a 2D array using NumPy?

Interview question :
What does shape represent in a NumPy array?

Interview question :
How do you perform element-wise operations on NumPy arrays?

Interview question :
What is broadcasting in NumPy, and how does it work?

Interview question :
How do you reshape a NumPy array using reshape()?

Interview question :
What is the difference between copy() and view() in NumPy?

Interview question :
How do you concatenate two NumPy arrays along a specific axis?

Interview question :
What is the role of axis parameter in NumPy functions like sum(), mean(), etc.?

Interview question :
How do you find the maximum and minimum values in a NumPy array?

Interview question :
What are ufuncs in NumPy, and give an example?

Interview question :
How do you sort a NumPy array using np.sort()?

Interview question :
What is the use of np.where() in conditional indexing?

Interview question :
How do you generate random numbers using NumPy?

Interview question :
What is the difference between np.random.rand() and np.random.randn()?

Interview question :
How do you load data from a file into a NumPy array?

Interview question :
What is vectorization in NumPy, and why is it important?

Interview question :
How do you calculate the dot product of two arrays in NumPy?

#️⃣ tags: #NumPy #Python #ScientificComputing #Array #ndarray #ElementWiseOperations #Broadcasting #Reshape #CopyView #Concatenation #AxisParameter #MaximumMinimum #ufuncs #Sorting #ConditionalIndexing #RandomNumbers #DataLoading #Vectorization #DotProduct

By: t.iss.one/DataScienceQ 🚀
#numpy #python #programming #question #array #basic

Write a Python code snippet using NumPy to create a 2D array of shape (3, 4) filled with zeros. Then, modify the element at position (1, 2) to be 5. Print the resulting array.

import numpy as np

# Create a 2D array of zeros with shape (3, 4)
arr = np.zeros((3, 4))

# Modify the element at position (1, 2) to be 5
arr[1, 2] = 5

# Print the resulting array
print(arr)

Output:
[[0. 0. 0. 0.]
[0. 0. 5. 0.]
[0. 0. 0. 0.]]

By: @DataScienceQ 🚀
2
#numpy #python #programming #question #array #intermediate

Write a Python program using NumPy to perform the following tasks:

1. Create a 1D array of integers from 1 to 10.
2. Reshape it into a 2D array of shape (2, 5).
3. Compute the sum of each row and store it in a new array.
4. Find the indices of elements greater than 7 in the original 1D array.
5. Print the resulting 2D array, the row sums, and the indices.

import numpy as np

# 1. Create a 1D array from 1 to 10
arr_1d = np.arange(1, 11)

# 2. Reshape into a 2D array of shape (2, 5)
arr_2d = arr_1d.reshape(2, 5)

# 3. Compute the sum of each row
row_sums = np.sum(arr_2d, axis=1)

# 4. Find indices of elements greater than 7 in the original 1D array
indices_greater_than_7 = np.where(arr_1d > 7)[0]

# 5. Print results
print("2D Array:\n", arr_2d)
print("Row sums:", row_sums)
print("Indices of elements > 7:", indices_greater_than_7)

Output:
2D Array:
[[ 1 2 3 4 5]
[ 6 7 8 9 10]]
Row sums: [15 40]
Indices of elements > 7: [7 8 9]

By: @DataScienceQ 🚀
4
🧠 NumPy Quiz: Array Shapes
Question: What will be the output of arr.shape for the NumPy array created by np.zeros((2, 3))?
import numpy as np
arr = np.zeros((2, 3))

A) (3, 2)
B) (2, 3)
C) 6
D) (2, 3, 0)
Correct answer: B
#NumPy #Python #DataScience #Array #Quiz

---
By: @DataScienceQ