Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas convert numbers in parentheses to negative

(df['Currency'].replace( '[$,)]','', regex=True )
               .replace( '[(]','-',   regex=True ).astype(float))

   Currency
0         1
1      2000
2     -3000
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #convert #numbers #parentheses #negative
ADD COMMENT
Topic
Name
7+1 =