書名: Clojure Data Analysis Cookbook(Second Edition)作者名: Eric Rochester本章字數: 166字更新時間: 2021-08-06 19:26:05
Reading data from Excel with Incanter
We've seen how Incanter makes a lot of common data-processing tasks very simple, and reading an Excel spreadsheet is another example of this.
Getting ready
First, make sure that your Leiningen project.clj
file contains the right dependencies:
(defproject getting-data "0.1.0-SNAPSHOT" :dependencies [[org.clojure/clojure "1.6.0"] [incanter "1.5.5"]"]])
Also, make sure that you've loaded those packages into the REPL or script:
(use 'incanter.core 'incanter.excel)
Find the Excel spreadsheet you want to work on. The file name of my spreadsheet is data/small-sample-header.xls
, as shown in the following screenshot. You can download this from http://www.ericrochester.com/clj-data-analysis/data/small-sample-header.xls.

How to do it…
Now, all you need to do is call incanter.excel/read-xls
:
user=> (read-xls "data/small-sample-header.xls") | given-name | surname | relation | |------------+---------+-------------| | Gomez | Addams | father | | Morticia | Addams | mother | | Pugsley | Addams | brother |
推薦閱讀
- ASP.NET Web API:Build RESTful web applications and services on the .NET framework
- jQuery EasyUI網站開發實戰
- Flash CS6中文版應用教程(第三版)
- Full-Stack Vue.js 2 and Laravel 5
- Python 3破冰人工智能:從入門到實戰
- 手把手教你學C語言
- PHP從入門到精通(第4版)(軟件開發視頻大講堂)
- 3ds Max印象 電視欄目包裝動畫與特效制作
- WildFly Cookbook
- Java程序設計實用教程(第2版)
- C語言程序設計
- jQuery基礎教程(第4版)
- ServiceDesk Plus 8.x Essentials
- Instant OpenCV for iOS
- 趣學Python游戲編程