2017-09-25 1 views

答えて

0

SPSSで直接行うのは難しいようです。 可能な答え:python + pandasを使用しています。

import pandas as pd 

def add_leading_zero_to_csv(path_to_csv_file): 
    # open the file 
    df_csv = pd.read_csv(path_to_csv_file) 
    # you can possibly specify the format of a column if needed 
    df_csv['specific_column'] = df_csv['specific_column'].map(lambda x: '%.2f' % x) 
    # save the file (with a precision of 3 for all the floats) 
    df_csv.to_csv(path_to_csv_file, index=False, float_format='%.3g') 

「g」フォーマットの詳細:Format Specification Mini-Language

浮動小数点の問題に注意してください(例:answer to this questionを参照)

関連する問題