Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas change to numeric

>>> s = pd.Series(["8", 6, "7.5", 3, "0.9"]) # mixed string and numeric values
>>> s
0      8
1      6
2    7.5
3      3
4    0.9
dtype: object

>>> pd.to_numeric(s) # convert everything to float values
0    8.0
1    6.0
2    7.5
3    3.0
4    0.9
dtype: float64
Comment

PREVIOUS NEXT
Code Example
Python :: how to find which 2 rows of a df are the most similar 
Python :: how to add two numbers in python 
Python :: run powershell script in python 
Python :: python sqlite 
Python :: pandas iterrows 
Python :: or operator django 
Python :: sort a stack using recursion 
Python :: seaborn bar plot 
Python :: add row in db django 
Python :: drop column pandas 
Python :: how to create string in python 
Python :: heroku python version 
Python :: robust scaler 
Python :: python push to list 
Python :: create an array of n same value python 
Python :: formatting in python 
Python :: index in list 
Python :: xor string python 
Python :: what is hashlib in python 
Python :: get tail of dataframe pandas 
Python :: selenium get parent element 
Python :: matplotlib location legend 
Python :: python get last element of list 
Python :: yahoo finance api python 
Python :: change to first letter capital list python 
Python :: dataframe to dictionary 
Python :: pandas cheat sheet pdf 
Python :: python create folder 
Python :: fast fourier transform python 
Python :: python convert string to byte array 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =