还是之前的那一堆csv数,主要算每列的中位数、四分位数、最大值、最小值等
我在这里做个笔记,方便下次用的时候直接粘过来用
#!usr/bin/env python # -*- coding:utf-8 -*- """ @author: Suyue @file: vilolinpic.py @time: 2024/08/13 @desc: """ import pandas as pd df = pd.read_csv('G:/8_area.csv') median_series = df.median() max_series = df.max() min_series = df.min() quantile_41 = df.quantile(0.25) quantile_43 = df.quantile(0.75) df2 = pd.DataFrame() df2.insert(loc=0,column='中位数',value=median_series) df2.insert(loc=1,column='最大值',value=max_series) df2.insert(loc=2,column='最小值',value=min_series) df2.insert(loc=3,column='四分之一',value=quantile_41) df2.insert(loc=4,column='四分之三',value=quantile_43) print(df2) df2.to_excel('G:/8_area_result.xlsx')
标签:loc,python,series,quantile,中位数,value,df2,df,最小值 From: https://www.cnblogs.com/shirleysu90/p/18361298