Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- input_file = "input.csv"
- output_file = "output.csv"
- INTER = "Inter"
- INTRA = "Intra"
- def round_nums(val):
- copy = round(val, 4)
- if copy < val:
- copy = copy + 0.0001
- return copy
- def convert(input_df):
- input_df[INTER] = input_df[INTER].apply(round_nums)
- input_df[INTRA] = input_df[INTRA].apply(round_nums)
- return input_df
- input_df = pd.read_csv(input_file)
- output_df = convert(input_df)
- output_df.to_csv(output_file, index=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement