Help us understand the problem. What is going on with this article?

DataFrameに関する関数

列名が同じときに1つだけ残して同じ名前の列を除く関数

def del_duplicate_columns(df):
    """this function removes columns if they have the same name"""
    ret_list=df.columns.tolist()
    ret_result=[]
    for i in range(len(ret_list)):
        if ret_list[i] not in ret_list[0:i]:
            ret_result.append(i)
    return df.iloc[:,ret_result]

季節調整ダミー変数行列の作成

import pandas as pd

def df_seag(index_len=24, seag=12):
    df_seag=pd.DataFrame(0, index=range(index_len), columns=range(seag-1))
    for i in range(index_len):
        if i%seag != seag-1:
            df_seag.iloc[i,i%seag]=1
    return df_seag

df dropper

def df_dropper(df, criteria=0.05):
    '''delete row if it is not densed enough'''
    df=df.reset_index()
    list_to_del=[]
    for i in range(len(df.index)):
        r=df.iloc[i,:]
        if sum(r==r) / len(r) <0.05:
               list_to_del.append(i)
    df.drop(list_to_del, axis=0)
    return df
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away