Python Data Science Jobs & Interviews
20.6K subscribers
192 photos
4 videos
25 files
334 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
Python Question / Quiz;

What is the output of the following Python code, and why? πŸ€”πŸš€ Comment your answers below! πŸ‘‡

#python #programming #developer #programmer #coding #coder #softwaredeveloper #computerscience #webdev #webdeveloper #webdevelopment #pythonprogramming #pythonquiz #ai #ml #machinelearning #datascience

https://t.iss.one/DataScienceQ
πŸ‘4
Python Question / Quiz;

What is the output of the following Python code, and why? πŸ€”πŸš€ Comment your answers below! πŸ‘‡

#python #programming #developer #programmer #coding #coder #softwaredeveloper #computerscience #webdev #webdeveloper #webdevelopment #pythonprogramming #pythonquiz #ai #ml #machinelearning #datascience

https://t.iss.one/DataScienceQ
πŸ‘2❀1
Python Question / Quiz;

What is the output of the following Python code, and why? πŸ€”πŸš€ Comment your answers below! πŸ‘‡

#python #programming #developer #programmer #coding #coder #softwaredeveloper #computerscience #webdev #webdeveloper #webdevelopment #pythonprogramming #pythonquiz #ai #ml #machinelearning #datascience

https://t.iss.one/DataScienceQ
πŸ‘3
πŸ˜‰ A list of the best YouTube videos
βœ… To learn data science


1️⃣ SQL language


⬅️ Learning

πŸ’° 4-hour SQL course from zero to one hundred

πŸ’° Window functions tutorial

⬅️ Projects

πŸ“Ž Starting your first SQL project

πŸ’° Data cleansing project

πŸ’° Restaurant order analysis

⬅️ Interview

πŸ’° How to crack the SQL interview?

βž–βž–βž–

2️⃣ Python


⬅️ Learning

πŸ’° 12-hour Python for Data Science course

⬅️ Projects

πŸ’° Python project for beginners

πŸ’° Analyzing Corona Data with Python

⬅️ Interview

πŸ’° Python interview golden tricks

πŸ’° Python Interview Questions

βž–βž–βž–

3️⃣ Statistics and machine learning


⬅️ Learning

πŸ’° 7-hour course in applied statistics

πŸ’° Machine Learning Training Playlist

⬅️ Projects

πŸ’° Practical ML Project

⬅️ Interview

πŸ’° ML Interview Questions and Answers

πŸ’° How to pass a statistics interview?

βž–βž–βž–

4️⃣ Product and business case studies


⬅️ Learning

πŸ’° Building strong product understanding

πŸ’° Product Metric Definition

⬅️ Interview

πŸ’° Case Study Analysis Framework

πŸ’° How to shine in a business interview?

#DataScience #SQL #Python #MachineLearning #Statistics #BusinessAnalytics #ProductCaseStudies #DataScienceProjects #InterviewPrep #LearnDataScience #YouTubeLearning #CodingInterview #MLInterview #SQLProjects #PythonForDataScience



βœ‰οΈ Our Telegram channels: https://t.iss.one/addlist/0f6vfFbEMdAwODBk
Please open Telegram to view this post
VIEW IN TELEGRAM
❀2
Question 2 (Intermediate):
What is a common use case for the PCA (Principal Component Analysis) algorithm in machine learning?

A) Hyperparameter tuning
B) Data visualization and dimensionality reduction
C) Gradient descent optimization
D) Model ensembling

#MachineLearning #PCA #DimensionalityReduction #MLQuiz #DataScience
Question 2 (Advanced):
In machine learning with Python, what does the random_state parameter do in scikit-learn's train_test_split() function?

A) Controls the shuffling applied to the data before splitting
B) Sets the percentage of data to use for testing
C) Determines the number of CPU cores to use
D) Specifies the type of ML algorithm to apply

#Python #MachineLearning #ScikitLearn #DataScience
Question 13 (Intermediate):
In NumPy, what is the difference between np.array([1, 2, 3]) and np.array([[1, 2, 3]])?

A) The first is a 1D array, the second is a 2D row vector
B) The first is faster to compute
C) The second automatically transposes the data
D) They are identical in memory usage

#Python #NumPy #Arrays #DataScience

βœ… By: https://t.iss.one/DataScienceQ
❀3
πŸš€ Comprehensive Guide: How to Prepare for a Graph Neural Networks (GNN) Job Interview – 350 Most Common Interview Questions

Read: https://hackmd.io/@husseinsheikho/GNN-interview

#GNN #GraphNeuralNetworks #MachineLearning #DeepLearning #AI #DataScience #PyTorchGeometric #DGL #NodeClassification #LinkPrediction #GraphML

