data-import

Reading text data from a CSV file in MATLAB

与世无争的帅哥 提交于 2019-11-28 09:25:01
问题 my data is in following form: days of week date time(hrs) visitors mon jan 2 2010 900 501 mon jan 2 2010 1000 449 mon jan 2 2010 1100 612 likewise for every day for entire year. i need to create a matrix of days of week as shown below: A=[ mon mon mon ] 回答1: Here is how I would read the tab-separated values , and parse the dates: %# read and parse file fid = fopen('data.csv','rt'); C = textscan(fid, '%s %s %s %d', 'Delimiter','\t', 'HeaderLines',1, ... 'MultipleDelimsAsOne',true,

'utf-8' codec can't decode byte 0x92 in position 18: invalid start byte

时光总嘲笑我的痴心妄想 提交于 2019-11-27 23:22:04
I am trying to read in a dataset called df1, but it does not work import pandas as pd df1=pd.read_csv("https://raw.githubusercontent.com/tuyenhavan/Statistics/Dataset/World_Life_Expectancy.csv",sep=";") df1.head() Here are huge errors from the above code, but this is the most relevant UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 18: invalid start byte The data is indeed not encoded as UTF-8; everything is ASCII except for that single 0x92 byte: b'Korea, Dem. People\x92s Rep.' Decode it as Windows codepage 1252 instead, where 0x92 is a fancy quote, ’ : df1 = pd.read_csv(

Can you automatically create a mysqldump file that doesn't enforce foreign key constraints?

你。 提交于 2019-11-27 20:22:31
When I run a mysqldump command on my database and then try to import it, it fails as it attempts to create the tables alphabetically, even though they may have a foreign key that references a table later in the file. There doesn't appear to be anything in the documentation and I've found answers like this that say to update the file after it's created to include: set FOREIGN_KEY_CHECKS = 0; ...original mysqldump file contents... set FOREIGN_KEY_CHECKS = 1; Is there no way to automatically set those lines or export the tables in the necessary order (without having to manually specify all table

Fastest way to import CSV files in MATLAB

廉价感情. 提交于 2019-11-27 18:39:21
问题 I've written a script that saves its output to a CSV file for later reference, but the second script for importing the data takes an ungainly amount of time to read it back in. The data is in the following format: Item1,val1,val2,val3 Item2,val4,val5,val6,val7 Item3,val8,val9 where the headers are on the left-most column, and the data values take up the remainder of the row. One major difficulty is that the arrays of data values can be different lengths for each test item. I'd save it as a

App Engine BadValueError On Bulk Data Upload - TextProperty being construed as StringProperty

浪尽此生 提交于 2019-11-27 03:05:30
问题 bulkoader.yaml: transformers: - kind: ExampleModel connector: csv property_map: - property: __key__ external_name: key export_transform: transform.key_id_or_name_as_string - property: data external_name: data - property: type external_name: type model.py: class ExampleModel(db.Model): data = db.TextProperty(required=True) type = db.StringProperty(required=True) Everything seems to be fine, yet when I upload I get this error: BadValueError: Property data is 24788 bytes long; it must be 500 or

'utf-8' codec can't decode byte 0x92 in position 18: invalid start byte

北城余情 提交于 2019-11-26 23:18:04
问题 I am trying to read in a dataset called df1, but it does not work import pandas as pd df1=pd.read_csv("https://raw.githubusercontent.com/tuyenhavan/Statistics/Dataset/World_Life_Expectancy.csv",sep=";") df1.head() Here are huge errors from the above code, but this is the most relevant UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 18: invalid start byte 回答1: The data is indeed not encoded as UTF-8; everything is ASCII except for that single 0x92 byte: b'Korea, Dem.

Can you automatically create a mysqldump file that doesn't enforce foreign key constraints?

冷暖自知 提交于 2019-11-26 22:50:35
问题 When I run a mysqldump command on my database and then try to import it, it fails as it attempts to create the tables alphabetically, even though they may have a foreign key that references a table later in the file. There doesn't appear to be anything in the documentation and I've found answers like this that say to update the file after it's created to include: set FOREIGN_KEY_CHECKS = 0; ...original mysqldump file contents... set FOREIGN_KEY_CHECKS = 1; Is there no way to automatically set