Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. from decimal import Decimal
  2. import pandas as pd
  3.  
  4. def decimal_from_value(value):
  5. return Decimal(value)
  6.  
  7. df = pd.read_csv(filename, converters={'values': decimal_from_value})
  8.  
  9. # converter set values type to "object" (Decimal), not default float64
  10. print(df.dtypes)
  11. # values object
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement