Interview Q&A / Data Science

INTERVIEW Q&A · 56 QUESTIONS

Data Science interview questions

Statistics, pandas, cleaning data and exploratory analysis for analyst and data science roles.

  1. What is the difference between merge, join and concat in pandas?

    merge combines two DataFrames on matching column values, like a SQL join. join does the same but matches on the index by default. concat simply stacks DataFrames on top of each other (rows) or side by side (columns) without matching any keys.

    BeginnerIn-depth3 min read
  2. How does groupby work in pandas?

    groupby splits the rows into groups by key, applies a function such as sum or count to each group, and combines the results into a new object. Named aggregation lets you compute several summaries in one call.

    BeginnerQuick answer1 min read
  3. What is the difference between loc and iloc in pandas?

    loc selects by label (index values and column names) and includes the end of a slice. iloc selects by integer position and excludes the end, like normal Python slicing.

    BeginnerQuick answer1 min read
  4. When would you use pivot_table instead of groupby in pandas?

    pivot_table is groupby with the second key spread across columns, giving a cross-tab style summary. Use it when you want a grid for reading or charting, and groupby when you want a long list of groups.

    BeginnerQuick answer1 min read