openmolecules.org

 
Home » DataWarrior » Functionality » How to change the data type in a column?
How to change the data type in a column? [message #121] Thu, 19 November 2015 17:46 Go to next message
jenninaj is currently offline  jenninaj
Messages: 2
Registered: November 2015
Junior Member
When importing a text file with a column that contains a mix of numbers (e.g. 1500.0, 9.3, etc.) and blanks datawarrior appears to cast this column as text. However, I cannot find a way to change the data type back to numbers and/or how to tell datawarrior during file import time that the column should be treated as numerical.
Am I missing an obvious function/command or is this basic requirement lacking from the current version of DW?
Thanks.
Re: How to change the data type in a column? [message #122 is a reply to message #121] Tue, 24 November 2015 21:25 Go to previous messageGo to next message
thomas is currently offline  thomas
Messages: 146
Registered: June 2014
Senior Member
The data type is determined automatically. If DataWarrior cannot perceive numerical content, it would not help, if you would declare the column to be numerical. I suggest to clean the data, e.g. with search & replace. If a column contains multiple numerical values, they either need to be in separate lines or they should be delimited by '; '. In your case it may already fix the issue, if you replace ', ' by '; '.

Hope this helps, Thomas
Re: How to change the data type in a column? [message #125 is a reply to message #122] Fri, 11 December 2015 16:48 Go to previous messageGo to next message
jenninaj is currently offline  jenninaj
Messages: 2
Registered: November 2015
Junior Member
Thanks. I've confirmed that this occurs when a field in a column contains only numbers but some other fields in the column are blank. I was surprised that based upon the blank/empty fields that DW then interpreted the entire column as text.
Re: How to change the data type in a column? [message #126 is a reply to message #125] Sat, 12 December 2015 14:45 Go to previous message
thomas is currently offline  thomas
Messages: 146
Registered: June 2014
Senior Member
Empty cells are still considered numerical unless they contain invisible characters, e.g. spaces.
Previous Topic: Using text tool
Next Topic: Rounding up to specified decimal points.
Goto Forum:
  


Current Time: Mon Jul 16 04:47:26 CEST 2018

Total time taken to generate the page: 0.00549 seconds