'Dict.get()' equivalent for pandas Series?
indexing, pandas, python, series
Solution
As mentioned in the comments, pandas implements `get` directly for Series.
So `s1.get('x', 0)` would return `0`
Problem
Does anyone know if there's an equivalent for the `Dict.get()` method for pandas Series? I've got a series that looks like this: ``` In [25]: s1 Out[25]: a 1 b 2 c 3 dtype: int64 ``` And I'd like to return a default value, such as 0, if I try to access an index that isn't there. For example, I'd like `s1.ix['z']` to return `0` instead of `KeyError`. I know pandas has great support for dealing with missing values in other circumstances, but I couldn't find anything specifically about this. Thank you!