Skip to main content

All Questions

Tagged with
0 votes
1 answer
81 views

How to resolve fractions and subtraction in a pandas string column [duplicate]

I have a dataframe column that includes fractions and subtraction, like so: 60 12.5 6/12 2021-1988 NaN 8/12 3 NaN 2021-2004 5 It's in string format right now. I want it to be numeric. However, when I ...
midnightradi0's user avatar
0 votes
1 answer
499 views

How to convert string entries within a dataset to float?

I am trying to convert string to float in a dataset. The dataset consists of several columns where one of the columns contains entries: col1 col2 x [1.1, 1.2, 1.3 ... When I use pd.to_numeric I get ...
user16470918's user avatar
12 votes
4 answers
26k views

Pandas convert strings to numeric if possible; else keep string values

I have a Pandas Dataframe which has columns which look something like this: df: Column0 Column1 Column2 'MSC' '1' 'R2' 'MIS' 'Tuesday' '22' '13' 'Finance' 'Monday' ...
JanB's user avatar
  • 199
0 votes
0 answers
69 views

testing if an element of a dataframe is a string in r

I'm trying to manage a large data frame with r. I want to subset only rows with a number on the first cell (participants), and get rid of rows starting with a characters (testing trials). I've ...
Raphael Mizzi's user avatar
2 votes
1 answer
747 views

Convert a column of strings in data frame into numeric in R (not the usual kind)

So in R I have a column consisting of strings that look like something similar to this: "Peter","Paul","John","Melissa","Paul","Peter" ... And I want to convert these names to a numerical ID format, ...
hippie_poe's user avatar