pandas 0.3.3 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 952bd0798aaf70a04aad070946185ba24462c5ba88d68650d65c096bcb3a8e81
4
- data.tar.gz: fb70cd2d1f07485ea94fbab52ed054be9d14cbe35948a297d5f011b60f9353cb
3
+ metadata.gz: 2c1913012c2ccb555b4ed0b8a9ff2b7b1da0976c3a6ed163a08039d0304c9d19
4
+ data.tar.gz: f86be3583b9ffaebf0b3d3253a36d57682c878499df3030313416c642d28061e
5
5
  SHA512:
6
- metadata.gz: d21e7f9c032f5efae82689ac111167bdc3f9db844748aa2b148261750d39f54a17f3ce5c1578121238ef0dc5af7d04564672a18525f3394157dea4ba0f60b73a
7
- data.tar.gz: 15bfd63048f2cbbc2f602ad08626a2d2fe838cf026eeaaa583a27223e9255291bea113ae97d23286fbcd89c249b1effb65235b3b18b5620f99446f9eb723e97c
6
+ metadata.gz: b8ae3f74cdb2174ca85011a3449864dbc36aa2de9dae0e8910ca9c68fd53dbfef58d0c443e4dd243d1ec4ec50c408eaa4deac75a20bcb9f0aa2e064afaa4a38e
7
+ data.tar.gz: 045aad20c787141b0f29f7d2ed044be8d9558e841e67ed4121f42ca1014880f0c1ee5bd6088712f5693e96fbe8cd389423d2675638c9bbcc4ad22850f32d8c31
data/CHANGES.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # The chenge history of Pandas wrapper for Ruby
2
2
 
3
+ ## 0.3.8
4
+
5
+ * Add `to_iruby_mimebundle` in `Pandas::DataFrame`
6
+
7
+ ## 0.3.7
8
+
9
+ * Avoid circular require warning
10
+
11
+ ## 0.3.6
12
+
13
+ * Add `to_narray` in `Pandas::DataFrame`, `Pandas::Series`, and `Pandas::Index`
14
+
15
+ ## 0.3.5
16
+
17
+ * Fix the bug of `to_a` for Series after doing dropna
18
+
19
+ ## 0.3.4
20
+
21
+ * Add `to_a` methods in `Pandas::Series` and `Pandas::Index`
22
+
23
+ * Add `length` method in `Pandas::Series` and `Pandas::Index`
24
+
3
25
  ## 0.3.3
4
26
 
5
27
  * Support array index in `Pandas::Series#[]`
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Pandas wrapper for Ruby
2
2
 
3
- [![Build Status](https://travis-ci.org/mrkn/pandas.rb.svg)](https://travis-ci.org/mrkn/pandas.rb)
3
+ [![CI](https://github.com/mrkn/pandas.rb/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/mrkn/pandas.rb/actions?query=workflow%3ACI)
4
4
 
5
5
  This library enables to directry call [pandas](http://pandas.pydata.org/) from Ruby language.
6
6
  This uses [pycall](https://github.com/mrkn/pycall).
@@ -1,4 +1,4 @@
1
- require 'pandas'
1
+ require 'pandas' unless defined?(Pandas)
2
2
 
3
3
  module Pandas
4
4
  class DataFrame
@@ -6,5 +6,29 @@ module Pandas
6
6
  key = PyCall::List.new(key) if key.is_a?(Array)
7
7
  super
8
8
  end
9
+
10
+ def to_narray
11
+ to_numpy.to_narray
12
+ end
13
+
14
+ def to_iruby_mimebundle(include: [], exclude: [])
15
+ include = ["text/html", "text/latex", "text/plain"] if include.empty?
16
+ include -= exclude unless exclude.empty?
17
+ include.map { |mime|
18
+ data = case mime
19
+ when "text/html"
20
+ _repr_html_
21
+ when "text/latex"
22
+ _repr_latex_
23
+ when "text/plain"
24
+ if respond_to?(:_repr_pretty_)
25
+ _repr_pretty_
26
+ else
27
+ __repr__
28
+ end
29
+ end
30
+ [mime, data] if data
31
+ }.compact.to_h
32
+ end
9
33
  end
10
34
  end
data/lib/pandas/index.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'pandas'
1
+ require 'pandas' unless defined?(Pandas)
2
2
 
3
3
  module Pandas
4
4
  class Index
@@ -17,5 +17,17 @@ module Pandas
17
17
  def unique?
18
18
  is_unique
19
19
  end
20
+
21
+ def length
22
+ size
23
+ end
24
+
25
+ def to_a
26
+ Array.new(length) {|i| self[i] }
27
+ end
28
+
29
+ def to_narray
30
+ to_numpy.to_narray
31
+ end
20
32
  end
21
33
  end
data/lib/pandas/io.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'pandas'
1
+ require 'pandas' unless defined?(Pandas)
2
2
 
3
3
  module Pandas
4
4
  module IO
@@ -1,4 +1,4 @@
1
- require 'pandas'
1
+ require 'pandas' unless defined?(Pandas)
2
2
 
3
3
  module Pandas
4
4
  class LocIndexer
@@ -1,3 +1,5 @@
1
+ require 'pandas' unless defined?(Pandas)
2
+
1
3
  module Pandas
2
4
  module OptionsHelper
3
5
  module_function
data/lib/pandas/series.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'pandas'
1
+ require 'pandas' unless defined?(Pandas)
2
2
 
3
3
  module Pandas
4
4
  class Series
@@ -32,5 +32,17 @@ module Pandas
32
32
  def unique?
33
33
  is_unique
34
34
  end
35
+
36
+ def length
37
+ size
38
+ end
39
+
40
+ def to_a
41
+ Array.new(length) {|i| self.iloc[i] }
42
+ end
43
+
44
+ def to_narray
45
+ to_numpy.to_narray
46
+ end
35
47
  end
36
48
  end
@@ -1 +1 @@
1
- PANDAS_VERSION = "0.3.3"
1
+ PANDAS_VERSION = "0.3.8"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pandas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenta Murata
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-19 00:00:00.000000000 Z
11
+ date: 2021-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pycall
@@ -141,7 +141,7 @@ homepage: https://github.com/mrkn/pandas.rb
141
141
  licenses:
142
142
  - MIT
143
143
  metadata: {}
144
- post_install_message:
144
+ post_install_message:
145
145
  rdoc_options: []
146
146
  require_paths:
147
147
  - lib
@@ -156,8 +156,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubygems_version: 3.2.3
160
- signing_key:
159
+ rubygems_version: 3.2.21
160
+ signing_key:
161
161
  specification_version: 4
162
162
  summary: Pandas wrapper for Ruby
163
163
  test_files: []