Compute the Tukey five-number summary of a pandas Series
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: easy
Interview Round: Other
Implement `five_number_summary(s: pd.Series) -> pd.Series` that returns the five-number summary of a numeric Series as a `float64` Series indexed exactly `['min', 'q1', 'median', 'q3', 'max']`, in that order.
Requirements:
- `q1`, `median` and `q3` are `s.quantile(0.25)`, `s.quantile(0.5)` and `s.quantile(0.75)` with the default `interpolation='linear'`. `min` and `max` are `s.min()` and `s.max()`.
- NaNs are skipped (the pandas default).
- The result has `.name is None` and `.index.name is None`.
Example:
```python
s = pd.Series([1, 2, 3, 4, 5])
five_number_summary(s)
# min 1.0
# q1 2.0
# median 3.0
# q3 4.0
# max 5.0
# dtype: float64
```
```hint Check more than the values
`assert_series_equal` compares the dtype, the index order and the names as well as the numbers. Think about what each of those will be for an integer input Series that has a name.
```
### Constraints & Assumptions
- The input is a numeric Series of integers or floats and can contain NaN.
- The result is checked with `pd.testing.assert_series_equal` on a fixed Series of 12 floats, one of them NaN.
### What a Strong Answer Covers
- Which quantile definition produces `q1`, `median` and `q3`, and how NaN values are treated.
- How the output index order is guaranteed.
- How the result ends up `float64` when the input holds integers.
- What happens to `.name` and `.index.name`, given that the input Series may carry a name.
- Edge cases such as an empty or all-NaN Series.
### Follow-up Questions
- Tukey's original summary uses hinges (the medians of the lower and upper halves). How do they differ from linear-interpolated quartiles, and when does the difference matter?
- How would you compute the same summary for every numeric column of a DataFrame in one call?
- How would you get the five-number summary of a column that is too large to fit in memory?
Overview: Write a pandas function that returns the minimum, quartiles, median and maximum of a numeric Series as a float64 Series with a fixed index order. It tests pandas quantile interpolation, NaN handling, dtype control and the metadata that a strict Series equality check compares.