pandas 0.3.2 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8543416156440087fbaf48acad949e5a15426d06fa871d4493705dabff8ba722
4
- data.tar.gz: '0304593f38ec6d5e3fd65abe8ded93b4d2d9354571cb4e93650aa292b9390e06'
3
+ metadata.gz: cb4920b69400b783baa3a1b7d3de0bba0de307a3501ed4eea268c3b29c87724c
4
+ data.tar.gz: 33651feb566d77b5c214df533d726a9b451cc8e6b09b30f8fe9ab46728ac0742
5
5
  SHA512:
6
- metadata.gz: 3afba55b10fe1f4e17aa98fd1fa759be3c76673b17abab11ea98f56fb4963434c889f8ee2ee5ec8d986ab975869053da932ea8de870017c3b6e0043f9552c88c
7
- data.tar.gz: a11d1d1ea1f5d5d1d5e5b0fb78dfadc0bede08b335e3e4256a25250668ce8bb2b6c5149a68de5c9e25375401fe9f7aa47226dc6b16c0c9a0bf9e927d6c0eab5b
6
+ metadata.gz: abfca8a9bfe9644d92f99a180c0377bc10b4da2e878ec0dcd07b3bef0791144fe6e4f03b736909b485f382415172e436a5d921fbe86c8f9fa0834f1644480fef
7
+ data.tar.gz: af9989bfd4fe2f6d589f65c0f93fce3bfb84dae25cbf2a9597a0e5383dd7363d4f2a3415bc3355d06ef4403d7e1de1705705c153d736ca9394c40ba552a1db0a
@@ -0,0 +1,69 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ types:
9
+ - opened
10
+ - synchronize
11
+ - reopened
12
+
13
+ jobs:
14
+ test:
15
+ name: ${{ matrix.os}} ${{ matrix.ruby }} ${{ matrix.python }}-${{ matrix.python_arch }}
16
+ runs-on: ${{ matrix.os }}
17
+
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ os:
22
+ - ubuntu-latest
23
+ - macos-latest
24
+ ruby:
25
+ - 3.0
26
+ - 2.7
27
+ - 2.6
28
+ - 2.5
29
+ - 2.4
30
+ - debug
31
+ python:
32
+ - 3.8.x
33
+ - 3.7.x
34
+ - 3.6.x
35
+ - 2.7.x
36
+ python_arch:
37
+ - x64
38
+
39
+ steps:
40
+ - uses: actions/checkout@v2
41
+ with:
42
+ fetch-depth: 1
43
+
44
+ - uses: ruby/setup-ruby@v1
45
+ with:
46
+ ruby-version: ${{ matrix.ruby }}
47
+
48
+ - uses: actions/setup-python@v1
49
+ with:
50
+ python-version: ${{ matrix.python }}
51
+ architecture: ${{ matrix.python_arch }}
52
+
53
+ - run: sudo apt-get install libsqlite3-dev
54
+ if: matrix.os == 'ubuntu-latest'
55
+
56
+ - run: brew install sqlite3
57
+ if: matrix.os == 'macos-latest'
58
+
59
+ - run: pip install -r requirements.txt
60
+
61
+ - run: gem install bundler
62
+ - run: bundle install
63
+
64
+ - run: bundle exec rake
65
+ env:
66
+ PYTHON: python
67
+
68
+ - run: rake build
69
+ - run: gem install pkg/*.gem
data/CHANGES.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # The chenge history of Pandas wrapper for Ruby
2
2
 
3
+ ## 0.3.7
4
+
5
+ * Avoid circular require warning
6
+
7
+ ## 0.3.6
8
+
9
+ * Add `to_narray` in `Pandas::DataFrame`, `Pandas::Series`, and `Pandas::Index`
10
+
11
+ ## 0.3.5
12
+
13
+ * Fix the bug of `to_a` for Series after doing dropna
14
+
15
+ ## 0.3.4
16
+
17
+ * Add `to_a` methods in `Pandas::Series` and `Pandas::Index`
18
+
19
+ * Add `length` method in `Pandas::Series` and `Pandas::Index`
20
+
21
+ ## 0.3.3
22
+
23
+ * Support array index in `Pandas::Series#[]`
24
+
25
+ * Add predicate methods for `Pandas::Index` and `Pandas::Series`
26
+
27
+ * Support closed-end string ranges in `Pandas::Series#[]`
28
+
29
+ * Support string array index in `Pandas::DataFrame#loc[]`
30
+
31
+ * Support array index in `Pandas::DataFrame#iloc[]`
32
+
3
33
  ## 0.3.2
4
34
 
5
35
  * Fix for pandas 1.0
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).
data/lib/pandas.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require "pandas/version"
2
- require "pycall"
2
+ require "numpy"
3
3
 
4
4
  Pandas = PyCall.import_module("pandas")
5
5
  module Pandas
@@ -80,6 +80,9 @@ module Pandas
80
80
  end
81
81
 
82
82
  require 'pandas/data_frame'
83
+ require 'pandas/index'
83
84
  require 'pandas/io'
85
+ require 'pandas/loc_indexer'
84
86
  require 'pandas/options'
87
+ require 'pandas/series'
85
88
  end
@@ -1,12 +1,14 @@
1
- require 'pandas'
1
+ require 'pandas' unless defined?(Pandas)
2
2
 
3
3
  module Pandas
4
4
  class DataFrame
5
- def [](*key)
6
- if key.length == 1 && key[0].is_a?(Array)
7
- key[0] = PyCall::List.new(key[0])
8
- end
5
+ def [](key)
6
+ key = PyCall::List.new(key) if key.is_a?(Array)
9
7
  super
10
8
  end
9
+
10
+ def to_narray
11
+ to_numpy.to_narray
12
+ end
11
13
  end
12
14
  end
@@ -0,0 +1,33 @@
1
+ require 'pandas' unless defined?(Pandas)
2
+
3
+ module Pandas
4
+ class Index
5
+ def monotonic?
6
+ is_monotonic
7
+ end
8
+
9
+ def monotonic_decreasing?
10
+ is_monotonic_decreasing
11
+ end
12
+
13
+ def monotonic_increasing?
14
+ is_monotonic_increasing
15
+ end
16
+
17
+ def unique?
18
+ is_unique
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
32
+ end
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
@@ -0,0 +1,25 @@
1
+ require 'pandas' unless defined?(Pandas)
2
+
3
+ module Pandas
4
+ class LocIndexer
5
+ def [](*keys)
6
+ for i in 0...keys.length
7
+ if keys[i].is_a? Array
8
+ keys[i] = PyCall::List.new(keys[i])
9
+ end
10
+ end
11
+ super
12
+ end
13
+ end
14
+
15
+ class IlocIndexer
16
+ def [](*keys)
17
+ for i in 0...keys.length
18
+ if keys[i].is_a? Array
19
+ keys[i] = PyCall::List.new(keys[i])
20
+ end
21
+ end
22
+ super
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,5 @@
1
+ require 'pandas' unless defined?(Pandas)
2
+
1
3
  module Pandas
2
4
  module OptionsHelper
3
5
  module_function
@@ -0,0 +1,48 @@
1
+ require 'pandas' unless defined?(Pandas)
2
+
3
+ module Pandas
4
+ class Series
5
+ def [](*key)
6
+ if key.length == 1
7
+ case key[0]
8
+ when Array
9
+ key[0] = PyCall::List.new(key[0])
10
+ when Range
11
+ case key[0].begin
12
+ when String
13
+ key[0] = key[0].begin ... key[0].end # force exclude-end
14
+ end
15
+ end
16
+ end
17
+ super
18
+ end
19
+
20
+ def monotonic?
21
+ is_monotonic
22
+ end
23
+
24
+ def monotonic_decreasing?
25
+ is_monotonic_decreasing
26
+ end
27
+
28
+ def monotonic_increasing?
29
+ is_monotonic_increasing
30
+ end
31
+
32
+ def unique?
33
+ is_unique
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
47
+ end
48
+ end
@@ -1 +1 @@
1
- PANDAS_VERSION = "0.3.2"
1
+ PANDAS_VERSION = "0.3.7"
data/pandas.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.add_dependency "pycall", ">= 1.0.0"
25
+ spec.add_dependency "numpy"
25
26
 
26
27
  spec.add_development_dependency "bundler", ">= 1.17.2"
27
28
  spec.add_development_dependency "rake"
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.2
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenta Murata
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-04 00:00:00.000000000 Z
11
+ date: 2021-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pycall
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: numpy
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -101,9 +115,9 @@ executables: []
101
115
  extensions: []
102
116
  extra_rdoc_files: []
103
117
  files:
118
+ - ".github/workflows/ci.yml"
104
119
  - ".gitignore"
105
120
  - ".rspec"
106
- - ".travis.yml"
107
121
  - CHANGES.md
108
122
  - Gemfile
109
123
  - LICENSE.txt
@@ -114,9 +128,12 @@ files:
114
128
  - data/titanic.csv
115
129
  - lib/pandas.rb
116
130
  - lib/pandas/data_frame.rb
131
+ - lib/pandas/index.rb
117
132
  - lib/pandas/io.rb
118
133
  - lib/pandas/io/active_record.rb
134
+ - lib/pandas/loc_indexer.rb
119
135
  - lib/pandas/options.rb
136
+ - lib/pandas/series.rb
120
137
  - lib/pandas/version.rb
121
138
  - pandas.gemspec
122
139
  - requirements.txt
@@ -139,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
156
  - !ruby/object:Gem::Version
140
157
  version: '0'
141
158
  requirements: []
142
- rubygems_version: 3.1.2
159
+ rubygems_version: 3.2.21
143
160
  signing_key:
144
161
  specification_version: 4
145
162
  summary: Pandas wrapper for Ruby
data/.travis.yml DELETED
@@ -1,26 +0,0 @@
1
- sudo: false
2
- language: ruby
3
-
4
- rvm:
5
- - ruby-head
6
- - 2.5.1
7
- - 2.4.4
8
- - 2.3.7
9
- - 2.2.10
10
-
11
- env:
12
- matrix:
13
- - PYTHON=python
14
- - PYENV_VERSION=3.6 PYTHON=python
15
-
16
- before_install:
17
- - gem update --system
18
- - gem update bundler
19
-
20
- before_script:
21
- - pip install --user -r requirements.txt
22
- - PYENV_VERSION=3.6 pip3 install --user -r requirements.txt
23
-
24
- matrix:
25
- allow_failures:
26
- - env: PYTHON=python # Ignore failed on python 2.7