import-csv

fread in R imports a large .csv file as a data frame with one row

杀马特。学长 韩版系。学妹 提交于 2019-12-12 09:37:20
问题 I'm importing a large .csv file into R (about 0.5 million rows), so I've been trying to use fread() from the data.table package as a faster alternative to read.table() and read.csv(). However, fread() returns a data frame with all of the data from the rows inside one row, even though it has the correct number of columns. I found a bug report from 2013 showing this is related to the integer64 data class: http://r-forge.r-project.org/tracker/index.php?func=detail&aid=2786&group_id=240&atid=975

VBA Import CSV file

送分小仙女□ 提交于 2019-12-12 06:05:00
问题 My macro can import text files from a folder: DoCmd.TransferText acImportDelim, .... But now, I no longer need to import text files, I need to import csv files. How can I implement the code to achieve this? 来源: https://stackoverflow.com/questions/43923256/vba-import-csv-file

writing data to csv from dictionaries with multiple values per key

不打扰是莪最后的温柔 提交于 2019-12-11 20:38:59
问题 Background I am storing data in dictionaries. The dictionaries can be off different length and in a particular dictionary there could be keys with multiple values. I am trying to spit out the data on a CSV file. Problem/Solution Image 1 is how my actual output prints out. Image 2 shows how i would want my output to actually printout. Image 2 is the desired output . CODE import csv from itertools import izip_longest e = {'Lebron':[25,10],'Ray':[40,15]} c = {'Nba':5000} def writeData(): with

FileNotFoundError while importing a csv file using pandas in Jupyter notebook

℡╲_俬逩灬. 提交于 2019-12-04 13:32:31
Screenshot of the described error. import pandas as pd df = pd.read_csv('/home/josepm/Documents/test_ver2.csv') --------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) <ipython-input-3-5cd7fd573fb7> in <module>() 1 import pandas as pd ----> 2 df = pd.read_csv('/home/josepm/Documents/test_ver2.csv') I try to import a CSV file using pandas and every time it says that it doesn't find the file. It's like Jupyter doesn't see it. I tried to do this: import os os.path.isfile('/home/josepm/Documents/test_ver2.csv') and it doesn't

Importing CSV having Duplicate Column names with SQL Query

只谈情不闲聊 提交于 2019-12-01 14:37:01
I have 3 csv files located in different network folders. The network folders/sub-folders may have spaces in them. I want to join these 3 csv files to create a single ADO Recordset containing required columns. Test1.csv (I have excluded unnecessary columns from all csv's) T1Id | Gpos | lbl ----------------------- 1001 | 0 | Innovate 1002 | 1 | Buys 1003 | 2 | Sales 1004 | 3 | Forecasts 1005 | 4 | Usage 1006 | 5 | Forum Test2.csv: (I have excluded unnecessary columns from all csv's) T2Id | T1Id | Apos | tval ----------------------------------- 382 | 1001 | 1 | my life my rules. 203 | 1001 | 2 |

Importing CSV having Duplicate Column names with SQL Query

喜欢而已 提交于 2019-12-01 12:58:09
问题 I have 3 csv files located in different network folders. The network folders/sub-folders may have spaces in them. I want to join these 3 csv files to create a single ADO Recordset containing required columns. Test1.csv (I have excluded unnecessary columns from all csv's) T1Id | Gpos | lbl ----------------------- 1001 | 0 | Innovate 1002 | 1 | Buys 1003 | 2 | Sales 1004 | 3 | Forecasts 1005 | 4 | Usage 1006 | 5 | Forum Test2.csv: (I have excluded unnecessary columns from all csv's) T2Id | T1Id

Reading CSV file some missing columns

泪湿孤枕 提交于 2019-11-30 22:48:34
问题 I am trying to read in a CSV file into my VB.net application using the following code: While Not EOF(1) Input(1, dummy) Input(1, phone_number) Input(1, username) Input(1, product_name) Input(1, wholesale_cost) Input(1, dummy) Input(1, dummy) End While My CSV file (as text) looks like this: Customer Name,Phone Number,Username,Product,Wholesale Cost,Sales Price,Gross Profit, Customer Reference ,00000000000,00000000000,Product Name,25.00,35.00,10.00, ,00000000000,00000000000,Product Name,1.00,1

MySQL Invalid UTF8 character string when importing csv table

落爺英雄遲暮 提交于 2019-11-30 06:55:06
I want to import an .csv file into MySQL Database by: load data local infile 'C:\\Users\\t_lichtenberger\\Desktop\\tblEnvironmentLog.csv' into table tblenvironmentlog character set utf8 fields terminated by ';' lines terminated by '\n' ignore 1 lines; The .csv file looks like: But I am getting the following error and I cannot explain why: Error Code: 1300. Invalid utf8 character string: 'M' Any suggestions? Rick James See what the settings for the export were. Look for "UTF-8". This suggests that "Truncated text" is caused by the data not being encoded as utf8mb4. Outside MySQL, "look for "UTF

MySQL Invalid UTF8 character string when importing csv table

我怕爱的太早我们不能终老 提交于 2019-11-29 12:06:40
问题 I want to import an .csv file into MySQL Database by: load data local infile 'C:\\Users\\t_lichtenberger\\Desktop\\tblEnvironmentLog.csv' into table tblenvironmentlog character set utf8 fields terminated by ';' lines terminated by '\n' ignore 1 lines; The .csv file looks like: But I am getting the following error and I cannot explain why: Error Code: 1300. Invalid utf8 character string: 'M' Any suggestions? 回答1: See what the settings for the export were. Look for "UTF-8". This suggests that

Pandas csv-import: Keep leading zeros in a column

陌路散爱 提交于 2019-11-26 22:07:01
I am importing study data into a Pandas data frame using read_csv . My subject codes are 6 numbers coding, among others, the day of birth. For some of my subjects this results in a code with a leading zero (e.g. "010816"). When I import into Pandas, the leading zero is stripped of and the column is formatted as int64 . Is there a way to import this column unchanged maybe as a string? I tried using a custom converter for the column, but it does not work - it seems as if the custom conversion takes place before Pandas converts to int. baltasvejas As indicated in this question/answer by Lev