Qwen3-Reranker-0.6B部署案例:中小企业低成本构建高精度语义搜索服务

核心内容摘要

Switch游戏安装工具全方位实战指南:从入门到精通
IDEA创建多级包时显示在同一行怎么办

万物识别大模型在SpringBoot项目中的集成应用

Python数据分析是一个系统性的技术领域涉及数据获取、清洗、处理、可视化到建模的完整流程。

以下是核心知识体系和实践指南

Python数据分析技术栈核心库与工具库名称主要用途学习重点NumPy​数值计算基础多维数组操作数组创建、索引切片、广播机制、数学运算Pandas​数据处理核心表格数据操作DataFrame操作、数据清洗、分组聚合、合并连接Matplotlib​基础绘图库高度可定制折线图、柱状图、散点图、子图布局Seaborn​统计可视化基于Matplotlib分布图、热力图、分类图、主题美化Scikit-learn​机器学习库算法丰富数据预处理、模型训练、评估、特征工程辅助工具Jupyter Notebook/JupyterLab交互式开发环境适合探索性分析VS Code/PyCharm专业IDE适合大型项目Anaconda包管理工具简化环境配置

数据分析完整流程阶段1数据获取与加载import pandas as pd # 从CSV文件读取 df pd.read_csv(data.csv, encodingutf-

# 从Excel读取 df pd.read_excel(data.xlsx, sheet_nameSheet

# 从数据库读取需安装对应驱动 import sqlite3 conn sqlite

connect(database.db) df pd.read_sql_query(SELECT * FROM table, conn)阶段2数据探索与清洗# 查看数据基本信息 print(df.info()) # 数据类型、缺失值 print(df.describe()) # 数值型统计描述 print(df.head()) # 前几行数据 # 处理缺失值 df.dropna() # 删除缺失行 df.fillna(

# 填充为0 df.fillna(df.mean()) # 用均值填充 # 处理重复值 df.drop_duplicates() # 数据类型转换 df[column] df[column].astype(int) # 转换为整型 df[date_col] pd.to_datetime(df[date_col]) # 转换为日期 # 异常值处理 Q1 df[col].quantile(

0.

Q3 df[col].quantile(

0.

IQR Q3 - Q1 df df[~((df[col] (Q1 -

5*IQR)) | (df[col] (Q3

5*IQR)))]阶段3数据预处理与特征工程# 数据标准化 from sklearn.preprocessing import StandardScaler scaler StandardScaler() df_scaled scaler.fit_transform(df[[col1, col2]]) # 独热编码分类变量 df_encoded pd.get_dummies(df, columns[category_col]) # 时间特征提取 df[year] df[date_col].dt.year df[month] df[date_col].dt.month df[day_of_week] df[date_col].dt.dayofweek # 分组聚合 grouped df.groupby(category)[value].agg([mean, std, count])阶段4数据可视化import matplotlib.pyplot as plt import seaborn as sns # 设置样式 plt.style.use(seaborn-v0_

sns.set_palette(husl) # 单变量分布 plt.figure(figsize(10,

) sns.histplot(df[value], kdeTrue) plt.title(Value Distribution) plt.show() # 双变量关系 plt.figure(figsize(10,

) sns.scatterplot(xx_col, yy_col, datadf, huecategory) plt.title(Scatter Plot) plt.show() # 多变量热力图 corr df.corr() plt.figure(figsize(12,

) sns.heatmap(corr, annotTrue, cmapcoolwarm) plt.title(Correlation Heatmap) plt.show()阶段5建模与评估from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error, r2_score # 划分训练集和测试集 X df[[feature1, feature2]] y df[target] X_train, X_test, y_train, y_test train_test_split(X, y, test_size

2, random_state

# 模型训练 model LinearRegression() model.fit(X_train, y_train) # 预测与评估 y_pred model.predict(X_test) print(MSE:, mean_squared_error(y_test, y_pred)) print(R2 Score:, r2_score(y_test, y_pred)) # 特征重要性线性回归系数 coef_df pd.DataFrame({feature: X.columns, coefficient: model.coef_}) print(coef_df.sort_values(coefficient, ascendingFalse))

常用数据分析场景

描述性统计分析# 基本统计量 df.describe() # 分类变量统计 df[category].value_counts() # 交叉表 pd.crosstab(df[cat1], df[cat2]) # 分组统计 df.groupby(group_col)[value_col].agg([mean, median, std])

时间序列分析# 设置时间索引 df_time df.set_index(date_col) # 重采样日→月 monthly_data df_time[value].resample(M).mean() # 移动平均 rolling_mean df_time[value].rolling(window

.mean() # 时间序列可视化 plt.figure(figsize(12,

) plt.plot(df_time.index, df_time[value], labelOriginal) plt.plot(rolling_mean.index, rolling_mean, label7-Day MA, colorred) plt.legend() plt.show()

数据透视表# 创建透视表 pivot_table pd.pivot_table(df, valuessales, indexregion, columnsmonth, aggfuncsum, fill_value

print(pivot_table)

数据合并与连接# 按列合并 pd.concat([df1, df2], axis

# 按行合并 pd.concat([df1, df2], axis

# 按键连接 pd.merge(df1, df2, onkey_col, howinner) # 内连接 pd.merge(df1, df2, onkey_col, howleft) # 左连接

黄金网站9.1入口免费观不下载-黄金网站9.1入口免费观不下载应用

百度百家号客服电话人工服务

123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123