easy_sheet_io 0.4.6.2 → 0.4.7.1

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: '0489a9c987e6b88c82136b5d22a6645e95935c6015118db1246afa8794141d53'
4
- data.tar.gz: 28462d03acd63beb8d36937aef938028e2a66c83f759e965afd888b97dc6645a
3
+ metadata.gz: a53b3053320aed73cc23e53314ddbad656a0d7567f9012a4bf1388c7e44958c0
4
+ data.tar.gz: 971ad3bfc3a5211493c31886a5487f5f19a4ddda8b7a71a5be3c4a6cf10d2761
5
5
  SHA512:
6
- metadata.gz: 401597fa2203db419f00b38ee1e75427946885c581bf62bb8b2026531975376ae8863510829a702409984a5a7a8b3d1b02d9a29eef6645e187a3a27139decefc
7
- data.tar.gz: eaa9893d8540dce0a4c64433e8e8c6eb4cb4223eb39c8ff39c6827524016920ddb6d74ac7cca8e86a5636925b899cbacb6966d9f6caac339e96c4032fac3c8b0
6
+ metadata.gz: 4b24c4ffdb2c549ab9457362c0d16234808f3b98e8140e1a656771749203aee0fd2d8aafd90590c98ffc19358eda892cc45e4887702884560c92cc7950101a75
7
+ data.tar.gz: 952d816e49b326fb3b266a5ae00ff4d649b337e080451ca348068975b333384f311b59471db41084cdee584746e43fd9a88c34b2b91b6ec94834eb5147d1f875
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EasySheetIo
4
- VERSION = "0.4.6.2"
4
+ VERSION = "0.4.7.1"
5
5
  end
data/lib/easy_sheet_io.rb CHANGED
@@ -44,7 +44,7 @@ module EasySheetIo
44
44
  # Converting Encode and Setting index.. rover not supported yet
45
45
  if format.to_s == "daru" || format.nil?
46
46
  ans.convert_enc!(from: encoding, to: "utf-8")
47
- ans.set_index! if index
47
+ ans.set_index!(index) if index
48
48
  end
49
49
 
50
50
  return ans
@@ -53,7 +53,7 @@ module EasySheetIo
53
53
 
54
54
  # ##Generate Array from EXCEL File, and convert it to Hash or DataFrame.
55
55
  # **opt candidate= line_from: 1, header: 0)
56
- def read_excel(path, sheet_i: 0, format: :daru, encoding: "utf-8", **opt)
56
+ def read_excel(path, sheet_i: 0, format: :daru, encoding: "utf-8", index: nil, **opt)
57
57
  a2d = open_excel(path, sheet_i, encoding: encoding) # Get 2D Array
58
58
 
59
59
  if format.to_s == "array"
@@ -61,7 +61,11 @@ module EasySheetIo
61
61
  elsif format.to_s == "hash"
62
62
  return to_hash(a2d, **opt)
63
63
  else # include format.nil?
64
- return to_df(to_hash(a2d, **opt), format: format)
64
+ ans = to_df(to_hash(a2d, **opt), format: format)
65
+ if format.to_s == "daru" || format.nil?
66
+ ans.set_index!(index) if index
67
+ end
68
+ return ans
65
69
  end
66
70
  end
67
71
 
data/lib/to_csv.rb CHANGED
@@ -49,8 +49,8 @@ class Daru::DataFrame
49
49
  #####################
50
50
 
51
51
  # rover not suppoted yet about indexing
52
- def set_index!
53
- self.index = self[0]
52
+ def set_index!(indexcolumn)
53
+ self.index = self[indexcolumn]
54
54
  end
55
55
 
56
56
  alias_method :addvec, :add_vector
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_sheet_io
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6.2
4
+ version: 0.4.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - show-o-atakun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-16 00:00:00.000000000 Z
11
+ date: 2023-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daru