Skip to content

Commit c058dcc

Browse files
Address comments
1 parent 98eecb1 commit c058dcc

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

pandas/io/sql.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,11 @@ def read_sql(
485485
486486
Examples
487487
--------
488-
Read data from SQL via either a SQL query or a SQL tablename (latter not
489-
possible for SQLite tables)
488+
Read data from SQL via either a SQL query or a SQL tablename.
489+
For SQLite talbes
490+
490491
>>> from sqlite3 import connect
491-
>>> conn = connect('file.db')
492+
>>> conn = connect(':memory:')
492493
>>> df = pd.DataFrame(data=[[0, '10/11/12'], [1, '12/11/10']],
493494
... columns=['int_column', 'date_column'])
494495
>>> df.to_sql('test_data', conn)
@@ -500,12 +501,12 @@ def read_sql(
500501
501502
>>> pd.read_sql('test_data', 'postgres:///db_name') # doctest:+SKIP
502503
503-
Apply dateparsing to columns through the ``parse_dates`` argument
504+
Apply date parsing to columns through the ``parse_dates`` argument
504505
505506
>>> pd.read_sql('SELECT int_column, date_column FROM test_data',
506507
... conn,
507508
... parse_dates=["date_column"])
508-
int_column date_column
509+
int_column date_column
509510
0 0 2012-10-11
510511
1 1 2010-12-11
511512
@@ -517,11 +518,11 @@ def read_sql(
517518
>>> pd.read_sql('SELECT int_column, date_column FROM test_data',
518519
... conn,
519520
... parse_dates={"date_column": {"errors": "ignore"}})
520-
int_column date_column
521+
int_column date_column
521522
0 0 2012-10-11
522523
1 1 2010-12-11
523524
524-
2. Apply a dayfirst dateparsing order on the values of "date_column"
525+
2. Apply a dayfirst date parsing order on the values of "date_column"
525526
526527
>>> pd.read_sql('SELECT int_column, date_column FROM test_data',
527528
... conn,
@@ -530,12 +531,12 @@ def read_sql(
530531
0 0 2012-11-10
531532
1 1 2010-11-12
532533
533-
3. Apply custom formatting when dateparsing the values of "date_column"
534+
3. Apply custom formatting when date parsing the values of "date_column"
534535
535536
>>> pd.read_sql('SELECT int_column, date_column FROM test_data',
536537
... conn,
537538
... parse_dates={"date_column": {"format": "%d/%m/%y"}})
538-
int_column date_column
539+
int_column date_column
539540
0 0 2012-11-10
540541
1 1 2010-11-12
541542
"""

0 commit comments

Comments
 (0)