Skip to content

Commit 9b57581

Browse files
Generator -> iterable & add note section
1 parent ac281d6 commit 9b57581

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

doc/source/user_guide/io.rst

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5021,8 +5021,7 @@ Example of a callable using PostgreSQL `COPY clause
50215021
conn : sqlalchemy.engine.Engine or sqlalchemy.engine.Connection
50225022
keys : list of str
50235023
Column names
5024-
data_iter : generator of list
5025-
Each item contains a list of values to be inserted
5024+
data_iter : Iterable that iterates the values to be inserted
50265025
"""
50275026
# gets a DBAPI connection that can provide a cursor
50285027
dbapi_conn = conn.connection
@@ -5057,15 +5056,17 @@ table name and optionally a subset of columns to read.
50575056
50585057
pd.read_sql_table('data', engine)
50595058
5060-
Note that pandas infers column dtypes from query outputs, and not by looking
5061-
up data types in the physical database schema. For example, assume ``userid``
5062-
is an integer column in a table. Then, intuitively, ``select userid ...`` will
5063-
return integer-valued series, while ``select cast(userid as text) ...`` will
5064-
return object-valued (str) series. Accordingly, if the query output is empty,
5065-
then all resulting columns will be returned as object-valued (since they are
5066-
most general). If you foresee that your query will sometimes generate an empty
5067-
result, you may want to explicitly typecast afterwards to ensure dtype
5068-
integrity.
5059+
.. note::
5060+
5061+
Note that pandas infers column dtypes from query outputs, and not by looking
5062+
up data types in the physical database schema. For example, assume ``userid``
5063+
is an integer column in a table. Then, intuitively, ``select userid ...`` will
5064+
return integer-valued series, while ``select cast(userid as text) ...`` will
5065+
return object-valued (str) series. Accordingly, if the query output is empty,
5066+
then all resulting columns will be returned as object-valued (since they are
5067+
most general). If you foresee that your query will sometimes generate an empty
5068+
result, you may want to explicitly typecast afterwards to ensure dtype
5069+
integrity.
50695070

50705071
You can also specify the name of the column as the ``DataFrame`` index,
50715072
and specify a subset of columns to be read.

0 commit comments

Comments
 (0)