I would like to summarize the Python code used in data analysis as a review of what I learned at school.
This time, I would like to focus on the basics. (It is undecided how many times it will end.)
Jupyter-Notebook (https://jupyter.org/) Have Numpy installed
In the class, all the data was stored in the csv file (Excel file). The reading code is
import numpy as np
array=np.loadtxt(fname="(file name)",delimiter=".")
//The file name is~~.Let's write up to csv.//
The read data has a matrix structure. The position of the data has a structure similar to Excel. Column 0 has the first row of Excel.
Also, if you say that the file cannot be read, make sure that the file is in a certain hierarchy. For example, if the document has a file, open Jupyter-notebook, click the document, and try it there.
The data obtained by the above method is an array array. The data contains both explanatory variables and results. It is a work to separate this. As I said earlier, the obtained data array contains data in the same order and structure as Excel. Divide this into columns (vertical).
array_x=array[:,j]Get column j
array_x=array[:,j:]Get from column j to last column
It's the first time, so it's about this. Farewell-
Recommended Posts