βœ‰οΈ Our Telegram channels: https://t.iss.one/addlist/0f6vfFbEMdAwODBk

πŸ“± Our WhatsApp channel: https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Please open Telegram to view this post
VIEW IN TELEGRAM
❀5
Python.pdf
488 KB
πŸ³οΈβ€πŸŒˆ Notes "Mastering Python"
βœ… From Basic to Advanced

πŸ‘¨πŸ»β€πŸ’» An excellent note that teaches everything from basic concepts to building professional projects with Python.

⭕️ Basic concepts like variables, data types, and control flow

⏺ Functions, modules, and writing reusable code

⭕️ Data structures like lists, dictionaries, sets, and tuples

⏺ Object-oriented programming: classes, inheritance, and polymorphism

⭕️ Working with files, error handling, and debugging

⬅️ Alongside, with practical projects like data analysis, web scraping, and working with APIs, you learn how to apply Python in the real world.

🌐 #Data_Science #DataScience
βž–βž–βž–βž–βž–βž–βž–βž–βž–βž–βž–βž–βž–
Please open Telegram to view this post
VIEW IN TELEGRAM
❀2πŸ”₯1
1. What is the primary data structure in pandas?
2. How do you create a DataFrame from a dictionary?
3. Which method is used to read a CSV file in pandas?
4. What does the head() function do in pandas?
5. How can you check the data types of columns in a DataFrame?
6. Which function drops rows with missing values in pandas?
7. What is the purpose of the merge() function in pandas?
8. How do you filter rows based on a condition in pandas?
9. What does the groupby() method do?
10. How can you sort a DataFrame by a specific column?
11. Which method is used to rename columns in pandas?
12. What is the difference between loc and iloc in pandas?
13. How do you handle duplicate rows in pandas?
14. What function converts a column to datetime format?
15. How do you apply a custom function to a DataFrame?
16. What is the use of the apply() method in pandas?
17. How can you concatenate two DataFrames?
18. What does the pivot_table() function do?
19. How do you calculate summary statistics in pandas?
20. Which method is used to export a DataFrame to a CSV file?

#️⃣ #pandas #dataanalysis #python #dataframe #coding #programming #datascience

By: t.iss.one/DataScienceQ πŸš€
❀1
#How can I implement the K-Nearest Neighbors (KNN) algorithm for classification using scikit-learn? Provide a Python example, explain how distance metrics affect predictions, and discuss the impact of choosing different values of k.

Answer:
KNN is a non-parametric algorithm that classifies data points based on the majority class among their k nearest neighbors in feature space.

import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import accuracy_score, confusion_matrix
import seaborn as sns

# Load dataset
data = datasets.load_iris()
X = data.data
y = data.target
feature_names = data.feature_names
target_names = data.target_names

# Split and scale data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train)
X_test_scaled = scaler.transform(X_test)

# Train KNN model with k=5
knn = KNeighborsClassifier(n_neighbors=5, metric='euclidean')
knn.fit(X_train_scaled, y_train)

# Predict and evaluate
y_pred = knn.predict(X_test_scaled)
accuracy = accuracy_score(y_test, y_pred)
print(f"Accuracy: {accuracy:.2f}")

# Confusion Matrix
cm = confusion_matrix(y_test, y_pred)
plt.figure(figsize=(6, 4))
sns.heatmap(cm, annot=True, fmt='d', cmap='Blues', xticklabels=target_names, yticklabels=target_names)
plt.title('Confusion Matrix')
plt.ylabel('True Label')
plt.xlabel('Predicted Label')
plt.show()

# Visualize decision boundaries (for first two features only)
plt.figure(figsize=(8, 6))
X_plot = X[:, :2] # Use only first two features for visualization
X_plot_scaled = scaler.fit_transform(X_plot)
knn_visual = KNeighborsClassifier(n_neighbors=5)
knn_visual.fit(X_plot_scaled, y)
h = 0.02
x_min, x_max = X_plot_scaled[:, 0].min() - 1, X_plot_scaled[:, 0].max() + 1
y_min, y_max = X_plot_scaled[:, 1].min() - 1, X_plot_scaled[:, 1].max() + 1
xx, yy = np.meshgrid(np.arange(x_min, x_max, h), np.arange(y_min, y_max, h))
Z = knn_visual.predict(np.c_[xx.ravel(), yy.ravel()])
Z = Z.reshape(xx.shape)
plt.contourf(xx, yy, Z, alpha=0.3, cmap=plt.cm.Paired)
for i, color in enumerate(['red', 'green', 'blue']):
idx = np.where(y == i)
plt.scatter(X_plot_scaled[idx, 0], X_plot_scaled[idx, 1], c=color, label=target_names[i], edgecolors='k')
plt.xlabel(feature_names[0])
plt.ylabel(feature_names[1])
plt.title('KNN Decision Boundaries (First Two Features)')
plt.legend()
plt.show()


