Skip to content

Commit 9f8c24f

Browse files
authored
Merge branch 'main' into sql_nullable
2 parents a67913d + 1488157 commit 9f8c24f

File tree

15 files changed

+43
-94
lines changed

15 files changed

+43
-94
lines changed

.github/workflows/scorecards.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
[![Package Status](https://img.shields.io/pypi/status/pandas.svg)](https://pypi.org/project/pandas/)
1212
[![License](https://img.shields.io/pypi/l/pandas.svg)](https://github.com/pandas-dev/pandas/blob/main/LICENSE)
1313
[![Coverage](https://codecov.io/github/pandas-dev/pandas/coverage.svg?branch=main)](https://codecov.io/gh/pandas-dev/pandas)
14-
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/pandas-dev/pandas/badge)](https://api.securityscorecards.dev/projects/github.com/pandas-dev/pandas)
1514
[![Downloads](https://static.pepy.tech/personalized-badge/pandas?period=month&units=international_system&left_color=black&right_color=orange&left_text=PyPI%20downloads%20per%20month)](https://pepy.tech/project/pandas)
1615
[![Slack](https://img.shields.io/badge/join_Slack-information-brightgreen.svg?logo=slack)](https://pandas.pydata.org/docs/dev/development/community.html?highlight=slack#community-slack)
1716
[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org)

doc/source/getting_started/comparison/comparison_with_sas.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ The pandas method is :func:`read_csv`, which works similarly.
112112
.. ipython:: python
113113
114114
url = (
115-
"https://raw.github.com/pandas-dev/"
115+
"https://raw.githubusercontent.com/pandas-dev/"
116116
"pandas/main/pandas/tests/io/data/csv/tips.csv"
117117
)
118118
tips = pd.read_csv(url)

doc/source/getting_started/comparison/comparison_with_spreadsheets.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ In pandas, you pass the URL or local path of the CSV file to :func:`~pandas.read
100100
.. ipython:: python
101101
102102
url = (
103-
"https://raw.github.com/pandas-dev"
103+
"https://raw.githubusercontent.com/pandas-dev"
104104
"/pandas/main/pandas/tests/io/data/csv/tips.csv"
105105
)
106106
tips = pd.read_csv(url)

doc/source/getting_started/comparison/comparison_with_sql.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ structure.
1717
.. ipython:: python
1818
1919
url = (
20-
"https://raw.github.com/pandas-dev"
20+
"https://raw.githubusercontent.com/pandas-dev"
2121
"/pandas/main/pandas/tests/io/data/csv/tips.csv"
2222
)
2323
tips = pd.read_csv(url)

doc/source/getting_started/comparison/comparison_with_stata.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ the data set if presented with a url.
108108
.. ipython:: python
109109
110110
url = (
111-
"https://raw.github.com/pandas-dev"
111+
"https://raw.githubusercontent.com/pandas-dev"
112112
"/pandas/main/pandas/tests/io/data/csv/tips.csv"
113113
)
114114
tips = pd.read_csv(url)

doc/source/user_guide/io.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5790,21 +5790,6 @@ Specifying this will return an iterator through chunks of the query result:
57905790
for chunk in pd.read_sql_query("SELECT * FROM data_chunks", engine, chunksize=5):
57915791
print(chunk)
57925792
5793-
You can also run a plain query without creating a ``DataFrame`` with
5794-
:func:`~pandas.io.sql.execute`. This is useful for queries that don't return values,
5795-
such as INSERT. This is functionally equivalent to calling ``execute`` on the
5796-
SQLAlchemy engine or db connection object. Again, you must use the SQL syntax
5797-
variant appropriate for your database.
5798-
5799-
.. code-block:: python
5800-
5801-
from pandas.io import sql
5802-
5803-
sql.execute("SELECT * FROM table_name", engine)
5804-
sql.execute(
5805-
"INSERT INTO table_name VALUES(?, ?, ?)", engine, params=[("id", 1, 12.2, True)]
5806-
)
5807-
58085793
58095794
Engine connection examples
58105795
''''''''''''''''''''''''''

doc/source/whatsnew/v2.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ Other API changes
487487
or :attr:`~DataFrame.iloc` (thus, ``df.loc[:, :]`` or ``df.iloc[:, :]``) now returns a
488488
new DataFrame (shallow copy) instead of the original DataFrame, consistent with other
489489
methods to get a full slice (for example ``df.loc[:]`` or ``df[:]``) (:issue:`49469`)
490+
- Disallow computing ``cumprod`` for :class:`Timedelta` object; previously this returned incorrect values (:issue:`50246`)
490491
-
491492

492493
.. ---------------------------------------------------------------------------

pandas/core/arrays/timedeltas.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,12 +417,13 @@ def _accumulate(self, name: str, *, skipna: bool = True, **kwargs):
417417

418418
data = self._ndarray.copy()
419419

420-
if name in {"cumsum", "cumprod"}:
421-
# TODO: cumprod should not work here GH#48111
422-
func = np.cumsum if name == "cumsum" else np.cumprod
420+
if name == "cumsum":
421+
func = np.cumsum
423422
result = cast(np.ndarray, nanops.na_accum_func(data, func, skipna=skipna))
424423

425424
return type(self)._simple_new(result, freq=None, dtype=self.dtype)
425+
elif name == "cumprod":
426+
raise TypeError("cumprod not supported for Timedelta.")
426427

427428
else:
428429
return super()._accumulate(name, skipna=skipna, **kwargs)

pandas/io/sql.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,7 @@ def execute(sql, con, params=None):
192192
----------
193193
sql : string
194194
SQL query to be executed.
195-
con : SQLAlchemy connectable(engine/connection) or sqlite3 connection
196-
Using SQLAlchemy makes it possible to use any DB supported by the
197-
library.
195+
con : SQLAlchemy connection or sqlite3 connection
198196
If a DBAPI2 object, only sqlite3 is supported.
199197
params : list or tuple, optional, default: None
200198
List of parameters to pass to execute method.
@@ -203,6 +201,10 @@ def execute(sql, con, params=None):
203201
-------
204202
Results Iterable
205203
"""
204+
sqlalchemy = import_optional_dependency("sqlalchemy", errors="ignore")
205+
206+
if sqlalchemy is not None and isinstance(con, (str, sqlalchemy.engine.Engine)):
207+
raise TypeError("pandas.io.sql.execute requires a connection") # GH50185
206208
with pandasSQL_builder(con, need_transaction=True) as pandas_sql:
207209
args = _convert_params(sql, params)
208210
return pandas_sql.execute(*args)

0 commit comments

Comments
 (0)