农粮组织数据分析实战

知识点:

1.pandas中空值是none,所以可以用isnull()方法来统计

 面板数据:同一指标的对比

 2.地理上相互联系的是否有关联

3.随着时间的推移是否有变化

4.时间序列的处理方法 按照时间切片

def time_slice(df, time_period):

    # Only take data for time period of interest
    df = df[df.time_period==time_period] 

    # Pivot table 
    #country作为索引
    #variable作为列名
    #value作为每列的值
    df = df.pivot(index='country', columns='variable', values='value')
    
    df.columns.name = time_period
    
    return df

 

    传入时间和数据

        

 5.按照国家切片

def country_slice(df, country):
    
    # Only take data for country of interest
    df = df[df.country==country] 

    # Pivot table 
    df = df.pivot(index='variable', columns='time_period', values='value')
    
    df.index.name = country
    return df
    

 

7.pandas_profiling.ProfileReport

 rejected 说明相关系数过高,可以舍弃

 

 

 

 

单变量的分析

最大最小均值

 8.有偏数据的处理

 

偏度:均值比中位数小就是左偏,均值比中位数大就是右偏

scipy.stats.skew


峰度: 峰值就是峰度

 

 人口少的国家多,人口多的国家少。

有偏数据不适合拿来建模

bins=50就是50个柱子

通常会把数据看作正态分布

 

  

Guess you like

Origin blog.csdn.net/weixin_45955767/article/details/120102262