將arff格式檔案匯入到mysql資料庫

2021-07-02 14:33:17 字數 905 閱讀 2739

weka中有許多arff格式的資料檔案,有時為方便操作,需要把他們放到資料庫中,現以weka安裝目錄下data資料夾中的iris.arff檔案為例。 

1、先在weka中將arff檔案轉換為csv檔案,這一步使用weka開啟,然後另存為csv格式的檔案即可。

2、然後刪除csv檔案中第一行對屬性名的描述,如下圖。 

2、儲存,並放到資料庫資料檔案目錄下(如c:\programdata\mysql\mysql server 5.5\data\weka); 這個目錄如果不好找,可以直接搜尋

3、在mysql中對應的資料庫建立資料表,本例中:

create table iris(sepallength real,sepalwidth real,petallength real,petalwidth real,class varchar(20));
並在命令列下執行以上批處理語句:

load data infile '\iris.csv'   

into table iris

fields terminated by ',' optionally enclosed by '"' escaped by '"'

lines terminated by '\r\n';

至此,成功將arff檔案匯入資料庫,如圖: 

xls格式檔案匯入到資料庫

set time limit 0 指令碼不超時 以下三步載入phpexcel的類 require once phpexcel.php require once phpexcel iofactory.php require once phpexcel reader excel5.php use exc...

將stdout stderr匯入到指定檔案

在編寫程式中,經常用到stdout stderr作為輸出,通常stdout用於輸出程式執行正常時的資訊,stderr用於輸出程式出錯時的資訊。我們可以通過一些命令將stdout stderr在螢幕上的輸出匯入到指定的檔案。1 準備工作 帶有stdout stderr輸出的test.cpp test....

將csv檔案匯入到mysql

首先,為自己要匯入的檔案按照屬性建立好錶 mysql create table id int notnull primary key,name char 30 character set utf8 not null level char 30 character set utf8 not null,...