Questions tagged [csvreader]

A CsvReader represents a reader that provides forward-only access to a CSV text data source. A CsvReader may also support other delimited-separator formats.

172 questions
1
vote
0 answers

How can CsvReader property be adjusted to read in multiple date formats and avoid exception?

I have an issue with parsing date values with CsvReader. In my test data the dates were in this format: 01/03/2021 Therefore, my CsvReader property is designed like this: [Format("dd/MM/yyyy")] [Name("Date")] public DateTime Date { get =>…
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
1
vote
1 answer

What attribute must I use to read in these date fields using CsvReader?

My CSV file has a field called Date. The values in this column are of type dd/mm/yyyy. For example: 08/01/2022 At the moment I am mapping it in my CsvReader class to a string: public class CLMExplorerHistory { [Name("Date")] public string…
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
1
vote
1 answer

How to read a specific column of a row from a csv file in java

I have the following code which reads the data from the csv file, it iterates over the rows but i don't manage to figure out how to iterate over specific columns (for example the first 2 columns of that row) in order to find the data. Any…
Sanne112
  • 37
  • 4
1
vote
2 answers

Reading CsvReader field text field into Boolean field?

I am new to using CsvReader and it is going well. My object currently has these fields: public class CLMExplorerStudent { [Name("Student ID")] public int Id { get; set; } [Name("Last Name")] public string LastName { get; set; } …
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
1
vote
2 answers

CSV Writer (Python) with CRLF instead of LF

Hi I am trying to use csv library to convert my CSV file into a new one. The code that I wrote is the following: import csv import re file_read=r'C:\Users\Comarch\Desktop\Test.csv' file_write=r'C:\Users\Comarch\Desktop\Test_new.csv' def…
John Snow
  • 107
  • 1
  • 10
1
vote
1 answer

CSV reader incorrectly parses tabspaces after inverted commas

I am using the CSV reader to read a TSV in Python. The code is: f = csv.reader(open('sample.csv'), delimiter='\t') for chunk in f: print(chunk) One row from the tab separated CSV file looks like this (csv hosted…
Someone
  • 35
  • 2
  • 7
1
vote
0 answers

How to read CSV with NULL and different headers?

I have a task to convert one CSV file from UTF8 encoding to ANSI encoding and format it. I have learned that ANSI is really the encoding of the system in some sense, but this is not the issue at the moment. Before converting, I have to be able to…
Oskars
  • 407
  • 4
  • 24
1
vote
1 answer

Error encountered when configuring csvReader to use the Avro schema registry in Apache Nifi

csvReader property set: enter image description here Here is the schema I created and registered in AvroSchemaRegistry { "namespace": "nifi", "type": "record", "name": "users", "fields" : [ {"name": "first_name", "type": "string"}, {"name":…
bentoi
  • 49
  • 4
1
vote
1 answer

How to read a CSV file from a downloadable link in Android

In the app, I'm currently making, I need to read a CSV file from a downloadable link and show its data. For example, consider this link: https://api.covid19india.org/csv/latest/case_time_series.csv If you click on the link, it'll download a CSV…
Light Yagami
  • 961
  • 1
  • 9
  • 29
1
vote
1 answer

How can I use a loop to create similarly-named strings for a number of similar columns imported from a csv?

I want to work with data form a csv in python. I'm looking to make each column a separate string, and I am wondering if there is a way to loop through this process so that I don't have to specify the name of each string individually (as the naming…
1
vote
0 answers

How to read commas in the column of a csv in Java

I have the following code to read from CSV file in java. It works fine except for the case when I have commas in my column values. I got the exception. code: FileReader fileReader = new FileReader(file); CSVReader csvReader = new…
AVMathi
  • 71
  • 8
1
vote
1 answer

Discord.py Getting a bot to add role based on csv file

So I am new to Python, Discord.py, and programming in general, but I am using Discord as a good opportunity to learn. So please excuse any illiteracy on my part. I have assembled a bot from bits and pieces here and there on the Internet, and it’s…
1
vote
1 answer

Python shell csv problem FileNotFoundError: [Errno 2] No such file or directory: 'iris.csv'

iris_df = pd.read_csv("iris.csv") Traceback (most recent call last): File "", line 1, in iris_df = pd.read_csv("iris.csv") File "C:\Python 3.8.1\lib\site-packages\pandas\io\parsers.py", line 610, in read_csv return…
blue
  • 11
  • 1
  • 1
  • 2
1
vote
2 answers

Import oddly formatted csv with quotes

I have a csv file that comes from outside, so I am not able to change its definitions or formatting and I have to read it into a database. The file has some things that look very odd for a csv format and I would like to know if there is a way of…
vascosp7
  • 23
  • 3
1
vote
1 answer

Limiting row numbers with Python (CSV Reader)

I want to give limitation in row numbers in the below python code, executing code if we have less than 200 rows and nit run the code if it is more than 200. with below code, I am printing the number of rows but the if clause for limiting rows gives…
CodeGirl
  • 81
  • 8
1 2
3
11 12