标签:list frame none str dataframe lse orm code class
1 # 处理小数+符号 2 def deal_data_symbol(dataframe, deal_list, symbol=None, floatformat=2): 3 ‘‘‘ 4 dataframe: 需要处理的dataframe 5 deal_list: 需要处理的列,必须是可迭代 6 symbol: 需要添加的符号,默认无 7 floatformat:保留几位小数,默认为2位 8 ‘‘‘ 9 def data(x): 10 if str(x) != ‘‘: 11 y = ‘%.‘ + str(floatformat) + ‘f‘ 12 if symbol != None: 13 x = y % x + symbol 14 else: 15 x = y % x 16 return x 17 18 for i in deal_list: 19 dataframe[i] = dataframe[i].map(data) 20 return dataframe
标签:list frame none str dataframe lse orm code class
原文地址:https://www.cnblogs.com/xshan/p/12182299.html