Method: RedAmber::DataFrameDisplayable#tdr
- Defined in:
- lib/red_amber/data_frame_displayable.rb
#tdr(limit = 10, tally: 5, elements: 5) ⇒ nil Also known as: glimpse
Shows some information about self in a transposed style.
Examples:
Default
Default
diamonds = diamonds.assign_left(:index) { indices }
diamonds
# =>
#<RedAmber::DataFrame : 53940 x 11 Vectors, 0x0000000000035084>
index carat cut color clarity depth table price x y z
<uint16> <double> <string> <string> <string> <double> <double> <uint16> <double> <double> <double>
0 0 0.23 Ideal E SI2 61.5 55.0 326 3.95 3.98 2.43
1 1 0.21 Premium E SI1 59.8 61.0 326 3.89 3.84 2.31
2 2 0.23 Good E VS1 56.9 65.0 327 4.05 4.07 2.31
3 3 0.29 Premium I VS2 62.4 58.0 334 4.2 4.23 2.63
4 4 0.31 Good J SI2 63.3 58.0 335 4.34 4.35 2.75
5 5 0.24 Very Good J VVS2 62.8 57.0 336 3.94 3.96 2.48
6 6 0.24 Very Good I VVS1 62.3 57.0 336 3.95 3.98 2.47
7 7 0.26 Very Good H SI1 61.9 55.0 337 4.07 4.11 2.53
8 8 0.22 Fair E VS2 65.1 61.0 337 3.87 3.78 2.49
9 9 0.23 Very Good H VS1 59.4 61.0 338 4.0 4.05 2.39
10 10 0.3 Good J SI1 64.0 55.0 339 4.25 4.28 2.73
11 11 0.23 Ideal J VS1 62.8 56.0 340 3.93 3.9 2.46
12 12 0.22 Premium F SI1 60.4 61.0 342 3.88 3.84 2.33
13 13 0.31 Ideal J SI2 62.2 54.0 344 4.35 4.37 2.71
14 14 0.2 Premium E SI2 60.2 62.0 345 3.79 3.75 2.27
15 15 0.32 Premium E I1 60.9 58.0 345 4.38 4.42 2.68
16 16 0.3 Ideal I SI2 62.0 54.0 348 4.31 4.34 2.68
17 17 0.3 Good J SI1 63.4 54.0 351 4.23 4.29 2.7
18 18 0.3 Good J SI1 63.8 56.0 351 4.23 4.26 2.71
19 19 0.3 Very Good J SI1 62.7 59.0 351 4.21 4.27 2.66
: : : : : : : : : : : :
53936 53936 0.72 Good D SI1 63.1 55.0 2757 5.69 5.75 3.61
53937 53937 0.7 Very Good D SI1 62.8 60.0 2757 5.66 5.68 3.56
53938 53938 0.86 Premium H SI2 61.0 58.0 2757 6.15 6.12 3.74
53939 53939 0.75 Ideal D SI2 62.2 55.0 2757 5.83 5.87 3.64
diamonds.tdr
# =>
RedAmber::DataFrame : 53940 x 11 Vectors
Vectors : 8 numeric, 3 strings
# key type level data_preview
0 :index uint16 53940 [0, 1, 2, 3, 4, ... ]
1 :carat double 273 [0.23, 0.21, 0.23, 0.29, 0.31, ... ]
2 :cut string 5 {"Ideal"=>21551, "Premium"=>13791, "Good"=>4906, "Very Good"=>12082, "Fair"=>1610}
3 :color string 7 ["E", "E", "E", "I", "J", ... ]
4 :clarity string 8 ["SI2", "SI1", "VS1", "VS2", "SI2", ... ]
5 :depth double 184 [61.5, 59.8, 56.9, 62.4, 63.3, ... ]
6 :table double 127 [55.0, 61.0, 65.0, 58.0, 58.0, ... ]
7 :price uint16 11602 [326, 326, 327, 334, 335, ... ]
8 :x double 554 [3.95, 3.89, 4.05, 4.2, 4.34, ... ]
9 :y double 552 [3.98, 3.84, 4.07, 4.23, 4.35, ... ]
... 1 more Vector ...
Show all variables
Show all variables
diamonds.tdr(:all)
# =>
RedAmber::DataFrame : 53940 x 11 Vectors
Vectors : 8 numeric, 3 strings
# key type level data_preview
0 :index uint16 53940 [0, 1, 2, 3, 4, ... ]
1 :carat double 273 [0.23, 0.21, 0.23, 0.29, 0.31, ... ]
2 :cut string 5 {"Ideal"=>21551, "Premium"=>13791, "Good"=>4906, "Very Good"=>12082, "Fair"=>1610}
3 :color string 7 ["E", "E", "E", "I", "J", ... ]
4 :clarity string 8 ["SI2", "SI1", "VS1", "VS2", "SI2", ... ]
5 :depth double 184 [61.5, 59.8, 56.9, 62.4, 63.3, ... ]
6 :table double 127 [55.0, 61.0, 65.0, 58.0, 58.0, ... ]
7 :price uint16 11602 [326, 326, 327, 334, 335, ... ]
8 :x double 554 [3.95, 3.89, 4.05, 4.2, 4.34, ... ]
9 :y double 552 [3.98, 3.84, 4.07, 4.23, 4.35, ... ]
10 :z double 375 [2.43, 2.31, 2.31, 2.63, 2.75, ... ]
Use tally mode up to 8 levels
Use tally mode up to 8 levels
diamonds.tdr(tally: 8)
# =>
RedAmber::DataFrame : 53940 x 11 Vectors
Vectors : 8 numeric, 3 strings
# key type level data_preview
0 :index uint16 53940 [0, 1, 2, 3, 4, ... ]
1 :carat double 273 [0.23, 0.21, 0.23, 0.29, 0.31, ... ]
2 :cut string 5 {"Ideal"=>21551, "Premium"=>13791, "Good"=>4906, "Very Good"=>12082, "Fair"=>1610}
3 :color string 7 {"E"=>9797, "I"=>5422, "J"=>2808, "H"=>8304, "F"=>9542, "G"=>11292, "D"=>6775}
4 :clarity string 8 {"SI2"=>9194, "SI1"=>13065, "VS1"=>8171, "VS2"=>12258, "VVS2"=>5066, "VVS1"=>3655, "I1"=>741, "IF"=>1790}
5 :depth double 184 [61.5, 59.8, 56.9, 62.4, 63.3, ... ]
6 :table double 127 [55.0, 61.0, 65.0, 58.0, 58.0, ... ]
7 :price uint16 11602 [326, 326, 327, 334, 335, ... ]
8 :x double 554 [3.95, 3.89, 4.05, 4.2, 4.34, ... ]
9 :y double 552 [3.98, 3.84, 4.07, 4.23, 4.35, ... ]
... 1 more Vector ...
Increase elements to show
Increase elements to show
diamonds.tdr(elements: 10)
# =>
RedAmber::DataFrame : 53940 x 11 Vectors
Vectors : 8 numeric, 3 strings
# key type level data_preview
0 :index uint16 53940 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ... ]
1 :carat double 273 [0.23, 0.21, 0.23, 0.29, 0.31, 0.24, 0.24, 0.26, 0.22, 0.23, ... ]
2 :cut string 5 {"Ideal"=>21551, "Premium"=>13791, "Good"=>4906, "Very Good"=>12082, "Fair"=>1610}
3 :color string 7 ["E", "E", "E", "I", "J", "J", "I", "H", "E", "H", ... ]
4 :clarity string 8 ["SI2", "SI1", "VS1", "VS2", "SI2", "VVS2", "VVS1", "SI1", "VS2", "VS1", ... ]
5 :depth double 184 [61.5, 59.8, 56.9, 62.4, 63.3, 62.8, 62.3, 61.9, 65.1, 59.4, ... ]
6 :table double 127 [55.0, 61.0, 65.0, 58.0, 58.0, 57.0, 57.0, 55.0, 61.0, 61.0, ... ]
7 :price uint16 11602 [326, 326, 327, 334, 335, 336, 336, 337, 337, 338, ... ]
8 :x double 554 [3.95, 3.89, 4.05, 4.2, 4.34, 3.94, 3.95, 4.07, 3.87, 4.0, ... ]
9 :y double 552 [3.98, 3.84, 4.07, 4.23, 4.35, 3.96, 3.98, 4.11, 3.78, 4.05, ... ]
... 1 more Vector ...
Parameters:
-
limit
(Integer, :all)
(defaults to: 10)
—
maximum number of variables (columns) to show. Shows all valiables (columns) if it is
:all. -
tally
(Integer)
(defaults to: 5)
—
maximum level to use tally mode. Tally mode counts the occurrences of each element and shows as a hash with the elements as keys and the corresponding counts as values.
-
elements
(Integer)
(defaults to: 5)
—
maximum number of elements to show values in each column.
Returns:
- (nil)
267 268 269 |
# File 'lib/red_amber/data_frame_displayable.rb', line 267 def tdr(limit = 10, tally: 5, elements: 5) puts tdr_str(limit, tally: tally, elements: elements) end |