doc_content stringlengths 1 386k | doc_id stringlengths 5 188 |
|---|---|
pandas.Timestamp.year Timestamp.year | pandas.reference.api.pandas.timestamp.year |
pandas.to_datetime pandas.to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False, utc=None, format=None, exact=True, unit=None, infer_datetime_format=False, origin='unix', cache=True)[source]
Convert argument to datetime. This function converts a scalar, array-like, Series or DataFrame/dict-like to a pandas datetime object. Parameters
arg:int, float, str, datetime, list, tuple, 1-d array, Series, DataFrame/dict-like
The object to convert to a datetime. If a DataFrame is provided, the method expects minimally the following columns: "year", "month", "day".
errors:{‘ignore’, ‘raise’, ‘coerce’}, default ‘raise’
If 'raise', then invalid parsing will raise an exception. If 'coerce', then invalid parsing will be set as NaT. If 'ignore', then invalid parsing will return the input.
dayfirst:bool, default False
Specify a date parse order if arg is str or is list-like. If True, parses dates with the day first, e.g. "10/11/12" is parsed as 2012-11-10. Warning dayfirst=True is not strict, but will prefer to parse with day first. If a delimited date string cannot be parsed in accordance with the given dayfirst option, e.g. to_datetime(['31-12-2021']), then a warning will be shown.
yearfirst:bool, default False
Specify a date parse order if arg is str or is list-like. If True parses dates with the year first, e.g. "10/11/12" is parsed as 2010-11-12. If both dayfirst and yearfirst are True, yearfirst is preceded (same as dateutil). Warning yearfirst=True is not strict, but will prefer to parse with year first.
utc:bool, default None
Control timezone-related parsing, localization and conversion. If True, the function always returns a timezone-aware UTC-localized Timestamp, Series or DatetimeIndex. To do this, timezone-naive inputs are localized as UTC, while timezone-aware inputs are converted to UTC. If False (default), inputs will not be coerced to UTC. Timezone-naive inputs will remain naive, while timezone-aware ones will keep their time offsets. Limitations exist for mixed offsets (typically, daylight savings), see Examples section for details. See also: pandas general documentation about timezone conversion and localization.
format:str, default None
The strftime to parse time, e.g. "%d/%m/%Y". Note that "%f" will parse all the way up to nanoseconds. See strftime documentation for more information on choices.
exact:bool, default True
Control how format is used: If True, require an exact format match. If False, allow the format to match anywhere in the target string.
unit:str, default ‘ns’
The unit of the arg (D,s,ms,us,ns) denote the unit, which is an integer or float number. This will be based off the origin. Example, with unit='ms' and origin='unix' (the default), this would calculate the number of milliseconds to the unix epoch start.
infer_datetime_format:bool, default False
If True and no format is given, attempt to infer the format of the datetime strings based on the first non-NaN element, and if it can be inferred, switch to a faster method of parsing them. In some cases this can increase the parsing speed by ~5-10x.
origin:scalar, default ‘unix’
Define the reference date. The numeric values would be parsed as number of units (defined by unit) since this reference date. If 'unix' (or POSIX) time; origin is set to 1970-01-01. If 'julian', unit must be 'D', and origin is set to beginning of Julian Calendar. Julian day number 0 is assigned to the day starting at noon on January 1, 4713 BC. If Timestamp convertible, origin is set to Timestamp identified by origin.
cache:bool, default True
If True, use a cache of unique, converted dates to apply the datetime conversion. May produce significant speed-up when parsing duplicate date strings, especially ones with timezone offsets. The cache is only used when there are at least 50 values. The presence of out-of-bounds values will render the cache unusable and may slow down parsing. Changed in version 0.25.0: changed default value from False to True. Returns
datetime
If parsing succeeded. Return type depends on input (types in parenthesis correspond to fallback in case of unsuccessful timezone or out-of-range timestamp parsing): scalar: Timestamp (or datetime.datetime) array-like: DatetimeIndex (or Series with object dtype containing datetime.datetime) Series: Series of datetime64 dtype (or Series of object dtype containing datetime.datetime) DataFrame: Series of datetime64 dtype (or Series of object dtype containing datetime.datetime) Raises
ParserError
When parsing a date from string fails. ValueError
When another datetime conversion error happens. For example when one of ‘year’, ‘month’, day’ columns is missing in a DataFrame, or when a Timezone-aware datetime.datetime is found in an array-like of mixed time offsets, and utc=False. See also DataFrame.astype
Cast argument to a specified dtype. to_timedelta
Convert argument to timedelta. convert_dtypes
Convert dtypes. Notes Many input types are supported, and lead to different output types: scalars can be int, float, str, datetime object (from stdlib datetime module or numpy). They are converted to Timestamp when possible, otherwise they are converted to datetime.datetime. None/NaN/null scalars are converted to NaT. array-like can contain int, float, str, datetime objects. They are converted to DatetimeIndex when possible, otherwise they are converted to Index with object dtype, containing datetime.datetime. None/NaN/null entries are converted to NaT in both cases. Series are converted to Series with datetime64 dtype when possible, otherwise they are converted to Series with object dtype, containing datetime.datetime. None/NaN/null entries are converted to NaT in both cases. DataFrame/dict-like are converted to Series with datetime64 dtype. For each row a datetime is created from assembling the various dataframe columns. Column keys can be common abbreviations like [‘year’, ‘month’, ‘day’, ‘minute’, ‘second’, ‘ms’, ‘us’, ‘ns’]) or plurals of the same. The following causes are responsible for datetime.datetime objects being returned (possibly inside an Index or a Series with object dtype) instead of a proper pandas designated type (Timestamp, DatetimeIndex or Series with datetime64 dtype): when any input element is before Timestamp.min or after Timestamp.max, see timestamp limitations. when utc=False (default) and the input is an array-like or Series containing mixed naive/aware datetime, or aware with mixed time offsets. Note that this happens in the (quite frequent) situation when the timezone has a daylight savings policy. In that case you may wish to use utc=True. Examples Handling various input formats Assembling a datetime from multiple columns of a DataFrame. The keys can be common abbreviations like [‘year’, ‘month’, ‘day’, ‘minute’, ‘second’, ‘ms’, ‘us’, ‘ns’]) or plurals of the same
>>> df = pd.DataFrame({'year': [2015, 2016],
... 'month': [2, 3],
... 'day': [4, 5]})
>>> pd.to_datetime(df)
0 2015-02-04
1 2016-03-05
dtype: datetime64[ns]
Passing infer_datetime_format=True can often-times speedup a parsing if its not an ISO8601 format exactly, but in a regular format.
>>> s = pd.Series(['3/11/2000', '3/12/2000', '3/13/2000'] * 1000)
>>> s.head()
0 3/11/2000
1 3/12/2000
2 3/13/2000
3 3/11/2000
4 3/12/2000
dtype: object
>>> %timeit pd.to_datetime(s, infer_datetime_format=True)
100 loops, best of 3: 10.4 ms per loop
>>> %timeit pd.to_datetime(s, infer_datetime_format=False)
1 loop, best of 3: 471 ms per loop
Using a unix epoch time
>>> pd.to_datetime(1490195805, unit='s')
Timestamp('2017-03-22 15:16:45')
>>> pd.to_datetime(1490195805433502912, unit='ns')
Timestamp('2017-03-22 15:16:45.433502912')
Warning For float arg, precision rounding might happen. To prevent unexpected behavior use a fixed-width exact type. Using a non-unix epoch origin
>>> pd.to_datetime([1, 2, 3], unit='D',
... origin=pd.Timestamp('1960-01-01'))
DatetimeIndex(['1960-01-02', '1960-01-03', '1960-01-04'],
dtype='datetime64[ns]', freq=None)
Non-convertible date/times If a date does not meet the timestamp limitations, passing errors='ignore' will return the original input instead of raising any exception. Passing errors='coerce' will force an out-of-bounds date to NaT, in addition to forcing non-dates (or non-parseable dates) to NaT.
>>> pd.to_datetime('13000101', format='%Y%m%d', errors='ignore')
datetime.datetime(1300, 1, 1, 0, 0)
>>> pd.to_datetime('13000101', format='%Y%m%d', errors='coerce')
NaT
Timezones and time offsets The default behaviour (utc=False) is as follows: Timezone-naive inputs are converted to timezone-naive DatetimeIndex:
>>> pd.to_datetime(['2018-10-26 12:00', '2018-10-26 13:00:15'])
DatetimeIndex(['2018-10-26 12:00:00', '2018-10-26 13:00:15'],
dtype='datetime64[ns]', freq=None)
Timezone-aware inputs with constant time offset are converted to timezone-aware DatetimeIndex:
>>> pd.to_datetime(['2018-10-26 12:00 -0500', '2018-10-26 13:00 -0500'])
DatetimeIndex(['2018-10-26 12:00:00-05:00', '2018-10-26 13:00:00-05:00'],
dtype='datetime64[ns, pytz.FixedOffset(-300)]', freq=None)
However, timezone-aware inputs with mixed time offsets (for example issued from a timezone with daylight savings, such as Europe/Paris) are not successfully converted to a DatetimeIndex. Instead a simple Index containing datetime.datetime objects is returned:
>>> pd.to_datetime(['2020-10-25 02:00 +0200', '2020-10-25 04:00 +0100'])
Index([2020-10-25 02:00:00+02:00, 2020-10-25 04:00:00+01:00],
dtype='object')
A mix of timezone-aware and timezone-naive inputs is converted to a timezone-aware DatetimeIndex if the offsets of the timezone-aware are constant:
>>> from datetime import datetime
>>> pd.to_datetime(["2020-01-01 01:00 -01:00", datetime(2020, 1, 1, 3, 0)])
DatetimeIndex(['2020-01-01 01:00:00-01:00', '2020-01-01 02:00:00-01:00'],
dtype='datetime64[ns, pytz.FixedOffset(-60)]', freq=None)
Finally, mixing timezone-aware strings and datetime.datetime always raises an error, even if the elements all have the same time offset.
>>> from datetime import datetime, timezone, timedelta
>>> d = datetime(2020, 1, 1, 18, tzinfo=timezone(-timedelta(hours=1)))
>>> pd.to_datetime(["2020-01-01 17:00 -0100", d])
Traceback (most recent call last):
...
ValueError: Tz-aware datetime.datetime cannot be converted to datetime64
unless utc=True
Setting utc=True solves most of the above issues: Timezone-naive inputs are localized as UTC
>>> pd.to_datetime(['2018-10-26 12:00', '2018-10-26 13:00'], utc=True)
DatetimeIndex(['2018-10-26 12:00:00+00:00', '2018-10-26 13:00:00+00:00'],
dtype='datetime64[ns, UTC]', freq=None)
Timezone-aware inputs are converted to UTC (the output represents the exact same datetime, but viewed from the UTC time offset +00:00).
>>> pd.to_datetime(['2018-10-26 12:00 -0530', '2018-10-26 12:00 -0500'],
... utc=True)
DatetimeIndex(['2018-10-26 17:30:00+00:00', '2018-10-26 17:00:00+00:00'],
dtype='datetime64[ns, UTC]', freq=None)
Inputs can contain both naive and aware, string or datetime, the above rules still apply
>>> pd.to_datetime(['2018-10-26 12:00', '2018-10-26 12:00 -0530',
... datetime(2020, 1, 1, 18),
... datetime(2020, 1, 1, 18,
... tzinfo=timezone(-timedelta(hours=1)))],
... utc=True)
DatetimeIndex(['2018-10-26 12:00:00+00:00', '2018-10-26 17:30:00+00:00',
'2020-01-01 18:00:00+00:00', '2020-01-01 19:00:00+00:00'],
dtype='datetime64[ns, UTC]', freq=None) | pandas.reference.api.pandas.to_datetime |
pandas.to_numeric pandas.to_numeric(arg, errors='raise', downcast=None)[source]
Convert argument to a numeric type. The default return dtype is float64 or int64 depending on the data supplied. Use the downcast parameter to obtain other dtypes. Please note that precision loss may occur if really large numbers are passed in. Due to the internal limitations of ndarray, if numbers smaller than -9223372036854775808 (np.iinfo(np.int64).min) or larger than 18446744073709551615 (np.iinfo(np.uint64).max) are passed in, it is very likely they will be converted to float so that they can stored in an ndarray. These warnings apply similarly to Series since it internally leverages ndarray. Parameters
arg:scalar, list, tuple, 1-d array, or Series
Argument to be converted.
errors:{‘ignore’, ‘raise’, ‘coerce’}, default ‘raise’
If ‘raise’, then invalid parsing will raise an exception. If ‘coerce’, then invalid parsing will be set as NaN. If ‘ignore’, then invalid parsing will return the input.
downcast:str, default None
Can be ‘integer’, ‘signed’, ‘unsigned’, or ‘float’. If not None, and if the data has been successfully cast to a numerical dtype (or if the data was numeric to begin with), downcast that resulting data to the smallest numerical dtype possible according to the following rules: ‘integer’ or ‘signed’: smallest signed int dtype (min.: np.int8) ‘unsigned’: smallest unsigned int dtype (min.: np.uint8) ‘float’: smallest float dtype (min.: np.float32) As this behaviour is separate from the core conversion to numeric values, any errors raised during the downcasting will be surfaced regardless of the value of the ‘errors’ input. In addition, downcasting will only occur if the size of the resulting data’s dtype is strictly larger than the dtype it is to be cast to, so if none of the dtypes checked satisfy that specification, no downcasting will be performed on the data. Returns
ret
Numeric if parsing succeeded. Return type depends on input. Series if Series, otherwise ndarray. See also DataFrame.astype
Cast argument to a specified dtype. to_datetime
Convert argument to datetime. to_timedelta
Convert argument to timedelta. numpy.ndarray.astype
Cast a numpy array to a specified type. DataFrame.convert_dtypes
Convert dtypes. Examples Take separate series and convert to numeric, coercing when told to
>>> s = pd.Series(['1.0', '2', -3])
>>> pd.to_numeric(s)
0 1.0
1 2.0
2 -3.0
dtype: float64
>>> pd.to_numeric(s, downcast='float')
0 1.0
1 2.0
2 -3.0
dtype: float32
>>> pd.to_numeric(s, downcast='signed')
0 1
1 2
2 -3
dtype: int8
>>> s = pd.Series(['apple', '1.0', '2', -3])
>>> pd.to_numeric(s, errors='ignore')
0 apple
1 1.0
2 2
3 -3
dtype: object
>>> pd.to_numeric(s, errors='coerce')
0 NaN
1 1.0
2 2.0
3 -3.0
dtype: float64
Downcasting of nullable integer and floating dtypes is supported:
>>> s = pd.Series([1, 2, 3], dtype="Int64")
>>> pd.to_numeric(s, downcast="integer")
0 1
1 2
2 3
dtype: Int8
>>> s = pd.Series([1.0, 2.1, 3.0], dtype="Float64")
>>> pd.to_numeric(s, downcast="float")
0 1.0
1 2.1
2 3.0
dtype: Float32 | pandas.reference.api.pandas.to_numeric |
pandas.to_timedelta pandas.to_timedelta(arg, unit=None, errors='raise')[source]
Convert argument to timedelta. Timedeltas are absolute differences in times, expressed in difference units (e.g. days, hours, minutes, seconds). This method converts an argument from a recognized timedelta format / value into a Timedelta type. Parameters
arg:str, timedelta, list-like or Series
The data to be converted to timedelta. Deprecated since version 1.2: Strings with units ‘M’, ‘Y’ and ‘y’ do not represent unambiguous timedelta values and will be removed in a future version
unit:str, optional
Denotes the unit of the arg for numeric arg. Defaults to "ns". Possible values: ‘W’ ‘D’ / ‘days’ / ‘day’ ‘hours’ / ‘hour’ / ‘hr’ / ‘h’ ‘m’ / ‘minute’ / ‘min’ / ‘minutes’ / ‘T’ ‘S’ / ‘seconds’ / ‘sec’ / ‘second’ ‘ms’ / ‘milliseconds’ / ‘millisecond’ / ‘milli’ / ‘millis’ / ‘L’ ‘us’ / ‘microseconds’ / ‘microsecond’ / ‘micro’ / ‘micros’ / ‘U’ ‘ns’ / ‘nanoseconds’ / ‘nano’ / ‘nanos’ / ‘nanosecond’ / ‘N’ Changed in version 1.1.0: Must not be specified when arg context strings and errors="raise".
errors:{‘ignore’, ‘raise’, ‘coerce’}, default ‘raise’
If ‘raise’, then invalid parsing will raise an exception. If ‘coerce’, then invalid parsing will be set as NaT. If ‘ignore’, then invalid parsing will return the input. Returns
timedelta
If parsing succeeded. Return type depends on input: list-like: TimedeltaIndex of timedelta64 dtype Series: Series of timedelta64 dtype scalar: Timedelta See also DataFrame.astype
Cast argument to a specified dtype. to_datetime
Convert argument to datetime. convert_dtypes
Convert dtypes. Notes If the precision is higher than nanoseconds, the precision of the duration is truncated to nanoseconds for string inputs. Examples Parsing a single string to a Timedelta:
>>> pd.to_timedelta('1 days 06:05:01.00003')
Timedelta('1 days 06:05:01.000030')
>>> pd.to_timedelta('15.5us')
Timedelta('0 days 00:00:00.000015500')
Parsing a list or array of strings:
>>> pd.to_timedelta(['1 days 06:05:01.00003', '15.5us', 'nan'])
TimedeltaIndex(['1 days 06:05:01.000030', '0 days 00:00:00.000015500', NaT],
dtype='timedelta64[ns]', freq=None)
Converting numbers by specifying the unit keyword argument:
>>> pd.to_timedelta(np.arange(5), unit='s')
TimedeltaIndex(['0 days 00:00:00', '0 days 00:00:01', '0 days 00:00:02',
'0 days 00:00:03', '0 days 00:00:04'],
dtype='timedelta64[ns]', freq=None)
>>> pd.to_timedelta(np.arange(5), unit='d')
TimedeltaIndex(['0 days', '1 days', '2 days', '3 days', '4 days'],
dtype='timedelta64[ns]', freq=None) | pandas.reference.api.pandas.to_timedelta |
pandas.tseries.frequencies.to_offset pandas.tseries.frequencies.to_offset()
Return DateOffset object from string or tuple representation or datetime.timedelta object. Parameters
freq:str, datetime.timedelta, BaseOffset or None
Returns
DateOffset or None
Raises
ValueError
If freq is an invalid frequency See also BaseOffset
Standard kind of date increment used for a date range. Examples
>>> to_offset("5min")
<5 * Minutes>
>>> to_offset("1D1H")
<25 * Hours>
>>> to_offset("2W")
<2 * Weeks: weekday=6>
>>> to_offset("2B")
<2 * BusinessDays>
>>> to_offset(pd.Timedelta(days=1))
<Day>
>>> to_offset(Hour())
<Hour> | pandas.reference.api.pandas.tseries.frequencies.to_offset |
pandas.tseries.offsets.BDay pandas.tseries.offsets.BDay
alias of pandas._libs.tslibs.offsets.BusinessDay | pandas.reference.api.pandas.tseries.offsets.bday |
pandas.tseries.offsets.BMonthBegin pandas.tseries.offsets.BMonthBegin
alias of pandas._libs.tslibs.offsets.BusinessMonthBegin | pandas.reference.api.pandas.tseries.offsets.bmonthbegin |
pandas.tseries.offsets.BMonthEnd pandas.tseries.offsets.BMonthEnd
alias of pandas._libs.tslibs.offsets.BusinessMonthEnd | pandas.reference.api.pandas.tseries.offsets.bmonthend |
pandas.tseries.offsets.BQuarterBegin classpandas.tseries.offsets.BQuarterBegin
DateOffset increments between the first business day of each Quarter. startingMonth = 1 corresponds to dates like 1/01/2007, 4/01/2007, … startingMonth = 2 corresponds to dates like 2/01/2007, 5/01/2007, … startingMonth = 3 corresponds to dates like 3/01/2007, 6/01/2007, … Examples
>>> from pandas.tseries.offsets import BQuarterBegin
>>> ts = pd.Timestamp('2020-05-24 05:01:15')
>>> ts + BQuarterBegin()
Timestamp('2020-06-01 05:01:15')
>>> ts + BQuarterBegin(2)
Timestamp('2020-09-01 05:01:15')
>>> ts + BQuarterBegin(startingMonth=2)
Timestamp('2020-08-03 05:01:15')
>>> ts + BQuarterBegin(-1)
Timestamp('2020-03-02 05:01:15')
Attributes
base Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
n
name
nanos
normalize
rule_code
startingMonth Methods
__call__(*args, **kwargs) Call self as a function.
rollback Roll provided date backward to next offset only if not on offset.
rollforward Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset | pandas.reference.api.pandas.tseries.offsets.bquarterbegin |
pandas.tseries.offsets.BQuarterBegin.__call__ BQuarterBegin.__call__(*args, **kwargs)
Call self as a function. | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.__call__ |
pandas.tseries.offsets.BQuarterBegin.apply BQuarterBegin.apply() | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.apply |
pandas.tseries.offsets.BQuarterBegin.apply_index BQuarterBegin.apply_index(other) | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.apply_index |
pandas.tseries.offsets.BQuarterBegin.base BQuarterBegin.base
Returns a copy of the calling offset object with n=1 and all other attributes equal. | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.base |
pandas.tseries.offsets.BQuarterBegin.copy BQuarterBegin.copy() | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.copy |
pandas.tseries.offsets.BQuarterBegin.freqstr BQuarterBegin.freqstr | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.freqstr |
pandas.tseries.offsets.BQuarterBegin.is_anchored BQuarterBegin.is_anchored() | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.is_anchored |
pandas.tseries.offsets.BQuarterBegin.is_month_end BQuarterBegin.is_month_end() | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.is_month_end |
pandas.tseries.offsets.BQuarterBegin.is_month_start BQuarterBegin.is_month_start() | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.is_month_start |
pandas.tseries.offsets.BQuarterBegin.is_on_offset BQuarterBegin.is_on_offset() | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.is_on_offset |
pandas.tseries.offsets.BQuarterBegin.is_quarter_end BQuarterBegin.is_quarter_end() | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.is_quarter_end |
pandas.tseries.offsets.BQuarterBegin.is_quarter_start BQuarterBegin.is_quarter_start() | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.is_quarter_start |
pandas.tseries.offsets.BQuarterBegin.is_year_end BQuarterBegin.is_year_end() | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.is_year_end |
pandas.tseries.offsets.BQuarterBegin.is_year_start BQuarterBegin.is_year_start() | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.is_year_start |
pandas.tseries.offsets.BQuarterBegin.isAnchored BQuarterBegin.isAnchored() | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.isanchored |
pandas.tseries.offsets.BQuarterBegin.kwds BQuarterBegin.kwds | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.kwds |
pandas.tseries.offsets.BQuarterBegin.n BQuarterBegin.n | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.n |
pandas.tseries.offsets.BQuarterBegin.name BQuarterBegin.name | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.name |
pandas.tseries.offsets.BQuarterBegin.nanos BQuarterBegin.nanos | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.nanos |
pandas.tseries.offsets.BQuarterBegin.normalize BQuarterBegin.normalize | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.normalize |
pandas.tseries.offsets.BQuarterBegin.onOffset BQuarterBegin.onOffset() | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.onoffset |
pandas.tseries.offsets.BQuarterBegin.rollback BQuarterBegin.rollback()
Roll provided date backward to next offset only if not on offset. Returns
TimeStamp
Rolled timestamp if not on offset, otherwise unchanged timestamp. | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.rollback |
pandas.tseries.offsets.BQuarterBegin.rollforward BQuarterBegin.rollforward()
Roll provided date forward to next offset only if not on offset. Returns
TimeStamp
Rolled timestamp if not on offset, otherwise unchanged timestamp. | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.rollforward |
pandas.tseries.offsets.BQuarterBegin.rule_code BQuarterBegin.rule_code | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.rule_code |
pandas.tseries.offsets.BQuarterBegin.startingMonth BQuarterBegin.startingMonth | pandas.reference.api.pandas.tseries.offsets.bquarterbegin.startingmonth |
pandas.tseries.offsets.BQuarterEnd classpandas.tseries.offsets.BQuarterEnd
DateOffset increments between the last business day of each Quarter. startingMonth = 1 corresponds to dates like 1/31/2007, 4/30/2007, … startingMonth = 2 corresponds to dates like 2/28/2007, 5/31/2007, … startingMonth = 3 corresponds to dates like 3/30/2007, 6/29/2007, … Examples
>>> from pandas.tseries.offsets import BQuarterEnd
>>> ts = pd.Timestamp('2020-05-24 05:01:15')
>>> ts + BQuarterEnd()
Timestamp('2020-06-30 05:01:15')
>>> ts + BQuarterEnd(2)
Timestamp('2020-09-30 05:01:15')
>>> ts + BQuarterEnd(1, startingMonth=2)
Timestamp('2020-05-29 05:01:15')
>>> ts + BQuarterEnd(startingMonth=2)
Timestamp('2020-05-29 05:01:15')
Attributes
base Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
n
name
nanos
normalize
rule_code
startingMonth Methods
__call__(*args, **kwargs) Call self as a function.
rollback Roll provided date backward to next offset only if not on offset.
rollforward Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset | pandas.reference.api.pandas.tseries.offsets.bquarterend |
pandas.tseries.offsets.BQuarterEnd.__call__ BQuarterEnd.__call__(*args, **kwargs)
Call self as a function. | pandas.reference.api.pandas.tseries.offsets.bquarterend.__call__ |
pandas.tseries.offsets.BQuarterEnd.apply BQuarterEnd.apply() | pandas.reference.api.pandas.tseries.offsets.bquarterend.apply |
pandas.tseries.offsets.BQuarterEnd.apply_index BQuarterEnd.apply_index(other) | pandas.reference.api.pandas.tseries.offsets.bquarterend.apply_index |
pandas.tseries.offsets.BQuarterEnd.base BQuarterEnd.base
Returns a copy of the calling offset object with n=1 and all other attributes equal. | pandas.reference.api.pandas.tseries.offsets.bquarterend.base |
pandas.tseries.offsets.BQuarterEnd.copy BQuarterEnd.copy() | pandas.reference.api.pandas.tseries.offsets.bquarterend.copy |
pandas.tseries.offsets.BQuarterEnd.freqstr BQuarterEnd.freqstr | pandas.reference.api.pandas.tseries.offsets.bquarterend.freqstr |
pandas.tseries.offsets.BQuarterEnd.is_anchored BQuarterEnd.is_anchored() | pandas.reference.api.pandas.tseries.offsets.bquarterend.is_anchored |
pandas.tseries.offsets.BQuarterEnd.is_month_end BQuarterEnd.is_month_end() | pandas.reference.api.pandas.tseries.offsets.bquarterend.is_month_end |
pandas.tseries.offsets.BQuarterEnd.is_month_start BQuarterEnd.is_month_start() | pandas.reference.api.pandas.tseries.offsets.bquarterend.is_month_start |
pandas.tseries.offsets.BQuarterEnd.is_on_offset BQuarterEnd.is_on_offset() | pandas.reference.api.pandas.tseries.offsets.bquarterend.is_on_offset |
pandas.tseries.offsets.BQuarterEnd.is_quarter_end BQuarterEnd.is_quarter_end() | pandas.reference.api.pandas.tseries.offsets.bquarterend.is_quarter_end |
pandas.tseries.offsets.BQuarterEnd.is_quarter_start BQuarterEnd.is_quarter_start() | pandas.reference.api.pandas.tseries.offsets.bquarterend.is_quarter_start |
pandas.tseries.offsets.BQuarterEnd.is_year_end BQuarterEnd.is_year_end() | pandas.reference.api.pandas.tseries.offsets.bquarterend.is_year_end |
pandas.tseries.offsets.BQuarterEnd.is_year_start BQuarterEnd.is_year_start() | pandas.reference.api.pandas.tseries.offsets.bquarterend.is_year_start |
pandas.tseries.offsets.BQuarterEnd.isAnchored BQuarterEnd.isAnchored() | pandas.reference.api.pandas.tseries.offsets.bquarterend.isanchored |
pandas.tseries.offsets.BQuarterEnd.kwds BQuarterEnd.kwds | pandas.reference.api.pandas.tseries.offsets.bquarterend.kwds |
pandas.tseries.offsets.BQuarterEnd.n BQuarterEnd.n | pandas.reference.api.pandas.tseries.offsets.bquarterend.n |
pandas.tseries.offsets.BQuarterEnd.name BQuarterEnd.name | pandas.reference.api.pandas.tseries.offsets.bquarterend.name |
pandas.tseries.offsets.BQuarterEnd.nanos BQuarterEnd.nanos | pandas.reference.api.pandas.tseries.offsets.bquarterend.nanos |
pandas.tseries.offsets.BQuarterEnd.normalize BQuarterEnd.normalize | pandas.reference.api.pandas.tseries.offsets.bquarterend.normalize |
pandas.tseries.offsets.BQuarterEnd.onOffset BQuarterEnd.onOffset() | pandas.reference.api.pandas.tseries.offsets.bquarterend.onoffset |
pandas.tseries.offsets.BQuarterEnd.rollback BQuarterEnd.rollback()
Roll provided date backward to next offset only if not on offset. Returns
TimeStamp
Rolled timestamp if not on offset, otherwise unchanged timestamp. | pandas.reference.api.pandas.tseries.offsets.bquarterend.rollback |
pandas.tseries.offsets.BQuarterEnd.rollforward BQuarterEnd.rollforward()
Roll provided date forward to next offset only if not on offset. Returns
TimeStamp
Rolled timestamp if not on offset, otherwise unchanged timestamp. | pandas.reference.api.pandas.tseries.offsets.bquarterend.rollforward |
pandas.tseries.offsets.BQuarterEnd.rule_code BQuarterEnd.rule_code | pandas.reference.api.pandas.tseries.offsets.bquarterend.rule_code |
pandas.tseries.offsets.BQuarterEnd.startingMonth BQuarterEnd.startingMonth | pandas.reference.api.pandas.tseries.offsets.bquarterend.startingmonth |
pandas.tseries.offsets.BusinessDay classpandas.tseries.offsets.BusinessDay
DateOffset subclass representing possibly n business days. Attributes
base Returns a copy of the calling offset object with n=1 and all other attributes equal.
offset Alias for self._offset.
calendar
freqstr
holidays
kwds
n
name
nanos
normalize
rule_code
weekmask Methods
__call__(*args, **kwargs) Call self as a function.
rollback Roll provided date backward to next offset only if not on offset.
rollforward Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset | pandas.reference.api.pandas.tseries.offsets.businessday |
pandas.tseries.offsets.BusinessDay.__call__ BusinessDay.__call__(*args, **kwargs)
Call self as a function. | pandas.reference.api.pandas.tseries.offsets.businessday.__call__ |
pandas.tseries.offsets.BusinessDay.apply BusinessDay.apply() | pandas.reference.api.pandas.tseries.offsets.businessday.apply |
pandas.tseries.offsets.BusinessDay.apply_index BusinessDay.apply_index(other) | pandas.reference.api.pandas.tseries.offsets.businessday.apply_index |
pandas.tseries.offsets.BusinessDay.base BusinessDay.base
Returns a copy of the calling offset object with n=1 and all other attributes equal. | pandas.reference.api.pandas.tseries.offsets.businessday.base |
pandas.tseries.offsets.BusinessDay.calendar BusinessDay.calendar | pandas.reference.api.pandas.tseries.offsets.businessday.calendar |
pandas.tseries.offsets.BusinessDay.copy BusinessDay.copy() | pandas.reference.api.pandas.tseries.offsets.businessday.copy |
pandas.tseries.offsets.BusinessDay.freqstr BusinessDay.freqstr | pandas.reference.api.pandas.tseries.offsets.businessday.freqstr |
pandas.tseries.offsets.BusinessDay.holidays BusinessDay.holidays | pandas.reference.api.pandas.tseries.offsets.businessday.holidays |
pandas.tseries.offsets.BusinessDay.is_anchored BusinessDay.is_anchored() | pandas.reference.api.pandas.tseries.offsets.businessday.is_anchored |
pandas.tseries.offsets.BusinessDay.is_month_end BusinessDay.is_month_end() | pandas.reference.api.pandas.tseries.offsets.businessday.is_month_end |
pandas.tseries.offsets.BusinessDay.is_month_start BusinessDay.is_month_start() | pandas.reference.api.pandas.tseries.offsets.businessday.is_month_start |
pandas.tseries.offsets.BusinessDay.is_on_offset BusinessDay.is_on_offset() | pandas.reference.api.pandas.tseries.offsets.businessday.is_on_offset |
pandas.tseries.offsets.BusinessDay.is_quarter_end BusinessDay.is_quarter_end() | pandas.reference.api.pandas.tseries.offsets.businessday.is_quarter_end |
pandas.tseries.offsets.BusinessDay.is_quarter_start BusinessDay.is_quarter_start() | pandas.reference.api.pandas.tseries.offsets.businessday.is_quarter_start |
pandas.tseries.offsets.BusinessDay.is_year_end BusinessDay.is_year_end() | pandas.reference.api.pandas.tseries.offsets.businessday.is_year_end |
pandas.tseries.offsets.BusinessDay.is_year_start BusinessDay.is_year_start() | pandas.reference.api.pandas.tseries.offsets.businessday.is_year_start |
pandas.tseries.offsets.BusinessDay.isAnchored BusinessDay.isAnchored() | pandas.reference.api.pandas.tseries.offsets.businessday.isanchored |
pandas.tseries.offsets.BusinessDay.kwds BusinessDay.kwds | pandas.reference.api.pandas.tseries.offsets.businessday.kwds |
pandas.tseries.offsets.BusinessDay.n BusinessDay.n | pandas.reference.api.pandas.tseries.offsets.businessday.n |
pandas.tseries.offsets.BusinessDay.name BusinessDay.name | pandas.reference.api.pandas.tseries.offsets.businessday.name |
pandas.tseries.offsets.BusinessDay.nanos BusinessDay.nanos | pandas.reference.api.pandas.tseries.offsets.businessday.nanos |
pandas.tseries.offsets.BusinessDay.normalize BusinessDay.normalize | pandas.reference.api.pandas.tseries.offsets.businessday.normalize |
pandas.tseries.offsets.BusinessDay.offset BusinessDay.offset
Alias for self._offset. | pandas.reference.api.pandas.tseries.offsets.businessday.offset |
pandas.tseries.offsets.BusinessDay.onOffset BusinessDay.onOffset() | pandas.reference.api.pandas.tseries.offsets.businessday.onoffset |
pandas.tseries.offsets.BusinessDay.rollback BusinessDay.rollback()
Roll provided date backward to next offset only if not on offset. Returns
TimeStamp
Rolled timestamp if not on offset, otherwise unchanged timestamp. | pandas.reference.api.pandas.tseries.offsets.businessday.rollback |
pandas.tseries.offsets.BusinessDay.rollforward BusinessDay.rollforward()
Roll provided date forward to next offset only if not on offset. Returns
TimeStamp
Rolled timestamp if not on offset, otherwise unchanged timestamp. | pandas.reference.api.pandas.tseries.offsets.businessday.rollforward |
pandas.tseries.offsets.BusinessDay.rule_code BusinessDay.rule_code | pandas.reference.api.pandas.tseries.offsets.businessday.rule_code |
pandas.tseries.offsets.BusinessDay.weekmask BusinessDay.weekmask | pandas.reference.api.pandas.tseries.offsets.businessday.weekmask |
pandas.tseries.offsets.BusinessHour classpandas.tseries.offsets.BusinessHour
DateOffset subclass representing possibly n business hours. Parameters
n:int, default 1
The number of months represented.
normalize:bool, default False
Normalize start/end dates to midnight before generating date range.
weekmask:str, Default ‘Mon Tue Wed Thu Fri’
Weekmask of valid business days, passed to numpy.busdaycalendar.
start:str, default “09:00”
Start time of your custom business hour in 24h format.
end:str, default: “17:00”
End time of your custom business hour in 24h format. Attributes
base Returns a copy of the calling offset object with n=1 and all other attributes equal.
next_bday Used for moving to next business day.
offset Alias for self._offset.
calendar
end
freqstr
holidays
kwds
n
name
nanos
normalize
rule_code
start
weekmask Methods
__call__(*args, **kwargs) Call self as a function.
rollback(other) Roll provided date backward to next offset only if not on offset.
rollforward(other) Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset | pandas.reference.api.pandas.tseries.offsets.businesshour |
pandas.tseries.offsets.BusinessHour.__call__ BusinessHour.__call__(*args, **kwargs)
Call self as a function. | pandas.reference.api.pandas.tseries.offsets.businesshour.__call__ |
pandas.tseries.offsets.BusinessHour.apply BusinessHour.apply() | pandas.reference.api.pandas.tseries.offsets.businesshour.apply |
pandas.tseries.offsets.BusinessHour.apply_index BusinessHour.apply_index(other) | pandas.reference.api.pandas.tseries.offsets.businesshour.apply_index |
pandas.tseries.offsets.BusinessHour.base BusinessHour.base
Returns a copy of the calling offset object with n=1 and all other attributes equal. | pandas.reference.api.pandas.tseries.offsets.businesshour.base |
pandas.tseries.offsets.BusinessHour.calendar BusinessHour.calendar | pandas.reference.api.pandas.tseries.offsets.businesshour.calendar |
pandas.tseries.offsets.BusinessHour.copy BusinessHour.copy() | pandas.reference.api.pandas.tseries.offsets.businesshour.copy |
pandas.tseries.offsets.BusinessHour.end BusinessHour.end | pandas.reference.api.pandas.tseries.offsets.businesshour.end |
pandas.tseries.offsets.BusinessHour.freqstr BusinessHour.freqstr | pandas.reference.api.pandas.tseries.offsets.businesshour.freqstr |
pandas.tseries.offsets.BusinessHour.holidays BusinessHour.holidays | pandas.reference.api.pandas.tseries.offsets.businesshour.holidays |
pandas.tseries.offsets.BusinessHour.is_anchored BusinessHour.is_anchored() | pandas.reference.api.pandas.tseries.offsets.businesshour.is_anchored |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.