csv

Exporting large number to csv from R

[亡魂溺海] 提交于 2021-01-29 08:19:00
问题 I came across a strange problem when trying to export an R dataframe to a csv file. The dataframe contains some big numbers, but when they are written to the csv file, they "lose" the decimal part and are instead written without it. But not like one would expect, but like this: Say 3224571816.5649 is the correct value in R. When written to csv, it becomes 32245718165649. I am using the write.csv2 function to write the csv. The separators are correct, as it works normally for smaller values.

Selecting multiple specific columns in excel and exporting to CSV using Python

心不动则不痛 提交于 2021-01-29 07:52:55
问题 I'm trying to extract 3 columns in a large excel spreadsheet and export it to CSV format. I have XLRD but have found that there are no column specific tools I can use (Or maybe I just overlooked it). An example excel spreadsheet I have looks like the following Column1 Column2 Column3 Column4 Column5 Column6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 I'm looking to get just Column2, Column5, and Column6 into a CSV. The other columns are for

In python how to change date format in a csv?

萝らか妹 提交于 2021-01-29 07:45:29
问题 I am trying to change the format of dates from 30-Jan-02 to 30.Jan.2002 occurring in second position in a csv file using python. I tried several things but I am confused with strings and bytes comptability. import os import csv from datetime import datetime import sys from tempfile import NamedTemporaryFile with open("Filenamecsv",'r') as csvfile, NamedTemporaryFile(dir="path/parh",delete=False) as temp: w = csv.writer(temp) r = csv.reader(csvfile) for row in r: dt = row[2].split("-") row[2]

Filter CVS before importing to Google Spreadsheet

本秂侑毒 提交于 2021-01-29 07:40:46
问题 I have a Script in a Google Spreadsheet, the script downloads a zipped CSV from an URL and then import it to the spreadsheet. Actually, the CVS is too big and I don't need all the data from it. My question is, How can I filter the data before importing it to the spreadsheet? For example filter Column A with X value. This is the code I have so far: function descargarzip() { var urldescarga = "http://187.191.75.115/gobmx/salud/datos_abiertos/datos_abiertos_covid19.zip" var url = urldescarga var

Customising ActiveAdmin CSV

杀马特。学长 韩版系。学妹 提交于 2021-01-29 07:34:44
问题 I am using Activeadmin and would like to export the associated model values in the same CSV file. I am able to get the result but its not in a proper format. I want all the question to be the column name and the answer for that to be displayed in the row. can anyone help me? Papplication.rb ActiveAdmin.register Papplication do csv do column "Questions" do |papp| @questions.map do |question| question.question_text end end column "Answers" do |papp| @questions = Question.where(:program_id=>papp

Setting up a function in a class that will read in csv data in a way that it can be referenced in future functions

北慕城南 提交于 2021-01-29 07:29:11
问题 I'm trying to determine the best way to define a function within a class that reads a specific .csv file if a criterion is met. Then, the function returns the data in the file. But I need it to return the data in a way that allows me to call on those data again in a future function in the class. Some background: The data I'm reading in are time-stamped temperatures. The columns in each .csv file are 'day', 'hour', 'temp_1', 'temp_2', 'temp_3', 'temp_4' Then, there are rows of numeric data for

Use batch file to remove special characters from csv file

不羁岁月 提交于 2021-01-29 07:21:48
问题 I have a csv file with 18 fields. I have written a batch file to manipulate the data. Everything works except removing the comma from the "DEVILS DUE /1FIRST COMICS, LLC" publisher. That field does not parse correctly. I have tried looking at other batch files for examples, but I am not familiar with the snytax. @echo off & Setlocal EnableDelayedExpansion ( FOR /f "tokens=1-18 delims=," %%A in ('More +4 datatest.csv') do ( rem H is the department code rem S is the sales tax code rem Q is the

Sum column in stream using node

↘锁芯ラ 提交于 2021-01-29 07:18:22
问题 My goal is to count the sum of a column which correlates to another column in a csv. For example, I have an input csv what looks like this "500","my.jpg" "500","my.jpg" "200","another.jpg" I want the output to be: [{ bytes: 1000, uri: "my.jpg" }, { bytes:200, "another.jpg" }] Note: I need to do this as a stream as there can be over 3 millions records for a given csv and looping is just too slow. I have managed to accomplish this using awk but I am struggling to implement it in node Here is

Error passing curl -d parameter in requests library

社会主义新天地 提交于 2021-01-29 07:13:59
问题 I have a curl POST request that works perfectly in the terminal (macOS), returning a csv as expected. The following format is provided in the RJMetrcis documentation (see "Export figure data"). Here is the curl request in bash: curl -d "format=csv&includeColumnHeaders=1" -H "X-RJM-API-Key: myAPIkey" https://api.rjmetrics.com/0.1/figure/0000/export My objective is to implement the exact same curl request in Python using requests . When I input the same parameters as a POST request, the code

python pandas dtypes detection from sql

让人想犯罪 __ 提交于 2021-01-29 07:03:43
问题 I am quite troubled by the behaviour of Pandas DataFrame about Dtype detection. I use 'read_sql_query' to retrieve data from a database to build a DataFrame, and then dump it into a csv file. I don't need any transformation. Just dump it into a csv file and change date fields in the form : '%d/%m/%Y' However : self.dataframe.to_csv(self.fic, index=False, header=False, sep='|', mode='a', encoding='utf-8', line_terminator='\n', date_format='%d/%m/%Y ) Would miss to transforme/format some date