Explanation:
- Distance Metrics: Common choices include Euclidean, Manhattan, and Minkowski. Euclidean is default and suitable for continuous variables.
- Choice of k:
- Small k (e.g., 1 or 3): Sensitive to noise, may overfit.
- Large k: Smoother decision boundaries, but may underfit.
- Optimal k is found via cross-validation.
- Standardization: Crucial because KNN uses distance; unscaled features can dominate results.

Time Complexity: O(nm) per prediction, where n is training samples and m is features.
Space Complexity: O(nm) to store training data.
Use Case: KNN is simple, effective for small-to-medium datasets, and works well when patterns are localized.

#MachineLearning #KNN #Classification #ScikitLearn #DataScience #PythonProgramming #AlgorithmExplained #DimensionalityReduction #SupervisedLearning

By: @DataScienceQ πŸš€
#How can I use scikit-learn to build a machine learning pipeline for classification? Provide a Python example, explain the steps involved in preprocessing, model training, and evaluation, and demonstrate how to use cross-validation.

Answer:
Scikit-learn is a powerful Python library for machine learning that provides simple and efficient tools for data mining and data analysis. It supports various algorithms, preprocessing techniques, and evaluation metrics.

import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.model_selection import train_test_split, cross_val_score, GridSearchCV
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.svm import SVC
from sklearn.metrics import classification_report, confusion_matrix
import seaborn as sns

# Load dataset
data = datasets.load_iris()
X = data.data
y = data.target
feature_names = data.feature_names
target_names = data.target_names

# Split data into train and test sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)

# Create a pipeline with preprocessing and model
pipeline = Pipeline([
('scaler', StandardScaler()),
('classifier', SVC(kernel='rbf', random_state=42))
])

# Train the model
pipeline.fit(X_train, y_train)

# Make predictions
y_pred = pipeline.predict(X_test)

# Evaluate the model
accuracy = pipeline.score(X_test, y_test)
print(f"Accuracy: {accuracy:.2f}")

# Classification report
print("Classification Report:")
print(classification_report(y_test, y_pred, target_names=target_names))

# Confusion Matrix
cm = confusion_matrix(y_test, y_pred)
plt.figure(figsize=(6, 4))
sns.heatmap(cm, annot=True, fmt='d', cmap='Blues', xticklabels=target_names, yticklabels=target_names)
plt.title('Confusion Matrix')
plt.ylabel('True Label')
plt.xlabel('Predicted Label')
plt.show()

# Cross-validation
cv_scores = cross_val_score(pipeline, X_train, y_train, cv=5)
print(f"Cross-validation scores: {cv_scores}")
print(f"Mean CV Score: {cv_scores.mean():.2f} Β± {cv_scores.std():.2f}")

# Hyperparameter tuning using GridSearchCV
param_grid = {
'classifier__C': [0.1, 1, 10],
'classifier__gamma': ['scale', 'auto', 0.1, 1]
}
grid_search = GridSearchCV(pipeline, param_grid, cv=5, scoring='accuracy')
grid_search.fit(X_train, y_train)

print("Best parameters:", grid_search.best_params_)
print("Best cross-validation score:", grid_search.best_score_)

# Final model with best parameters
best_model = grid_search.best_estimator_
final_predictions = best_model.predict(X_test)
final_accuracy = accuracy_score(y_test, final_predictions)
print(f"Final Accuracy with tuned model: {final_accuracy:.2f}")


Explanation:
- Pipeline: Combines preprocessing (StandardScaler) and model (SVC) into one unit for clean workflow and avoiding data leakage.
- StandardScaler: Normalizes features to have zero mean and unit variance.
- SVC: Support Vector Classifier for classification; RBF kernel handles non-linear data.
- Cross-validation: Evaluates model performance on multiple folds to reduce overfitting.
- GridSearchCV: Automates hyperparameter tuning by testing combinations of parameters.

Key Features of scikit-learn:
- Consistent API across models and utilities.
- Built-in support for preprocessing, feature selection, model evaluation, and ensemble methods.
- Extensive documentation and community support.

Use Case: Ideal for beginners and professionals alike to quickly prototype, evaluate, and optimize machine learning models.

#MachineLearning #ScikitLearn #Python #DataScience #MLPipeline #Classification #CrossValidation #HyperparameterTuning #SVM #GridSearchCV #DataPreprocessing

By: @DataScienceQ πŸš€