Code Fellows courses Notes
This project is maintained by QamarAlkhatib
JupyterLab is a next-generation web-based user interface for Project Jupyter.JupyterLab enables you to work with documents and activities such as Jupyter notebooks, text editors, terminals, and custom components in a flexible, integrated, and extensible manner.
Almost every data analysis or machine learning package for Python leverages NumPy in some way. NumPy was originally developed in the mid 2000s, and arose from an even older package called Numeric.
steps to work with data using python csv package:
delimiter=";"
to make sure that the records are split up on the semicolon character instead of the default comma character.
carr the list type to get all the rows from the file.here is an example:
import csv
with open('name of the file.csv','r') as file
name = list(csv.reader(file,delimiter=';'))
print(name[:3])
we can calculate or edit the data once the data has been printed out.
Notes:
A 2-dimensional array is also known as a matrix
In a NumPy array, the number of dimensions is called the rank, and each dimension is called an axis. So the rows are the first axis, and the columns are the second axis.
One of the limitations of NumPy is that all the elements in an array have to be of the same type,
if we include the header row, all the elements in the array will be read in as strings
If we pass in a list of lists, it will automatically create a NumPy array with the same number of rows and columns. Because we want all of the elements in the array to be float elements for easy computation, we can use the numpy.array function to compute an element-by-element array.
using numpy with the previous code:
import csv
with open('name of the file.csv','r') as file
name = list(csv.reader(file,delimiter=';'))
import numpy as np
name = np.array(name[1:], dtype=np.float)
We can check the number of rows and columns in our data using the shape property of NumPy arrays:
name.shape