Я хочу создать карту Индии с количеством штатов, используя Python, и это библиотека визуализации данных. и иметь его на сайте - PullRequest
0 голосов
/ 01 мая 2020

Я впервые подключился к своему местному Postgre sql. А затем создал pandas фрейм данных

Фрейм данных выглядит как -


    State             Clear     Suspect
0   UTTAR PRADESH     4540278   863091
1   RAJASTHAN         1866196   373572
2   MADHYA PRADESH    1373106   311683
3   WEST BENGAL       1367113   294851
4   KARNATAKA         1012743   243519

Сценарий подключения к базе данных выглядит как -

# This gist contains a direct connection to a local PostgreSQL database
# called "suppliers" where the username and password parameters are "postgres"

# This code is adapted from the tutorial hosted below:
# http://www.postgresqltutorial.com/postgresql-python/connect/

import psycopg2

# Establish a connection to the database by creating a cursor object
# The PostgreSQL server must be accessed through the PostgreSQL APP or Terminal Shell

# conn = psycopg2.connect("dbname=suppliers port=5432 user=postgres password=postgres")

# Or:
conn = psycopg2.connect(host="localhost", port = 5432, database="postgres", user="postgres", password="123")

# Create a cursor object
cur = conn.cursor()

# A sample query of all data from the "vendors" table in the "suppliers" database
cur.execute("""SELECT * FROM data""")
query_results = cur.fetchall()
print(query_results)

# Close the cursor and connection to so the server can allocate
# bandwidth to other requests
cur.close()
conn.close()

Я хочу показать очистить и подозреваемый подсчитывает на карте Индии для каждого штата, используя любую библиотеку визуализации python. Основная цель - подсчет 'Clear' и 'Suspect' для каждого состояния при наведении курсора.

Заранее спасибо:)

...