Add support for pandas>=3#1698
Conversation
| elem, errors='coerce') | ||
| temp_val = elem if isinstance(temp_val[0], type(pd.NaT)) else temp_val | ||
| return_value.append(temp_val) | ||
| elif isinstance(array, list): | ||
| temp_val = pd.to_datetime( | ||
| array, errors='coerce', infer_datetime_format=True) | ||
| array, errors='coerce') | ||
| return_value = array if isinstance(temp_val[0], type(pd.NaT)) else temp_val | ||
| else: | ||
| temp_val = pd.to_datetime( | ||
| array, errors='coerce', infer_datetime_format=True) | ||
| array, errors='coerce') |
There was a problem hiding this comment.
The kwarg infer_datetime_format was deprecated in pandas 2.0; see changelog, pandas-dev/pandas#48621. The behavior since v2 is equivalent to infer_datetime_format=True.
There was a problem hiding this comment.
Should we have a condition here for the pandas version being used? Otherwise I guess we'd be breaking datetimes handling for pandas <2?
| @@ -81,7 +81,7 @@ | |||
| "axes_options = {\"y\": {\"tick_format\": \",\"}}\n", | |||
| "time_series = plt.plot(dates, prices, colors=[\"deepskyblue\"], \n", | |||
| " stroke_width=1.5, axes_options=axes_options)\n", | |||
| "return_label = plt.label([], x=[], y=[prices.max() * .9], \n", | |||
| "return_label = plt.label([], x=[], y=[prices.max().squeeze() * .9], \n", | |||
| " align=\"middle\", default_size=36, \n", | |||
| " font_weight=\"bolder\", colors=[\"orange\"])\n", | |||
There was a problem hiding this comment.
The squeeze kwarg has been deprecated since v1.4; see changelog, pandas-dev/pandas#43242.
| "\n", | ||
| "log_data.index = pd.to_datetime(\n", | ||
| " log_data[\"timestamp\"].str.replace(\"[\\[\\]]\", \"\"), format=\"%d/%b/%Y:%H:%M:%S\"\n", | ||
| " log_data[\"timestamp\"].str.replace(\"[\", '').str.replace(\"]\", ''), \n", |
There was a problem hiding this comment.
This regex wasn't working in my tests with pandas 3.0, so I replaced it with a longer and equivalent call.
| @@ -46,8 +47,16 @@ | |||
| "metadata": {}, | |||
| "outputs": [], | |||
| "source": [ | |||
| "sel.selected = 5" | |||
| "sel.selected = np.array([5])" | |||
There was a problem hiding this comment.
I found that bqplot fails when the selected attribute is set with a float/int rather a numpy array. Is that expected?
There was a problem hiding this comment.
that's strange/unexpected @copilot can you turn this into an issue to track this?
| - flake8 | ||
| - nose | ||
| - codespell | ||
| - scikit-learn |
There was a problem hiding this comment.
This is used by the tests but not required in the test-env.
|
please update snapshots |
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@meeseeksdev backport to 0.12.x |
Co-authored-by: Maarten Breddels <maartenbreddels@gmail.com>
This PR adds support for pandas>=3. I'll leave inline comments in the diff to explain changes.
References
This PR is a follow-up to #1692.
Closes #1691
Code changes
User-facing changes
Backwards-incompatible changes