Class: Pandas::DataFrame

Inherits:
Object
  • Object
show all
Defined in:
lib/pandas/data_frame.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



5
6
7
8
# File 'lib/pandas/data_frame.rb', line 5

def [](key)
  key = PyCall::List.new(key) if key.is_a?(Array)
  super
end

#to_iruby_mimebundle(include: [], exclude: []) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/pandas/data_frame.rb', line 14

def to_iruby_mimebundle(include: [], exclude: [])
  include = ["text/html", "text/latex", "text/plain"] if include.empty?
  include -= exclude unless exclude.empty?
  include.map { |mime|
    data = case mime
           when "text/html"
             _repr_html_
           when "text/latex"
             _repr_latex_
           when "text/plain"
             if respond_to?(:_repr_pretty_)
               _repr_pretty_
             else
               __repr__
             end
           end
    [mime, data] if data
  }.compact.to_h
end

#to_narrayObject



10
11
12
# File 'lib/pandas/data_frame.rb', line 10

def to_narray
  to_numpy.to_narray
end