In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces Spyder how to install and use the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe everyone will have a harvest after reading this article Spyder how to install and use, let's take a look at it together.
1. Spyder Editor Introduction
Spyder is a powerful scientific environment written in Python and designed by scientists, engineers and data analysts. It has a unique combination of advanced editing, analysis, debugging, and profiling capabilities of an integrated development tool with data exploration, interactive execution, in-depth inspection, and nifty visualization capabilities of the science package. In addition, Spyder has built-in integration with many popular scientific software packages, including NumPy, SciPy, Pandas, IPython, QtConsole, Matplotlib, Sympy, and more.
2. Spyder installation
Anaconda is recommended for installation. After installation, click windows key and enter Spyder to open the software.
3. test code
Create a new test.py file
# test
print("hello world")
a = 1
b = 2
c = a + b
Run the program, you can select, click ctrl + return, will run the script.
"Operation Results: "
4. test plot
test.py add drawing code, anconda installed, like the commonly used pandas, numpy, matplotlib can be used directly, the default has been installed.
import matplotlib.pyplot as plt
import numpy as np
dat = np.random.rand(100)
plt.plot(dat)
plt.show()
Click on the picture to display the picture.
5. Do a simple regression analysis
Code:
# regression
import numpy as np
import pandas as pd
from statsmodels.formula.api import ols
np.random.seed(123)
x = np.random.random(100)
y = 0.3*x + np.random.random(100)
dd = pd.DataFrame({"x":x,"y":y})
dd.head()
model = ols("y~x",dd).fit()
print(model.summary())
[Result: ]
6. Use feelings
Functionally similar to Rstudio, but not executed line by line, but according to scripts. There are variable names, there are pictures to show, there are help documents, there are file paths, the function is very full.
❝
Here, there is a feeling, Spyder inside the code completion function is very powerful, do not consider line by line execution, code to be written in blocks. Similar to Google browser just started to search directly in the URL of the place, very unaccustomed to, want to find similar browser search window function, has not been found. This led me to use Firefox for a long time because Firefox has relevant settings. After working with Google Chrome for so long, I was impressed by its simplicity and design. This is how browsers should be used! Because the URL box is very search-friendly, you can enter the URL, you can type keywords, and automatically match previous records. Now that he thought about it, he had wanted to find a function with a search box because his mind had not been opened and he had not thought of that level. In the past, he might have been too obsessed…Use R language habits to apply python, use Rstudio ideas to apply Spyder, there will be this problem, learn a thing, use the most authentic way to learn it!
❞7. A Simple Machine Learning Example
This is the data and code in a file. At the beginning, type in someone else's code first, and then type in the code yourself. It really takes 10,000 lines of code to be familiar with Python's commonly used methods, commonly used formats, and commonly used routines.
"Data Format: ""Data Description: " This is the data of a year of work experience and salary package. Generally speaking, the more years, the higher the salary.
"Analytical thinking: " Here, machine learning is used to divide the data into: reference group and candidate group, or "training group" and "test group", and then model with regression analysis, and then predict the test group to see the accuracy of the prediction.
Simple linear regression analysis
#Load the required package
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#Read the data
dataset = pd.read_csv('Salary_Data.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, -1].values
#Divide data into training and test data, using the partition function in sklearn
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 1/3, random_state = 0)
#Load Regression Analysis
from sklearn.linear_model import LinearRegression
regressor = LinearRegression()
re1 = regressor.fit(X_train, y_train)
#Predicting test data based on models
y_pred = regressor.predict(X_test)
#Visualize training population results
plt.scatter(X_train, y_train, color = 'red')
plt.plot(X_train, regressor.predict(X_train), color = 'blue')
plt.title('Salary vs Experience (Training set)')
plt.xlabel('Years of Experience')
plt.ylabel('Salary')
plt.show()
#Predictive visualization of test data
plt.scatter(X_test, y_test, color = 'red')
plt.plot(X_train, regressor.predict(X_train), color = 'blue')
plt.title('Salary vs Experience (Test set)')
plt.xlabel('Years of Experience')
plt.ylabel('Salary')
plt.show()
[Result: ]
About "Spyder how to install and use" the content of this article is introduced here, thank you for reading! I believe everyone has a certain understanding of "Spyder how to install and use" knowledge. If you still want to learn more knowledge, please pay attention to the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.