Time Series
50 questions available
Questions
What is the result of subtracting `datetime(2008, 6, 24, 8, 15)` from `datetime(2011, 1, 7)` using Python's datetime module?
View answer and explanationWhat does 'NaT' represent in the pandas library?
View answer and explanationWhen indexing a pandas time series that has duplicate timestamps, what is the result if you use a duplicated timestamp as the indexer?
View answer and explanationWhat is the primary function of `pandas.date_range`?
View answer and explanationWhat is the effect of passing a frequency string to the `shift` method, such as `ts.shift(2, freq='M')`?
View answer and explanationWhat is the result when two time series with different time zones are combined in pandas?
View answer and explanationIn pandas, what is the process of converting higher frequency time series data to a lower frequency called?
View answer and explanationWhat is the purpose of the `tz_localize` method on a pandas time series?
View answer and explanationHow does the `expanding` operator differ from the `rolling` operator in pandas?
View answer and explanationWhat does a `pandas.Period` object represent?
View answer and explanationIf a pandas `Period` object is defined as `p = pd.Period("2011", freq="A-DEC")`, what is the result of `p.asfreq("M", how="start")`?
View answer and explanationIn the context of `resample`, what does the `ohlc` aggregate function compute?
View answer and explanationWhat is the purpose of the `span` parameter in the `ewm` (exponentially weighted moving) operator?
View answer and explanationTo perform a grouped resampling operation on a DataFrame with a time column and a key column, what object can be used with `groupby`?
View answer and explanationAccording to the text, a pandas `Timestamp` can be substituted for a Python `datetime` object in most places. Is the reverse also true?
View answer and explanationIn the context of downsampling with `resample`, which two aspects must be considered about the time intervals or bins?
View answer and explanationWhat is the result of applying the `rollforward` method of a `MonthEnd` offset to the date `datetime(2011, 11, 17)`?
View answer and explanationWhat is the key difference between `ravel` and `flatten` when converting a multidimensional NumPy array to one dimension?
View answer and explanationWhen creating a `PeriodIndex` from separate year and quarter columns, such as `pd.PeriodIndex(year=data["year"], quarter=data["quarter"], freq="Q-DEC")`, what is the result?
View answer and explanationTo convert a time series indexed by Timestamps to one indexed by Periods, which method should be used?
View answer and explanationWhat is the function of the `min_periods` argument in a `rolling` operation, for example `rolling(250, min_periods=10)`?
View answer and explanationIf you create a pandas date range using `pd.date_range("2000-01-01", "2000-12-01", freq="BM")`, what kind of dates will be in the resulting index?
View answer and explanationWhich method is used to convert a time series from a lower frequency to a higher frequency without aggregation, introducing missing values?
View answer and explanationWhat does a call to `ts.resample('D')` on a time series `ts` return?
View answer and explanationWhen using `pd.date_range` for a period between "2012-04-01" and "2012-06-01", what is the default frequency `freq`?
View answer and explanationWhat is the difference in output between `p.asfreq("D", how="start")` and `p.asfreq("D", how="end")` for a quarterly period `p = pd.Period("2012Q4", freq="Q-JAN")`?
View answer and explanationIf `ts` is a pandas Series with a DatetimeIndex, what does the expression `ts[::2]` do?
View answer and explanationWhen localizing a naive time series with `ts.tz_localize("America/New_York")`, what happens during a Daylight Saving Time (DST) transition?
View answer and explanationHow can you select a slice of a long time series `longer_ts` corresponding to the entire year 2001?
View answer and explanationWhat does passing the `normalize=True` argument to `pd.date_range()` accomplish?
View answer and explanationIf `p = pd.Period("2011", freq="A-JUN")`, what is the result of `p.asfreq("M", how="end")`?
View answer and explanationWhat is a key constraint for the target frequency when upsampling with periods?
View answer and explanationHow can you perform a binary moving window operation, such as a rolling correlation between two time series `returns["AAPL"]` and `spx_rets`?
View answer and explanationWhat is the requirement for a user-defined function passed to the `apply` method of a rolling object?
View answer and explanationWhat does a timedelta object such as `timedelta(12)` represent when added to a datetime object?
View answer and explanationHow can you select data from a time series `ts` for a specific date using a string, for example, January 10, 2011?
View answer and explanationTo convert a time series to a fixed daily frequency, you can call `ts.resample('D')`. What must be done after this call to get an aggregated result?
View answer and explanationWhat is the key difference between the frequency strings 'M' and 'BM' in pandas?
View answer and explanationWhen using `ts.shift(2)`, what values are introduced into the time series?
View answer and explanationTo convert a time-zone-aware pandas Timestamp from UTC to the 'America/New_York' time zone, which method is used?
View answer and explanationIf two periods have the same frequency, what does their difference represent?
View answer and explanationIn the context of upsampling a time series using `resample`, how can you fill the newly created `NaN` values with the last valid observation?
View answer and explanationWhich pandas function is used to create a regular range of `Period` objects?
View answer and explanationIf a time series has a frequency of 'W-WED' (weekly on Wednesday), resampling it to 'W-FRI' (weekly on Friday) is considered what type of operation?
View answer and explanationWhat is the data type of scalar values from a pandas `DatetimeIndex`?
View answer and explanationWhen resampling time series data with `ts.resample("5min")`, what does the default behavior for `closed` and `label` produce for a 00:00 to 00:05 interval?
View answer and explanationTo get a date range representing the third Friday of each month, what frequency string should be used?
View answer and explanationWhen an operation is performed on two differently indexed time series, what is the fundamental principle of how pandas handles the operation?
View answer and explanationTo create a frequency of four hours in pandas, which string alias can be used?
View answer and explanationA common use of the naive `shift` method is to compute consecutive percent changes. How is this expressed for a time series `ts`?
View answer and explanation