Questions tagged [import-from-csv]

Import from CSV refers to execution of a script that parses a CSV file and imports structured data.

Import from CSV refers to execution of a script that parses a CSV file and imports structured data.

Importing from CSV is most commonly related to building custom import scripts in various programming languages. Usually, the CSV file is built with a certain structure and order of the columns, and the script is built in a way to expect the same columns in that same order. Once the data is extracted from the CSV file, the script goes through all CSV lines and inserts the structured data into internal data structures or a database.

380 questions
108
votes
13 answers

Read a small random sample from a big CSV file into a Pandas data frame

The CSV file that I want to read does not fit into main memory. How can I read a few (~10K) random lines of it and do some simple statistics on the selected data frame?
P.Escondido
  • 3,373
  • 6
  • 23
  • 29
55
votes
2 answers

How to import a tsv file with SQLite3

I have a tsv (tab separated file) that I would like to import with sqlite3. Does someone know a clear way to do it? I have installed sqlite3, but not created any database or tables yet. I've tried the command .import /path/filename.tsv…
bsuire
  • 1,383
  • 2
  • 18
  • 27
23
votes
5 answers

What does the "More Columns than Column Names" error mean?

I'm trying to read in a .csv file from the IRS and it doesn't appear to be formatted in any weird way. I'm using the read.table() function, which I have used several times in the past but it isn't working this time; instead, I get this…
user3084629
  • 445
  • 2
  • 4
  • 7
21
votes
5 answers

How can I import a CSV file via a rake task?

I know this question has been asked a lot on this forum but I'm under a strict deadline and I need some help, so any advice is much appreciated. I'm new to Ruby on Rails so please keep that in mind when responding. I want to create a rake task…
RubyDude1012
  • 477
  • 1
  • 8
  • 14
19
votes
4 answers

Cannot import data from csv file in d3

I'm just learning d3, and I'm attempting to import data from a CSV file, but I keep getting the error "XMLHttpRequest cannot load file:///Users/Laura/Desktop/SampleECG.csv. Cross origin requests are only supported for HTTP. ". I've searched for how…
Lcat91
  • 804
  • 3
  • 10
  • 14
19
votes
1 answer

Importing data from .csv using d3.js

I am trying to import some data from a .csv using d3.js. I am having trouble doing this, and was wondering if anyone could lend a hand. My .csv file is formatted like…
araspion
  • 693
  • 1
  • 9
  • 24
18
votes
3 answers

numpy loadtxt skip first row

I have a small issue when I'm trying to import data from CSV files with numpy's loadtxt function. Here's a sample of the type of data files I have. Call it 'datafile1.csv': # Comment 1 # Comment 2 x,y,z 1,2,3 4,5,6 7,8,9 ... ... # End of File…
astromax
  • 6,001
  • 10
  • 36
  • 47
17
votes
2 answers

How can I parse CSV data from a character vector to extract a data frame?

The read.table and read.csv functions in R are used to parse a file or URL containing delimited data and produce an R data frame. However, I already have a character vector that contains the CSV delimited data (using comma and \n as column and…
MattJ
  • 173
  • 1
  • 4
17
votes
2 answers

Reading Tab Delimited Data in to R

I am trying to read a large tab delimited file in to R. First I tried this: data <- read.table("data.csv", sep="\t") But it is reading some of the numeric variables in as factors So I tried to read in the data based on what type I want each…
Ford
  • 2,439
  • 4
  • 17
  • 15
9
votes
1 answer

pgadmin 4 import/export table does not work

I have made sure that the columns match the 'column to export' field in the columns tab, not null columns have data, tried in both csv and txt but all i get is a message saying: import/export job created Nothing else: no errors, no warning, no…
Blue
  • 195
  • 1
  • 4
  • 9
9
votes
2 answers

Data Manipulation in R: 'X' must be atomic

I have imported a file with headings and numbers in multiple columns using the following command. irs_data <- read.csv(file="10incyallnoagi.csv") I would like to divide the values in 1 column by another and then determine the highest 3 values. …
user2657817
  • 652
  • 2
  • 9
  • 18
9
votes
2 answers

Warning message: In file(file, "rt")

I am trying to import CSV files to graph for a project. I'm using R 2.15.2 on a Mac OS X. The first way tried The script I'm trying to run to import the CSV file is this: group4 <- read.csv("XXXX.csv", header=T) But I keep getting this error…
Siya
  • 829
  • 4
  • 17
  • 29
8
votes
7 answers

Converting CSV to HTML Table in Python

I'm trying to take data from a .csv file and importing into a HTML table within python. This is the csv file https://www.mediafire.com/?mootyaa33bmijiq Context: The csv is populated with data from a football team [Age group, Round, Opposition, Team…
kmarshy
  • 83
  • 1
  • 1
  • 3
8
votes
1 answer

Pandas importing CSV and Excel file error

I am trying to use Python Pandas to import a CSV file. The example data in this file is as follows where the first row is the column names separated by commas. End Customer Organization ID,End Customer Organization Name,End Customer Top Parent…
Baktaawar
  • 7,086
  • 24
  • 81
  • 149
8
votes
3 answers

How to read csv files in matlab as you would in R?

I have a data set that is saved as a .csv file that looks like the following: Name,Age,Password John,9,\i1iiu1h8 Kelly,20,\771jk8 Bob,33,\kljhjj In R I could open this file by the following: X = read.csv("file.csv",header=TRUE) Is there a default…
user2005253
1
2 3
25 26