-1
I had to turn a column of a database into a string in order to remove the last digits of the values, which were 0.1, 0.2 or 0.3 and this would disturb my data in the future. However, by trying to reconnect this column to the previous database, the entire database has become something I can’t even read as a table.
How could I make this column become what it was before, but without such 0.1 numbers... in the end?
Follow a part of the code:
raiosplanetas=ascii.read('raios planetarios.txt', guess=False)
Nome_Simbad=str(raiosplanetas['SimbadName']).replace('.01' or '.02' or '0.3' or '0.4','')
raiosplanetas['Nome']=Nome_Simbad
The first line shows how I turned the column into a string and removed the values I didn’t want, and the second is trying to reintroduce it to the original table.
An example of what is changed with this replace:KOI-0001.01 function turns KOI-0001 and KOI-5877.03 turns KOI-5877
Name_simbad is a number or string?
– Felipe Avelar
Only with this piece of code is complicated. Put the full code for us to help you
– Evilmaax
And another thing. You can remove decimal numbers without having to pass to a string.
– Evilmaax
Felipe: Name_simbad apparently became a string when I did this transformation in the second line of the code. Max: I could stick to the complete table with the 'Simbadname' column, but in theory that part of the code is the total of the problem. The other way to remove the numbers would be like Ruben suggested below? I’m trying it.
– Augusto Baldo