modin.pandas.Series.get¶
- Series.get(key, default=None) DataFrame | Series | Scalar [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/.tox/docs/lib/python3.9/site-packages/modin/pandas/base.py#L1889-L1899)¶
Get item from object for given key (ex: DataFrame column).
Returns default value if not found.
- Parameters:
key (object) –
- Return type:
same type as items contained in object
Examples
>>> df = pd.DataFrame( ... [ ... [24.3, 75.7, "high"], ... [31, 87.8, "high"], ... [22, 71.6, "medium"], ... [35, 95, "medium"], ... ], ... columns=["temp_celsius", "temp_fahrenheit", "windspeed"], ... index=pd.date_range(start="2014-02-12", end="2014-02-15", freq="D"), ... )
>>> df temp_celsius temp_fahrenheit windspeed 2014-02-12 24.3 75.7 high 2014-02-13 31.0 87.8 high 2014-02-14 22.0 71.6 medium 2014-02-15 35.0 95.0 medium
>>> df.get(["temp_celsius", "windspeed"]) temp_celsius windspeed 2014-02-12 24.3 high 2014-02-13 31.0 high 2014-02-14 22.0 medium 2014-02-15 35.0 medium
>>> ser = df['windspeed'] >>> ser.get('2014-02-13') 2014-02-13 high Freq: None, Name: windspeed, dtype: object
>>> ser.get('2014-02-10', '[unknown]') Series([], Freq: None, Name: windspeed, dtype: object)
Notes
Generally Snowpark pandas won’t raise KeyError or IndexError if any key is not found. So the result of get will be a result with existing keys or an empty result if no key is found. Default value won’t be used.