diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..5e82ce0
Binary files /dev/null and b/.DS_Store differ
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a047a94
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+.idea/
+__pycache__/
\ No newline at end of file
diff --git a/MainWindow.ui b/MainWindow.ui
new file mode 100644
index 0000000..bec446f
--- /dev/null
+++ b/MainWindow.ui
@@ -0,0 +1,263 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 800
+ 600
+
+
+
+ MainWindow
+
+
+
+ -
+
+
-
+
+
+ -
+
+
+ 打开数据
+
+
+
+ -
+
+
+ 清除
+
+
+
+
+
+ -
+
+
+
-
+
+
-
+
+
+ 线性回归
+
+
+
+ -
+
+
+ 聚类算法
+
+
+
+ -
+
+
+ PushButton
+
+
+
+ -
+
+
+ PushButton
+
+
+
+
+
+ -
+
+
+ 1
+
+
+
+
-
+
+
+ -
+
+
-
+
+
+ Linear Regression
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+ 数据清洗
+
+
+
+ -
+
+
+ 数据归一化
+
+
+
+ -
+
+
+ 开始预处理
+
+
+
+
+
+ -
+
+
+ 24
+
+
+
+ -
+
+
-
+
+
+ 原始数据
+
+
+
+ -
+
+
+ -
+
+
+ 列
+
+
+
+ -
+
+
+ 目标数据
+
+
+
+ -
+
+
+ -
+
+
+ 列
+
+
+
+
+
+ -
+
+
-
+
+
+ 开始拟合
+
+
+
+ -
+
+
+ 保存数据
+
+
+
+ -
+
+
+ 显示结果
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Open
+
+
+
+
+ Clear
+
+
+
+
+ About At
+
+
+
+
+ About
+
+
+
+
+ Exit
+
+
+
+
+
+
+
+
diff --git a/MainWindows.py b/MainWindows.py
new file mode 100644
index 0000000..333d062
--- /dev/null
+++ b/MainWindows.py
@@ -0,0 +1,43 @@
+import Ui_MainWindow
+from PyQt5.QtCore import QFile, QFileInfo, pyqtSlot, pyqtSignal
+from PyQt5 import QtGui, QtWidgets, QtCore
+from PyQt5.QtWidgets import QPushButton
+from PyQt5.QtGui import QIcon, QPixmap
+from data_set_read import Data_Read
+
+class MainWindows:
+ def __init__(self) -> None:
+ self.MainWindow = QtWidgets.QMainWindow()
+ self.ui = Ui_MainWindow.Ui_MainWindow()
+ self.ui.setupUi(self.MainWindow)
+ self.window_ui_init()
+ self.file_object_init()
+
+ def window_ui_init(self):
+ self.MainWindow.setWindowTitle("Data Analysis By Python")
+ self.MainWindow.setWindowIcon(QIcon(QPixmap(":/src/image/icon.jpg")))
+ self.ui.progressBar_linear_regression.setValue(0)
+
+ def file_object_init(self):
+ self.ui.pushButton_filepath.clicked.connect(self.pushButton_filepath_clicked)
+ self.ui.pushButton_filepath_clear.clicked.connect(self.pushButton_filepath_clear_clicked)
+ self.ui.pushButton_linear_regression.clicked.connect(lambda checked: self.ui.stackedWidget.setCurrentIndex(0))
+ self.ui.pushButton_Kmeans.clicked.connect(lambda checked: self.ui.stackedWidget.setCurrentIndex(1))
+
+ def pushButton_filepath_clicked(self):
+ file_path = QtWidgets.QFileDialog.getOpenFileName(self.MainWindow, "Open File", ".", "All Files(*);;csv Files(*.csv);;Old Excel Files(*.xls);;New Excel Files(*.xlsx)")
+ print(file_path[0])
+ info = QFileInfo(file_path[0])
+ suffix = info.suffix()
+ if suffix == "csv":
+ #self.data_read = Data_Read(file_path[0], suffix)
+ self.ui.lineEdit_filepath.setText(file_path[0])
+ elif suffix == "xls" or suffix == "xlsx":
+ #self.data_read = Data_Read(file_path[0], suffix)
+ self.ui.lineEdit_filepath.setText(file_path[0])
+ # if file_path is not None:
+ # self.ui.lineEdit_filepath.setText(file_path)
+
+ def pushButton_filepath_clear_clicked(self):
+ self.ui.lineEdit_filepath.clear()
+
\ No newline at end of file
diff --git a/Ui_MainWindow.py b/Ui_MainWindow.py
new file mode 100644
index 0000000..c917cff
--- /dev/null
+++ b/Ui_MainWindow.py
@@ -0,0 +1,192 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/Users/lennlouis/lenn_ws/python_ws/pyqt_data_analysis/MainWindow.ui'
+#
+# Created by: PyQt5 UI code generator 5.15.9
+#
+# WARNING: Any manual changes made to this file will be lost when pyuic5 is
+# run again. Do not edit this file unless you know what you are doing.
+
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+
+class Ui_MainWindow(object):
+ def setupUi(self, MainWindow):
+ MainWindow.setObjectName("MainWindow")
+ MainWindow.resize(800, 600)
+ self.centralwidget = QtWidgets.QWidget(MainWindow)
+ self.centralwidget.setObjectName("centralwidget")
+ self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget)
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.horizontalLayout = QtWidgets.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.lineEdit_filepath = QtWidgets.QLineEdit(self.centralwidget)
+ self.lineEdit_filepath.setObjectName("lineEdit_filepath")
+ self.horizontalLayout.addWidget(self.lineEdit_filepath)
+ self.pushButton_filepath = QtWidgets.QPushButton(self.centralwidget)
+ self.pushButton_filepath.setObjectName("pushButton_filepath")
+ self.horizontalLayout.addWidget(self.pushButton_filepath)
+ self.pushButton_filepath_clear = QtWidgets.QPushButton(self.centralwidget)
+ self.pushButton_filepath_clear.setObjectName("pushButton_filepath_clear")
+ self.horizontalLayout.addWidget(self.pushButton_filepath_clear)
+ self.verticalLayout_2.addLayout(self.horizontalLayout)
+ self.widget = QtWidgets.QWidget(self.centralwidget)
+ self.widget.setObjectName("widget")
+ self.verticalLayout = QtWidgets.QVBoxLayout(self.widget)
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.pushButton_linear_regression = QtWidgets.QPushButton(self.widget)
+ self.pushButton_linear_regression.setObjectName("pushButton_linear_regression")
+ self.horizontalLayout_2.addWidget(self.pushButton_linear_regression)
+ self.pushButton_Kmeans = QtWidgets.QPushButton(self.widget)
+ self.pushButton_Kmeans.setObjectName("pushButton_Kmeans")
+ self.horizontalLayout_2.addWidget(self.pushButton_Kmeans)
+ self.pushButton_4 = QtWidgets.QPushButton(self.widget)
+ self.pushButton_4.setObjectName("pushButton_4")
+ self.horizontalLayout_2.addWidget(self.pushButton_4)
+ self.pushButton_5 = QtWidgets.QPushButton(self.widget)
+ self.pushButton_5.setObjectName("pushButton_5")
+ self.horizontalLayout_2.addWidget(self.pushButton_5)
+ self.verticalLayout.addLayout(self.horizontalLayout_2)
+ self.stackedWidget = QtWidgets.QStackedWidget(self.widget)
+ self.stackedWidget.setObjectName("stackedWidget")
+ self.page = QtWidgets.QWidget()
+ self.page.setObjectName("page")
+ self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.page)
+ self.horizontalLayout_5.setObjectName("horizontalLayout_5")
+ self.tableWidget_linear_regression = QtWidgets.QTableWidget(self.page)
+ self.tableWidget_linear_regression.setObjectName("tableWidget_linear_regression")
+ self.tableWidget_linear_regression.setColumnCount(0)
+ self.tableWidget_linear_regression.setRowCount(0)
+ self.horizontalLayout_5.addWidget(self.tableWidget_linear_regression)
+ self.verticalLayout_3 = QtWidgets.QVBoxLayout()
+ self.verticalLayout_3.setObjectName("verticalLayout_3")
+ self.label = QtWidgets.QLabel(self.page)
+ self.label.setObjectName("label")
+ self.verticalLayout_3.addWidget(self.label)
+ self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
+ self.horizontalLayout_3.setSpacing(0)
+ self.horizontalLayout_3.setObjectName("horizontalLayout_3")
+ self.checkBox_linear_regression_data_cleaning = QtWidgets.QCheckBox(self.page)
+ self.checkBox_linear_regression_data_cleaning.setObjectName("checkBox_linear_regression_data_cleaning")
+ self.horizontalLayout_3.addWidget(self.checkBox_linear_regression_data_cleaning)
+ self.checkBox_linear_regression_normalize = QtWidgets.QCheckBox(self.page)
+ self.checkBox_linear_regression_normalize.setObjectName("checkBox_linear_regression_normalize")
+ self.horizontalLayout_3.addWidget(self.checkBox_linear_regression_normalize)
+ self.pushButton_linear_regression_preview = QtWidgets.QPushButton(self.page)
+ self.pushButton_linear_regression_preview.setObjectName("pushButton_linear_regression_preview")
+ self.horizontalLayout_3.addWidget(self.pushButton_linear_regression_preview)
+ self.verticalLayout_3.addLayout(self.horizontalLayout_3)
+ self.progressBar_linear_regression = QtWidgets.QProgressBar(self.page)
+ self.progressBar_linear_regression.setProperty("value", 24)
+ self.progressBar_linear_regression.setObjectName("progressBar_linear_regression")
+ self.verticalLayout_3.addWidget(self.progressBar_linear_regression)
+ self.gridLayout = QtWidgets.QGridLayout()
+ self.gridLayout.setObjectName("gridLayout")
+ self.label_linear_regression_original = QtWidgets.QLabel(self.page)
+ self.label_linear_regression_original.setObjectName("label_linear_regression_original")
+ self.gridLayout.addWidget(self.label_linear_regression_original, 0, 0, 1, 1)
+ self.lineEdit = QtWidgets.QLineEdit(self.page)
+ self.lineEdit.setObjectName("lineEdit")
+ self.gridLayout.addWidget(self.lineEdit, 0, 1, 1, 1)
+ self.label_linear_regression_original_col = QtWidgets.QLabel(self.page)
+ self.label_linear_regression_original_col.setObjectName("label_linear_regression_original_col")
+ self.gridLayout.addWidget(self.label_linear_regression_original_col, 0, 2, 1, 1)
+ self.label_linear_regression_target = QtWidgets.QLabel(self.page)
+ self.label_linear_regression_target.setObjectName("label_linear_regression_target")
+ self.gridLayout.addWidget(self.label_linear_regression_target, 1, 0, 1, 1)
+ self.lineEdit_linear_regression_target = QtWidgets.QLineEdit(self.page)
+ self.lineEdit_linear_regression_target.setObjectName("lineEdit_linear_regression_target")
+ self.gridLayout.addWidget(self.lineEdit_linear_regression_target, 1, 1, 1, 1)
+ self.label_linear_regression_target_col = QtWidgets.QLabel(self.page)
+ self.label_linear_regression_target_col.setObjectName("label_linear_regression_target_col")
+ self.gridLayout.addWidget(self.label_linear_regression_target_col, 1, 2, 1, 1)
+ self.verticalLayout_3.addLayout(self.gridLayout)
+ self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
+ self.horizontalLayout_4.setObjectName("horizontalLayout_4")
+ self.pushButton_linear_regression_begin = QtWidgets.QPushButton(self.page)
+ self.pushButton_linear_regression_begin.setObjectName("pushButton_linear_regression_begin")
+ self.horizontalLayout_4.addWidget(self.pushButton_linear_regression_begin)
+ self.pushButton_linear_regression_save = QtWidgets.QPushButton(self.page)
+ self.pushButton_linear_regression_save.setObjectName("pushButton_linear_regression_save")
+ self.horizontalLayout_4.addWidget(self.pushButton_linear_regression_save)
+ self.pushButton_linear_regression_show = QtWidgets.QPushButton(self.page)
+ self.pushButton_linear_regression_show.setObjectName("pushButton_linear_regression_show")
+ self.horizontalLayout_4.addWidget(self.pushButton_linear_regression_show)
+ self.verticalLayout_3.addLayout(self.horizontalLayout_4)
+ self.horizontalLayout_5.addLayout(self.verticalLayout_3)
+ self.stackedWidget.addWidget(self.page)
+ self.page_2 = QtWidgets.QWidget()
+ self.page_2.setObjectName("page_2")
+ self.stackedWidget.addWidget(self.page_2)
+ self.page_3 = QtWidgets.QWidget()
+ self.page_3.setObjectName("page_3")
+ self.stackedWidget.addWidget(self.page_3)
+ self.page_4 = QtWidgets.QWidget()
+ self.page_4.setObjectName("page_4")
+ self.stackedWidget.addWidget(self.page_4)
+ self.verticalLayout.addWidget(self.stackedWidget)
+ self.verticalLayout_2.addWidget(self.widget)
+ MainWindow.setCentralWidget(self.centralwidget)
+ self.menubar = QtWidgets.QMenuBar(MainWindow)
+ self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 24))
+ self.menubar.setObjectName("menubar")
+ self.menu_file = QtWidgets.QMenu(self.menubar)
+ self.menu_file.setObjectName("menu_file")
+ self.menu_about = QtWidgets.QMenu(self.menubar)
+ self.menu_about.setObjectName("menu_about")
+ MainWindow.setMenuBar(self.menubar)
+ self.statusbar = QtWidgets.QStatusBar(MainWindow)
+ self.statusbar.setObjectName("statusbar")
+ MainWindow.setStatusBar(self.statusbar)
+ self.actionOpen = QtWidgets.QAction(MainWindow)
+ self.actionOpen.setObjectName("actionOpen")
+ self.actionClear = QtWidgets.QAction(MainWindow)
+ self.actionClear.setObjectName("actionClear")
+ self.actionAbout_At = QtWidgets.QAction(MainWindow)
+ self.actionAbout_At.setObjectName("actionAbout_At")
+ self.actionAbout = QtWidgets.QAction(MainWindow)
+ self.actionAbout.setObjectName("actionAbout")
+ self.actionExit = QtWidgets.QAction(MainWindow)
+ self.actionExit.setObjectName("actionExit")
+ self.menu_file.addAction(self.actionOpen)
+ self.menu_file.addAction(self.actionClear)
+ self.menu_file.addAction(self.actionExit)
+ self.menu_about.addAction(self.actionAbout_At)
+ self.menu_about.addAction(self.actionAbout)
+ self.menubar.addAction(self.menu_file.menuAction())
+ self.menubar.addAction(self.menu_about.menuAction())
+
+ self.retranslateUi(MainWindow)
+ self.stackedWidget.setCurrentIndex(1)
+ QtCore.QMetaObject.connectSlotsByName(MainWindow)
+
+ def retranslateUi(self, MainWindow):
+ _translate = QtCore.QCoreApplication.translate
+ MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
+ self.pushButton_filepath.setText(_translate("MainWindow", "打开数据"))
+ self.pushButton_filepath_clear.setText(_translate("MainWindow", "清除"))
+ self.pushButton_linear_regression.setText(_translate("MainWindow", "线性回归"))
+ self.pushButton_Kmeans.setText(_translate("MainWindow", "聚类算法"))
+ self.pushButton_4.setText(_translate("MainWindow", "PushButton"))
+ self.pushButton_5.setText(_translate("MainWindow", "PushButton"))
+ self.label.setText(_translate("MainWindow", "Linear Regression"))
+ self.checkBox_linear_regression_data_cleaning.setText(_translate("MainWindow", "数据清洗"))
+ self.checkBox_linear_regression_normalize.setText(_translate("MainWindow", "数据归一化"))
+ self.pushButton_linear_regression_preview.setText(_translate("MainWindow", "开始预处理"))
+ self.label_linear_regression_original.setText(_translate("MainWindow", "原始数据"))
+ self.label_linear_regression_original_col.setText(_translate("MainWindow", "列"))
+ self.label_linear_regression_target.setText(_translate("MainWindow", "目标数据"))
+ self.label_linear_regression_target_col.setText(_translate("MainWindow", "列"))
+ self.pushButton_linear_regression_begin.setText(_translate("MainWindow", "开始拟合"))
+ self.pushButton_linear_regression_save.setText(_translate("MainWindow", "保存数据"))
+ self.pushButton_linear_regression_show.setText(_translate("MainWindow", "显示结果"))
+ self.menu_file.setTitle(_translate("MainWindow", "文件"))
+ self.menu_about.setTitle(_translate("MainWindow", "关于"))
+ self.actionOpen.setText(_translate("MainWindow", "Open"))
+ self.actionClear.setText(_translate("MainWindow", "Clear"))
+ self.actionAbout_At.setText(_translate("MainWindow", "About At"))
+ self.actionAbout.setText(_translate("MainWindow", "About"))
+ self.actionExit.setText(_translate("MainWindow", "Exit"))
diff --git a/data.csv b/data.csv
new file mode 100644
index 0000000..e69de29
diff --git a/data_set_read.py b/data_set_read.py
index e69de29..b3b664d 100644
--- a/data_set_read.py
+++ b/data_set_read.py
@@ -0,0 +1,16 @@
+import pandas as pd
+import numpy as np
+
+class Data_Read:
+ def __init__(self, file_path, suffix) -> None:
+ self.file_path = file_path
+ if suffix == "csv":
+ self.data_frame = pd.read_csv(self.file_path)
+ elif suffix == "xls" or suffix == "xlsx":
+ self.data_frame = pd.read_excel(self.file_path)
+
+ def get_head_data(self, n : int):
+ return self.data_frame.head(n)
+
+
+
\ No newline at end of file
diff --git a/images.qrc b/images.qrc
new file mode 100644
index 0000000..91d1c39
--- /dev/null
+++ b/images.qrc
@@ -0,0 +1,5 @@
+
+
+ src/image/icon.jpg
+
+
diff --git a/main.py b/main.py
index e69de29..dcc7b42 100644
--- a/main.py
+++ b/main.py
@@ -0,0 +1,10 @@
+from MainWindows import MainWindows
+from PyQt5.QtCore import QFile, QFileInfo
+from PyQt5 import QtGui, QtWidgets, QtCore
+import sys
+
+if __name__ == "__main__":
+ app = QtWidgets.QApplication(sys.argv)
+ mainwindows = MainWindows()
+ mainwindows.MainWindow.show()
+ sys.exit(app.exec_())
\ No newline at end of file
diff --git a/src/.DS_Store b/src/.DS_Store
new file mode 100644
index 0000000..05f74b2
Binary files /dev/null and b/src/.DS_Store differ
diff --git a/src/image/icon.jpg b/src/image/icon.jpg
new file mode 100644
index 0000000..d70eb45
Binary files /dev/null and b/src/image/icon.jpg differ