How to sort dates on a graph in ascending order?
📁 Advanced Python Topics, pandas, matplotlib
There is a CSV file with the number of cases for the past year, but it has an incorrect structure, i.e. today's date comes first, then yesterday's, etc.
How to build a correct graph so that it goes from past to present, and not the other way around?
import pandas as pdimport matplotlib.pyplot as pltdata = pd.read_csv('data.txt')plt.plot(data['val'])plt.show()I tried: data = data[::-1]
According to the same documentation, the correct usage pattern would be something like this:
conn = psycopg2.connect(DSN)try: with conn: with conn.cursor() as curs: curs.execute(SQL1) with conn: with conn.cursor() as curs: curs.execute(SQL2)finally: conn.close()What is meant here.
connectionlives as long as you need it for your operations; if you have database operations in a row -connectiondoes not need to be closed and reopened; but if you worked with the database and then
Log in to leave an answer