[PYTHON] [Super Basics] About jupyter Notebook

What is this?

I'm neither a software engineer nor a data scientist, but as I extract data from MySQL, BigQuery, etc. in my daily work, I've become interested in the method of statistically expressing and visualizing them. I think jupyter notebook is suitable for realizing them, and recently wrote Python in jupyter notebook. This article is a compilation of memorandums when I use jupyter, and the scope is from reading CSV data using pandas to checking basic statistics and simple data visualization methods.

What is Jupyter Notebook?

Refer to official document

Code memo

What is Pandas? ... A library that provides functions to support data analysis. In particular, it provides data structures and operations for manipulating mathematical tables and time series data. What is numpy? ・ ・ ・ Library for numerical analysis What is pyplot? ・ ・ ・ Visualization library

1. Import data and check data

test.ipynb


# 1.Import the libraries needed for data analysis

import pandas as pd 
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline

#2.Read data * It is assumed that there is a column. If not header=Specify None as an option
# head()、tail()By using the function, you can check the contents of the data at the beginning or the end. I use it when there are many lines
data = pd.read_csv("hogehoge.csv") 

#3.Check the matrix of data
data.shape # -> (Rows, columns) will be returned.

#4.Check the basic statistics (basic characteristics of the data. Mean, standard deviation, maximum, minimum, etc.) and data type.
#Also, mean()By using functions such as, it is also possible to return only the average.
data.describe()
data.info()


#To specify a column: "Hogehoge" in the where clause in SQL=Image to specify "hoge"
data["hoge"]

2. Data visualization

test.ipynb



#Draw a line graph.
#The size can be specified as an option. figsize=(Horizontal size,Vertical size)Specify with
#In addition, the title can be specified as an option. title= "hoge"
data["hoge"].plot()

#Specifies the name of the x-axis and y-axis
label = date.plot(figzize=(15,5),title="test")
label.set_xlabel("hogehoge")
label.set_ylabel("hogehoge")

#variable.plot.hist()でヒストグラムを、variable.boxplot(by=x axis)Box plot is also possible with.

Recommended Posts

[Super Basics] About jupyter Notebook
Jupyter Notebook memo
Introducing Jupyter Notebook
Powerful Jupyter Notebook
Jupyter notebook password
Jupyter Notebook Basics of how to use
Jupyter Notebook memo
How to use Jupyter notebook [Super Basic]
Get started Jupyter Notebook
3 Jupyter notebook (Python) tricks
PyTorch Super Introduction PyTorch Basics
Make clear about super ()
[Cloud103] # 3 Jupyter Notebook again
Shortcut key for Jupyter notebook
Introduced Jupyter Notebook to CentOS 7
Using Graphviz with Jupyter Notebook
Display HTML in Jupyter notebook
Use pip with Jupyter Notebook
About the garbled Japanese part of pandas-profiling in Jupyter notebook
Multiprocessing error in Jupyter Notebook
Try using Jupyter Notebook dynamically
High charts on Jupyter notebook
View PDF on Jupyter Notebook
Use Cython with Jupyter Notebook
homebrew, pyenv, anaconda, Jupyter Notebook
Play with Jupyter Notebook (IPython Notebook)
[Complete version] Jupyter Notebook shortcut
Run Jupyter Notebook on windows
How to use Jupyter Notebook
python3.8 venv environment jupyter notebook
Allow external connections with jupyter notebook
Formatting with autopep8 on Jupyter notebook
Snippet settings for python jupyter notebook
Jupyter Notebook essential for software development
Python memo Anaconda x Jupyter Notebook
Post a Jupyter Notebook as a blog post
Visualize decision trees with jupyter notebook
Make a sound with Jupyter notebook
Jupyter Notebook Magic Command Personal Summary
Simply view the Jupyter notebook file
Run azure ML on jupyter notebook
Jupyter Notebook: 4 banal tips and tricks
[MEMO] [Development environment construction] Jupyter Notebook
Use markdown with jupyter notebook (with shortcut)
Add more kernels with Jupyter Notebook
View graphs inline in Jupyter Notebook
Convenient analysis with Pandas + Jupyter notebook
Launch jupyter notebook (+ take security measures)
Easy to use Jupyter notebook (Python3.5)
Try running Jupyter Notebook on Mac
Somehow I tried using jupyter notebook
About Linux commands Super basic edition
About the basics list of Python basics
Try starting Jupyter Notebook ~ Esper training
I tried VS Code's Jupyter notebook