Learn practical skills, build real-world projects, and advance your career
import pandas as pd
import MySQLdb
import pandas.io.sql as psql
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib.animation as animation
from IPython.display import HTML
host="192.168.20.246"
port=3306,
user="root"
passwd="avani@0987"
db="python_db"
charset='utf8'

db=MySQLdb.connect(host=host, user=user, passwd=passwd, db=db)
 
# create the query
query = "select * from logfiles2"
 
# execute the query and assign it to a pandas dataframe
df = psql.read_sql(query, con=db)
# close the database connection
db.close()
df.head()

Company_id vs Request_Method

groups = df.groupby(["company_id"])["Request_Method"].count()
groups.plot.(color="green",figsize=(16,6))

plt.title("Company_id vs Request_Method ")
plt.xlabel("Company_id")
plt.ylabel("Request_Method")
plt.legend()
plt.show()
Notebook Image