Python Coding Questions & Answers for Data Analysis & Data Science
100 Python Coding Interview Questions & Answer
For Data Analysis and Data Scientists
1. Reverse a string
2. Check if a number is prime
3. Find factorial using recursion
4. Check palindrome string
5. Find largest number in a list
Python Coding Questions & Answers for Data Analysis & Data Science
6. Swap two variables
7. Count vowels in a string
8. Check Armstrong number
9. Generate Fibonacci series
[Link] GCD of two numbers
[Link] anagram
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] words in a sentence
[Link] duplicates in a list
[Link] second largest number in a list
[Link] if string contains only digits
[Link] nested list
[Link] dictionary by values
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] words in a string
[Link] leap year
[Link] two dictionaries
[Link] words by first letter
[Link] all pairs in list whose sum equals target
[Link] list of tuples into dictionary
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] top 3 most frequent elements in a list
[Link] a matrix
[Link] stack using Python list
[Link] queue using [Link]
[Link] random numbers without random module
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] string to title case
[Link] punctuation from string
[Link] CSV in pandas and display first 10 rows
[Link] rows where column value > 100
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] rows with missing values
[Link] missing values with column mean
[Link] two DataFrames on a column
[Link] data by column and calculate mean
[Link] DataFrame by multiple columns
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] custom function to column
[Link] number of unique values in a column
[Link] multiple columns in DataFrame
[Link] a NumPy array of zeros
[Link] a NumPy array from 1 to 10
[Link] 1D NumPy array to 2D
[Link] max and min in NumPy array
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] mean, median, std of array
[Link] first 3 elements of array
[Link] index of max in NumPy array
[Link] diagonal matrix in NumPy
[Link] two NumPy arrays element-wise
[Link] matrix multiplication
[Link] random NumPy array of shape 2x3
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] a NumPy array
[Link] unique values from NumPy array
[Link] negative values with zero
[Link] for NaN in NumPy array
[Link] NumPy array to Python list
[Link] rows in pandas with multiple conditions
[Link] pivot table in pandas
[Link] correlation matrix
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] DataFrame to CSV
[Link] specific columns
[Link] DataFrame by column descending
[Link] columns
[Link] rows with missing values
[Link] missing values with mean
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] column to datetime
[Link] year and month from datetime
[Link] duplicate rows
[Link] by column and sum
[Link] custom function to column
[Link] two DataFrames on key
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] two DataFrames vertically
[Link] top 2 rows by column
[Link] bottom 2 rows by column
[Link] missing values
[Link] specific value
[Link] categorical to dummy variables
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] cumulative sum
[Link] percentage of total
[Link] outliers using IQR
[Link] a numeric column using z-score
[Link] values between 0 and 1
[Link] dataset into train and test
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] simple linear regression
[Link] predictions
[Link] regression using R2 score
[Link] logistic regression
[Link] confusion matrix
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] accuracy, precision, recall, f1-score
[Link] k-fold cross-validation
[Link] decision tree classifier
[Link] random forest classifier
[Link] support vector machine classifier
[Link] features using StandardScaler
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] categorical using LabelEncoder
[Link]-hot encode categorical feature
[Link] dimensions using PCA
[Link] trained model with joblib
Python Coding Questions & Answers for Data Analysis & Data Science
[Link] trained model with joblib
100. Create pipeline with scaler and classifier
Compiled by: Ramesh Prajapati