Questions tagged [read.csv]

The command in R to read a data file with a “comma separated values” (csv) format.

The read.csv is a command in R to read a data file with a “comma separated values” (csv) format.

737 questions
-1
votes
2 answers

Pandas Dataframe is not pretty displayed

Well I am trying to create a dataframe in pandas and print it reading a csv file, however it is not pretty displayed This is the code: import pandas as pd df = pd.read_csv("weather.csv") print(df) And this is my output: What can I do?
-1
votes
1 answer

Appending many files into 1 dataset

I have many ".csv" files in one folder with names "file1", "file2", "file3", ... "file50". They all have totally the same structure. Expression for reading one file is: read.csv(file = "file1.csv", delim = ";", dec = ".") I need to union (append)…
-1
votes
2 answers

How to read fixed-width data?

data looks like 212253820000025000.00000002500.00000000375.00111120211105202117 212456960000000750.00000000075.00000000011.25111120211102202117 212387470000010000.00000001000.00000000150.00111120211105202117 need to add separator…
Suri.B
  • 11
  • 1
-1
votes
2 answers

How to work with nested for loops in R with same list?

I amtrying to do some R coding for my project. Where I have to read some .csv files from one directory in R and I have to assign data frame as df_subject1_activity1, i have tried nested loops but it is not working. ex: my dir name is "Test" and i…
-1
votes
1 answer

R importing .csv data with date as first field erroneously

This is absolutely maddening! I am trying to import a basic, simple file that has dates as the first field. If I import the file as-is, it renders the dates into row names. If, however, I go into the .csv file and manually change ANYthing at all, in…
Ryan Utz
  • 51
  • 1
  • 6
-1
votes
2 answers

I need to read a set of .CSV files in a folder by copying the header(First row) to a column variable and the second row as a header in R

I need to read a set of .CSV files in a folder by copying the header(First row) to a column variable and the second row as a header in R. My input format is like this enter image description here My output format would be like this Date =…
-1
votes
1 answer

Warning message in R when using colClasses when reading csv files

I am using lapply to read a list of files. The files have multiple rows and columns, and I interested in the first row in the first column. The code I am using is: lapply(file_list, read.csv,sep=',', header = F, col.names=F, nrow=1, colClasses =…
Tanjil
  • 198
  • 1
  • 17
-1
votes
1 answer

How do I properly import a csv file for a 52 playing card deck?

I am working on a project to create the war card game in python. The assignment calls for the 52 playing card deck to be created with a csv file but I am having trouble with it. I created the csv file through excel and tried to import it but its not…
Megan
  • 23
  • 1
  • 4
-1
votes
2 answers

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 cases I found, there was headers in the data. My…
r_e
  • 242
  • 4
  • 14
-1
votes
1 answer

R read csv with observations in colums

in every example I have seen so far for reading csv files in R, the variables are in columns and the observations (individuals) are in rows. In a introductory statistics course I am taking there is an example table where the (many) variables are in…
Hans
  • 145
  • 9
-1
votes
1 answer

When I save the change made to the data variable, the old state is being saved. Where's the mistake?

My input data is: X, occupation , focc , education , race 1, 1 , sales , professional , 14 , non-black 2, 2 , craftsmen , sales , 13 , non-black 3, 3 , sales , professional 16 , non-black I delete the x column and…
Enes
  • 41
  • 1
  • 10
-1
votes
2 answers

Reading data from multiple csv files in R

I was able to create a function that allowed me to read data from a csv file and calculate the mean of specific columns. My problem now is that when I try to combine data from multiple csv files using rbind in order to calculate the mean, it…
Simpa
  • 1
-1
votes
1 answer

Large CSV with commas and quotes as delimiters and an open quote somethere - how should i import this in R?

My data has around 2.6 million rows with both quotes and commas as delimiters. But sometimes there are commas withing a variable which i do not want to be considered as a delimiter. Also, i think there is an open quote somewhere, so when i simply…
Sharvi
  • 1
  • 1
-1
votes
1 answer

Why does R think my imported vector of characters are numbers?

This is probably a basic question, but why does R think my vector, which has a bunch of words in it, are numbers when I try to use these vectors as column names? I imported a data set and it turns out the first row of data are the column headers…
user6472523
  • 211
  • 3
  • 8
-1
votes
2 answers

Issues reading data as csv in R

I have a large data set of (~20000x1). Not all the fields are filled, in other words the data does have missing values. Each feature is a string. I have done the following code runs: Input: data <- read.csv("data.csv", header=TRUE, quote = "") datan…