In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail about python correlation analysis and drawing scattered point example analysis, Xiaobian think it is quite practical, so share it for everyone to make a reference, I hope you can gain something after reading this article.
Library needed
The main libraries used are pandas, numpy, matplotlib, seaborn, etc. If you want to use seaborn library, you must introduce matplotlib library, seaborn is its plug-in library.
#1 load pakeage import pandas as pd#read and write tables and table processing import numpy as np#for data computation import geopandas as gpdimport matplotlib.pyplot as pltimport seaborn as snsimport osimport warningswarnings.filterwarnings ("ignore")plt.rc ('font',family='Times New Roman')from glob import globfrom osgeo import gdal,gdal_array, gdalnumericplt.rcParams <$'font.sans-serif']=<$'Simhei'] #Display Chinese plt.rcParams <$'axes.unicode_minus']=False #Display sign data read
Here I am using a portion of my junior brother's data, reading the data here.
df = pd.read_csv('./ JXDY_1.csv',encoding='utf-8')df.head()
Here we do correlation analysis
df.corr()#default is pearson correlation analysis
Then we do a batch scatter plot output, putting correlation data on the graph
a = 2#where the correlation is calculated from the second bit, so I extract for i in df.columns[3:]: a1 = sns.lmplot(y='fruit',x=i,data=df) ax = plt.gca() ax.text(0.9,1,"Pearson:{:.2f}".format(df.corr().iloc[1,a]),transform=ax.transAxes)#Add correlation a = a+1 plt.savefig('./ {}.jpg'.format(i),dpi=300,bbox_inches = 'tight')
The result is done, and then the result output can be!
About "python correlation analysis and drawing scattered point example analysis" This article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.