Giter Site home page Giter Site logo

freecodecamp-pandas-real-life-example's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

freecodecamp-pandas-real-life-example's Issues

Unable to open database file

I am using jupyter notebooks on a MAC and I am unable to open the sakila database. Here is the error message that I got.

OperationalError Traceback (most recent call last)
Input In [6], in <cell line: 1>()
----> 1 conn = sqlite3.connect('data/sakila.db')
3 df = pd.read_sql('''
4 SELECT
5 rental.rental_id, rental.rental_date, rental.return_date,
(...)
19 ;
20 ''', conn, index_col='rental_id', parse_dates=['rental_date', 'return_date'])

OperationalError: unable to open database file

Error in loading data from the DWH in Exercise 2 using Colab

Anyone also experienced problems with loading data from the DWH using Colab?

The code:

`conn = sqlite3.connect('data/sakila.db')

df = pd.read_sql('''
SELECT
rental.rental_id, rental.rental_date, rental.return_date,
customer.last_name AS customer_lastname,
store.store_id,
city.city AS rental_store_city,
film.title AS film_title, film.rental_duration AS film_rental_duration,
film.rental_rate AS film_rental_rate, film.replacement_cost AS film_replacement_cost,
film.rating AS film_rating
FROM rental
INNER JOIN customer ON rental.customer_id == customer.customer_id
INNER JOIN inventory ON rental.inventory_id == inventory.inventory_id
INNER JOIN store ON inventory.store_id == store.store_id
INNER JOIN address ON store.address_id == address.address_id
INNER JOIN city ON address.city_id == city.city_id
INNER JOIN film ON inventory.film_id == film.film_id
;
''', conn, index_col='rental_id', parse_dates=['rental_date', 'return_date'])`

The error message:


OperationalError Traceback (most recent call last)
in ()
----> 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---------------------------------------------------------------------------

How to download the exercises from Lecture 1 without downloading a zip.

I tried typing the code from the video in Google Colab and get this message "head: cannot open 'data/sales_data.csv' for reading: No such file or directory". In the issues, it seems that people need to download the zip and open it in VS Code. Is there a simpler way to do it? I want to use Google Colab, not VS Code. It would be helpful if we could actually download the datasets. These kinds of obstacles for beginners can be so frustrating - not being able to get past the first step (which should be simple) makes me want to give up lol.

Google colab issue

I cant seem to make this code run like the lecture video. Im not sure how to follow along the lesson with out the code .

I also get a warning when I try to run the file because this notebook is not authorized by google

This is the traceback I get on google colab when I click the play button on the 2nd line of code:
FileNotFoundError Traceback (most recent call last)
in ()
1 sales = pd.read_csv(
2 'data/sales_data.csv',
----> 3 parse_dates=['Date'])

4 frames
/usr/local/lib/python3.6/dist-packages/pandas/io/parsers.py in init(self, src, **kwds)
1889 kwds["usecols"] = self.usecols
1890
-> 1891 self._reader = parsers.TextReader(src, **kwds)
1892 self.unnamed_cols = self._reader.unnamed_cols
1893

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.cinit()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()

FileNotFoundError: [Errno 2] File data/sales_data.csv does not exist: 'data/sales_data.csv'

Cannot read data file

I can't edit any of the coding textboxes within github, and when I open the code in google colab, I can't read the data file.
problem

If you faced error in loading data in Exercise 1 using colab

The original code
sales = pd.read_csv( 'data/sales_data.csv', parse_dates=['Date'])
may cause error for you
then you can replace it with
sales = pd.read_csv( 'https://raw.githubusercontent.com/ine-rmotr-curriculum/FreeCodeCamp-Pandas-Real-Life-Example/master/data/sales_data.csv', parse_dates=['Date'])
And it worked well for me 💯

Exercises_2.ipynb sql code cannot import data

Was getting this error, fixed it by swapping the / for a forward slash, or even deleting "data/" alltogether

OperationalError Traceback (most recent call last)
in ()
----> 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

Now getting a new error - same error when I try using Mysql directly instead of Colab:

OperationalError: no such table: rental

Also in Mysql when I just use the SQL, seeing another error saying that the syntax around the SQL portion is incorrect.

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '== customer.customer_id
INNER JOIN inventory ON rental.inventory_id == inven' at line 10

Can't figure this out to save my life.

Cannot load Exercises_1.ipynb or Exercises_2.ipynb

Hi

I've just started learning Data Analysis using Python from FreeCodeCamp.org. I am new to Githhub also, so bear with me!

I am using JupyterLab (v3.2.1) launched from Anaconda (v2.2.0) to load the exercises (since Notebook.ai mentioned in lectures is apparently shutting down). When I try to load Exercises_1.ipynb or Exercises_2.ipynb I get the following error:

File Load Error for Exercises_2.ipynb
Unreadable Notebook: C:\XXXXX\Exercises_2.ipynb NotJSONError("Notebook does not appear to be JSON: '\n\n\n\n\n\n\n\n<html la...")

I tried to search for a solution, but it appears to be beyond my skill set.

Can somebody help with this?

Thanks,
Shahid

Can't read data file and upload course file

I'm a beginner in the field of coding and I can't follow the course videos. At the first lecture, I'm trying to retrieve the sales_data.csv file but it's not working!

How I can upload the course file into Jupyter Notebook?

image
screencapture-localhost-8888-notebooks-Untitled-ipynb-2022-02-01-12_33_55

Google Colab

Hi, I'm trying to follow along using Google Colab but the data doesn't open - it says that there is no such file. How can I use the data used in these lectures to follow along? Please help me.

Can't read data/sales_data.csv using panda library

When we run the code we encounter the following error


FileNotFoundError Traceback (most recent call last)

in <cell line: 1>()
----> 1 sales = pd.read_csv(
2 'data/sales_data.csv',
3 parse_dates=['Date'])

6 frames

/usr/local/lib/python3.10/dist-packages/pandas/io/common.py in get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)
854 if ioargs.encoding and "b" not in ioargs.mode:
855 # Encoding
--> 856 handle = open(
857 handle,
858 ioargs.mode,

FileNotFoundError: [Errno 2] No such file or directory: 'data/sales_data.csv'
image

Exercise 1 incorrect code?

For the Question: How many sales with more than 500 in Revenue were made by men?
The answer given is: sales.loc[(sales['Customer_Gender'] == 'M') & (sales['Revenue'] == 500)].shape[0]

Question asks for MORE than 500. Shouldn't answer be: sales.loc[(sales['Customer_Gender'] == 'M') & (sales['Revenue'] >= 500)].shape[0]

Exercises show answers before even finishing

Why is it that the exercises show you the answer before you even have a chance to figure it out?
i.e
box says '# your code goes here'
but immediately below it it shows you the exact answer to put in

Lecture_2.ipynb has syntax error at [18] and [19]

It currently reads:

df['rental_gain_return'].mean().round(2)

df['rental_gain_return'].median().round(2)

but should be:

round(df['rental_gain_return'].mean(),2)

round(df['rental_gain_return'].median(),2)

practice

how do I open the practice files to work on them? every time I press open in GitHub desktop it just prompts me to download GitHub again

Exercise 1: NameError: name 'sales' is not defined

I tried to run the stuff in the first three head information boxes on Noteable.io, having uploaded the csv file and all, yet the name sales is yet undefined.

NameError: name 'sales' is not defined

Why is this happening, may I ask? And how do I fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.