Data & Analysis Libraries
The libraries that do the actual data work in code — pandas and NumPy in Python, dplyr and ggplot2 in R, plus the plotting layers on top. Interviewers ask about them because they reveal whether you think in vectorized operations or in loops.
on this pageshowhide
explore
- Pandas143 questions
- Series, DataFrame and Index15 questions
- Selectors and Setters17 questions
- Choosing a Dtype19 questions
- Missing Data10 questions
- Deriving Columns11 questions
- Order and Uniqueness12 questions
- GroupBy11 questions
- Merge, Join, and Concat6 questions
- Reshaping and Pivoting6 questions
- Temporal Data12 questions
- Readers and Writers12 questions
- Vectorized Speed and Memory6 questions
- Plotting and Interop6 questions
- NumPyempty
- ndarray and Dtypesempty
- Indexing and Slicingempty
- Broadcastingempty
- Linear Algebraempty
- Matplotlibempty
- Seabornempty
- dplyrempty
- ggplot2empty
- Kotlin DataFrameempty
- Working With Data in One Process295 questions
- Tables and Arrays24 questions
- Column Types and What They Cost20 questions
- Whole Columns at a Time27 questions
- Getting At Rows and Columns26 questions
- Absent Values22 questions
- Split, Apply, Combine25 questions
- Putting Two Tables Together25 questions
- Long and Wide20 questions
- Time-Indexed Data23 questions
- Getting Data In and Out22 questions
- Saying It With a Chart22 questions
- When One Machine Is Not Enough18 questions
- Trusting the Result21 questions
questions
438 · 2 sectionsIn pandas, how does a DataFrame built from a dict of lists differ from one built from a list of dicts like API records?
basics
~20 sA dict of lists is column-oriented: each key is a column and all lists must share one length. A list of dicts is row-oriented: each dict is a row, columns are the union of keys, and a missing key becomes NaN.
In pandas, what do shape, dtypes, head(), info() and describe() each tell you about a DataFrame you have just built?
basics
~20 sshape gives (rows, columns); dtypes gives each column's type; head() shows the first five rows; info() prints the index, each column's non-null count and dtype; describe() gives count, mean, spread and quartiles of numeric columns unless include='all'.
In pandas 3.0, if you take `email = customers['email']` and change a value in `email`, does the `customers` DataFrame change?
basics
~20 sNo. In pandas 3.0 Copy-on-Write makes every indexing result, including a column taken with [], behave as a copy, so editing it leaves the parent DataFrame untouched; to change the frame, write to the frame itself.
In pandas, what do DataFrame.set_index and reset_index do to a product table's row labels, and what does drop change in each?
basics
~20 sset_index moves one or more columns into the row labels and, by default, removes them from the columns; reset_index moves the labels back into columns and installs a fresh RangeIndex, or discards them when drop=True.
In pandas, a scraped price column holds strings like '$1,200' and 'N/A' — why does astype(float) raise, and how do you convert it?
basics
~10 sastype(float) is all-or-nothing: one value that does not parse, such as '$1,200' or 'N/A', raises ValueError. Strip the symbols with .str.replace, call pd.to_numeric(errors='coerce') so leftovers become NaN, then count those NaN.
Two columns of 1,000 values each, taken from different tables, are added together — what decides which value pairs with which?
basics
~10 sThe tool decides, not the expression. Designs that carry a per-row identifier pair the two operands by that identifier first; designs that carry none pair strictly by position and refuse operands of different lengths.
A match of two tables on their key columns returns zero rows, though the same codes print on both sides. Why?
basics
~20 sEquality compares stored values, not the rendering. Two codes that print alike can differ by letter case, leading or trailing spaces, an invisible character, a lost leading zero, or one side holding digits as text and the other as numbers.
Matching 1,000 orders to a customer list on customer id returns 940 rows: which match shape was used, and what do the others keep?
basics
~20 sLosing 60 rows means the match kept only rows partnered on both sides. The three alternatives keep the orders table whole, the customer list whole, or both whole, and unpartnered rows then survive with the other side's columns holding the absent-value marker.
Twelve monthly pieces are stacked into one longer table - how does that differ from gluing two tables side by side?
basics
~20 sStacking adds records, so the result is longer and the hazard is two pieces whose column sets do not agree. Gluing side by side adds attributes, so the result is wider and the hazard is rows paired in an order nobody checked.
A match of 1,000 order rows against a customer reference table returns 1,340 rows - how is that possible?
basics
~20 sA key match returns, for each key value, the first side's occurrence count multiplied by the second side's. If a customer identifier appears more than once in the reference table, the orders carrying it are copied and the total grows.