Skip to content

DOC: code example isn't formatted in pandas.DataFrame.to_sql #36922

Closed
@hkennyv

Description

@hkennyv

Location of the documentation

The code example in pandas.DataFrame.to_sql isn't formatted properly.

(it's the example that inserts User 4 and User 5 into the db)

Note: You can check the latest versions of the docs on master here.

Documentation problem

image

oh no, the code isn't formatted correctly!

Suggested fix for documentation

The reason is there's no blank line before the code snippet, see:

pandas/pandas/core/generic.py

Lines 2692 to 2695 in b58ee57

An `sqlalchemy.engine.Connection` can also be passed to to `con`:
>>> with engine.begin() as connection:
... df1 = pd.DataFrame({'name' : ['User 4', 'User 5']})
... df1.to_sql('users', con=connection, if_exists='append')

Add a blank line above the code snippet :), i have a PR in progress

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions