Skip to content

Support for times being a pd.Timestamp #73

@AdamRJensen

Description

@AdamRJensen

Right now the times parameter has to be a pd.DatetimeIndex. While a single timestamp can be passed, this is kinda awkward as you would normally just pass a timestamp as ``pd.Timestamp`.

The function _pandas_to_utc could be modified to allow for a single time stamp being passed to the solar position algorithms. Is this a desirable feature?

The functionality would look like this:

solposx.solposition.michalsky(
    times=pd.Timestamp('2020-01-01 00:00+00'),
    latitude=50,
    longitude=10)

alternatively maybe even with a single timestamp in the form of a string:

solposx.solposition.michalsky(
    times='2020-01-01 00:00+00',
    latitude=50,
    longitude=10)

This could be achieved with addition of the following line to the _pandas_to_utc function:

    if isinstance(pd_object, (str, pd.Timestamp)):
        pd_object = pd.DatetimeIndex[pd_object]

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions