The Ultimate Guide to Getting Started in Data Science
Tags: datascience, datasciencemarathon, python, datanalysis
Published: 2022-04-02 19:16:27


We can define data science as an inter disciplinary field that uses scientific methods to prepare data for analysis, including cleansing, aggregating, and manipulating the data to perform advanced data analysis.In this article I am going to provide a guide on the various topics you can cover ,in order to get a head start at this awesome field.

>>

 **1.Introduction to Python, Mastering Python basics.**

Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.Due to its simple structure and the qualifications above it is highly preferred for data science and data analytics.You can visit my posts [on introduction to python](https://dev.to/marrie/introduction-to-modern-python-48hh) and [python data structures](https://dev.to/marrie/data-structures-and-algorithims-with-python-3k1d) to get a quick introduction to this wonderfull language.
A quick and easy way to run your python codes would be using Jupyter notebook on anaconda.Jupyter notebook is a text editor which comes in very handy when advancing from writing simple python codes to using python libraries to perform data science tasks.
Anaconda on the other hand, is an open distribution of the R and python programming languages that simplifies package management and deployment.You are first required to install anaconda then install jupyter notebook present in anaconda.
[Here](https://medium.com/codingthesmartway-com-blog/getting-started-with-jupyter-notebook-for-python-4e7082bd5d46) is a blog post that sheds more light on jupyter notebook for python and anaconda.

 **Tip**:Once you have anaconda installed and you are familiar with vs code , you can install jupyter notebook as an extension and create a new file using the (.ipynb) extension to use jupyter notebook  in vs code.
Once you run a file,you will be prompted to select the environment you want to use to run your notebook.Ensure you select the _**base**_ environment to smoothen your process.

You can also use the **google colab** which is much easier since all the packages are pre installed ,all you need to do is import and use them,so long as you have a stable network connection.Please opt for this option after you get the basics right so as to ease your coding process

>>

**2.Introduction to Databases**

Once you have tried out some python projects and feel comfortable with moving forward , then learn about databases.
A database simply consists of a collection of data which are stored and accessed electronically.Data is fetched from the database with the help of queries which ask the database to perform various functions.There exists two types of databases , _relational_ and _non-relational_ databases.
A **relational** database usually has tables and data is stored in the tables in form of rows and columns.An example is the [SQL database](https://www.sqltutorial.org/).
A **non-relational** database is also refferred to as NoSQL database.It stores data in a format known as _JSON_ which uses human readable formart to store and retrieve data. Data is stored as  a collection of objects containing key value pairs which are separated from each other with the help of a semi-colon.

```
user
 {
'id':'qwe245ert',
'name':'John',
'occupation':'Doctor'
}
```
In the example above , we have a user object with keys id,name and occupation each containing its own value.Some non-relational databases include [Mongodb](https://www.mongodb.com/docs/manual/tutorial/getting-started/) and [Amazon DynamoDB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Introduction.html).
For further insight on the differences of relational database and non-relational database checkout [this](https://youtu.be/qkod5bY10lU) video.

>>

**3.Understanding Python libraries used in Datascience**

This is always the exciting part for me and I do hope it excites you too.Python contains very useful libraries that are used to perform various data science tasks .Thus understanding these packages is essential to your progress in this field.To use these libraries we must install them using `pip3 install library_name` and then import it into our file.
 
The libraries include:

- Pandas

- Numpy

- Matplotlib

- Seaborn

- Pyforest

**a)Pandas**

This is the python package or library that is used in data analysis.It provides a dataframe that allows you to play around with your data and structure it however you want.Pandas is mostly prefered for its **_flexibility_** and ability to work with **_big data_**.
Most people prefer to refer to a dataframe as (df) when analysing their data.Some functionalities that come with pandas include :
Reading the dataset in any format:

```
df.read_csv('url_of_the_excel_sheet')
```

Viewing part of the dataset

```
df.head()
```

Locate anything:

```
df.loc['column_name']

#locating using an integer
df.iloc[column(s)]

```

Sorting

```
df.sort_values('column_to_sort_by' , ascending=False)
```

Just to mention a few .Check out [this ](https://medium.com/bhavaniravi/python-pandas-tutorial-92018da85a33) blog for more clarifications

**b)Numpy**
Numpy is the same a lists in python.It is used to store multidimentional arrays eg 1D,2D or 3D arrays.Numpy is ussually preferred over lists since it uses fixed values wherease values in list vary.Numpy less storage space compared to list due to the fact that all the blocks storing data are next to each other (contiguous blocks) whereas  in list the blocks are far apart and pointers are used to store data.Numpy enables us to do all the mathematics we need .
Using this library, we can perform more that we could not with lists eg 

```
a=[1,2,3,4]
b=[4,5,6,7]
a*b
```

The above code produces and error.However, in numpy we accomplish this using:

```
a=np.array([1,2,3,4])
b=np.array([4,5,6,7])
a*b
```

we get [4,10,12,28]
Now click [here](https://medium.com/nerd-for-tech/a-complete-guide-on-numpy-for-data-science-c54f47dfef8d) and get more information on how to get started with numpy.

**c.)Matplotlib**
This is an open source drawing library that converts our  dataset into drawings that can be used to understand and further explain our dataset.You can generate various charts eg plots,histograms,bar charts,pie charts and scatter plots.If you are curious about what I am talking about , let [this](https://www.simplilearn.com/tutorials/python-tutorial/matplotlib) tutorial feed your interests.
**Note:** this library feeds on data that is as a result of the two libraries above it .In short, analyse your data by performing mathematical operations on it then plot a suitable chart of it.
**d.)Seaborn**
This is where we visualise information from matrices and dataframes  in order to make attractive statistical plots.This is just a compliment of matplotlib and  not a substitute.In short it adds more flavor to our charts and makes them look more appealing.In order to use seaborn, you need to understand how it approaches data visualizations.
[More info.](https://python.plainenglish.io/seaborn-a-step-by-step-guide-to-catch-your-audience-part-1-42d9e6e30bea).

Now ,after understanding the functionalities of the above libraries, we can use one awesome library called **pyforest** to import all our required libraries with ease.How cool is that guys.....

```
#First install the library in your terminal 
pip3 install pyforest 

#Now write this 
from pyforest import *

#You can veiw all imports by typing
lazy_imports()
```

>>

**4. Connecting to a database of your choice**
We now know the python syntax ,libraries and databases present.How about we combine the knowledge and come up with something cool....
Yes I am talking about connecting our python files to the database.This is very important since we have seen we will work with a collection of data that we will regularly store and retrieve.Check this post about connecting a [postgres database to python](https://medium.com/analytics-vidhya/how-to-setup-a-python-application-with-a-postgres-database-f965e7c1581e),[Python and Dynamodb data](https://medium.com/swlh/a-basic-introduction-to-boto3-a66df5548475)and [connecting to MYSQL](https://medium.com/codex/connect-to-an-mysql-database-via-python-9c88ceac999a).When working with databases ,we will also get to understand some usefull techniques that data must undergo like [data flattening and how to flatten data into a table
](https://towardsdatascience.com/flattening-json-objects-in-python-f5343c794b10) and some common errors found in data like missing values ,bad values , duplicates and methods of avoiding such errors .

I hope this article helps you to get started with data science.Do not let the topics overwhelm you.Try to learn on each day and for sure you will be at a better place within a month or even weeks..... 
[Here](https://github.com/Marriane791/Day3and4_DSC) are some code  examples of the topics covered aboveincase you need more examples.
Happy coding!!!