Text data analysis 1234567891011121314151617181920212223242526272829303132333435363738394041import pandas as pdfrom nltk import FreqDistimport jiebafrom matplotlib import pyplot as pltfrom wordcloud import WordCloudfile 2022-03-28 #jieba #nltk
Time series data analysis 1. Basic operation of time series123456789101112131415import pandas as pdprint(pd.to_datetime('20180828'))print()# Pass in multiple datetime stringsdate_index = pd.to_datetime(['2018082 2022-03-27 #pandas
Drawing advanced charts using Matplotlib 1. Drawing a contour map12345678910111213141516171819202122232425262728import numpy as npimport matplotlib.pyplot as pltdef calcu_elevation(x1, y1): h = (1 - x1 / 2 + x1 ** 5 + y1 ** 3) * np.exp(-x 2022-03-27 #Matplotlib
Drawing 3D charts and statistical maps 1. Drawing 3D charts using mplot3d1.1 Mplot3d overview1234567import matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dfig = plt.figure()ax = Axes3D(fig)plt.show() 123456import matplotlib 2022-03-27 #Matplotlib
Jupyter Notebook Autocompletion & Code Formatting 1. Install the extension nbextensions Install: pip install jupyter_contrib_nbextensions -i https://pypi.mirrors.ustc.edu.cn/simple Activation: jupyter contrib nbextension install --user nbextensio 2022-03-25 #Jupyter
Axis customization 1. Axis overview1234import matplotlib.pyplot as pltcur_ax = plt.gca()print(cur_ax.spines) Note: Does not display properly 2. Add an axis to any location12345678910import matplotlib.pyplot as plt# plt. 2022-03-25 #Matplotlib
Sub-graphs and sharing of coordinate axes 1. Draw subgraphs of fixed areas 1.1 Draw single subgraphUsing the subplot() function of the pyplot module, you can draw a single subgraph in a planned area. 1234567891011import matplotlib.pyplot as p 2022-03-17 #Matplotlib
Beautification of chart style 1. Overview of chart styles1.1 Default chart styles123import matplotlibprint(matplotlib.rc_params()) Common configuration items Configuration items Instructions The default value lines.color Li 2022-03-17 #Matplotlib
Classifying with k-Nearest Neighbors 1. Classifying with distance measurements2. Example: imporving matches from a dating site with kNN3. Example: a handwriting recognition system 2022-03-14 #kNN
Customization of chart auxiliary elements 1. The auxiliary elements commonly used in chartsCommon auxiliary elements include following: Coordinate axis: The single coordinate axis can be divided into horizontal coordinate axis (X axis) and v 2022-03-14 #Matplotlib