'sql database a panda

hello someone can help me I must create a program in Python that connects to my database, read the database records and create a pivot table with Pandas with that data



Solution 1:[1]

You might be looking for pandas.read_sql

You can use con parameter to pass your database connection string.

Solution 2:[2]

Here's a link to connect SQL to Python. Depending on the database you use, library will vary. Search for your particular database to python connection.

https://www.geeksforgeeks.org/how-to-connect-python-with-sql-database/

This will give you a 5 min crash course with Pandas and how to use pivot tables.

https://medium.com/bhavaniravi/python-pandas-tutorial-92018da85a33#:~:text=%20Get%20Started%20With%20Pandas%20In%205%20mins,DataFrame%20and%20understood%20its%20structure%2C%20let%E2%80%99s...%20More%20

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ashwani
Solution 2 Hrishikesh Nadkarni