Created
October 16, 2009 02:38
-
-
Save davidrichards/211488 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data_frame (master): plain_frame | |
Loading Data Frame version: 0.1.8 | |
>> df = DataFrame.from_csv('http://archive.ics.uci.edu/ml/machine-learning-databases/forest-fires/forestfires.csv') | |
=> DataFrame rows: 517 labels: [:x, :y, :month, :day, :ffmc, :dmc, :dc, :isi, :temp, :rh, :wind, :rain, :area] | |
>> df.month.categories | |
=> ["apr", "aug", "dec", "feb", "jan", "jul", "jun", "mar", "may", "nov", "oct", "sep"] | |
>> df.wind.categories | |
=> [0.4, 0.9, 1.3, 1.8, 2.2, 2.7, 3.1, 3.6, 4, 4.5, 4.9, 5.4, 5.8, 6.3, 6.7, 7.2, 7.6, 8, 8.5, 8.9, 9.4] | |
>> df.wind.add_category(0) {|e| e <= 5} | |
=> {0=>#<Proc:0x0259cdf4@(irb):4>} | |
>> df.wind.add_category(1) {|e| e > 5} | |
=> {1=>#<Proc:0x025902ac@(irb):5>} | |
>> df.wind.categories | |
=> [0, 1] | |
>> df.duplicate!(:wind) | |
=> true | |
>> df.rename!(:wind_categories, :wind1) | |
=> :wind_categories | |
>> df.categorize!(:wind_categories) | |
=> false | |
>> df.wind.uniq | |
=> [6.7, 0.9, 1.3, 4, 1.8, 5.4, 3.1, 2.2, 7.2, 4.5, 4.9, 2.7, 5.8, 3.6, 7.6, 6.3, 8.9, 8.5, 9.4, 0.4, 8] | |
>> df.wind_categories.uniq | |
=> [6.7, 0.9, 1.3, 4, 1.8, 5.4, 3.1, 2.2, 7.2, 4.5, 4.9, 2.7, 5.8, 3.6, 7.6, 6.3, 8.9, 8.5, 9.4, 0.4, 8] | |
>> df.wind.categories | |
=> [0.4, 0.9, 1.3, 1.8, 2.2, 2.7, 3.1, 3.6, 4, 4.5, 4.9, 5.4, 5.8, 6.3, 6.7, 7.2, 7.6, 8, 8.5, 8.9, 9.4] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment