Having completed the project I reviewed my code against the Codecademy solution. We got the same answers however I used mainly functions on their own and they used a class with lots of methods?
What is the main advantage of using classes in the data science/analyst discipline?
Hello! Classes allow you to imitate and create types (like int
, string
, etc.) based on things you need to create types on (say a type Person
if you were creating a database on a school and all the people in it).
As well as this, classes allow certain blocks of code or groups of methods to be exported, meaning you don’t have to write the same code (say you’ve got a class containing lots of useful functions about data parsing), in every script; you have export and import the class, which will save time and readability.
1 Like