2017-09-25 6 views

Répondre

0

Il semble difficile de le faire directement dans SPSS. Une réponse possible: utiliser 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') 

En savoir plus sur la mise en forme "g": Format Specification Mini-Language. Et faites attention au problème du point flottant (par exemple, voir le answer to this question)