Data Analysis with python

Hi, I have been working on the Data Analysis exercise 2 and i cant seem to connect with sqlite db, the conn line of code in the example is giving operational error. any ideas how to fix this?

Can you share your code and the error message?

import numpy as np

import pandas as pd

import matplotlib.pyplot as plt

import sqlite3

%matplotlib inline

conn = sqlite3.connect(‘data/sakila.db’)

error message
OperationalError Traceback (most recent call last)
in <cell line: 1>()
----> 1 conn = sqlite3.connect(‘data/sakila.db’)
2
3 df = pd.read_sql(‘’’
4 SELECT
5 rental.rental_id, rental.rental_date, rental.return_date,

OperationalError: unable to open database file

1 Like

Thank you for your response, i have shared the code, seems the error is from the ‘conn’ line of code

Are you running this on a google collab notebook? Is it possible to share that?

looms like i cant share a link here, how can i add you?
i will be looking out for your response,thanks!

Is it google colab? Should have a Share button in the top right.

Does ‘data/sakila.db’ exist in your project? Look for the file folder icon to the menu at the left. Google Colab will delete files after a while so you might need to re-add it.

yes, i see the share button. whats your email and i can add you that way.
Also, i don’t think data/sakila.db exists in my folder. I’ll try re-adding it.Thanks!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.