Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Python :: python not equal multiple values 
Python :: open csv from url python 
Python :: seaborn iris dataset 
Python :: echo $pythonpath ubuntu set default 
Python :: How to Merge train and Test dataset in python 
Python :: feature to determine image too dark opencv 
Python :: remove space characters from string in python 
Python :: pandas data frame to list 
Python :: discord bot slash 
Python :: how to dump a database using manage.py 
Python :: how to use setattr Python 
Python :: drop colums whoose value are object type in python 
Python :: pandas dataframe to series 
Python :: python see if a number is greater than other 
Python :: extract nonzero array elements python 
Python :: how to create an entry box on tkinter python 
Python :: buttons on canvas tkinter 
Python :: how to make dictionary in python 
Python :: if else in list comprehension 
Python :: round list python 
Python :: how to concatenate dataframe in python 
Python :: sort folders content by name python 
Python :: python web crawler 
Python :: how to take multiple line input in python 
Python :: python timer() 
Python :: write cell output to file jupyter colab 
Python :: python numpy array 
Python :: how to use a function to find the average in python 
Python :: django update request.post 
Python :: read multiple images cv2 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =