Questions tagged [csv]

Comma-Separated Values or Character-Separated Values (CSV) is a standard "flat file database" format for storing tabular data in plain text, consisting of an optional header row that lists the table fields delimited by commas or tabs or other delimiter character, followed by one or more rows (newline separated) representing the table records as delimited lists of the values. Newlines and separator characters can appear within (quoted) fields.

1
vote
0answers
8 views

Using a Normal For Loop with CSV (Import-CSV)

I am working on a PowerShell script that will import a CSV file containing server information (including server name, instance, status, and database names) using the Import_Csv cmdlet. After importing ...
-3
votes
0answers
15 views

How to remove extra lines from csv files? [duplicate]

I have file like: STATE,MAHARASHTRA, DISTRICT,MUMBAI_CITY, S NO.,DISTRICT,STATION, DATE ,TIME (UTC),RAINFALL CUMULATIVE, 1,MUMBAI_CITY,MUMBAI_SANTA_CRUZ,2019-06-11,00:00:00,33, 2,...
0
votes
2answers
11 views

Read a tabulator seperated csv with PHP

I'm not able to read a tabulator seperarated csv file (and yes, i know its csv and no tsv and the c is for tabulator...) with php and seperate it right. When i give out my imported Data with echo or ...
0
votes
1answer
17 views

Add 8 registers for 0008 and keep the rest a 6 registers

I'm converting a .dat to a csv. Everything works but I need to add 8 registers for 0008 and keep the rest a 6. Here is the .dat file: 0004|IP 0006|IP 0008|IP except there are no blank lines Here ...
0
votes
1answer
25 views

Need some guidance as to compare two csv files/lists in python efficiently in Python

I wrote a python program to compare two csv files of same columns, to find out the matching and non-matching data, row wise. 1. both the files have the columns Prod, AL, ME, JE and JED 2. The ...
0
votes
0answers
21 views

How to use .csv file with xyz coordinates(RD_NEW) and implement in Unity?

I'm working on a personal project in which I want to visualize airplanes above airports. I created a .csv file containing the coordinates of one airplane over a certain period of time. I tried to ...
0
votes
1answer
35 views

Pulling out data from CSV files' specific columns in Python

I need a quick help with reading CSV files using Python and storing it in a 'data-type' file to use the data to graph after storing all the data in different files. I have searched it, but in all ...
0
votes
1answer
26 views

How to omit the cells in CSV file when their value is “00/00/0000” in Python

Hello I have a code to convert US dates into UK ones from the following topic: Python Date format conversion to UK. However, the files which I have contain cells with 00/00/0000 as date and I get the ...
0
votes
1answer
16 views

how to save model.get_weight in form of array to csv?

I am a beginner who is starting learn to code in Keras backend Tensorflow. I am using python 2.7 I have model in keras and after training i want to check my weight. weight = model.get_weights() ...
0
votes
1answer
36 views

Python csv.reader is printing the last line a second time

I have a 2 column comma separated text file of English sentences and their translation into another language with each translation pair on a new row e.g. i like cats,me gustan los gatos hello,...
0
votes
1answer
28 views

How to find the intersection (common elements) between two columns of a single csv file in python?

I am having two columns almost (1000 rows) in a csv file without headers (tab separated). The sample content of the column values are as follows. It can be a phrase or a single word. CSV File Format: ...
0
votes
1answer
28 views

How to replace one value of csv with value of other csv files in python?

I have two files bmg1.csv and bmg2.csv bmg1.csv "FX Rate","BloombergIdentifier","Strategy","PM Team" "1","BBG000BLNNH6 Equity","QT.SCALI","DELTA ONE (SCALI)" "1","BBG000BW3M86 Equity","QUANTITATIVE",...
0
votes
2answers
18 views

Write floats to a csv file to 2 significant figures

My writer function looks like: with open(filename, "w") as file: file.truncate(0) writer = csv.writer(file) writer.writerows(input_list) My input_list looks like: [[10.0, 11.0, 20.0, ...
-2
votes
1answer
26 views

How to convert an embedded JSON file to CSV in pandas python

Hi I have received a JSON file with below format, please let me know how do i parse this JSOn file and convert them to CSV JSON file format {'Sections': [{'MC': [[{'IsMandatory': False, 'LD': ...
0
votes
0answers
15 views

FileNotFound Error for string variable in Pandas?

I stored a string of a list temp in a variable and then tried to add it to csv filename while converting a Pandas dataframe to CSV. But it constantly shows file not found error while converting. I ...
0
votes
0answers
18 views

How to pull out Data Array from CoreData TableView array, put it into a new Array and export it as csv?

I have an app that takes user inputs in an alertController, and then this values will be stored in CoreData which is then displayed in a tableview. I concatenated all the strings to gather with a ...
-4
votes
0answers
20 views

Create a csv file from several txt files [on hold]

I have several txt files, say "N", and I need to create a csv file from them. For instance, if the txt files are: txt1.txt 25/06/2019 26/06/2019 and the text2.txt file is Alice Peter I need a ...
0
votes
3answers
25 views

Shifting misaligned values to a given column

I have a messed up csv file with time and x and y values that I want to fix, like the one below: col1 col2 col3 col4 col5 col6 col7... Time X Y X2 Y2 X3 ...
0
votes
1answer
26 views

Scraping Training.gov.au of tables

I am trying to automate some of my work. The website in question is training.gov.au where under specific pages they nest table e.g. https://training.gov.au/Training/Details/BSBWHS402 Really what I ...
-3
votes
0answers
17 views

How to convert csv into xml where each column in csv = xml attribute of tag

How to convert csv to xml, where each column in csv is attribute in xml tag via C#? Let me show you what I mean: This is CSV: 1;A;a;b;c;d; 2;B;e;f;g;h; This is Xml: <section> <row code="...
0
votes
1answer
25 views

storing values from csv file to the attributes of a class

I am trying to code for a scheduling problem. Today I've got a problem in my code. I am trying to store the values from a csv file to the attributes of a class. please help me to understand it. ...
1
vote
2answers
42 views

Edit CSV rows in two different ways

I have a bash script that outputs two CSV columns. I need to prepend the three-digit number of those rows of the second column that contain them with "f. " and keep the rest of the rows intact. I ...
1
vote
2answers
37 views

Split CSV file into multiple (non-same-sized) files, keeping the headers

I have a large csv (test.csv) with the following header columns id; type; name and the following values: 1; A; ASW23 2; C; SDF92 3; D; SDI22 4; D; ASD00 5; C; WPE03 6; D; PPO30 7; A; WER34 8; C; ...
-1
votes
0answers
10 views

I have a .sml file and need to convert it to csv or read it from python code

I have a .sml file that contains data as a csv document. How can I convert .sml to csv or read it in python? Thanks !
0
votes
1answer
34 views

How to add the date in a for loop without if/else statements

my task is to create a Python script that analyzes the records in my pybank.csv to calculate each of the following: https://i.stack.imgur.com/MzM4N.png The total number of months included in the ...
0
votes
1answer
16 views

Python 2.7 with pandas to_csv() gives UnicodeEncodeError: 'ascii' codec can't encode character u'\xc7' in position 4: ordinal not in range(128)

I am using Python 2.7, and to overcome UTF-8 issues, I am using pandas to_csv method. The issue is, I am still getting unicode errors, which I dont get when I run the script on my local laptop with ...
0
votes
0answers
12 views

What does 'data' mean in this documentation example

I suspect this has a pretty easy answer, but I'm darned if I can figure it out. From the docs https://spark.apache.org/docs/latest/api/python/pyspark.sql.html?highlight=csv#pyspark.sql....
0
votes
1answer
30 views

insert data in rows based on conditional value in python

I have a log file (.txt) containing the following data structure: ID-Number 1 value 1 value 2 ID-Number 2 value 1 value 2 value 3 ID-Number 3 value 1 I'm expecting to have the following ...
-1
votes
0answers
17 views

take csv file, delete everything from it and then write new informations with php

I want to take csv file from my location and then delete all informations that are in it(delete rows). And after that start to write again in that file, is it possible? I know how I can read it, how ...
0
votes
1answer
18 views

Dataframe is only taking first 50 rows of my csv no matter specified length

I'm trying to take my CSV into a dataframe so that I can process it easier, but for some reason the frame is only including the first 50 lines of my csv even when specified 10, 500, 100000, etc (csv ...
0
votes
0answers
22 views

How to Fix java.io.IOException: (line 1) invalid char between encapsulated token and delimiter with Spark Dataframe

I have two spark dataframes that I am trying to join. I'm trying to join the two dataframes by the second column ("C1") Dataframe 1: a Dataframe 2: b I ran this code: joined = a.join(b, a.C1==b.C1) ...
0
votes
1answer
18 views

Extract text from .txt file and save into .csv files with columns and header

I have approximately 100 text files with clinical notes that consist of 1-2 paragraphs. Each file is named doc_1.txt to doc_179.txt accordingly. I would like to save the text from each file into a ....
0
votes
0answers
20 views

How can I combine multiple CSV files to a worksheet from a table of file locations, VBA?

I have a table of file locations in a separate sheet that the user has specified in a different macro. I want to take the CSV files in these locations and make them one large table in a sheet in the ...
0
votes
1answer
23 views

How to export multiple dictionaries with some different keys into one csv file in Python?

I'm trying to write multiple dictionaries with different fieldnames into one csv file. I'd like to have all dictionaries' keys on top of the csv file as a header and all their values in each row. But ...
0
votes
1answer
23 views

Django - Determine model fields and create model at runtime based on CSV file header

I need to determine the best approach to determine the structure of my Django app models at runtime based on the structure of an uploaded CSV file, which will then be held constant once the models are ...
0
votes
0answers
12 views

How can I update MySQL table which had been imported from CSV without import it again?

I have imported CSV file to MySQL Workbench. Is there any way to update MySQL table automatically when I update CSV file or I have to import the CSV file again and again after each edit?
0
votes
2answers
33 views

How to merge two csv files that do not have the same number of lines?

Below is my two csv files: CSV1: Class DTWC DR DW IDFP IDS ISQLQ IGS LIC LT MIM NLMR PD RAM SL UC LazyClass com.onegravity.colorpicker.demo.MainActivity 0 0 0 0 0 0 ...
0
votes
1answer
38 views

Compare two CSV files and create a new CSV

I have two CSV files that each have two columns, id and name. I want to compare both files by their name columns; if the values match, then create a new CSV file with the id values from both files. 1....
0
votes
1answer
36 views

Properly reading in a CSV file in pandas with double quotes

I have a csv file, where each line is enclosed with double quotes, where the first field is not enclosed in double quotes, but all other fields are, like this - "Col1,""Col2"",""Col3"",""Col4"",""...
-3
votes
1answer
33 views

How to develop a function

I am completely new in python and I am learning it. I have written the following code but i couldnt make any functions of it. Can somebody help me please? import pandas as pd import numpy as np f = ...
0
votes
0answers
14 views

Reading a bar delimited file with unquoted text fields in R

I'm trying to load a | delimited file into R, and am having difficulty loading the text portion of the file, which isn't parsing well. The data is as follows: c("ENMI|Close_Type|ENMIN|Close_Number|...
0
votes
2answers
37 views

How to graph from CSV into HTML?

I'm trying to create a html page that has an interactive graph that is constantly updating from a local CSV file on my computer. None of these processes will be online. The R code that I have written ...
2
votes
0answers
25 views

How tovisualize local csv file with javascript using d3?

I'm trying to visualize my local csv file with javascript. As I was trying to make a bar graph and wanted to have x Axis "disease name" and y Axis "Anzahl" which is occurence . But having an error ...
0
votes
1answer
39 views

Incomplete large CSV import using fread in R

I'm using fread within R to import a number of large CSV files to create a summary file to take further for analysis. When plotting the summarised data there are a few time points (each CSV represents ...
0
votes
0answers
16 views

How to conserve data type list when writing CSV with pandas

When i write my dataframe to csv it doesn't conserve my types. I have a dataframe where some of my columns contains lists. type(df[28]) = list 28 [Associations, collectivités territoriales, pô.....
0
votes
3answers
29 views

clearing a list of domains / remove subdomains

I have a large list of domains which is mixed with subdomains. google.de spiegel.de sub1.google.de zeit.de sub1.spiegel.de Is there a tool or a workaround in an editor (e.g. Sublime or Notepad++) to ...
0
votes
0answers
28 views

How to prevent alphabetical ordering of rows when converting dataframe to csv?

I am trying to convert the following dataframe to a csv file using the to_csv() function of pandas (v0.24.0): robustness orseilline disrupt jarkman woodprint ...
1
vote
0answers
44 views

Check if new Entry is allready in csv.file

I receive user input through QT Creator form. This user input gets passed to a function that writes this input to a CSV FILE. everything works. No problems. But when some new input is done and the ...
0
votes
0answers
11 views

How to give keep_default_na or similar function of pd.read_csv while creating a dataframe using pd.Dataframe(data)?

I want to create a data frame from hive using Presto. I am done with it but with one exception: there are empty strings in my data which would be NaN if the corresponding CSV file is read using Pandas ...
1
vote
1answer
21 views

Unable to create Hive table using Presto from a CSV File

I want to create a Hive table using Presto with data stored in a csv file on S3. I have uploaded the file on S3 and I am sure that the Presto is able to connect to the bucket. Now, when I give the ...