rsheftel / pandas_market_calendars

Exchange calendars to use with pandas for trading applications
MIT License
803 stars 173 forks source link

not compatible with pandas >= 2.0.3 #315

Closed randomrandomguy12345 closed 9 months ago

randomrandomguy12345 commented 11 months ago

I had hard time finding the list of pandas versions that are compatible with the package.

Anyway, the package isn't compatible with pandas 2. This is a problem, as pandas 2 did a few changes here and there, and this breaks the code. Downgrading pandas creates a lot of trouble with big projects. Is there a prospect that in near future the package will be compatible with the newer versions of pandas?

rsheftel commented 11 months ago

Making it pandas 2.0 compatible is the next item on the task list. For now the latest PyPi release has pandas < 2.0 as a requirement

randomrandomguy12345 commented 11 months ago

Thanks!

LongSimple commented 10 months ago

Thank you

programmingwithalex commented 10 months ago

@rsheftel is there any update on when the update will be deployed? I'll attempt to fork the repo and make a pull request if there's been no progress yet.

nathanramoscfa commented 10 months ago

I forked the project, made this change to allow pandas greater than 2.0:

https://github.com/nathanramoscfa/pandas_market_calendars/commit/0c15491795280123a0b965fb9f0a8b9d65511075

I saw that there were some commits to this project to support pandas 2.1.x so I am trusting that when I install this forked version of the project, it'll work with pandas>=2.0. Well, I installed this forked version to my environment, and reran my Python application, and it worked with no problems. For reference, the pandas compatibility issue came up for me when I tried to build the docs for my application on ReadTheDocs, which would fail, because of this issue.

krazykoder commented 10 months ago

@nathanramoscfa - I am a noob. Appreciate any input. Can you write a few lines of instruction on how to build the wheel and install with pip after I git clone your fork. I am having the same issue - some of my code required pandas >2.0.

nathanramoscfa commented 10 months ago

@nathanramoscfa - I am a noob. Appreciate any input.

Can you write a few lines of instruction on how to build the wheel and install with pip after I git clone your fork. I am having the same issue - some of my code required pandas >2.0.

Starting in command prompt, activate your Python environment. I like to use anaconda, so for me it's like this (replace environment name with the actual name of your environment without the <>):

conda activate <environment name>

Navigate to your folder where you store all your Python projects, could be something like this:

cd C:/Python Projects/

Clone my forked version there:

git clone https://github.com/nathanramoscfa/pandas_market_calendars.git

Then navigate to the project's root directory:

cd pandas_market_calendars

Then install as a package to your environment.

pip install .

It should then install the cloned forked project to your Python environment and now when you import pandas_market_calendars into your application, it'll be using my forked version.

Whenever the pandas_market_calendars project updates the PyPi package with the changes we're discussing here, you would then use this command to upgrade the pandas_market_calendars back to the official pip installed version.

pip install --upgrade pandas_market_calendars

I just simply needed a solution now, couldn't wait for the devs to update the official PyPi package. But when they do I'll revert back to that version instead of my forked version.

rundef commented 10 months ago

FWIW I'm using a slightly older version (4.3.1) with pandas 2.1 and haven't encountered any issue

rsheftel commented 10 months ago

Thanks. This is going to require some investigation as this library uses a lot of the deep internals of pandas to work and much of the pandas holiday functionality is undocumented.

kentonself commented 10 months ago

Hi.

I am running pandas_market_calendars 4.3.3 with pandas 2.2.0. Everything runs fine, except, I get the following message when I call

get_calendar("NYSE").open_at_Time(schedule=x, timestamp=y)`

FutureWarning: Downcasting behavior in replace is deprecated and will be removed in a future version. To retain the old behavior, explicitly call result.infer_objects(copy=False). To opt-in to the future behavior, set pd.set_option('future.no_silent_downcasting', True)

I am assuming this is related to this issue/project.

rsheftel commented 9 months ago

v.4.4.0 is published to PyPi and works with Python 3.12 and Pandas 2.2.0