Skip to content

Check allowing pandas v3#1194

Merged
misi9170 merged 4 commits into
NatLabRockies:developfrom
misi9170:pkg/pandas-3
Jun 2, 2026
Merged

Check allowing pandas v3#1194
misi9170 merged 4 commits into
NatLabRockies:developfrom
misi9170:pkg/pandas-3

Conversation

@misi9170
Copy link
Copy Markdown
Collaborator

As raised in #1193 , pandas v3 was released earlier this year and it would be nice to have FLORIS be compatible.

I have so far simply updated the dependencies and run tests, but not examples; opening this PR should run the examples. Assume they all execute correctly without error, it's likely we can simply support both pandas v2 and pandas v3, which would be my preference over dropping pandas v2 support.

@paulf81
Copy link
Copy Markdown
Collaborator

paulf81 commented Jun 1, 2026

Works for me!

@misi9170
Copy link
Copy Markdown
Collaborator Author

misi9170 commented Jun 1, 2026

Within the core code, I think pandas is only used in two places:

  • solve_for_velocity_deficit_profiles() on Core in floris/core/core.py, where the return object is a pandas dataframe
  • _initialize_multidim_power_thrust_table() on Turbine in floris/core/turbine/turbine.py, where pandas is used to read and extract values from a csv.

It's also used rather minimally in two examples and one test (after I've now removed some unused imports). I'm comfortable allowing pandas 3 (but will continue to allow pandas 2, as I suspect many users will not have upgraded)

@rafmudaf
Copy link
Copy Markdown
Collaborator

rafmudaf commented Jun 2, 2026

FWIW we could eliminate the second usage with numpy.loadtxt. The first one might be more involved, but generally it feels like an anti pattern if that's the only place where we're using a dataframe.

@misi9170 what do you think about eliminating Pandas as a dependency all together? I can take a stab at this if you agree.

@misi9170
Copy link
Copy Markdown
Collaborator Author

misi9170 commented Jun 2, 2026

@rafmudaf , I'd be very on board, but my one hesitation is that the solve_for_velocity_deficit_profiles routines, which are user facing, actually return a pandas dataframe to the user, so it'd be a breaking change to eliminate that and return something else instead. That being said, I'd be happy for you to remove all other uses, and then maybe add a note (and a deprecation warning?) to remove that in future... what do you think? Alternatively, maybe this is a little-enough-used method that we can break the rules on breaking changes in this case (for the greater good of removing a rather hefty dependency)

@rafmudaf
Copy link
Copy Markdown
Collaborator

rafmudaf commented Jun 2, 2026

@misi9170 I made the change in the turbine file. As for the velocity deficit profile function, I'm happy to add a warning, but I also lean toward your latter perspective. I think it's a lightly enough used function and we could make the change clear in the release notes.
FWIW it's a bigger effort to completely remove Pandas, so maybe the warning log is good enough for now.

@rafmudaf
Copy link
Copy Markdown
Collaborator

rafmudaf commented Jun 2, 2026

And just for documentation, I used np.genfromtxt because it creates a named array from the header row directly whereas np.loadtxt does not.

@misi9170
Copy link
Copy Markdown
Collaborator Author

misi9170 commented Jun 2, 2026

I agree on all fronts, thanks @rafmudaf . Looks like all checks are passing, so I'll merge unless you are planning on any more changes

@rafmudaf
Copy link
Copy Markdown
Collaborator

rafmudaf commented Jun 2, 2026

Good to go from my end. Thanks @misi9170

@misi9170 misi9170 merged commit 70adeb9 into NatLabRockies:develop Jun 2, 2026
18 checks passed
@misi9170 misi9170 deleted the pkg/pandas-3 branch June 2, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants