SQLLite DB를 생성했다면 직접 DB에 접속해서 쿼리를 날려 분석할 수 도 있겠지만 pandas를 이용하여 연동도 가능하다
import pandas as pd
import sqlite3
conn = sqlite3.connect(path)
query = 'select * from weblog'
df = pd.read_sql_query(query,conn)
df['logtime'] = pd.to_datetime(df['logtime'])
print(df.dtypes)
-----------------------------------------------
logtime datetime64[ns]
useragent object
scstatus object
scbytes int64
timetaken int64
country object
extension object
print(df)
-----------------------------------------------
logtime ... extension
0 2019-06-03 00:00:00 ... jpg
1 2019-06-03 00:00:01 ... ashx
2 2019-06-03 00:00:01 ... ico
3 2019-06-03 00:00:02 ... ashx
4 2019-06-03 00:00:03 ... js
... ... ... ...
1748887 2019-06-03 23:59:53 ... aspx
1748888 2019-06-03 23:59:53 ... jpg
1748889 2019-06-03 23:59:54 ... js
1748890 2019-06-03 23:59:54 ... ashx
1748891 2019-06-03 23:59:54 ... ashx
[1748892 rows x 7 columns]