My list with numbers in OpenOffice calc look so: http://prntscr.com/3hlqaa
and on save as .csv my parameters are: http://prntscr.com/3hlrms, as field delimetter "," but if i open this file with notepad i see it so:
546
5454
5456
5446
58654
8796
13211
but i need it to have so:
546,5454,5456,5446,58654,8796,13211
Can someone help me what i do wrong here?
The export is correct, as #Frazz says there is "one line in csv for every row in excel file", if you want all the numbers in one line, there are several ways, i will use this PHP script:
<?
$file = file_get_contents("your_export_file.csv"); //Name of your file
$replaced_data = str_replace("\n",",",$file);
file_put_contents("new_export_file.csv",$replaced_data); //Desired name
?>
If you don't have PHP installed perhaps an advanced editor (Notepad++, Sublime, Eclipse, Netbeans,..) could do the job, just replace \n for ,
It seems that the end-of-lines are not transformed to the delimiters.
If you put all the numbers in one line, it should work. At least it does in Excel (which seens to work similar).
You can use the Transpose function to get (a copy) in one line.
https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_TRANSPOSE_function
Related
I have a problem when opening a dataset in WEKA. While in its .csv format all the variables and respective values are clearly distinguished, in WEKA I only have one attribute which looks like this:
PINCP; AGEP; LANX; RACWHT; RACBLK; RACASN; SEX; etc.
and the values associated look similar, being separated by a semicolon as well.
Do you have any suggestions on how to make this work?
Thanks in advance!
CSV stands for comma-separated values. Your dataset, on the other hand, uses semi-colons as separator between cells.
When opening your dataset in the Weka Explorer, check the Invoke options dialog box in the file chooser dialog. Then change the fieldSeparator option from a comma to a semi-colon.
In case you are using the command-line for loading your dataset, use the -F option of the CSVLoader class.
I have a folder containing a number of csv files, e.g. "leeds dz.csv", "leeds gh.csv", "leeds fr.csv". The first part of the file names is constant (i.e. always "leeds").
I want to import each to Stata individually, convert to .dta file and save it. Currently I have this code:
cd "etcetc"
clear
local myfilelist : dir . files"*.csv"
foreach file of local myfilelist {
drop _all
insheet using `file', comma
local outfile = subinstr("`file'",".csv","",.)
save "`outfile'", replace
}
The code works fine if I rename all the .csv files manually to delete the "leeds" part, ie if each .csv is named "dz.csv" instead of "leeds dz.csv" etc.
However, if I do not do this deletion I receive the error "invalid 'dz.csv' "
I'm guessing this has something to do with my 3rd line of code, in particular the "*.csv". But I'm unsure how to adapt the code/ why it won't allow me to import files with a space in the name?
The line
insheet using `file', comma
will be problematic with any filename containing spaces.
Try
insheet using "`file'", comma
The help for insheet is quite explicit on this:
If filename is specified without an extension, .raw is assumed. If your
filename contains embedded spaces, remember to enclose it in double
quotes.
The output of my datamapper is a csv file. And the output looks like the below one.
For eg:
"1","10"
"3","40"
But my requirement"
1,10
3,40
What configuration should i do to get the o/p as required. Pls suggest!!!
Click on the options circled in red on the destination profile and uncheck the check box "Quote Strings" in the pop up that comes there after .
Some times the CSV file has this Quotes by default
I have a semicolon-separated csv file over here, and I would like to be able to look at it with gnumeric. Sadly, gnumeric does not read the semicolon as a separator.
I have tried:
appending sep=; on the first line
clicking through the GUI menus
using sed to replace the semicolons with commas (sadly, that leads to breakage, since by document occasionally uses commas within cells
What else can I do?
In recent versions of gnumeric a new Import Data tool is available. To launch the tool choose Data|Import Data|Import Text File... from the menu.
In the Import Data File dialog choose your file and hit Open.
In the next screen select Separated format and click Forward
In the following screen select a separator from a number of available options and click Forward once again to choose the columns to import.
Click Finish to complete.
Solution that worked for me in a comma separated csv file with dot decimal separators:
Open .csv file from a text editor
replace all "," with ";" (semicolon)
replace all dot decimal separators "." with ","
save file
open gnumeric, go to Data -> Get External Data -> Import Text File
and then open the saved file
hit Forward and Finish
save as a gnumeric file
This CSV file has a field delimiter of $
It looks like this:
14$"ALL0053"$$$"A"$$$"Direct Deposit in FOGSI A/c"$$"DR"$"DAS PRADIP ...
How can I view the file as columns, each field shown as in columns in a table.
I've tried many ways, none work. Any one knows how?
I am using Ubuntu
That's a weird CSV. Since a comma-separated file is usually separated by, well, commas. I think all you need to do is use a simple find/replace available in any text editor.
Open the file in Gnome Edit and look under Edit > Replace...
From there you can specify to replace all $s with ,s
Once your file is a real CSV, you can open it in Open Office Calc (spreadsheet), or really any other spreadsheet program for Ubuntu (GNOME).
cut -d $ -f 1,2,...x filename | sed 's/\$/ /g'
if you only want particular columns, and you don't want to see the $
or
sed 's/\$/ /g' filename
if you just want the $ to be replaced by a space
in ubuntu right-click on the file hit open with.. then OpenOffice Calc. then you should see a dialog box asking for delimiters etc. uncheck comma and and in the "other" field type a $. then hit okay and it will import it for you.
N
As a first attempt:
column -ts'$' path
but this doesn't handle empty fields well, so fix that with this ugly hack:
sed 's/\$\$/$ $/g' path | column -ts$