Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api_doc/datetime/DatetimeOrdinal.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DatetimeOrdinal
===============

.. automodule:: feature_engine.datetime.datetime_ordinal
.. autoclass:: feature_engine.datetime.DatetimeOrdinal
:members:

10 changes: 4 additions & 6 deletions docs/user_guide/datetime/DatetimeOrdinal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ DatetimeOrdinal

:class:`DatetimeOrdinal()` converts datetime variables into ordinal numbers, that is, a numerical representation of the date.

Datetime variables cannot be used directly by machine learning algorithms because they are not numerical. However, they contain valuable information about sequences of events or elapsed time.

By converting datetime variables into ordinal numbers, we can capture this information while discarding the complexities of raw datetime formats. Ordinal numbers preserve the relative distances between dates (e.g., the number of days between events), allowing algorithms to capture linear trends, calculate temporal distances naturally, and handle time consistently without needing to parse or split the datetime into multiple separate features like year, month, or day.

By default, :class:`DatetimeOrdinal()` returns the proleptic Gregorian ordinal, where January 1 of year 1 has ordinal 1.

Optionally, :class:`DatetimeOrdinal()` can compute the number of days relative to a user-defined `start_date`.
Expand Down Expand Up @@ -121,12 +125,6 @@ If `missing_values="raise"`, the transformer will raise an error if NaT values a
If `missing_values="ignore"`, the transformer will ignore NaT values, and the resulting ordinal feature will contain `NaN` (or `pd.NA`) in their place.


.. autoclass:: DatetimeOrdinal
:members:
:undoc-members:
:show-inheritance:


Additional resources
--------------------

Expand Down