I have a data frame that I’d like to filter
I have only tried one solution of those given.
Float64. What you talked about is accurate @fmarz10. I wanted to filter the rows and apply a transformation, then remove something. This first row of code works perfect, it just worked.
df.loc[df[‘col2’]<=5,’col2’] = df[‘col2’]*1000
I did, however, refrain from using the second suggestion to as some numbers are not just whole numbers and contain values at least two places into the decimal. To complete it, I did something like this and it looks good from just scanning the first few rows.
df[‘col’2’] = df[‘col2’].replace(‘,’,’’)
vs the original suggestion:
df[‘col’2’] = df[‘col2’].str.replace(‘,’,’’)
NOTE: This works, but this is weekly data, and each row is a week’s worth of data and there are about 15,000 rows, so I need to just graze a few before making an assessment, but the first few look good.
On the column that I’d like to filter, the column contains data from two different sources. I’d like to normalize this data. We collected some data a certain way and the other rows of data contain data that was collected another way. There are rows that contain 1.2 2.3 3.4 and nothing over 5. I would like to multiply these numbers by 1,000 to match up with the others and remove the comma from the numbers above 1,000.




col1
col2




1
1.641


2
1.548


3
1,807.000


4
1,759.000