Skip to content

Commit e511844

Browse files
committed
update gemspec and minor doc updates
1 parent 2a05cd9 commit e511844

File tree

2 files changed

+40
-20
lines changed

2 files changed

+40
-20
lines changed

daru.gemspec

+26-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ require 'daru/version.rb'
55

66
Daru::DESCRIPTION = <<MSG
77
Daru (Data Analysis in RUby) is a library for analysis, manipulation and visualization
8-
of data.
8+
of data. Daru works seamlessly accross interpreters and leverages interpreter-specific
9+
optimizations whenever they are available.
910
10-
Daru works with Ruby arrays and NMatrix, thus working seamlessly accross
11-
ruby interpreters, at the same time providing speed for those who need it, while
12-
making working with data super simple and intuitive.
11+
It is the default data storage gem for all the statsample gems (glm, timeseries, etc.)
12+
and can be used with many others like mixed_models, gnuplotrb, nyaplot and iruby.
1313
MSG
1414

1515
Gem::Specification.new do |spec|
@@ -27,6 +27,28 @@ Gem::Specification.new do |spec|
2727
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
2828
spec.require_paths = ["lib"]
2929

30+
spec.post_install_message = <<-EOF
31+
*************************************************************************
32+
Thank you for installing daru!
33+
34+
oOOOOOo
35+
,| oO
36+
//| |
37+
\\| |
38+
`| |
39+
`-----`
40+
41+
42+
Hope you love daru! For enhanced interactivity and better visualizations,
43+
consider using gnuplotrb and nyaplot with iruby. For statistics use the
44+
statsample family.
45+
46+
Read the README for interesting use cases and examples.
47+
48+
Cheers!
49+
*************************************************************************
50+
EOF
51+
3052
spec.add_runtime_dependency 'reportbuilder', '~> 1.4'
3153
spec.add_runtime_dependency 'spreadsheet', '~> 1.0.3'
3254

lib/daru/dataframe.rb

+14-16
Original file line numberDiff line numberDiff line change
@@ -1587,22 +1587,21 @@ def join(other_df,opts={})
15871587
# to new dataset, and fields which responds to second
15881588
# pattern will be added one case for each different %n.
15891589
#
1590-
# == Usage
1590+
# @example
15911591
# cases=[
15921592
# ['1','george','red',10,'blue',20,nil,nil],
15931593
# ['2','fred','green',15,'orange',30,'white',20],
15941594
# ['3','alfred',nil,nil,nil,nil,nil,nil]
15951595
# ]
15961596
# ds=Daru::DataFrame.rows(cases, order: [:id, :name, :car_color1, :car_value1, :car_color2, :car_value2, :car_color3, :car_value3])
15971597
# ds.one_to_many([:id],'car_%v%n').to_matrix
1598-
# => Matrix[
1599-
# ["red", "1", 10],
1600-
# ["blue", "1", 20],
1601-
# ["green", "2", 15],
1602-
# ["orange", "2", 30],
1603-
# ["white", "2", 20]
1604-
# ]
1605-
#
1598+
# #=> Matrix[
1599+
# # ["red", "1", 10],
1600+
# # ["blue", "1", 20],
1601+
# # ["green", "2", 15],
1602+
# # ["orange", "2", 30],
1603+
# # ["white", "2", 20]
1604+
# # ]
16061605
def one_to_many(parent_fields, pattern)
16071606
re = Regexp.new pattern.gsub("%v","(.+?)").gsub("%n","(\\d+?)")
16081607
ds_vars = parent_fields.dup
@@ -1670,14 +1669,14 @@ def add_vectors_by_split_recode(name_, join='-', sep=Daru::SPLIT_TOKEN)
16701669
# * table - String specifying name of the table that will created in SQL.
16711670
# * charset - Character set. Default is "UTF8".
16721671
#
1673-
# == Usage
1672+
# @example
16741673
#
16751674
# ds = Daru::DataFrame.new({
16761675
# :id => Daru::Vector.new([1,2,3,4,5]),
16771676
# :name => Daru::Vector.new(%w{Alex Peter Susan Mary John})
16781677
# })
16791678
# ds.create_sql('names')
1680-
# ==>"CREATE TABLE names (id INTEGER,\n name VARCHAR (255)) CHARACTER SET=UTF8;"
1679+
# #=>"CREATE TABLE names (id INTEGER,\n name VARCHAR (255)) CHARACTER SET=UTF8;"
16811680
#
16821681
def create_sql(table,charset="UTF8")
16831682
sql = "CREATE TABLE #{table} ("
@@ -1740,6 +1739,8 @@ def to_a
17401739
arry
17411740
end
17421741

1742+
# Convert to json. If no_index is false then the index will NOT be included
1743+
# in the JSON thus created.
17431744
def to_json no_index=true
17441745
if no_index
17451746
self.to_a[0].to_json
@@ -1814,12 +1815,9 @@ def update
18141815
@data.each { |v| v.update } if Daru.lazy_update
18151816
end
18161817

1818+
# Rename the DataFrame.
18171819
def rename new_name
1818-
if new_name.is_a?(Numeric)
1819-
@name = new_name
1820-
return
1821-
end
1822-
@name = new_name.to_sym
1820+
@name = new_name
18231821
end
18241822

18251823
# Write this DataFrame to a CSV file.

0 commit comments

Comments
 (0)