Questions tagged [csv]

A comma-separated values (CSV) file stores tabular data (numbers and text) as plain text, with rows and columns delimited by line terminators and commas, respectively. You may also use this tag for variants where fields are separated by tabs or semicolons.

Filter by
Sorted by
Tagged with
5 votes
2 answers
483 views

CSV to TSV converter in C+yacc+lex and a Makefile

This is Comma-Separated Values to Tab-Separated Values converter written in C, with yacc(1) and lex(1). I'm remembering how to use yacc (the first (and last) time I used it was while reading «The UNIX ...
user avatar
4 votes
2 answers
75 views

Read a file format with mixed CSV and non-CSV content

I have a file format that I need to read which contains blocks of CSV data interspersed by non-CSV (or at least, inconsistent CSV) lines. Other than the very first line of the file (which has comma-...
user avatar
  • 263
4 votes
3 answers
94 views

Analyzing baby name data in CSV files

First time using code review. I am still a student so there will be a lot to be desired. Basically as part of the homework we are told what methods to create (Method names are given with their ...
user avatar
5 votes
2 answers
273 views

CSV file parser with some checks for header fields and duplicate rows

I have built a sample Parser class on top of the csv module for basic checks that we normally need as the first step of pre-processing. I would love a bit of feedback on the code and any areas that I ...
user avatar
  • 161
2 votes
1 answer
92 views

Fetch CSV file into PANDAS and send report of Spotify statistics

I'm relatively new and self taught in Python. I've written this code which gets a CSV file from a website, plays around with the data then creates an email with information gleaned. I know this is too ...
user avatar
  • 23
0 votes
1 answer
44 views

Sorting nested dictionary by price - without extra memory

I am working on parsing an orders.csv file with products and prices by different vendors which is kind of a time-series data. The output of that process looks something like below, with order total by ...
user avatar
2 votes
2 answers
74 views

Create csv file for each id value and write all data rows to csv with same id

I have a text file which is tab delimited: 1 324 2344 1 8372 1234 2 62 12 2 872 12111 2 1211 28736 3 87636 198272 The first &...
user avatar
  • 23
2 votes
0 answers
96 views

CSV file aggregator (appender) CLI

My goal is to write a CLI utility that aggregate (appends) many CSV files in a lightweight and performant (my use-case involves output files in the 10s of GBs) manner. Specifically, the utility ...
user avatar
  • 223
1 vote
2 answers
176 views

Create an ASCII table from CSV

The following code convert csv to ascii table. ...
user avatar
1 vote
2 answers
141 views

Take every second row in CSV file, and put it next to the previous row

I have a csv file ...
user avatar
4 votes
3 answers
167 views

Add missing business days in CSV file

I need to fill missing business days (i.e. any days except saturday and sunday) in a series. So let's say I have this array: ...
user avatar
  • 163
2 votes
3 answers
72 views

Abstraction for CSV files

I made a CSV class which manages CSV files. Is this good?, I'm beginner btw. It's probably bad but can you give me some tips! Header file: ...
user avatar
  • 53
1 vote
1 answer
316 views

How to speed up the search by patterns matching and modifying a DataFrame

I need to classify URLs from a DataFrame and modify it by exact match and contains conditions: ...
user avatar
  • 25
2 votes
2 answers
494 views

C++ Minimal CSV parser

I wrote a minimal CSV parser for my machine learning toy project. ...
user avatar
  • 1,121
2 votes
1 answer
76 views

Simple lightweight CSV reader in C++

My coding background is mostly from C and I've noticed that I tend to "use C++ as it was C" quite a lot. So this is a very small project I've written to improve my understanding of best ...
user avatar
  • 123
4 votes
1 answer
421 views

Reading a CSV file using Haskell

I'm reading a CSV using Haskell. I'm not sure if this is the appropriate way to do it. This is what I'm doing: Read rows from a CSV -> return lazy byte string Parse the headers and rows from the ...
user avatar
  • 207
1 vote
1 answer
195 views

Writing data to CSV, checking for duplicates

I am writing a program that takes user input and writes it to a CSV file. I am also checking to see if what they have input is a duplicate of whatever is in that CSV file. So far, the flow of this ...
user avatar
3 votes
1 answer
262 views

Reducing the amount of duplicated code (python) - cricket matches [closed]

I'm a beginner and self taught and just want to see if there are neater ways of doing what I am doing, or whether there are bits of code that are poorly written. I think Lines 100-204 are the most ...
user avatar
0 votes
0 answers
50 views

displaying contents from CSV files in an HTML table

I'm pretty new to programming and shell and I'm not having any issue with the script below; it's working perfectly but I want to know if I can do better. I'm inserting the content of some CSV files (<...
user avatar
5 votes
1 answer
80 views

GUI that reads data and generates/ saves charts

I have a program that uses pandas to read csv files and then generates and saves graphical charts. I have been trying to follow the SOLID principles so I have tried to seperate responsibilities. So ...
user avatar
2 votes
1 answer
78 views

Calculate students' GPAs and sort them, based on two CSV input files

Problem: Given two csv files science_courses.csv and other_courses.csv, which has students name and their respective course ...
user avatar
  • 173
-2 votes
1 answer
130 views

Java: Is there an easy way to append a new column that will be having same value for all rows in csv? [closed]

I am processing a file as the following and closing it. Later, I do some more processing and get some ID that I want to append to all rows in the previous CSV generated. So all rows will have the same ...
user avatar
  • 97
1 vote
2 answers
61 views

Python script for parsing and using CSV data

I am given a CSV file of stations, with data like this: ...
user avatar
  • 111
4 votes
1 answer
151 views

Basic CSV Parser in C++

This was written down solely as a mean to practice basic C++ and isn't meant to serve any production purposes. Clearly, the implementation can't handle all input formats: it always expects the CSV to ...
user avatar
3 votes
1 answer
70 views

Mapping CSV columns

I have the following code where I am trying to map columns from the input file to output. I have written it using multiple loops. Is there a way to write this more efficiently? input.csv: ...
user avatar
0 votes
1 answer
63 views

Compare hostnames and leases between CSV and DHCP info

I have 3 nested loops and they do the following: Get scopes from DHCP Get hostnames from csv file Compares hostnames and leases, matches are added to a hash table There are 5 DHCP servers, 100's of ...
user avatar
1 vote
0 answers
42 views

Open and update csv file

...
user avatar
  • 11
3 votes
1 answer
76 views

Manipulating Pandas Dataframe with vaccination data from CSV to display on matplotlib

I have some code that manipulates a Pandas Dataframe containing Covid-19 vaccine data and displays it on Matplotlib. The data is here: https://covid.ourworldindata.org/data/owid-covid-data.csv (...
user avatar
1 vote
1 answer
53 views

convert .sav SPSS files into long or flat format CSVs

I'm a long standing PHP, JS, C#(Unity) dev looking to get outside objects and lower down. I've written a quick program to read binary data from a .sav file, and output the data section into CSV's in ...
user avatar
4 votes
2 answers
97 views

Read a csv file and insert into DB table

I've found some resources about PHP performance optimization here and there but I don't know how to start. I send 130k CSV rows in approximatively 7min. My script read CSV file and send ...
user avatar
1 vote
1 answer
694 views

Processing CSV files with filtering

I have 4 CSV files that i need to process (filter out Part segment and then merge them) but the problem is that they do not fit in my memory. So I decided to: [open - filter - write out] each one of ...
user avatar
  • 13
2 votes
1 answer
64 views

Transform Data from JSON and CSV to another JSON format

I have 2 files wholesaler_a.csv ...
user avatar
  • 149
1 vote
0 answers
120 views

Command line utility for user data migration from MUBI.com to letterboxd.com

Please make code review for command line utility for user data migration from MUBI.com to letterboxd.com. Utility makes Get HTTP request downloads json-data, parses it and saves as CSV-file. Can be ...
user avatar
  • 232
2 votes
1 answer
108 views

Script that makes a rating of movie directors for a user of IMDB

I want to create a script that displays the rating of movie directors for a user on IMDB. After some research, I realized that there is no free API for making such a list. The only option is to export ...
user avatar
5 votes
2 answers
197 views

Mapping column names and values of a csv using another csv

I have two csv files, pricat.csv which contains objects I need to populate my DB with, and mapping.csv which specifies how the ...
user avatar
2 votes
2 answers
4k views

Python script to extract columns from a CSV file

I have a very basic python script that reads a CSV file. I'm importing the csv module setting some empty list variables and getting the data I want. The problem is that I know there is a much more ...
user avatar
2 votes
1 answer
1k views

Java CSV to XML converter

I'm relatively new to programming and I was trying to work a project. I would like recommendations of how to annotate or comment my project and any improvement I could make to it, any suggestion is ...
user avatar
4 votes
1 answer
95 views

Create a CSV from SQL Data and email as attachment using PHP

I put together some functions that allows a PHP script to send the SQL data obtained from user inputs on a website via an email attachment as a CSV file. It works perfectly and I have no issues with ...
user avatar
-2 votes
1 answer
76 views

what is the best practice concerning opening CSV files in python [closed]

I am looking for the best way to save regular data from a series of sensors to a CSV file. the program will be reading every sensor once a minute 24/7 and needs to report the results to a CSV file ...
user avatar
5 votes
3 answers
650 views

Creating a CSV stream from an object

I have this code that gets a CSV string from a list of objects where the first row in the string is the object's properties and the rows underneath are the properties values. I then create a ...
user avatar
  • 185
6 votes
3 answers
2k views

CSV to HTML Converter

I have written a little program that converts a CSV-File to an HTML-Table. It works for my purposes. But are there parts in my code that can be written more clean? Can you improve maybe the ...
user avatar
  • 2,006
2 votes
2 answers
57 views

Go Quiz exercise, part of Gophercises

This is the first exercise from https://gophercises.com/. Basically the idea is to parse a CSV file in a form of 'question:answer' and count the number of correct answers. Also you have a time out ...
user avatar
  • 253
3 votes
0 answers
207 views

Reorder the Columns in a CSV File in Descending Order

I wrote a script to reorder the columns in a CSV file in descending order and then write to another CSV file. My script needs to be able to handle several tens of millions of records, and I would like ...
user avatar
1 vote
0 answers
29 views

How can this JavaScript CSV to JSON hook code be optimized to prevent timeouts?

This code is utilized within a platform that has strict limitations on script execution time, occasionally being exceeded if there is a very large number of lines within the CSV input that is passed ...
user avatar
5 votes
1 answer
216 views

Concatenate several CSV files in a single dataframe

I have currently 600 CSV files (and this number will grow) of 50K lines each i would like to put in one single dataframe. I did this, it works well and it takes 3 minutes : ...
user avatar
  • 207
3 votes
1 answer
81 views

Sending a CSV file for a client list from a database

What can I improve about this code in order to be production-ready? I'm not worried about security but about errors that could occur. What exceptions should I catch? I feel overwhelmed about ...
user avatar
  • 43
3 votes
1 answer
41 views

Count the number of riders in each category

I have a code to get riders from certain teams and calculate the number of riders in those teams in that category: ...
user avatar
2 votes
1 answer
110 views

Library for parsing CSV data

Please review my C++ CSV parsing class. I have some specific questions: Should get_next_record be a static function? CsvParser ...
user avatar
  • 2,227
3 votes
1 answer
396 views

C# Reflection-based CSV Parser

I've been trying to make a C# version of my Java CSV Parser using C# specific idioms. Here is the full code: ...
user avatar
3 votes
2 answers
248 views

Java Reflection-based CSV Parser

I'm an experienced Java developer, however I don't have experience with reflection or Annotation classes. For fun, I tried to develop a CSV Reader class which can parse each row into a particular type....
user avatar

1
2 3 4 5
13