csv

How to import a csv file using @ as delimiter with VBA

旧巷老猫 提交于 2021-02-07 07:15:50
问题 I am trying to load data from a csv file in Excel with VBA using ADODB. I have a function to return a Connection object. Private Function OpenConnection(dataSource As String) As ADODB.Connection Set OpenConnection = CreateObject("ADODB.Connection") With OpenConnection .ConnectionTimeout = 5 .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dataSource & ";" & _ "Extended Properties=""Text;HDR=YES;FMT=Delimited(,)"";Persist Security Info=False" Debug.Print "trying to connect

How can i sort large csv file without loading to memory

拜拜、爱过 提交于 2021-02-07 05:27:22
问题 I have 20GB+ csv file like this: **CallId,MessageNo,Information,Number** 1000,1,a,2 99,2,bs,3 1000,3,g,4 66,2,a,3 20,16,3,b 1000,7,c,4 99,1,lz,4 ... I must order this file by CallId and MessageNo as asc. (One way is load database->sort->export) How can i sort this file without loading all lines to memory in c#? (like line by line using streamreader) Do you know a library for solution? i wait your advice, thanks 回答1: You should use OS sort commands. Typically it's just sort myfile followed by

How to add a header to CSV export in jq?

会有一股神秘感。 提交于 2021-02-07 04:53:05
问题 I'm taking a modified command from the jq tutorial: curl 'https://api.github.com/repos/stedolan/jq/commits?per_page=5' \ | jq -r -c '.[] | {message: .commit.message, name: .commit.committer.name} | [.[]] | @csv' Which does csv export well, but missing the headers as the top: "Fix README","Nicolas Williams" "README: send questions to SO and Freenode","Nicolas Williams" "usage() should check fprintf() result (fix #771)","Nicolas Williams" "Use jv_mem_alloc() in compile.c (fix #771)","Nicolas

Reading a csv file in Python with different line terminator

ε祈祈猫儿з 提交于 2021-02-07 03:45:26
问题 I have a file in CSV format where the delimiter is the ASCII unit separator ^_ and the line terminator is the ASCII record separator ^^ (obviously, since these are nonprinting characters, I've just used one of the standard ways of writing them here). I've written plenty of code that reads and writes CSV files, so my issue isn't with Python's csv module per se. The problem is that the csv module doesn't support reading (but it does support writing) line terminators other than a carriage return

Reading a csv file in Python with different line terminator

痴心易碎 提交于 2021-02-07 03:43:12
问题 I have a file in CSV format where the delimiter is the ASCII unit separator ^_ and the line terminator is the ASCII record separator ^^ (obviously, since these are nonprinting characters, I've just used one of the standard ways of writing them here). I've written plenty of code that reads and writes CSV files, so my issue isn't with Python's csv module per se. The problem is that the csv module doesn't support reading (but it does support writing) line terminators other than a carriage return

Reading a csv file in Python with different line terminator

泄露秘密 提交于 2021-02-07 03:42:20
问题 I have a file in CSV format where the delimiter is the ASCII unit separator ^_ and the line terminator is the ASCII record separator ^^ (obviously, since these are nonprinting characters, I've just used one of the standard ways of writing them here). I've written plenty of code that reads and writes CSV files, so my issue isn't with Python's csv module per se. The problem is that the csv module doesn't support reading (but it does support writing) line terminators other than a carriage return

Reading a csv file in Python with different line terminator

非 Y 不嫁゛ 提交于 2021-02-07 03:42:09
问题 I have a file in CSV format where the delimiter is the ASCII unit separator ^_ and the line terminator is the ASCII record separator ^^ (obviously, since these are nonprinting characters, I've just used one of the standard ways of writing them here). I've written plenty of code that reads and writes CSV files, so my issue isn't with Python's csv module per se. The problem is that the csv module doesn't support reading (but it does support writing) line terminators other than a carriage return

combine/merge two csv using pandas/python

别说谁变了你拦得住时间么 提交于 2021-02-07 03:30:58
问题 I have two csvs, I want to combine or merge these csvs as left join... my key column is "id", I have same non-key column as "result" in both csvs, but I want to override "result" column if any value exists in "result" column of 2nd CSV . How can I achieve that using pandas or any scripting lang. Please see my final expected output. Input input.csv: id,scenario,data1,data2,result 1,s1,300,400,"{s1,not added}" 2,s2,500,101,"{s2 added}" 3,s3,600,202, output.csv: id,result 1,"{s1,added}" 3,"{s3

Create a .csv file in C#

China☆狼群 提交于 2021-02-07 02:53:30
问题 Alright I want to create a .csv file in C#. I have been looking around and noticed a lot of people are using the system.IO.memorystream and system.io.streamwriter. The problem is this: I have a web application. I want to give the user the ability to export to excel. Problem is, Excel cannot be installed on the server (don't ask). I want to be able to write an .csv sheet export for a report. Now, the reports headers and data will be different for all of the reports (looping through will solve

d3 accessing nested data in grouped bar chart

a 夏天 提交于 2021-02-06 20:51:50
问题 I'm building a grouped bar chart by nesting a .csv file. The chart will also be viewable as a line chart, so I want a nesting structure that suits the line object. My original .csv looks like this: Month,Actual,Forecast,Budget Jul-14,200000,-,74073.86651 Aug-14,198426.57,-,155530.2499 Sep-14,290681.62,-,220881.4631 Oct-14,362974.9,-,314506.6437 Nov-14,397662.09,-,382407.67 Dec-14,512434.27,-,442192.1932 Jan-15,511470.25,511470.25,495847.6137 Feb-15,-,536472.5467,520849.9105 Mar-15,-,612579