diff --git a/css/api_block/index.css b/css/api_block/index.css index 4c9e7b5c..4360fab4 100644 --- a/css/api_block/index.css +++ b/css/api_block/index.css @@ -19,6 +19,7 @@ height: calc(100% - 100px); } .vp-apiblock-tab-container { + min-width: 265px; } .vp-apiblock-tab-header { height: 40px; diff --git a/css/common/bind.css b/css/common/bind.css new file mode 100644 index 00000000..840759e8 --- /dev/null +++ b/css/common/bind.css @@ -0,0 +1,33 @@ +.vp-bd-container { + width: 700px; + height: 550px; +} + +.vp-bd-container .vp-pp-body { + overflow: hidden; +} + +.vp-bd-grid-box { + display: grid; + grid-template-rows: 30px; + grid-row-gap: 5px; +} +.vp-bd-grid-box label { + font-weight: bold; +} +.vp-bd-grid-box select, +.vp-bd-grid-box input { + width: 160px; +} + +.vp-bd-type-box { + display: grid; + grid-template-rows: 30px; + grid-row-gap: 5px; +} + +.vp-bd-df-refresh { + display: inline-block; + cursor: pointer; + margin-left: 5px; +} diff --git a/css/common/component/columnSelector.css b/css/common/component/multiSelector.css similarity index 100% rename from css/common/component/columnSelector.css rename to css/common/component/multiSelector.css diff --git a/css/common/merge.css b/css/common/merge.css deleted file mode 100644 index 80a0651d..00000000 --- a/css/common/merge.css +++ /dev/null @@ -1,4 +0,0 @@ -.vp-mg-container { - width: 700px; - height: 550px; -} \ No newline at end of file diff --git a/css/common/reshape.css b/css/common/reshape.css new file mode 100644 index 00000000..aea3af51 --- /dev/null +++ b/css/common/reshape.css @@ -0,0 +1,42 @@ +.vp-rs-container { + width: 700px; + height: 550px; +} + +.vp-rs-container .vp-pp-body { + overflow: hidden; +} + +.vp-rs-df-box { + display: grid; + grid-template-rows: 30px; + grid-row-gap: 5px; +} + +.vp-rs-df-refresh { + display: inline-block; + cursor: pointer; + margin-left: 5px; +} +.vp-rs-df-box label { + font-weight: bold; +} +.vp-rs-df-box select, +.vp-rs-df-box input { + width: 160px; +} + +.vp-rs-type-box { + display: grid; + grid-template-rows: 30px; + grid-row-gap: 5px; +} +.vp-rs-type-title { + /* background: var(--light-gray-color); */ + border: 1px solid var(--border-gray-color); + height: 30px; + line-height: 30px; + vertical-align: middle; + padding: 0px 10px; + font-weight: bold; +} \ No newline at end of file diff --git a/css/component/common.css b/css/component/common.css index 7bbecfb6..47eb8723 100644 --- a/css/component/common.css +++ b/css/component/common.css @@ -46,7 +46,9 @@ background: #EF6B10; } .vp-button.disabled, -.vp-button.disabled:hover { +.vp-button.disabled:hover, +.vp-button:disabled, +.vp-button:disabled:hover { background: #E5E5E5; border: 0px; border: 0.25px solid #E4E4E4; @@ -64,6 +66,20 @@ border-right: 1px solid var(--font-primary); } +/* Scrollbar */ +.vp-scrollbar { + overflow-y: auto; + --webkit-mask-position: left top; +} +.vp-scrollbar::-webkit-scrollbar { + width: 5px; + height: 5px; +} +.vp-scrollbar::-webkit-scrollbar-thumb { + border: 0.3px solid #C4C4C4; + background: #C4C4C4; +} + /* Width selector */ .wp50 { width: 50px; @@ -78,6 +94,13 @@ width: 120px; } +.w40 { + width: 40%; +} +.w100 { + width: 100%; +} + /* font selector */ .fb { font-weight: bold; diff --git a/css/matplotlib/plot.css b/css/matplotlib/plot.css index 176937f4..45075bf3 100644 --- a/css/matplotlib/plot.css +++ b/css/matplotlib/plot.css @@ -3,6 +3,34 @@ --bgcolor: #696969; } +/* Import Options box*/ +.vp-import-box { + display: grid; + grid-template-rows: 30px; + grid-row-gap: 5px; + border: 1px solid var(--border-gray-color); + padding: 10px 0px; +} +.vp-import-box label { + min-width: 130px; + max-width: 300px; + vertical-align: middle; + text-align: left; + font-weight: bold; + height: 30px; + padding: 2px 5px 2px 16px; +} +.vp-import-box input[type="text"] { + width: 160px; +} +.vp-import-box input[type="number"] { + width: 79px; +} +.vp-pl-import-run { + float: right; + margin-right: 10px; +} + .vp-icon-btn.vp-close-view { position: absolute; right: 10px; @@ -268,18 +296,19 @@ .vp-method-select { border: 0.25px solid #C4C4C4; overflow-y: auto; - width: 125px; + width: 250px; height: 100px; } .vp-column-select-item, .vp-method-select-item { - padding-left: 3px; cursor: pointer; + padding: 3px; + border-bottom: 0.25px solid var(--border-gray-color); } .vp-column-select-item.selected, .vp-method-select-item.selected { color: var(--font-hightlight); - background: #C4C4C4; + background: var(--light-gray-color); } /* Select Data Button */ diff --git a/data/sample_csv/Titanic_test.csv b/data/sample_csv/Titanic_test.csv deleted file mode 100644 index 2ed7ef49..00000000 --- a/data/sample_csv/Titanic_test.csv +++ /dev/null @@ -1,419 +0,0 @@ -PassengerId,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked -892,3,"Kelly, Mr. James",male,34.5,0,0,330911,7.8292,,Q -893,3,"Wilkes, Mrs. James (Ellen Needs)",female,47,1,0,363272,7,,S -894,2,"Myles, Mr. Thomas Francis",male,62,0,0,240276,9.6875,,Q -895,3,"Wirz, Mr. Albert",male,27,0,0,315154,8.6625,,S -896,3,"Hirvonen, Mrs. Alexander (Helga E Lindqvist)",female,22,1,1,3101298,12.2875,,S -897,3,"Svensson, Mr. Johan Cervin",male,14,0,0,7538,9.225,,S -898,3,"Connolly, Miss. Kate",female,30,0,0,330972,7.6292,,Q -899,2,"Caldwell, Mr. Albert Francis",male,26,1,1,248738,29,,S -900,3,"Abrahim, Mrs. Joseph (Sophie Halaut Easu)",female,18,0,0,2657,7.2292,,C -901,3,"Davies, Mr. John Samuel",male,21,2,0,A/4 48871,24.15,,S -902,3,"Ilieff, Mr. Ylio",male,,0,0,349220,7.8958,,S -903,1,"Jones, Mr. Charles Cresson",male,46,0,0,694,26,,S -904,1,"Snyder, Mrs. John Pillsbury (Nelle Stevenson)",female,23,1,0,21228,82.2667,B45,S -905,2,"Howard, Mr. Benjamin",male,63,1,0,24065,26,,S -906,1,"Chaffee, Mrs. Herbert Fuller (Carrie Constance Toogood)",female,47,1,0,W.E.P. 5734,61.175,E31,S -907,2,"del Carlo, Mrs. Sebastiano (Argenia Genovesi)",female,24,1,0,SC/PARIS 2167,27.7208,,C -908,2,"Keane, Mr. Daniel",male,35,0,0,233734,12.35,,Q -909,3,"Assaf, Mr. Gerios",male,21,0,0,2692,7.225,,C -910,3,"Ilmakangas, Miss. Ida Livija",female,27,1,0,STON/O2. 3101270,7.925,,S -911,3,"Assaf Khalil, Mrs. Mariana (Miriam"")""",female,45,0,0,2696,7.225,,C -912,1,"Rothschild, Mr. Martin",male,55,1,0,PC 17603,59.4,,C -913,3,"Olsen, Master. Artur Karl",male,9,0,1,C 17368,3.1708,,S -914,1,"Flegenheim, Mrs. Alfred (Antoinette)",female,,0,0,PC 17598,31.6833,,S -915,1,"Williams, Mr. Richard Norris II",male,21,0,1,PC 17597,61.3792,,C -916,1,"Ryerson, Mrs. Arthur Larned (Emily Maria Borie)",female,48,1,3,PC 17608,262.375,B57 B59 B63 B66,C -917,3,"Robins, Mr. Alexander A",male,50,1,0,A/5. 3337,14.5,,S -918,1,"Ostby, Miss. Helene Ragnhild",female,22,0,1,113509,61.9792,B36,C -919,3,"Daher, Mr. Shedid",male,22.5,0,0,2698,7.225,,C -920,1,"Brady, Mr. John Bertram",male,41,0,0,113054,30.5,A21,S -921,3,"Samaan, Mr. Elias",male,,2,0,2662,21.6792,,C -922,2,"Louch, Mr. Charles Alexander",male,50,1,0,SC/AH 3085,26,,S -923,2,"Jefferys, Mr. Clifford Thomas",male,24,2,0,C.A. 31029,31.5,,S -924,3,"Dean, Mrs. Bertram (Eva Georgetta Light)",female,33,1,2,C.A. 2315,20.575,,S -925,3,"Johnston, Mrs. Andrew G (Elizabeth Lily"" Watson)""",female,,1,2,W./C. 6607,23.45,,S -926,1,"Mock, Mr. Philipp Edmund",male,30,1,0,13236,57.75,C78,C -927,3,"Katavelas, Mr. Vassilios (Catavelas Vassilios"")""",male,18.5,0,0,2682,7.2292,,C -928,3,"Roth, Miss. Sarah A",female,,0,0,342712,8.05,,S -929,3,"Cacic, Miss. Manda",female,21,0,0,315087,8.6625,,S -930,3,"Sap, Mr. Julius",male,25,0,0,345768,9.5,,S -931,3,"Hee, Mr. Ling",male,,0,0,1601,56.4958,,S -932,3,"Karun, Mr. Franz",male,39,0,1,349256,13.4167,,C -933,1,"Franklin, Mr. Thomas Parham",male,,0,0,113778,26.55,D34,S -934,3,"Goldsmith, Mr. Nathan",male,41,0,0,SOTON/O.Q. 3101263,7.85,,S -935,2,"Corbett, Mrs. Walter H (Irene Colvin)",female,30,0,0,237249,13,,S -936,1,"Kimball, Mrs. Edwin Nelson Jr (Gertrude Parsons)",female,45,1,0,11753,52.5542,D19,S -937,3,"Peltomaki, Mr. Nikolai Johannes",male,25,0,0,STON/O 2. 3101291,7.925,,S -938,1,"Chevre, Mr. Paul Romaine",male,45,0,0,PC 17594,29.7,A9,C -939,3,"Shaughnessy, Mr. Patrick",male,,0,0,370374,7.75,,Q -940,1,"Bucknell, Mrs. William Robert (Emma Eliza Ward)",female,60,0,0,11813,76.2917,D15,C -941,3,"Coutts, Mrs. William (Winnie Minnie"" Treanor)""",female,36,0,2,C.A. 37671,15.9,,S -942,1,"Smith, Mr. Lucien Philip",male,24,1,0,13695,60,C31,S -943,2,"Pulbaum, Mr. Franz",male,27,0,0,SC/PARIS 2168,15.0333,,C -944,2,"Hocking, Miss. Ellen Nellie""""",female,20,2,1,29105,23,,S -945,1,"Fortune, Miss. Ethel Flora",female,28,3,2,19950,263,C23 C25 C27,S -946,2,"Mangiavacchi, Mr. Serafino Emilio",male,,0,0,SC/A.3 2861,15.5792,,C -947,3,"Rice, Master. Albert",male,10,4,1,382652,29.125,,Q -948,3,"Cor, Mr. Bartol",male,35,0,0,349230,7.8958,,S -949,3,"Abelseth, Mr. Olaus Jorgensen",male,25,0,0,348122,7.65,F G63,S -950,3,"Davison, Mr. Thomas Henry",male,,1,0,386525,16.1,,S -951,1,"Chaudanson, Miss. Victorine",female,36,0,0,PC 17608,262.375,B61,C -952,3,"Dika, Mr. Mirko",male,17,0,0,349232,7.8958,,S -953,2,"McCrae, Mr. Arthur Gordon",male,32,0,0,237216,13.5,,S -954,3,"Bjorklund, Mr. Ernst Herbert",male,18,0,0,347090,7.75,,S -955,3,"Bradley, Miss. Bridget Delia",female,22,0,0,334914,7.725,,Q -956,1,"Ryerson, Master. John Borie",male,13,2,2,PC 17608,262.375,B57 B59 B63 B66,C -957,2,"Corey, Mrs. Percy C (Mary Phyllis Elizabeth Miller)",female,,0,0,F.C.C. 13534,21,,S -958,3,"Burns, Miss. Mary Delia",female,18,0,0,330963,7.8792,,Q -959,1,"Moore, Mr. Clarence Bloomfield",male,47,0,0,113796,42.4,,S -960,1,"Tucker, Mr. Gilbert Milligan Jr",male,31,0,0,2543,28.5375,C53,C -961,1,"Fortune, Mrs. Mark (Mary McDougald)",female,60,1,4,19950,263,C23 C25 C27,S -962,3,"Mulvihill, Miss. Bertha E",female,24,0,0,382653,7.75,,Q -963,3,"Minkoff, Mr. Lazar",male,21,0,0,349211,7.8958,,S -964,3,"Nieminen, Miss. Manta Josefina",female,29,0,0,3101297,7.925,,S -965,1,"Ovies y Rodriguez, Mr. Servando",male,28.5,0,0,PC 17562,27.7208,D43,C -966,1,"Geiger, Miss. Amalie",female,35,0,0,113503,211.5,C130,C -967,1,"Keeping, Mr. Edwin",male,32.5,0,0,113503,211.5,C132,C -968,3,"Miles, Mr. Frank",male,,0,0,359306,8.05,,S -969,1,"Cornell, Mrs. Robert Clifford (Malvina Helen Lamson)",female,55,2,0,11770,25.7,C101,S -970,2,"Aldworth, Mr. Charles Augustus",male,30,0,0,248744,13,,S -971,3,"Doyle, Miss. Elizabeth",female,24,0,0,368702,7.75,,Q -972,3,"Boulos, Master. Akar",male,6,1,1,2678,15.2458,,C -973,1,"Straus, Mr. Isidor",male,67,1,0,PC 17483,221.7792,C55 C57,S -974,1,"Case, Mr. Howard Brown",male,49,0,0,19924,26,,S -975,3,"Demetri, Mr. Marinko",male,,0,0,349238,7.8958,,S -976,2,"Lamb, Mr. John Joseph",male,,0,0,240261,10.7083,,Q -977,3,"Khalil, Mr. Betros",male,,1,0,2660,14.4542,,C -978,3,"Barry, Miss. Julia",female,27,0,0,330844,7.8792,,Q -979,3,"Badman, Miss. Emily Louisa",female,18,0,0,A/4 31416,8.05,,S -980,3,"O'Donoghue, Ms. Bridget",female,,0,0,364856,7.75,,Q -981,2,"Wells, Master. Ralph Lester",male,2,1,1,29103,23,,S -982,3,"Dyker, Mrs. Adolf Fredrik (Anna Elisabeth Judith Andersson)",female,22,1,0,347072,13.9,,S -983,3,"Pedersen, Mr. Olaf",male,,0,0,345498,7.775,,S -984,1,"Davidson, Mrs. Thornton (Orian Hays)",female,27,1,2,F.C. 12750,52,B71,S -985,3,"Guest, Mr. Robert",male,,0,0,376563,8.05,,S -986,1,"Birnbaum, Mr. Jakob",male,25,0,0,13905,26,,C -987,3,"Tenglin, Mr. Gunnar Isidor",male,25,0,0,350033,7.7958,,S -988,1,"Cavendish, Mrs. Tyrell William (Julia Florence Siegel)",female,76,1,0,19877,78.85,C46,S -989,3,"Makinen, Mr. Kalle Edvard",male,29,0,0,STON/O 2. 3101268,7.925,,S -990,3,"Braf, Miss. Elin Ester Maria",female,20,0,0,347471,7.8542,,S -991,3,"Nancarrow, Mr. William Henry",male,33,0,0,A./5. 3338,8.05,,S -992,1,"Stengel, Mrs. Charles Emil Henry (Annie May Morris)",female,43,1,0,11778,55.4417,C116,C -993,2,"Weisz, Mr. Leopold",male,27,1,0,228414,26,,S -994,3,"Foley, Mr. William",male,,0,0,365235,7.75,,Q -995,3,"Johansson Palmquist, Mr. Oskar Leander",male,26,0,0,347070,7.775,,S -996,3,"Thomas, Mrs. Alexander (Thamine Thelma"")""",female,16,1,1,2625,8.5167,,C -997,3,"Holthen, Mr. Johan Martin",male,28,0,0,C 4001,22.525,,S -998,3,"Buckley, Mr. Daniel",male,21,0,0,330920,7.8208,,Q -999,3,"Ryan, Mr. Edward",male,,0,0,383162,7.75,,Q -1000,3,"Willer, Mr. Aaron (Abi Weller"")""",male,,0,0,3410,8.7125,,S -1001,2,"Swane, Mr. George",male,18.5,0,0,248734,13,F,S -1002,2,"Stanton, Mr. Samuel Ward",male,41,0,0,237734,15.0458,,C -1003,3,"Shine, Miss. Ellen Natalia",female,,0,0,330968,7.7792,,Q -1004,1,"Evans, Miss. Edith Corse",female,36,0,0,PC 17531,31.6792,A29,C -1005,3,"Buckley, Miss. Katherine",female,18.5,0,0,329944,7.2833,,Q -1006,1,"Straus, Mrs. Isidor (Rosalie Ida Blun)",female,63,1,0,PC 17483,221.7792,C55 C57,S -1007,3,"Chronopoulos, Mr. Demetrios",male,18,1,0,2680,14.4542,,C -1008,3,"Thomas, Mr. John",male,,0,0,2681,6.4375,,C -1009,3,"Sandstrom, Miss. Beatrice Irene",female,1,1,1,PP 9549,16.7,G6,S -1010,1,"Beattie, Mr. Thomson",male,36,0,0,13050,75.2417,C6,C -1011,2,"Chapman, Mrs. John Henry (Sara Elizabeth Lawry)",female,29,1,0,SC/AH 29037,26,,S -1012,2,"Watt, Miss. Bertha J",female,12,0,0,C.A. 33595,15.75,,S -1013,3,"Kiernan, Mr. John",male,,1,0,367227,7.75,,Q -1014,1,"Schabert, Mrs. Paul (Emma Mock)",female,35,1,0,13236,57.75,C28,C -1015,3,"Carver, Mr. Alfred John",male,28,0,0,392095,7.25,,S -1016,3,"Kennedy, Mr. John",male,,0,0,368783,7.75,,Q -1017,3,"Cribb, Miss. Laura Alice",female,17,0,1,371362,16.1,,S -1018,3,"Brobeck, Mr. Karl Rudolf",male,22,0,0,350045,7.7958,,S -1019,3,"McCoy, Miss. Alicia",female,,2,0,367226,23.25,,Q -1020,2,"Bowenur, Mr. Solomon",male,42,0,0,211535,13,,S -1021,3,"Petersen, Mr. Marius",male,24,0,0,342441,8.05,,S -1022,3,"Spinner, Mr. Henry John",male,32,0,0,STON/OQ. 369943,8.05,,S -1023,1,"Gracie, Col. Archibald IV",male,53,0,0,113780,28.5,C51,C -1024,3,"Lefebre, Mrs. Frank (Frances)",female,,0,4,4133,25.4667,,S -1025,3,"Thomas, Mr. Charles P",male,,1,0,2621,6.4375,,C -1026,3,"Dintcheff, Mr. Valtcho",male,43,0,0,349226,7.8958,,S -1027,3,"Carlsson, Mr. Carl Robert",male,24,0,0,350409,7.8542,,S -1028,3,"Zakarian, Mr. Mapriededer",male,26.5,0,0,2656,7.225,,C -1029,2,"Schmidt, Mr. August",male,26,0,0,248659,13,,S -1030,3,"Drapkin, Miss. Jennie",female,23,0,0,SOTON/OQ 392083,8.05,,S -1031,3,"Goodwin, Mr. Charles Frederick",male,40,1,6,CA 2144,46.9,,S -1032,3,"Goodwin, Miss. Jessie Allis",female,10,5,2,CA 2144,46.9,,S -1033,1,"Daniels, Miss. Sarah",female,33,0,0,113781,151.55,,S -1034,1,"Ryerson, Mr. Arthur Larned",male,61,1,3,PC 17608,262.375,B57 B59 B63 B66,C -1035,2,"Beauchamp, Mr. Henry James",male,28,0,0,244358,26,,S -1036,1,"Lindeberg-Lind, Mr. Erik Gustaf (Mr Edward Lingrey"")""",male,42,0,0,17475,26.55,,S -1037,3,"Vander Planke, Mr. Julius",male,31,3,0,345763,18,,S -1038,1,"Hilliard, Mr. Herbert Henry",male,,0,0,17463,51.8625,E46,S -1039,3,"Davies, Mr. Evan",male,22,0,0,SC/A4 23568,8.05,,S -1040,1,"Crafton, Mr. John Bertram",male,,0,0,113791,26.55,,S -1041,2,"Lahtinen, Rev. William",male,30,1,1,250651,26,,S -1042,1,"Earnshaw, Mrs. Boulton (Olive Potter)",female,23,0,1,11767,83.1583,C54,C -1043,3,"Matinoff, Mr. Nicola",male,,0,0,349255,7.8958,,C -1044,3,"Storey, Mr. Thomas",male,60.5,0,0,3701,,,S -1045,3,"Klasen, Mrs. (Hulda Kristina Eugenia Lofqvist)",female,36,0,2,350405,12.1833,,S -1046,3,"Asplund, Master. Filip Oscar",male,13,4,2,347077,31.3875,,S -1047,3,"Duquemin, Mr. Joseph",male,24,0,0,S.O./P.P. 752,7.55,,S -1048,1,"Bird, Miss. Ellen",female,29,0,0,PC 17483,221.7792,C97,S -1049,3,"Lundin, Miss. Olga Elida",female,23,0,0,347469,7.8542,,S -1050,1,"Borebank, Mr. John James",male,42,0,0,110489,26.55,D22,S -1051,3,"Peacock, Mrs. Benjamin (Edith Nile)",female,26,0,2,SOTON/O.Q. 3101315,13.775,,S -1052,3,"Smyth, Miss. Julia",female,,0,0,335432,7.7333,,Q -1053,3,"Touma, Master. Georges Youssef",male,7,1,1,2650,15.2458,,C -1054,2,"Wright, Miss. Marion",female,26,0,0,220844,13.5,,S -1055,3,"Pearce, Mr. Ernest",male,,0,0,343271,7,,S -1056,2,"Peruschitz, Rev. Joseph Maria",male,41,0,0,237393,13,,S -1057,3,"Kink-Heilmann, Mrs. Anton (Luise Heilmann)",female,26,1,1,315153,22.025,,S -1058,1,"Brandeis, Mr. Emil",male,48,0,0,PC 17591,50.4958,B10,C -1059,3,"Ford, Mr. Edward Watson",male,18,2,2,W./C. 6608,34.375,,S -1060,1,"Cassebeer, Mrs. Henry Arthur Jr (Eleanor Genevieve Fosdick)",female,,0,0,17770,27.7208,,C -1061,3,"Hellstrom, Miss. Hilda Maria",female,22,0,0,7548,8.9625,,S -1062,3,"Lithman, Mr. Simon",male,,0,0,S.O./P.P. 251,7.55,,S -1063,3,"Zakarian, Mr. Ortin",male,27,0,0,2670,7.225,,C -1064,3,"Dyker, Mr. Adolf Fredrik",male,23,1,0,347072,13.9,,S -1065,3,"Torfa, Mr. Assad",male,,0,0,2673,7.2292,,C -1066,3,"Asplund, Mr. Carl Oscar Vilhelm Gustafsson",male,40,1,5,347077,31.3875,,S -1067,2,"Brown, Miss. Edith Eileen",female,15,0,2,29750,39,,S -1068,2,"Sincock, Miss. Maude",female,20,0,0,C.A. 33112,36.75,,S -1069,1,"Stengel, Mr. Charles Emil Henry",male,54,1,0,11778,55.4417,C116,C -1070,2,"Becker, Mrs. Allen Oliver (Nellie E Baumgardner)",female,36,0,3,230136,39,F4,S -1071,1,"Compton, Mrs. Alexander Taylor (Mary Eliza Ingersoll)",female,64,0,2,PC 17756,83.1583,E45,C -1072,2,"McCrie, Mr. James Matthew",male,30,0,0,233478,13,,S -1073,1,"Compton, Mr. Alexander Taylor Jr",male,37,1,1,PC 17756,83.1583,E52,C -1074,1,"Marvin, Mrs. Daniel Warner (Mary Graham Carmichael Farquarson)",female,18,1,0,113773,53.1,D30,S -1075,3,"Lane, Mr. Patrick",male,,0,0,7935,7.75,,Q -1076,1,"Douglas, Mrs. Frederick Charles (Mary Helene Baxter)",female,27,1,1,PC 17558,247.5208,B58 B60,C -1077,2,"Maybery, Mr. Frank Hubert",male,40,0,0,239059,16,,S -1078,2,"Phillips, Miss. Alice Frances Louisa",female,21,0,1,S.O./P.P. 2,21,,S -1079,3,"Davies, Mr. Joseph",male,17,2,0,A/4 48873,8.05,,S -1080,3,"Sage, Miss. Ada",female,,8,2,CA. 2343,69.55,,S -1081,2,"Veal, Mr. James",male,40,0,0,28221,13,,S -1082,2,"Angle, Mr. William A",male,34,1,0,226875,26,,S -1083,1,"Salomon, Mr. Abraham L",male,,0,0,111163,26,,S -1084,3,"van Billiard, Master. Walter John",male,11.5,1,1,A/5. 851,14.5,,S -1085,2,"Lingane, Mr. John",male,61,0,0,235509,12.35,,Q -1086,2,"Drew, Master. Marshall Brines",male,8,0,2,28220,32.5,,S -1087,3,"Karlsson, Mr. Julius Konrad Eugen",male,33,0,0,347465,7.8542,,S -1088,1,"Spedden, Master. Robert Douglas",male,6,0,2,16966,134.5,E34,C -1089,3,"Nilsson, Miss. Berta Olivia",female,18,0,0,347066,7.775,,S -1090,2,"Baimbrigge, Mr. Charles Robert",male,23,0,0,C.A. 31030,10.5,,S -1091,3,"Rasmussen, Mrs. (Lena Jacobsen Solvang)",female,,0,0,65305,8.1125,,S -1092,3,"Murphy, Miss. Nora",female,,0,0,36568,15.5,,Q -1093,3,"Danbom, Master. Gilbert Sigvard Emanuel",male,0.33,0,2,347080,14.4,,S -1094,1,"Astor, Col. John Jacob",male,47,1,0,PC 17757,227.525,C62 C64,C -1095,2,"Quick, Miss. Winifred Vera",female,8,1,1,26360,26,,S -1096,2,"Andrew, Mr. Frank Thomas",male,25,0,0,C.A. 34050,10.5,,S -1097,1,"Omont, Mr. Alfred Fernand",male,,0,0,F.C. 12998,25.7417,,C -1098,3,"McGowan, Miss. Katherine",female,35,0,0,9232,7.75,,Q -1099,2,"Collett, Mr. Sidney C Stuart",male,24,0,0,28034,10.5,,S -1100,1,"Rosenbaum, Miss. Edith Louise",female,33,0,0,PC 17613,27.7208,A11,C -1101,3,"Delalic, Mr. Redjo",male,25,0,0,349250,7.8958,,S -1102,3,"Andersen, Mr. Albert Karvin",male,32,0,0,C 4001,22.525,,S -1103,3,"Finoli, Mr. Luigi",male,,0,0,SOTON/O.Q. 3101308,7.05,,S -1104,2,"Deacon, Mr. Percy William",male,17,0,0,S.O.C. 14879,73.5,,S -1105,2,"Howard, Mrs. Benjamin (Ellen Truelove Arman)",female,60,1,0,24065,26,,S -1106,3,"Andersson, Miss. Ida Augusta Margareta",female,38,4,2,347091,7.775,,S -1107,1,"Head, Mr. Christopher",male,42,0,0,113038,42.5,B11,S -1108,3,"Mahon, Miss. Bridget Delia",female,,0,0,330924,7.8792,,Q -1109,1,"Wick, Mr. George Dennick",male,57,1,1,36928,164.8667,,S -1110,1,"Widener, Mrs. George Dunton (Eleanor Elkins)",female,50,1,1,113503,211.5,C80,C -1111,3,"Thomson, Mr. Alexander Morrison",male,,0,0,32302,8.05,,S -1112,2,"Duran y More, Miss. Florentina",female,30,1,0,SC/PARIS 2148,13.8583,,C -1113,3,"Reynolds, Mr. Harold J",male,21,0,0,342684,8.05,,S -1114,2,"Cook, Mrs. (Selena Rogers)",female,22,0,0,W./C. 14266,10.5,F33,S -1115,3,"Karlsson, Mr. Einar Gervasius",male,21,0,0,350053,7.7958,,S -1116,1,"Candee, Mrs. Edward (Helen Churchill Hungerford)",female,53,0,0,PC 17606,27.4458,,C -1117,3,"Moubarek, Mrs. George (Omine Amenia"" Alexander)""",female,,0,2,2661,15.2458,,C -1118,3,"Asplund, Mr. Johan Charles",male,23,0,0,350054,7.7958,,S -1119,3,"McNeill, Miss. Bridget",female,,0,0,370368,7.75,,Q -1120,3,"Everett, Mr. Thomas James",male,40.5,0,0,C.A. 6212,15.1,,S -1121,2,"Hocking, Mr. Samuel James Metcalfe",male,36,0,0,242963,13,,S -1122,2,"Sweet, Mr. George Frederick",male,14,0,0,220845,65,,S -1123,1,"Willard, Miss. Constance",female,21,0,0,113795,26.55,,S -1124,3,"Wiklund, Mr. Karl Johan",male,21,1,0,3101266,6.4958,,S -1125,3,"Linehan, Mr. Michael",male,,0,0,330971,7.8792,,Q -1126,1,"Cumings, Mr. John Bradley",male,39,1,0,PC 17599,71.2833,C85,C -1127,3,"Vendel, Mr. Olof Edvin",male,20,0,0,350416,7.8542,,S -1128,1,"Warren, Mr. Frank Manley",male,64,1,0,110813,75.25,D37,C -1129,3,"Baccos, Mr. Raffull",male,20,0,0,2679,7.225,,C -1130,2,"Hiltunen, Miss. Marta",female,18,1,1,250650,13,,S -1131,1,"Douglas, Mrs. Walter Donald (Mahala Dutton)",female,48,1,0,PC 17761,106.425,C86,C -1132,1,"Lindstrom, Mrs. Carl Johan (Sigrid Posse)",female,55,0,0,112377,27.7208,,C -1133,2,"Christy, Mrs. (Alice Frances)",female,45,0,2,237789,30,,S -1134,1,"Spedden, Mr. Frederic Oakley",male,45,1,1,16966,134.5,E34,C -1135,3,"Hyman, Mr. Abraham",male,,0,0,3470,7.8875,,S -1136,3,"Johnston, Master. William Arthur Willie""""",male,,1,2,W./C. 6607,23.45,,S -1137,1,"Kenyon, Mr. Frederick R",male,41,1,0,17464,51.8625,D21,S -1138,2,"Karnes, Mrs. J Frank (Claire Bennett)",female,22,0,0,F.C.C. 13534,21,,S -1139,2,"Drew, Mr. James Vivian",male,42,1,1,28220,32.5,,S -1140,2,"Hold, Mrs. Stephen (Annie Margaret Hill)",female,29,1,0,26707,26,,S -1141,3,"Khalil, Mrs. Betros (Zahie Maria"" Elias)""",female,,1,0,2660,14.4542,,C -1142,2,"West, Miss. Barbara J",female,0.92,1,2,C.A. 34651,27.75,,S -1143,3,"Abrahamsson, Mr. Abraham August Johannes",male,20,0,0,SOTON/O2 3101284,7.925,,S -1144,1,"Clark, Mr. Walter Miller",male,27,1,0,13508,136.7792,C89,C -1145,3,"Salander, Mr. Karl Johan",male,24,0,0,7266,9.325,,S -1146,3,"Wenzel, Mr. Linhart",male,32.5,0,0,345775,9.5,,S -1147,3,"MacKay, Mr. George William",male,,0,0,C.A. 42795,7.55,,S -1148,3,"Mahon, Mr. John",male,,0,0,AQ/4 3130,7.75,,Q -1149,3,"Niklasson, Mr. Samuel",male,28,0,0,363611,8.05,,S -1150,2,"Bentham, Miss. Lilian W",female,19,0,0,28404,13,,S -1151,3,"Midtsjo, Mr. Karl Albert",male,21,0,0,345501,7.775,,S -1152,3,"de Messemaeker, Mr. Guillaume Joseph",male,36.5,1,0,345572,17.4,,S -1153,3,"Nilsson, Mr. August Ferdinand",male,21,0,0,350410,7.8542,,S -1154,2,"Wells, Mrs. Arthur Henry (Addie"" Dart Trevaskis)""",female,29,0,2,29103,23,,S -1155,3,"Klasen, Miss. Gertrud Emilia",female,1,1,1,350405,12.1833,,S -1156,2,"Portaluppi, Mr. Emilio Ilario Giuseppe",male,30,0,0,C.A. 34644,12.7375,,C -1157,3,"Lyntakoff, Mr. Stanko",male,,0,0,349235,7.8958,,S -1158,1,"Chisholm, Mr. Roderick Robert Crispin",male,,0,0,112051,0,,S -1159,3,"Warren, Mr. Charles William",male,,0,0,C.A. 49867,7.55,,S -1160,3,"Howard, Miss. May Elizabeth",female,,0,0,A. 2. 39186,8.05,,S -1161,3,"Pokrnic, Mr. Mate",male,17,0,0,315095,8.6625,,S -1162,1,"McCaffry, Mr. Thomas Francis",male,46,0,0,13050,75.2417,C6,C -1163,3,"Fox, Mr. Patrick",male,,0,0,368573,7.75,,Q -1164,1,"Clark, Mrs. Walter Miller (Virginia McDowell)",female,26,1,0,13508,136.7792,C89,C -1165,3,"Lennon, Miss. Mary",female,,1,0,370371,15.5,,Q -1166,3,"Saade, Mr. Jean Nassr",male,,0,0,2676,7.225,,C -1167,2,"Bryhl, Miss. Dagmar Jenny Ingeborg ",female,20,1,0,236853,26,,S -1168,2,"Parker, Mr. Clifford Richard",male,28,0,0,SC 14888,10.5,,S -1169,2,"Faunthorpe, Mr. Harry",male,40,1,0,2926,26,,S -1170,2,"Ware, Mr. John James",male,30,1,0,CA 31352,21,,S -1171,2,"Oxenham, Mr. Percy Thomas",male,22,0,0,W./C. 14260,10.5,,S -1172,3,"Oreskovic, Miss. Jelka",female,23,0,0,315085,8.6625,,S -1173,3,"Peacock, Master. Alfred Edward",male,0.75,1,1,SOTON/O.Q. 3101315,13.775,,S -1174,3,"Fleming, Miss. Honora",female,,0,0,364859,7.75,,Q -1175,3,"Touma, Miss. Maria Youssef",female,9,1,1,2650,15.2458,,C -1176,3,"Rosblom, Miss. Salli Helena",female,2,1,1,370129,20.2125,,S -1177,3,"Dennis, Mr. William",male,36,0,0,A/5 21175,7.25,,S -1178,3,"Franklin, Mr. Charles (Charles Fardon)",male,,0,0,SOTON/O.Q. 3101314,7.25,,S -1179,1,"Snyder, Mr. John Pillsbury",male,24,1,0,21228,82.2667,B45,S -1180,3,"Mardirosian, Mr. Sarkis",male,,0,0,2655,7.2292,F E46,C -1181,3,"Ford, Mr. Arthur",male,,0,0,A/5 1478,8.05,,S -1182,1,"Rheims, Mr. George Alexander Lucien",male,,0,0,PC 17607,39.6,,S -1183,3,"Daly, Miss. Margaret Marcella Maggie""""",female,30,0,0,382650,6.95,,Q -1184,3,"Nasr, Mr. Mustafa",male,,0,0,2652,7.2292,,C -1185,1,"Dodge, Dr. Washington",male,53,1,1,33638,81.8583,A34,S -1186,3,"Wittevrongel, Mr. Camille",male,36,0,0,345771,9.5,,S -1187,3,"Angheloff, Mr. Minko",male,26,0,0,349202,7.8958,,S -1188,2,"Laroche, Miss. Louise",female,1,1,2,SC/Paris 2123,41.5792,,C -1189,3,"Samaan, Mr. Hanna",male,,2,0,2662,21.6792,,C -1190,1,"Loring, Mr. Joseph Holland",male,30,0,0,113801,45.5,,S -1191,3,"Johansson, Mr. Nils",male,29,0,0,347467,7.8542,,S -1192,3,"Olsson, Mr. Oscar Wilhelm",male,32,0,0,347079,7.775,,S -1193,2,"Malachard, Mr. Noel",male,,0,0,237735,15.0458,D,C -1194,2,"Phillips, Mr. Escott Robert",male,43,0,1,S.O./P.P. 2,21,,S -1195,3,"Pokrnic, Mr. Tome",male,24,0,0,315092,8.6625,,S -1196,3,"McCarthy, Miss. Catherine Katie""""",female,,0,0,383123,7.75,,Q -1197,1,"Crosby, Mrs. Edward Gifford (Catherine Elizabeth Halstead)",female,64,1,1,112901,26.55,B26,S -1198,1,"Allison, Mr. Hudson Joshua Creighton",male,30,1,2,113781,151.55,C22 C26,S -1199,3,"Aks, Master. Philip Frank",male,0.83,0,1,392091,9.35,,S -1200,1,"Hays, Mr. Charles Melville",male,55,1,1,12749,93.5,B69,S -1201,3,"Hansen, Mrs. Claus Peter (Jennie L Howard)",female,45,1,0,350026,14.1083,,S -1202,3,"Cacic, Mr. Jego Grga",male,18,0,0,315091,8.6625,,S -1203,3,"Vartanian, Mr. David",male,22,0,0,2658,7.225,,C -1204,3,"Sadowitz, Mr. Harry",male,,0,0,LP 1588,7.575,,S -1205,3,"Carr, Miss. Jeannie",female,37,0,0,368364,7.75,,Q -1206,1,"White, Mrs. John Stuart (Ella Holmes)",female,55,0,0,PC 17760,135.6333,C32,C -1207,3,"Hagardon, Miss. Kate",female,17,0,0,AQ/3. 30631,7.7333,,Q -1208,1,"Spencer, Mr. William Augustus",male,57,1,0,PC 17569,146.5208,B78,C -1209,2,"Rogers, Mr. Reginald Harry",male,19,0,0,28004,10.5,,S -1210,3,"Jonsson, Mr. Nils Hilding",male,27,0,0,350408,7.8542,,S -1211,2,"Jefferys, Mr. Ernest Wilfred",male,22,2,0,C.A. 31029,31.5,,S -1212,3,"Andersson, Mr. Johan Samuel",male,26,0,0,347075,7.775,,S -1213,3,"Krekorian, Mr. Neshan",male,25,0,0,2654,7.2292,F E57,C -1214,2,"Nesson, Mr. Israel",male,26,0,0,244368,13,F2,S -1215,1,"Rowe, Mr. Alfred G",male,33,0,0,113790,26.55,,S -1216,1,"Kreuchen, Miss. Emilie",female,39,0,0,24160,211.3375,,S -1217,3,"Assam, Mr. Ali",male,23,0,0,SOTON/O.Q. 3101309,7.05,,S -1218,2,"Becker, Miss. Ruth Elizabeth",female,12,2,1,230136,39,F4,S -1219,1,"Rosenshine, Mr. George (Mr George Thorne"")""",male,46,0,0,PC 17585,79.2,,C -1220,2,"Clarke, Mr. Charles Valentine",male,29,1,0,2003,26,,S -1221,2,"Enander, Mr. Ingvar",male,21,0,0,236854,13,,S -1222,2,"Davies, Mrs. John Morgan (Elizabeth Agnes Mary White) ",female,48,0,2,C.A. 33112,36.75,,S -1223,1,"Dulles, Mr. William Crothers",male,39,0,0,PC 17580,29.7,A18,C -1224,3,"Thomas, Mr. Tannous",male,,0,0,2684,7.225,,C -1225,3,"Nakid, Mrs. Said (Waika Mary"" Mowad)""",female,19,1,1,2653,15.7417,,C -1226,3,"Cor, Mr. Ivan",male,27,0,0,349229,7.8958,,S -1227,1,"Maguire, Mr. John Edward",male,30,0,0,110469,26,C106,S -1228,2,"de Brito, Mr. Jose Joaquim",male,32,0,0,244360,13,,S -1229,3,"Elias, Mr. Joseph",male,39,0,2,2675,7.2292,,C -1230,2,"Denbury, Mr. Herbert",male,25,0,0,C.A. 31029,31.5,,S -1231,3,"Betros, Master. Seman",male,,0,0,2622,7.2292,,C -1232,2,"Fillbrook, Mr. Joseph Charles",male,18,0,0,C.A. 15185,10.5,,S -1233,3,"Lundstrom, Mr. Thure Edvin",male,32,0,0,350403,7.5792,,S -1234,3,"Sage, Mr. John George",male,,1,9,CA. 2343,69.55,,S -1235,1,"Cardeza, Mrs. James Warburton Martinez (Charlotte Wardle Drake)",female,58,0,1,PC 17755,512.3292,B51 B53 B55,C -1236,3,"van Billiard, Master. James William",male,,1,1,A/5. 851,14.5,,S -1237,3,"Abelseth, Miss. Karen Marie",female,16,0,0,348125,7.65,,S -1238,2,"Botsford, Mr. William Hull",male,26,0,0,237670,13,,S -1239,3,"Whabee, Mrs. George Joseph (Shawneene Abi-Saab)",female,38,0,0,2688,7.2292,,C -1240,2,"Giles, Mr. Ralph",male,24,0,0,248726,13.5,,S -1241,2,"Walcroft, Miss. Nellie",female,31,0,0,F.C.C. 13528,21,,S -1242,1,"Greenfield, Mrs. Leo David (Blanche Strouse)",female,45,0,1,PC 17759,63.3583,D10 D12,C -1243,2,"Stokes, Mr. Philip Joseph",male,25,0,0,F.C.C. 13540,10.5,,S -1244,2,"Dibden, Mr. William",male,18,0,0,S.O.C. 14879,73.5,,S -1245,2,"Herman, Mr. Samuel",male,49,1,2,220845,65,,S -1246,3,"Dean, Miss. Elizabeth Gladys Millvina""""",female,0.17,1,2,C.A. 2315,20.575,,S -1247,1,"Julian, Mr. Henry Forbes",male,50,0,0,113044,26,E60,S -1248,1,"Brown, Mrs. John Murray (Caroline Lane Lamson)",female,59,2,0,11769,51.4792,C101,S -1249,3,"Lockyer, Mr. Edward",male,,0,0,1222,7.8792,,S -1250,3,"O'Keefe, Mr. Patrick",male,,0,0,368402,7.75,,Q -1251,3,"Lindell, Mrs. Edvard Bengtsson (Elin Gerda Persson)",female,30,1,0,349910,15.55,,S -1252,3,"Sage, Master. William Henry",male,14.5,8,2,CA. 2343,69.55,,S -1253,2,"Mallet, Mrs. Albert (Antoinette Magnin)",female,24,1,1,S.C./PARIS 2079,37.0042,,C -1254,2,"Ware, Mrs. John James (Florence Louise Long)",female,31,0,0,CA 31352,21,,S -1255,3,"Strilic, Mr. Ivan",male,27,0,0,315083,8.6625,,S -1256,1,"Harder, Mrs. George Achilles (Dorothy Annan)",female,25,1,0,11765,55.4417,E50,C -1257,3,"Sage, Mrs. John (Annie Bullen)",female,,1,9,CA. 2343,69.55,,S -1258,3,"Caram, Mr. Joseph",male,,1,0,2689,14.4583,,C -1259,3,"Riihivouri, Miss. Susanna Juhantytar Sanni""""",female,22,0,0,3101295,39.6875,,S -1260,1,"Gibson, Mrs. Leonard (Pauline C Boeson)",female,45,0,1,112378,59.4,,C -1261,2,"Pallas y Castello, Mr. Emilio",male,29,0,0,SC/PARIS 2147,13.8583,,C -1262,2,"Giles, Mr. Edgar",male,21,1,0,28133,11.5,,S -1263,1,"Wilson, Miss. Helen Alice",female,31,0,0,16966,134.5,E39 E41,C -1264,1,"Ismay, Mr. Joseph Bruce",male,49,0,0,112058,0,B52 B54 B56,S -1265,2,"Harbeck, Mr. William H",male,44,0,0,248746,13,,S -1266,1,"Dodge, Mrs. Washington (Ruth Vidaver)",female,54,1,1,33638,81.8583,A34,S -1267,1,"Bowen, Miss. Grace Scott",female,45,0,0,PC 17608,262.375,,C -1268,3,"Kink, Miss. Maria",female,22,2,0,315152,8.6625,,S -1269,2,"Cotterill, Mr. Henry Harry""""",male,21,0,0,29107,11.5,,S -1270,1,"Hipkins, Mr. William Edward",male,55,0,0,680,50,C39,S -1271,3,"Asplund, Master. Carl Edgar",male,5,4,2,347077,31.3875,,S -1272,3,"O'Connor, Mr. Patrick",male,,0,0,366713,7.75,,Q -1273,3,"Foley, Mr. Joseph",male,26,0,0,330910,7.8792,,Q -1274,3,"Risien, Mrs. Samuel (Emma)",female,,0,0,364498,14.5,,S -1275,3,"McNamee, Mrs. Neal (Eileen O'Leary)",female,19,1,0,376566,16.1,,S -1276,2,"Wheeler, Mr. Edwin Frederick""""",male,,0,0,SC/PARIS 2159,12.875,,S -1277,2,"Herman, Miss. Kate",female,24,1,2,220845,65,,S -1278,3,"Aronsson, Mr. Ernst Axel Algot",male,24,0,0,349911,7.775,,S -1279,2,"Ashby, Mr. John",male,57,0,0,244346,13,,S -1280,3,"Canavan, Mr. Patrick",male,21,0,0,364858,7.75,,Q -1281,3,"Palsson, Master. Paul Folke",male,6,3,1,349909,21.075,,S -1282,1,"Payne, Mr. Vivian Ponsonby",male,23,0,0,12749,93.5,B24,S -1283,1,"Lines, Mrs. Ernest H (Elizabeth Lindsey James)",female,51,0,1,PC 17592,39.4,D28,S -1284,3,"Abbott, Master. Eugene Joseph",male,13,0,2,C.A. 2673,20.25,,S -1285,2,"Gilbert, Mr. William",male,47,0,0,C.A. 30769,10.5,,S -1286,3,"Kink-Heilmann, Mr. Anton",male,29,3,1,315153,22.025,,S -1287,1,"Smith, Mrs. Lucien Philip (Mary Eloise Hughes)",female,18,1,0,13695,60,C31,S -1288,3,"Colbert, Mr. Patrick",male,24,0,0,371109,7.25,,Q -1289,1,"Frolicher-Stehli, Mrs. Maxmillian (Margaretha Emerentia Stehli)",female,48,1,1,13567,79.2,B41,C -1290,3,"Larsson-Rondberg, Mr. Edvard A",male,22,0,0,347065,7.775,,S -1291,3,"Conlon, Mr. Thomas Henry",male,31,0,0,21332,7.7333,,Q -1292,1,"Bonnell, Miss. Caroline",female,30,0,0,36928,164.8667,C7,S -1293,2,"Gale, Mr. Harry",male,38,1,0,28664,21,,S -1294,1,"Gibson, Miss. Dorothy Winifred",female,22,0,1,112378,59.4,,C -1295,1,"Carrau, Mr. Jose Pedro",male,17,0,0,113059,47.1,,S -1296,1,"Frauenthal, Mr. Isaac Gerald",male,43,1,0,17765,27.7208,D40,C -1297,2,"Nourney, Mr. Alfred (Baron von Drachstedt"")""",male,20,0,0,SC/PARIS 2166,13.8625,D38,C -1298,2,"Ware, Mr. William Jeffery",male,23,1,0,28666,10.5,,S -1299,1,"Widener, Mr. George Dunton",male,50,1,1,113503,211.5,C80,C -1300,3,"Riordan, Miss. Johanna Hannah""""",female,,0,0,334915,7.7208,,Q -1301,3,"Peacock, Miss. Treasteall",female,3,1,1,SOTON/O.Q. 3101315,13.775,,S -1302,3,"Naughton, Miss. Hannah",female,,0,0,365237,7.75,,Q -1303,1,"Minahan, Mrs. William Edward (Lillian E Thorpe)",female,37,1,0,19928,90,C78,Q -1304,3,"Henriksson, Miss. Jenny Lovisa",female,28,0,0,347086,7.775,,S -1305,3,"Spector, Mr. Woolf",male,,0,0,A.5. 3236,8.05,,S -1306,1,"Oliva y Ocana, Dona. Fermina",female,39,0,0,PC 17758,108.9,C105,C -1307,3,"Saether, Mr. Simon Sivertsen",male,38.5,0,0,SOTON/O.Q. 3101262,7.25,,S -1308,3,"Ware, Mr. Frederick",male,,0,0,359309,8.05,,S -1309,3,"Peter, Master. Michael J",male,,1,1,2668,22.3583,,C diff --git a/data/sample_csv/economic_index.csv b/data/sample_csv/economic_index.csv new file mode 100644 index 00000000..8ec20504 --- /dev/null +++ b/data/sample_csv/economic_index.csv @@ -0,0 +1,610 @@ +date,item,value,value2 +1959-03-31,realgdp,2710.349,-0.6527980013557215 +1959-03-31,infl,0.0,-0.8011258748718484 +1959-03-31,unemp,5.8,0.06542811718056146 +1959-06-30,realgdp,2778.801,-0.04081147835794923 +1959-06-30,infl,2.34,0.9158974374265392 +1959-06-30,unemp,5.1,-0.25304578439633385 +1959-09-30,realgdp,2775.488,1.0087034963683463 +1959-09-30,infl,2.74,-1.0181815185363623 +1959-09-30,unemp,5.3,1.2167389432729125 +1959-12-31,realgdp,2785.204,-0.10866119155397307 +1959-12-31,infl,0.27,-0.25900941268409144 +1959-12-31,unemp,5.6,-2.398005128611882 +1960-03-31,realgdp,2847.699,0.3593633995789623 +1960-03-31,infl,2.31,-0.4290290391165462 +1960-03-31,unemp,5.2,-0.3808024557814625 +1960-06-30,realgdp,2834.39,1.4273723464634807 +1960-06-30,infl,0.14,-0.3276640507333062 +1960-06-30,unemp,5.2,1.1598644167285688 +1960-09-30,realgdp,2839.022,-0.02321732855577241 +1960-09-30,infl,2.7,-2.0116163772748985 +1960-09-30,unemp,5.6,2.313853822192226 +1960-12-31,realgdp,2802.616,-1.4068885388214207 +1960-12-31,infl,1.21,1.5215059118291945 +1960-12-31,unemp,6.3,-0.47691199490336234 +1961-03-31,realgdp,2819.264,0.6097291529061134 +1961-03-31,infl,-0.4,0.2099027240327942 +1961-03-31,unemp,6.8,-0.8314398893349774 +1961-06-30,realgdp,2872.005,2.0114148506075034 +1961-06-30,infl,1.47,-0.7003224277645054 +1961-06-30,unemp,7.0,-0.5715346960595883 +1961-09-30,realgdp,2918.4190000000003,2.65203067553853 +1961-09-30,infl,0.8,-1.2415349654137715 +1961-09-30,unemp,6.8,-0.9402409555861058 +1961-12-31,realgdp,2977.83,-1.9679381711813198 +1961-12-31,infl,0.8,0.5462795769734295 +1961-12-31,unemp,6.2,-0.24159155319710973 +1962-03-31,realgdp,3031.241,-0.5268358251373823 +1962-03-31,infl,2.26,-2.399547143536072 +1962-03-31,unemp,5.6,0.19559686798447104 +1962-06-30,realgdp,3064.7090000000003,0.761415201039472 +1962-06-30,infl,0.13,-0.7229679930186586 +1962-06-30,unemp,5.5,0.965012992196971 +1962-09-30,realgdp,3093.047,1.482783988328222 +1962-09-30,infl,2.11,-0.4723278856937332 +1962-09-30,unemp,5.6,3.0582351768589544 +1962-12-31,realgdp,3100.563,-1.1510243526693082 +1962-12-31,infl,0.79,0.8612653999082355 +1962-12-31,unemp,5.5,-0.008826444091648854 +1963-03-31,realgdp,3141.087,0.3887720431776651 +1963-03-31,infl,0.53,-0.03653482338811275 +1963-03-31,unemp,5.8,0.8343494693071057 +1963-06-30,realgdp,3180.447,0.7651789375707988 +1963-06-30,infl,2.75,-1.2397912431027884 +1963-06-30,unemp,5.7,-1.2164817838818087 +1963-09-30,realgdp,3240.3320000000003,-0.06412210761638427 +1963-09-30,infl,0.78,0.3457759397523613 +1963-09-30,unemp,5.5,0.19422186259134416 +1963-12-31,realgdp,3264.967,-1.0828007580506904 +1963-12-31,infl,2.46,0.44711902167281076 +1963-12-31,unemp,5.6,0.3358773629160957 +1964-03-31,realgdp,3338.2459999999996,-2.3997895301567316 +1964-03-31,infl,0.13,0.4115176019458014 +1964-03-31,unemp,5.5,0.8576874275253575 +1964-06-30,realgdp,3376.587,-2.012708479980858 +1964-06-30,infl,0.9,-1.4140386932503166 +1964-06-30,unemp,5.2,-0.5097573606587794 +1964-09-30,realgdp,3422.469,-0.06869125056196258 +1964-09-30,infl,1.29,1.1729728620889721 +1964-09-30,unemp,5.0,0.9722866609758225 +1964-12-31,realgdp,3431.9570000000003,0.12807051177418335 +1964-12-31,infl,2.05,2.40645320861203 +1964-12-31,unemp,5.0,0.6469610409858159 +1965-03-31,realgdp,3516.2509999999997,-0.29719605800772103 +1965-03-31,infl,1.28,-0.7609385103012517 +1965-03-31,unemp,4.9,-1.7076803775532339 +1965-06-30,realgdp,3563.96,0.9650021536775036 +1965-06-30,infl,2.54,-0.45837758264273337 +1965-06-30,unemp,4.7,-0.6716998597559931 +1965-09-30,realgdp,3636.285,-0.00993942164013528 +1965-09-30,infl,0.89,0.10940003975696953 +1965-09-30,unemp,4.4,0.2541284893738393 +1965-12-31,realgdp,3724.014,-1.3594022390728417 +1965-12-31,infl,2.9,1.0778623770959321 +1965-12-31,unemp,4.1,1.5192862901900017 +1966-03-31,realgdp,3815.423,0.11759009973969238 +1966-03-31,infl,4.99,-0.08849021035058056 +1966-03-31,unemp,3.9,0.0035563930828963614 +1966-06-30,realgdp,3828.1240000000003,-0.6132701667837287 +1966-06-30,infl,2.1,-0.14152345054337878 +1966-06-30,unemp,3.8,-0.6659266182173023 +1966-09-30,realgdp,3853.301,-0.2696217275048386 +1966-09-30,infl,4.9,-1.326289134505406 +1966-09-30,unemp,3.8,-0.34188683738468617 +1966-12-31,realgdp,3884.52,-1.2433698729790503 +1966-12-31,infl,0.61,1.702099519777598 +1966-12-31,unemp,3.7,-1.2501312398020705 +1967-03-31,realgdp,3918.74,0.2104866702600748 +1967-03-31,infl,2.42,0.07983727449335654 +1967-03-31,unemp,3.8,-0.15622801704679704 +1967-06-30,realgdp,3919.5559999999996,0.7019691798583588 +1967-06-30,infl,3.61,-1.0241840969860896 +1967-06-30,unemp,3.8,-1.9586613407303168 +1967-09-30,realgdp,3950.8259999999996,-0.7524172615808616 +1967-09-30,infl,3.58,-1.3795731753132472 +1967-09-30,unemp,3.8,-1.0536835120430388 +1967-12-31,realgdp,3980.97,0.01944768211341814 +1967-12-31,infl,4.72,0.6210235820645398 +1967-12-31,unemp,3.9,1.5120651551316762 +1968-03-31,realgdp,4063.013,-0.6852632617861852 +1968-03-31,infl,3.5,0.8318913522281859 +1968-03-31,unemp,3.7,1.1630032526499527 +1968-06-30,realgdp,4131.998,1.5097535436565717 +1968-06-30,infl,5.77,0.22541355939831728 +1968-06-30,unemp,3.5,0.2671899545354689 +1968-09-30,realgdp,4160.267,-0.6883839258751691 +1968-09-30,infl,4.56,-2.0920732806388607 +1968-09-30,unemp,3.5,0.06744817296362166 +1968-12-31,realgdp,4178.293,-1.3463630686867325 +1968-12-31,infl,4.51,-0.48278061766162583 +1968-12-31,unemp,3.4,0.19040256473864617 +1969-03-31,realgdp,4244.1,0.30660055902023137 +1969-03-31,infl,6.67,0.8562672577448279 +1969-03-31,unemp,3.4,-0.21504110013362435 +1969-06-30,realgdp,4256.46,-0.8588276172538074 +1969-06-30,infl,5.47,1.6128446089573754 +1969-06-30,unemp,3.4,0.699125760157152 +1969-09-30,realgdp,4283.378,-1.3363051787209497 +1969-09-30,infl,5.4,-0.10619302940052693 +1969-09-30,unemp,3.6,0.20161342130478396 +1969-12-31,realgdp,4263.2609999999995,-0.6349826139159398 +1969-12-31,infl,6.38,0.6118757570330664 +1969-12-31,unemp,3.6,-0.18089158213593773 +1970-03-31,realgdp,4256.573,-0.1814745049891009 +1970-03-31,infl,6.28,-0.38932227671221337 +1970-03-31,unemp,4.2,-0.7294955256761637 +1970-06-30,realgdp,4264.289000000001,-0.7910624570022936 +1970-06-30,infl,4.13,-1.1308858379423388 +1970-06-30,unemp,4.8,-0.13993800848176335 +1970-09-30,realgdp,4302.259,0.7642038741858636 +1970-09-30,infl,5.11,-0.006755265490266504 +1970-09-30,unemp,5.2,0.14439948752211942 +1970-12-31,realgdp,4256.637,-1.30686513995397 +1970-12-31,infl,5.04,-0.11780620198863745 +1970-12-31,unemp,5.8,1.4564127026490332 +1971-03-31,realgdp,4374.016,1.0387574472056795 +1971-03-31,infl,2.0,0.05772357415014826 +1971-03-31,unemp,5.9,0.7157016813296572 +1971-06-30,realgdp,4398.829000000001,0.8760029118609458 +1971-06-30,infl,4.96,-0.009770259353663643 +1971-06-30,unemp,5.9,-0.2986806666127028 +1971-09-30,realgdp,4433.943,-0.20121765441523043 +1971-09-30,infl,2.94,0.16918507014788697 +1971-09-30,unemp,6.0,-0.9113835895794251 +1971-12-31,realgdp,4446.264,-0.09820977550250318 +1971-12-31,infl,2.92,0.1186770714765378 +1971-12-31,unemp,6.0,0.2257600602000264 +1972-03-31,realgdp,4525.769,1.079611957992218 +1972-03-31,infl,2.9,0.48818467270488797 +1972-03-31,unemp,5.8,0.4683884764945961 +1972-06-30,realgdp,4633.101,-0.37668535454620344 +1972-06-30,infl,2.88,1.53554288804614 +1972-06-30,unemp,5.7,0.28631933076184646 +1972-09-30,realgdp,4677.503,0.6306621846089808 +1972-09-30,infl,3.81,-0.0287551582157998 +1972-09-30,unemp,5.6,-0.23091887508726738 +1972-12-31,realgdp,4754.545999999999,2.222137749366672 +1972-12-31,infl,4.71,-0.5066096548368294 +1972-12-31,unemp,5.3,0.7382369932739763 +1973-03-31,realgdp,4876.166,0.1516138050394125 +1973-03-31,infl,9.26,0.5879105050578066 +1973-03-31,unemp,5.0,-0.3297302297652159 +1973-06-30,realgdp,4932.571,1.035174625055242 +1973-06-30,infl,4.55,0.052862484561880634 +1973-06-30,unemp,4.9,0.6988013695953853 +1973-09-30,realgdp,4906.252,0.7409657181597302 +1973-09-30,infl,12.47,0.6573893461623288 +1973-09-30,unemp,4.8,-1.1884955393337568 +1973-12-31,realgdp,4953.05,-0.06030646906139442 +1973-12-31,infl,10.39,2.0588278320628968 +1973-12-31,unemp,4.8,-0.3310757416021057 +1974-03-31,realgdp,4909.617,0.29943669708786735 +1974-03-31,infl,10.96,0.07524506054107553 +1974-03-31,unemp,5.1,0.6930753592028482 +1974-06-30,realgdp,4922.188,-0.2619768815854445 +1974-06-30,infl,9.86,-0.3668286868006567 +1974-06-30,unemp,5.2,0.5825886196406689 +1974-09-30,realgdp,4873.52,-0.12680620105553367 +1974-09-30,infl,13.56,0.8835482928012223 +1974-09-30,unemp,5.6,0.30861171934426773 +1974-12-31,realgdp,4854.34,1.1096934121296622 +1974-12-31,infl,10.07,-0.932368088081217 +1974-12-31,unemp,6.6,-0.09406499421413832 +1975-03-31,realgdp,4795.295,0.8018232113949443 +1975-03-31,infl,5.32,-1.575015504535897 +1975-03-31,unemp,8.2,0.9024878691545803 +1975-06-30,realgdp,4831.942,0.8340536918631442 +1975-06-30,infl,7.48,-0.7951833390521239 +1975-06-30,unemp,8.9,0.3323044433455581 +1975-09-30,realgdp,4913.3279999999995,0.8529430848644842 +1975-09-30,infl,6.61,-1.4038975286829485 +1975-09-30,unemp,8.5,-0.14652082308195863 +1975-12-31,realgdp,4977.5109999999995,1.5160093832639665 +1975-12-31,infl,6.5,-1.5117738790647621 +1975-12-31,unemp,8.3,-1.498599283907702 +1976-03-31,realgdp,5090.663,-0.20114467400937142 +1976-03-31,infl,2.14,-1.2066964705367287 +1976-03-31,unemp,7.7,-0.12406526440534581 +1976-06-30,realgdp,5128.947,0.2924689838960085 +1976-06-30,infl,6.37,-0.4843842574355739 +1976-06-30,unemp,7.6,-2.070433092016331 +1976-09-30,realgdp,5154.072,-0.6997559747043836 +1976-09-30,infl,6.27,-1.004644587821485 +1976-09-30,unemp,7.7,1.7373653316681326 +1976-12-31,realgdp,5191.499,0.2704617616763442 +1976-12-31,infl,5.49,-0.5171264098291797 +1976-12-31,unemp,7.8,-0.20261581039155666 +1977-03-31,realgdp,5251.762,0.08252558300419326 +1977-03-31,infl,8.76,0.7866128489171983 +1977-03-31,unemp,7.5,-0.3454561182920391 +1977-06-30,realgdp,5356.130999999999,-0.4196360791938377 +1977-06-30,infl,5.3,1.0583545646048018 +1977-06-30,unemp,7.1,0.5169909538360528 +1977-09-30,realgdp,5451.920999999999,-0.2784144697997929 +1977-09-30,infl,5.23,0.09351058943233745 +1977-09-30,unemp,6.9,0.7643715784199899 +1977-12-31,realgdp,5450.793000000001,0.8646973825809859 +1977-12-31,infl,7.08,0.7798531343525328 +1977-12-31,unemp,6.6,0.02238018517540628 +1978-03-31,realgdp,5469.405,0.4212062375449137 +1978-03-31,infl,7.58,-1.0154975488404596 +1978-03-31,unemp,6.3,0.04932147731129603 +1978-06-30,realgdp,5684.569,-0.43684234593248944 +1978-06-30,infl,9.89,-0.5516275036191627 +1978-06-30,unemp,6.0,1.0174033537625293 +1978-09-30,realgdp,5740.3,-0.0754775179137043 +1978-09-30,infl,9.65,0.4866969856242561 +1978-09-30,unemp,6.0,0.2850212709664721 +1978-12-31,realgdp,5816.222,0.2998541301844391 +1978-12-31,infl,8.26,0.3671878105420559 +1978-12-31,unemp,5.9,-0.3053276114163508 +1979-03-31,realgdp,5825.9490000000005,0.3410294821007178 +1979-03-31,infl,12.08,-1.0685600784574716 +1979-03-31,unemp,5.9,-1.5742831786605889 +1979-06-30,realgdp,5831.418000000001,-0.9993149021189919 +1979-06-30,infl,13.37,0.027452511790911963 +1979-06-30,unemp,5.7,-0.06713088266181891 +1979-09-30,realgdp,5873.335,-0.44015948989252934 +1979-09-30,infl,11.88,-1.7827638350910961 +1979-09-30,unemp,5.9,-0.5208110024080678 +1979-12-31,realgdp,5889.495,0.8713154882462657 +1979-12-31,infl,14.62,-1.173066068467663 +1979-12-31,unemp,5.9,-0.4109096051774396 +1980-03-31,realgdp,5908.467,-0.1385588089654513 +1980-03-31,infl,14.6,-1.1015018468377555 +1980-03-31,unemp,6.3,0.9350228265792433 +1980-06-30,realgdp,5787.3730000000005,0.16815530777128793 +1980-06-30,infl,8.32,-0.8347993777895827 +1980-06-30,unemp,7.3,-0.3273179920013723 +1980-09-30,realgdp,5776.616999999999,0.8775606628002273 +1980-09-30,infl,10.04,-0.537196793001126 +1980-09-30,unemp,7.7,0.5335793667095428 +1980-12-31,realgdp,5883.46,1.5114732705873328 +1980-12-31,infl,11.64,0.44000919264229976 +1980-12-31,unemp,7.4,0.6996047995583157 +1981-03-31,realgdp,6005.717,-2.0462105665120656 +1981-03-31,infl,8.62,-0.15348621700780438 +1981-03-31,unemp,7.4,-0.47117509299116234 +1981-06-30,realgdp,5957.795,0.5150412430014034 +1981-06-30,infl,10.63,0.22061143759268098 +1981-06-30,unemp,7.4,0.6612027670245153 +1981-09-30,realgdp,6030.184,1.081780868649736 +1981-09-30,infl,8.22,-0.6611316871934649 +1981-09-30,unemp,7.4,0.33192111851443706 +1981-12-31,realgdp,5955.062,-1.5037712824825544 +1981-12-31,infl,4.26,-1.3438055955717119 +1981-12-31,unemp,8.2,-0.15384601909673548 +1982-03-31,realgdp,5857.3330000000005,0.06785536153224178 +1982-03-31,infl,2.53,0.8418479428759695 +1982-03-31,unemp,8.8,-0.24215163913014237 +1982-06-30,realgdp,5889.0740000000005,-1.2175209793740451 +1982-06-30,infl,10.39,-0.13558813764400204 +1982-06-30,unemp,9.4,0.7650213388008646 +1982-09-30,realgdp,5866.37,3.00259086369985 +1982-09-30,infl,2.45,1.3786757234455984 +1982-09-30,unemp,9.9,1.678940055115715 +1982-12-31,realgdp,5871.001,0.6807481463085109 +1982-12-31,infl,-0.82,0.34814382923761394 +1982-12-31,unemp,10.7,1.4533779367294581 +1983-03-31,realgdp,5944.02,-0.7644496268357139 +1983-03-31,infl,3.66,-0.08472718313192877 +1983-03-31,unemp,10.4,-1.0271389655890393 +1983-06-30,realgdp,6077.619000000001,-1.2390389779404496 +1983-06-30,infl,4.03,-1.113615557009907 +1983-06-30,unemp,10.1,0.04094910249993892 +1983-09-30,realgdp,6197.468000000001,-0.6036520590153667 +1983-09-30,infl,3.99,0.08523290148596828 +1983-09-30,unemp,9.4,-0.09672636659613751 +1983-12-31,realgdp,6325.5740000000005,0.41025313410829284 +1983-12-31,infl,5.13,0.11241341310533896 +1983-12-31,unemp,8.5,-1.59082985094908 +1984-03-31,realgdp,6448.264,0.4040005208220972 +1984-03-31,infl,4.67,0.9515921964660341 +1984-03-31,unemp,7.9,1.5182953408699544 +1984-06-30,realgdp,6559.594,-1.3845779161602156 +1984-06-30,infl,3.09,-0.6864080958953628 +1984-06-30,unemp,7.5,0.27398005314710633 +1984-09-30,realgdp,6623.343000000001,1.1378123505872504 +1984-09-30,infl,3.82,0.015949830691238023 +1984-09-30,unemp,7.4,0.7964197112854233 +1984-12-31,realgdp,6677.264,-1.2463667359326878 +1984-12-31,infl,2.28,-0.3740088094245787 +1984-12-31,unemp,7.3,-0.743697253907241 +1985-03-31,realgdp,6740.275,-0.36810469283048464 +1985-03-31,infl,4.89,1.1622476856819453 +1985-03-31,unemp,7.3,-0.239405080567044 +1985-06-30,realgdp,6797.344,0.1611890099486354 +1985-06-30,infl,2.61,0.7560147919175185 +1985-06-30,unemp,7.3,0.771229993491501 +1985-09-30,realgdp,6903.523,0.980025611721425 +1985-09-30,infl,2.96,-0.16966625094362484 +1985-09-30,unemp,7.2,-0.9198563537366529 +1985-12-31,realgdp,6955.918000000001,-0.7573988143551815 +1985-12-31,infl,5.13,0.49015548541423326 +1985-12-31,unemp,7.0,0.8890473833916966 +1986-03-31,realgdp,7022.757,0.675418645501835 +1986-03-31,infl,-4.39,-1.1585254593233925 +1986-03-31,unemp,7.0,0.15675745974130187 +1986-06-30,realgdp,7050.969,-1.6072198294474318 +1986-06-30,infl,2.93,-1.2643801815572426 +1986-06-30,unemp,7.2,2.0791635512707933 +1986-09-30,realgdp,7118.95,-0.4824801736587573 +1986-09-30,infl,2.55,1.3598952388857763 +1986-09-30,unemp,7.0,-0.8267005603877547 +1986-12-31,realgdp,7153.359,0.3488419262048858 +1986-12-31,infl,4.33,-0.10956532784134702 +1986-12-31,unemp,6.8,0.23993607856119517 +1987-03-31,realgdp,7193.019,-0.44547726969575124 +1987-03-31,infl,4.64,0.4382037746734024 +1987-03-31,unemp,6.6,0.23271337842185327 +1987-06-30,realgdp,7269.51,-0.04742081309681592 +1987-06-30,infl,3.89,0.5900412311057388 +1987-06-30,unemp,6.3,1.0632780961173496 +1987-09-30,realgdp,7332.558000000001,1.2198431287123677 +1987-09-30,infl,4.2,-0.8380731134498747 +1987-09-30,unemp,6.0,0.20784640452063333 +1987-12-31,realgdp,7458.022,-1.5888653845684606 +1987-12-31,infl,3.46,-1.1485194868492792 +1987-12-31,unemp,5.9,-0.3837913342120381 +1988-03-31,realgdp,7496.6,0.5760587624299505 +1988-03-31,infl,4.12,1.0498808339273145 +1988-03-31,unemp,5.7,1.9122319628203135 +1988-06-30,realgdp,7592.880999999999,-0.9288802436822831 +1988-06-30,infl,4.41,0.8617620462725235 +1988-06-30,unemp,5.5,0.552936108554955 +1988-09-30,realgdp,7632.081999999999,-0.871337163552745 +1988-09-30,infl,4.7,1.1902500534028175 +1988-09-30,unemp,5.5,0.11939856020243124 +1988-12-31,realgdp,7733.991,-0.3613295217249724 +1988-12-31,infl,4.31,1.492518176263984 +1988-12-31,unemp,5.3,-0.5006091737981156 +1989-03-31,realgdp,7806.603,-0.3411516576318342 +1989-03-31,infl,6.22,-1.9072372380926337 +1989-03-31,unemp,5.2,0.6138508079477445 +1989-06-30,realgdp,7865.016,0.42542406760368195 +1989-06-30,infl,4.52,0.19440362311279225 +1989-06-30,unemp,5.2,1.011251068301112 +1989-09-30,realgdp,7927.393,-0.1010699237291641 +1989-09-30,infl,2.88,2.5210328479148663 +1989-09-30,unemp,5.3,-2.0347830492597203 +1989-12-31,realgdp,7944.696999999999,-0.6529004410554009 +1989-12-31,infl,6.64,-1.0665414771937898 +1989-12-31,unemp,5.4,-1.630805063095312 +1990-03-31,realgdp,8027.693,0.6974015093783449 +1990-03-31,infl,4.37,0.380921219842821 +1990-03-31,unemp,5.3,0.37233585274073916 +1990-06-30,realgdp,8059.598000000001,-0.5358256870897109 +1990-06-30,infl,4.93,0.04545564760753154 +1990-06-30,unemp,5.3,-0.1697630531582153 +1990-09-30,realgdp,8059.476,-0.5019105515853607 +1990-09-30,infl,8.79,-0.29530778708322347 +1990-09-30,unemp,5.7,-0.39643083955026004 +1990-12-31,realgdp,7988.8640000000005,-1.0598145042632763 +1990-12-31,infl,3.88,-0.37462359651118776 +1990-12-31,unemp,6.1,-1.4979462316219394 +1991-03-31,realgdp,7950.164000000001,-0.7738244187011749 +1991-03-31,infl,1.19,1.0826625158036407 +1991-03-31,unemp,6.6,-0.10168242922547147 +1991-06-30,realgdp,8003.821999999999,0.4272705807134954 +1991-06-30,infl,3.24,-2.6343420876925356 +1991-06-30,unemp,6.8,-0.29597165765205213 +1991-09-30,realgdp,8037.5380000000005,0.9150730273366975 +1991-09-30,infl,2.93,1.1083185217124314 +1991-09-30,unemp,6.9,-0.5982229038221001 +1991-12-31,realgdp,8069.045999999999,-0.027730324881727733 +1991-12-31,infl,3.19,1.8599583080415687 +1991-12-31,unemp,7.1,-1.0145714414421683 +1992-03-31,realgdp,8157.616,1.3689138003019325 +1992-03-31,infl,3.17,-0.7544705281312846 +1992-03-31,unemp,7.4,-3.010130883778502 +1992-06-30,realgdp,8244.294,-0.8599827018703934 +1992-06-30,infl,3.14,-1.081552888938459 +1992-06-30,unemp,7.6,-0.10765787986184047 +1992-09-30,realgdp,8329.360999999999,0.5148729324111173 +1992-09-30,infl,3.4,-0.4013959179005079 +1992-09-30,unemp,7.6,0.031235790961461715 +1992-12-31,realgdp,8417.016,-1.5087025398625504 +1992-12-31,infl,3.09,0.17464667930634833 +1992-12-31,unemp,7.4,-0.02346565140651374 +1993-03-31,realgdp,8432.485,0.4707360303072897 +1993-03-31,infl,2.79,-0.8053333096434494 +1993-03-31,unemp,7.2,-0.6313291825204507 +1993-06-30,realgdp,8486.435,0.8896250288059957 +1993-06-30,infl,1.94,-1.3395253561456213 +1993-06-30,unemp,7.1,-2.2509355848196395 +1993-09-30,realgdp,8531.108,-0.9927017683629622 +1993-09-30,infl,3.03,-0.002665993139163211 +1993-09-30,unemp,6.8,2.1486726720066756 +1993-12-31,realgdp,8643.769,2.4233727764762243 +1993-12-31,infl,1.92,0.10766051037432586 +1993-12-31,unemp,6.6,0.3408551964027892 +1994-03-31,realgdp,8727.919,-0.6271656415904744 +1994-03-31,infl,2.45,0.13100862056060533 +1994-03-31,unemp,6.6,1.1278852037895053 +1994-06-30,realgdp,8847.303,-0.4910285202223754 +1994-06-30,infl,3.25,-0.14339769587949 +1994-06-30,unemp,6.2,-0.5374810483409351 +1994-09-30,realgdp,8904.289,0.37001621557698167 +1994-09-30,infl,2.69,-1.0110496869064258 +1994-09-30,unemp,6.0,0.2180485463739563 +1994-12-31,realgdp,9003.18,0.3027222464771644 +1994-12-31,infl,2.93,-0.0303246244309902 +1994-12-31,unemp,5.6,0.12744949051313084 +1995-03-31,realgdp,9025.267,-0.5183891701763603 +1995-03-31,infl,3.44,-0.5139498447521581 +1995-03-31,unemp,5.5,-0.3497605488022286 +1995-06-30,realgdp,9044.668,-2.126972576113919 +1995-06-30,infl,2.1,-1.8917258850429906 +1995-06-30,unemp,5.7,0.5412065739371252 +1995-09-30,realgdp,9120.684000000001,-0.6071003566290029 +1995-09-30,infl,2.35,0.7052402215639505 +1995-09-30,unemp,5.7,-1.3331730699451871 +1995-12-31,realgdp,9184.275,-0.8157423106100871 +1995-12-31,infl,3.11,-1.8640279578351304 +1995-12-31,unemp,5.6,-0.12525723723717172 +1996-03-31,realgdp,9247.188,1.7134890954197604 +1996-03-31,infl,3.6,1.6740910541429634 +1996-03-31,unemp,5.5,0.21119709508929566 +1996-06-30,realgdp,9407.052,-1.5871247241414446 +1996-06-30,infl,2.3,1.285515929055534 +1996-06-30,unemp,5.5,-0.3870741253557776 +1996-09-30,realgdp,9488.879,0.711590259042123 +1996-09-30,infl,3.05,-1.9294859337719243 +1996-09-30,unemp,5.3,-0.2958247459826706 +1996-12-31,realgdp,9592.458,0.6592457103782177 +1996-12-31,infl,3.02,-0.5503180420943606 +1996-12-31,unemp,5.3,1.0299647209854874 +1997-03-31,realgdp,9666.235,0.5373491449239048 +1997-03-31,infl,1.25,1.4909557746517663 +1997-03-31,unemp,5.2,-0.5634562494514324 +1997-06-30,realgdp,9809.551,2.117532552449335 +1997-06-30,infl,1.25,0.2547593212029422 +1997-06-30,unemp,5.0,1.450865688341228 +1997-09-30,realgdp,9932.671999999999,0.6948852623160693 +1997-09-30,infl,2.73,-0.11836326716553706 +1997-09-30,unemp,4.9,-0.09355297297909745 +1997-12-31,realgdp,10008.874,-0.05362133782867928 +1997-12-31,infl,1.24,1.1461501551007538 +1997-12-31,unemp,4.7,-0.47314141122975434 +1998-03-31,realgdp,10103.425,1.8244329708494764 +1998-03-31,infl,0.49,1.119097112694746 +1998-03-31,unemp,4.6,0.37284366634985106 +1998-06-30,realgdp,10194.277,-0.5642660385829237 +1998-06-30,infl,2.46,-2.153120093374088 +1998-06-30,unemp,4.4,-0.2341706713839078 +1998-09-30,realgdp,10328.787,1.7855869779176636 +1998-09-30,infl,1.71,-0.882383728989154 +1998-09-30,unemp,4.5,2.0244495882490723 +1998-12-31,realgdp,10507.575,-0.3330068703006863 +1998-12-31,infl,1.95,1.19093094996243 +1998-12-31,unemp,4.4,-1.21301083357967 +1999-03-31,realgdp,10601.178999999998,-2.24207446446887 +1999-03-31,infl,2.9,-0.48398163973049974 +1999-03-31,unemp,4.3,0.8855230280313029 +1999-06-30,realgdp,10684.048999999999,-0.2302867143827644 +1999-06-30,infl,1.92,-0.05982302554847611 +1999-06-30,unemp,4.3,0.10633195313123582 +1999-09-30,realgdp,10819.913999999999,0.9121312715883854 +1999-09-30,infl,3.35,-1.268030947292471 +1999-09-30,unemp,4.2,0.05403153898838803 +1999-12-31,realgdp,11014.253999999999,-0.6971402699470096 +1999-12-31,infl,2.85,0.38234020925642176 +1999-12-31,unemp,4.1,0.10440566009715571 +2000-03-31,realgdp,11043.044,0.08979651271045248 +2000-03-31,infl,3.76,0.12734769686182001 +2000-03-31,unemp,4.0,-0.8846847549875351 +2000-06-30,realgdp,11258.454,0.8894011731411884 +2000-06-30,infl,4.19,-0.29026902175992697 +2000-06-30,unemp,3.9,-0.6192003858161558 +2000-09-30,realgdp,11267.867,-0.3037949946842862 +2000-09-30,infl,2.77,1.0444940654756212 +2000-09-30,unemp,4.0,0.9475774458463895 +2000-12-31,realgdp,11334.544,1.9538013690802056 +2000-12-31,infl,3.89,1.7261217021198108 +2000-12-31,unemp,3.9,0.6515327934387469 +2001-03-31,realgdp,11297.171,0.5475165207364051 +2001-03-31,infl,1.82,-1.0610360771764946 +2001-03-31,unemp,4.2,-1.4940663483760124 +2001-06-30,realgdp,11371.251,-1.332703591051456 +2001-06-30,infl,2.26,0.2861167728198805 +2001-06-30,unemp,4.4,0.367601144666728 +2001-09-30,realgdp,11340.075,-0.9864973821799761 +2001-09-30,infl,0.45,-0.6967290147956166 +2001-09-30,unemp,4.8,0.6406176233313411 +2001-12-31,realgdp,11380.128,0.3582428185938311 +2001-12-31,infl,0.23,0.6581278785482698 +2001-12-31,unemp,5.5,-0.09203070436591446 +2002-03-31,realgdp,11477.868,-1.2651227450995 +2002-03-31,infl,3.59,-2.8350866749421035 +2002-03-31,unemp,5.7,0.34667754621197483 +2002-06-30,realgdp,11538.77,-2.7795964069985657 +2002-06-30,infl,1.56,-0.3788054373409519 +2002-06-30,unemp,5.8,-1.9671315147299866 +2002-09-30,realgdp,11596.43,-1.0323823772842724 +2002-09-30,infl,2.66,1.3882592524296236 +2002-09-30,unemp,5.7,-0.6580417987469802 +2002-12-31,realgdp,11598.823999999999,-0.4298155826602842 +2002-12-31,infl,3.08,-1.7248299248779573 +2002-12-31,unemp,5.8,-0.8418940290531883 +2003-03-31,realgdp,11645.819,-1.0560819199947324 +2003-03-31,infl,1.31,1.5816723823269054 +2003-03-31,unemp,5.9,0.48065246678543216 +2003-06-30,realgdp,11738.706,-0.35997923281989375 +2003-06-30,infl,1.09,1.793852015272994 +2003-06-30,unemp,6.2,-0.8709747721230631 +2003-09-30,realgdp,11935.461000000001,1.6059854195866352 +2003-09-30,infl,2.6,-0.13020936102679292 +2003-09-30,unemp,6.1,-1.680682438285414 +2003-12-31,realgdp,12042.817,0.019566093424742 +2003-12-31,infl,3.02,0.46545566849860703 +2003-12-31,unemp,5.8,-0.05844498837144831 +2004-03-31,realgdp,12127.623,-0.007068753696583709 +2004-03-31,infl,2.35,0.4901045448402715 +2004-03-31,unemp,5.7,1.4681167750347761 +2004-06-30,realgdp,12213.818000000001,0.12082267616776458 +2004-06-30,infl,3.61,1.1020287734821839 +2004-06-30,unemp,5.6,-1.6270702937033301 +2004-09-30,realgdp,12303.533000000001,-0.029210009891220638 +2004-09-30,infl,3.58,-1.8051598215577849 +2004-09-30,unemp,5.4,-0.5948660164493911 +2004-12-31,realgdp,12410.282,0.5973226075190803 +2004-12-31,infl,2.09,-1.2049526679186415 +2004-12-31,unemp,5.4,2.4233813778621203 +2005-03-31,realgdp,12534.113000000001,0.024139482534182105 +2005-03-31,infl,4.15,-0.3839636255368182 +2005-03-31,unemp,5.3,-0.2104470228081022 +2005-06-30,realgdp,12587.535,-1.4030564987207848 +2005-06-30,infl,1.85,-0.6306528591401122 +2005-06-30,unemp,5.1,-0.6729456417413854 +2005-09-30,realgdp,12683.153,0.13147789479773042 +2005-09-30,infl,9.14,-0.6547952442753181 +2005-09-30,unemp,5.0,0.6418219505665321 +2005-12-31,realgdp,12748.698999999999,-0.7603816723590324 +2005-12-31,infl,0.4,1.3795818130561244 +2005-12-31,unemp,4.9,-0.045983849612816145 +2006-03-31,realgdp,12915.938,-2.046264865380875 +2006-03-31,infl,2.6,2.7259493081896857 +2006-03-31,unemp,4.7,0.2043014259418523 +2006-06-30,realgdp,12962.462,1.4423023302646307 +2006-06-30,infl,3.97,0.49837971450915663 +2006-06-30,unemp,4.7,-1.08499184857345 +2006-09-30,realgdp,12965.916000000001,0.49017472052138517 +2006-09-30,infl,-1.58,-1.0381663159747145 +2006-09-30,unemp,4.7,-1.1142585749461702 +2006-12-31,realgdp,13060.678999999998,0.12614598220812304 +2006-12-31,infl,3.3,-0.6948891487410438 +2006-12-31,unemp,4.4,-0.5941904219019398 +2007-03-31,realgdp,13099.901000000002,1.3116514703735493 +2007-03-31,infl,4.58,-1.0901857158460648 +2007-03-31,unemp,4.5,-0.40582305986726547 +2007-06-30,realgdp,13203.976999999999,-0.3777690656924559 +2007-06-30,infl,2.75,0.7782674208002048 +2007-06-30,unemp,4.5,-0.8712396462852713 +2007-09-30,realgdp,13321.108999999999,-0.43780914479141064 +2007-09-30,infl,3.45,0.11690039308944668 +2007-09-30,unemp,4.7,-0.5996743539744054 +2007-12-31,realgdp,13391.249,-1.4340841882990096 +2007-12-31,infl,6.38,2.4199970824607737 +2007-12-31,unemp,4.8,0.7675208821443359 +2008-03-31,realgdp,13366.865,0.6381340091379205 +2008-03-31,infl,2.82,-2.8981715596337887 +2008-03-31,unemp,4.9,1.0895519175649542 +2008-06-30,realgdp,13415.266000000001,0.1435337140756236 +2008-06-30,infl,8.53,-0.6553359702925654 +2008-06-30,unemp,5.4,0.7836577018360418 +2008-09-30,realgdp,13324.6,-0.4362896452458332 +2008-09-30,infl,-3.16,0.9651393381219074 +2008-09-30,unemp,6.0,0.08234731091161089 +2008-12-31,realgdp,13141.92,-1.2370392171272546 +2008-12-31,infl,-8.79,1.3864196648003146 +2008-12-31,unemp,6.9,0.5433302463650955 +2009-03-31,realgdp,12925.41,-0.3248110404956314 +2009-03-31,infl,0.94,0.9268572514142708 +2009-03-31,unemp,8.1,-1.6971892304769178 +2009-06-30,realgdp,12901.503999999999,-0.4359983732414076 +2009-06-30,infl,3.37,-0.2203037804128321 +2009-06-30,unemp,9.2,-0.23736327546714311 +2009-09-30,realgdp,12990.341,1.767866229061763 +2009-09-30,infl,3.56,-0.7735092002713998 +2009-09-30,unemp,9.6,-2.5126808740355853 diff --git a/data/sample_csv/tips.csv b/data/sample_csv/tips.csv new file mode 100644 index 00000000..ee9be5ff --- /dev/null +++ b/data/sample_csv/tips.csv @@ -0,0 +1,245 @@ +total_bill,tip,smoker,day,time,size +16.99,1.01,No,Sun,Dinner,2 +10.34,1.66,No,Sun,Dinner,3 +21.01,3.5,No,Sun,Dinner,3 +23.68,3.31,No,Sun,Dinner,2 +24.59,3.61,No,Sun,Dinner,4 +25.29,4.71,No,Sun,Dinner,4 +8.77,2.0,No,Sun,Dinner,2 +26.88,3.12,No,Sun,Dinner,4 +15.04,1.96,No,Sun,Dinner,2 +14.78,3.23,No,Sun,Dinner,2 +10.27,1.71,No,Sun,Dinner,2 +35.26,5.0,No,Sun,Dinner,4 +15.42,1.57,No,Sun,Dinner,2 +18.43,3.0,No,Sun,Dinner,4 +14.83,3.02,No,Sun,Dinner,2 +21.58,3.92,No,Sun,Dinner,2 +10.33,1.67,No,Sun,Dinner,3 +16.29,3.71,No,Sun,Dinner,3 +16.97,3.5,No,Sun,Dinner,3 +20.65,3.35,No,Sat,Dinner,3 +17.92,4.08,No,Sat,Dinner,2 +20.29,2.75,No,Sat,Dinner,2 +15.77,2.23,No,Sat,Dinner,2 +39.42,7.58,No,Sat,Dinner,4 +19.82,3.18,No,Sat,Dinner,2 +17.81,2.34,No,Sat,Dinner,4 +13.37,2.0,No,Sat,Dinner,2 +12.69,2.0,No,Sat,Dinner,2 +21.7,4.3,No,Sat,Dinner,2 +19.65,3.0,No,Sat,Dinner,2 +9.55,1.45,No,Sat,Dinner,2 +18.35,2.5,No,Sat,Dinner,4 +15.06,3.0,No,Sat,Dinner,2 +20.69,2.45,No,Sat,Dinner,4 +17.78,3.27,No,Sat,Dinner,2 +24.06,3.6,No,Sat,Dinner,3 +16.31,2.0,No,Sat,Dinner,3 +16.93,3.07,No,Sat,Dinner,3 +18.69,2.31,No,Sat,Dinner,3 +31.27,5.0,No,Sat,Dinner,3 +16.04,2.24,No,Sat,Dinner,3 +17.46,2.54,No,Sun,Dinner,2 +13.94,3.06,No,Sun,Dinner,2 +9.68,1.32,No,Sun,Dinner,2 +30.4,5.6,No,Sun,Dinner,4 +18.29,3.0,No,Sun,Dinner,2 +22.23,5.0,No,Sun,Dinner,2 +32.4,6.0,No,Sun,Dinner,4 +28.55,2.05,No,Sun,Dinner,3 +18.04,3.0,No,Sun,Dinner,2 +12.54,2.5,No,Sun,Dinner,2 +10.29,2.6,No,Sun,Dinner,2 +34.81,5.2,No,Sun,Dinner,4 +9.94,1.56,No,Sun,Dinner,2 +25.56,4.34,No,Sun,Dinner,4 +19.49,3.51,No,Sun,Dinner,2 +38.01,3.0,Yes,Sat,Dinner,4 +26.41,1.5,No,Sat,Dinner,2 +11.24,1.76,Yes,Sat,Dinner,2 +48.27,6.73,No,Sat,Dinner,4 +20.29,3.21,Yes,Sat,Dinner,2 +13.81,2.0,Yes,Sat,Dinner,2 +11.02,1.98,Yes,Sat,Dinner,2 +18.29,3.76,Yes,Sat,Dinner,4 +17.59,2.64,No,Sat,Dinner,3 +20.08,3.15,No,Sat,Dinner,3 +16.45,2.47,No,Sat,Dinner,2 +3.07,1.0,Yes,Sat,Dinner,1 +20.23,2.01,No,Sat,Dinner,2 +15.01,2.09,Yes,Sat,Dinner,2 +12.02,1.97,No,Sat,Dinner,2 +17.07,3.0,No,Sat,Dinner,3 +26.86,3.14,Yes,Sat,Dinner,2 +25.28,5.0,Yes,Sat,Dinner,2 +14.73,2.2,No,Sat,Dinner,2 +10.51,1.25,No,Sat,Dinner,2 +17.92,3.08,Yes,Sat,Dinner,2 +27.2,4.0,No,Thur,Lunch,4 +22.76,3.0,No,Thur,Lunch,2 +17.29,2.71,No,Thur,Lunch,2 +19.44,3.0,Yes,Thur,Lunch,2 +16.66,3.4,No,Thur,Lunch,2 +10.07,1.83,No,Thur,Lunch,1 +32.68,5.0,Yes,Thur,Lunch,2 +15.98,2.03,No,Thur,Lunch,2 +34.83,5.17,No,Thur,Lunch,4 +13.03,2.0,No,Thur,Lunch,2 +18.28,4.0,No,Thur,Lunch,2 +24.71,5.85,No,Thur,Lunch,2 +21.16,3.0,No,Thur,Lunch,2 +28.97,3.0,Yes,Fri,Dinner,2 +22.49,3.5,No,Fri,Dinner,2 +5.75,1.0,Yes,Fri,Dinner,2 +16.32,4.3,Yes,Fri,Dinner,2 +22.75,3.25,No,Fri,Dinner,2 +40.17,4.73,Yes,Fri,Dinner,4 +27.28,4.0,Yes,Fri,Dinner,2 +12.03,1.5,Yes,Fri,Dinner,2 +21.01,3.0,Yes,Fri,Dinner,2 +12.46,1.5,No,Fri,Dinner,2 +11.35,2.5,Yes,Fri,Dinner,2 +15.38,3.0,Yes,Fri,Dinner,2 +44.3,2.5,Yes,Sat,Dinner,3 +22.42,3.48,Yes,Sat,Dinner,2 +20.92,4.08,No,Sat,Dinner,2 +15.36,1.64,Yes,Sat,Dinner,2 +20.49,4.06,Yes,Sat,Dinner,2 +25.21,4.29,Yes,Sat,Dinner,2 +18.24,3.76,No,Sat,Dinner,2 +14.31,4.0,Yes,Sat,Dinner,2 +14.0,3.0,No,Sat,Dinner,2 +7.25,1.0,No,Sat,Dinner,1 +38.07,4.0,No,Sun,Dinner,3 +23.95,2.55,No,Sun,Dinner,2 +25.71,4.0,No,Sun,Dinner,3 +17.31,3.5,No,Sun,Dinner,2 +29.93,5.07,No,Sun,Dinner,4 +10.65,1.5,No,Thur,Lunch,2 +12.43,1.8,No,Thur,Lunch,2 +24.08,2.92,No,Thur,Lunch,4 +11.69,2.31,No,Thur,Lunch,2 +13.42,1.68,No,Thur,Lunch,2 +14.26,2.5,No,Thur,Lunch,2 +15.95,2.0,No,Thur,Lunch,2 +12.48,2.52,No,Thur,Lunch,2 +29.8,4.2,No,Thur,Lunch,6 +8.52,1.48,No,Thur,Lunch,2 +14.52,2.0,No,Thur,Lunch,2 +11.38,2.0,No,Thur,Lunch,2 +22.82,2.18,No,Thur,Lunch,3 +19.08,1.5,No,Thur,Lunch,2 +20.27,2.83,No,Thur,Lunch,2 +11.17,1.5,No,Thur,Lunch,2 +12.26,2.0,No,Thur,Lunch,2 +18.26,3.25,No,Thur,Lunch,2 +8.51,1.25,No,Thur,Lunch,2 +10.33,2.0,No,Thur,Lunch,2 +14.15,2.0,No,Thur,Lunch,2 +16.0,2.0,Yes,Thur,Lunch,2 +13.16,2.75,No,Thur,Lunch,2 +17.47,3.5,No,Thur,Lunch,2 +34.3,6.7,No,Thur,Lunch,6 +41.19,5.0,No,Thur,Lunch,5 +27.05,5.0,No,Thur,Lunch,6 +16.43,2.3,No,Thur,Lunch,2 +8.35,1.5,No,Thur,Lunch,2 +18.64,1.36,No,Thur,Lunch,3 +11.87,1.63,No,Thur,Lunch,2 +9.78,1.73,No,Thur,Lunch,2 +7.51,2.0,No,Thur,Lunch,2 +14.07,2.5,No,Sun,Dinner,2 +13.13,2.0,No,Sun,Dinner,2 +17.26,2.74,No,Sun,Dinner,3 +24.55,2.0,No,Sun,Dinner,4 +19.77,2.0,No,Sun,Dinner,4 +29.85,5.14,No,Sun,Dinner,5 +48.17,5.0,No,Sun,Dinner,6 +25.0,3.75,No,Sun,Dinner,4 +13.39,2.61,No,Sun,Dinner,2 +16.49,2.0,No,Sun,Dinner,4 +21.5,3.5,No,Sun,Dinner,4 +12.66,2.5,No,Sun,Dinner,2 +16.21,2.0,No,Sun,Dinner,3 +13.81,2.0,No,Sun,Dinner,2 +17.51,3.0,Yes,Sun,Dinner,2 +24.52,3.48,No,Sun,Dinner,3 +20.76,2.24,No,Sun,Dinner,2 +31.71,4.5,No,Sun,Dinner,4 +10.59,1.61,Yes,Sat,Dinner,2 +10.63,2.0,Yes,Sat,Dinner,2 +50.81,10.0,Yes,Sat,Dinner,3 +15.81,3.16,Yes,Sat,Dinner,2 +7.25,5.15,Yes,Sun,Dinner,2 +31.85,3.18,Yes,Sun,Dinner,2 +16.82,4.0,Yes,Sun,Dinner,2 +32.9,3.11,Yes,Sun,Dinner,2 +17.89,2.0,Yes,Sun,Dinner,2 +14.48,2.0,Yes,Sun,Dinner,2 +9.6,4.0,Yes,Sun,Dinner,2 +34.63,3.55,Yes,Sun,Dinner,2 +34.65,3.68,Yes,Sun,Dinner,4 +23.33,5.65,Yes,Sun,Dinner,2 +45.35,3.5,Yes,Sun,Dinner,3 +23.17,6.5,Yes,Sun,Dinner,4 +40.55,3.0,Yes,Sun,Dinner,2 +20.69,5.0,No,Sun,Dinner,5 +20.9,3.5,Yes,Sun,Dinner,3 +30.46,2.0,Yes,Sun,Dinner,5 +18.15,3.5,Yes,Sun,Dinner,3 +23.1,4.0,Yes,Sun,Dinner,3 +15.69,1.5,Yes,Sun,Dinner,2 +19.81,4.19,Yes,Thur,Lunch,2 +28.44,2.56,Yes,Thur,Lunch,2 +15.48,2.02,Yes,Thur,Lunch,2 +16.58,4.0,Yes,Thur,Lunch,2 +7.56,1.44,No,Thur,Lunch,2 +10.34,2.0,Yes,Thur,Lunch,2 +43.11,5.0,Yes,Thur,Lunch,4 +13.0,2.0,Yes,Thur,Lunch,2 +13.51,2.0,Yes,Thur,Lunch,2 +18.71,4.0,Yes,Thur,Lunch,3 +12.74,2.01,Yes,Thur,Lunch,2 +13.0,2.0,Yes,Thur,Lunch,2 +16.4,2.5,Yes,Thur,Lunch,2 +20.53,4.0,Yes,Thur,Lunch,4 +16.47,3.23,Yes,Thur,Lunch,3 +26.59,3.41,Yes,Sat,Dinner,3 +38.73,3.0,Yes,Sat,Dinner,4 +24.27,2.03,Yes,Sat,Dinner,2 +12.76,2.23,Yes,Sat,Dinner,2 +30.06,2.0,Yes,Sat,Dinner,3 +25.89,5.16,Yes,Sat,Dinner,4 +48.33,9.0,No,Sat,Dinner,4 +13.27,2.5,Yes,Sat,Dinner,2 +28.17,6.5,Yes,Sat,Dinner,3 +12.9,1.1,Yes,Sat,Dinner,2 +28.15,3.0,Yes,Sat,Dinner,5 +11.59,1.5,Yes,Sat,Dinner,2 +7.74,1.44,Yes,Sat,Dinner,2 +30.14,3.09,Yes,Sat,Dinner,4 +12.16,2.2,Yes,Fri,Lunch,2 +13.42,3.48,Yes,Fri,Lunch,2 +8.58,1.92,Yes,Fri,Lunch,1 +15.98,3.0,No,Fri,Lunch,3 +13.42,1.58,Yes,Fri,Lunch,2 +16.27,2.5,Yes,Fri,Lunch,2 +10.09,2.0,Yes,Fri,Lunch,2 +20.45,3.0,No,Sat,Dinner,4 +13.28,2.72,No,Sat,Dinner,2 +22.12,2.88,Yes,Sat,Dinner,2 +24.01,2.0,Yes,Sat,Dinner,4 +15.69,3.0,Yes,Sat,Dinner,3 +11.61,3.39,No,Sat,Dinner,2 +10.77,1.47,No,Sat,Dinner,2 +15.53,3.0,Yes,Sat,Dinner,2 +10.07,1.25,No,Sat,Dinner,2 +12.6,1.0,Yes,Sat,Dinner,2 +32.83,1.17,Yes,Sat,Dinner,2 +35.83,4.67,No,Sat,Dinner,3 +29.03,5.92,No,Sat,Dinner,3 +27.18,2.0,Yes,Sat,Dinner,2 +22.67,2.0,Yes,Sat,Dinner,2 +17.82,1.75,No,Sat,Dinner,2 +18.78,3.0,No,Thur,Dinner,2 diff --git a/data/sample_csv/Titanic_train.csv b/data/sample_csv/titanic.csv similarity index 100% rename from data/sample_csv/Titanic_train.csv rename to data/sample_csv/titanic.csv diff --git a/resource/apps/apps_merge.svg b/resource/apps/apps_bind.svg similarity index 100% rename from resource/apps/apps_merge.svg rename to resource/apps/apps_bind.svg diff --git a/src/api/functions/pandasCommand.py b/src/api/functions/pandasCommand.py index 7828c2fd..91fd947b 100644 --- a/src/api/functions/pandasCommand.py +++ b/src/api/functions/pandasCommand.py @@ -47,6 +47,29 @@ def _vp_get_columns_list(df): colList.append(cInfo) return colList +def _vp_get_multi_columns_list(dfs = []): + """ + Get Columns List with Detail Information of multiple dataframe + """ + if len(dfs) <= 0: + return [] + + common_set = set(dfs[0].columns) + for df in dfs[1:]: + common_set = common_set & set(df.columns) + common_columns = list(common_set) + + colList = [] + for i, c in enumerate(common_columns): + cInfo = { 'label': c, 'value': c, 'dtype': str(dfs[0][c].dtype), 'location': i } + # value + if type(c).__name__ == 'str': + cInfo['value'] = "'{}'".format(c) + elif type(c).__name__ == 'Timestamp': + cInfo['value'] = str(c) + colList.append(cInfo) + return colList + def _vp_get_column_category(df, col): """ Get Column's Uniq values(Categrical data only, limit 20) diff --git a/src/api_block/blockContainer.js b/src/api_block/blockContainer.js index 1a6b1cfa..16d98620 100644 --- a/src/api_block/blockContainer.js +++ b/src/api_block/blockContainer.js @@ -2649,7 +2649,7 @@ define([ this.hideOptionPreviewBox(); $(VP_ID_PREFIX + VP_APIBLOCK_BOARD_OPTION_PREVIEW_BUTTON).removeClass('enabled'); - this.setNavigator(BLOCK_CODELINE_TYPE.NONE, 'Visual Python 1.1.13'); + this.setNavigator(BLOCK_CODELINE_TYPE.NONE, 'Visual Python 1.1.14'); this.setFocusedPageType(FOCUSED_PAGE_TYPE.BOARD); $('.vp-apiblock-option-tab-none').css(STR_DISPLAY, STR_BLOCK); } diff --git a/src/api_block/constData.js b/src/api_block/constData.js index ece90e54..ae456f36 100644 --- a/src/api_block/constData.js +++ b/src/api_block/constData.js @@ -811,10 +811,11 @@ define([ color: 2, config: { width: '700px', height: '550px' } }, - 'merge': { - label: 'Merge', - file: 'nbextensions/visualpython/src/common/vpMerge', - icon: '/nbextensions/visualpython/resource/apps/apps_merge.svg', + 'bind': { + label: 'Bind', + tooltip: 'Bind pandas objects', + file: 'nbextensions/visualpython/src/common/vpBind', + icon: '/nbextensions/visualpython/resource/apps/apps_bind.svg', color: 3, }, 'reshape': { diff --git a/src/api_block/createAppsBtn.js b/src/api_block/createAppsBtn.js index 8d21fa53..400ec660 100644 --- a/src/api_block/createAppsBtn.js +++ b/src/api_block/createAppsBtn.js @@ -66,6 +66,11 @@ define([ bindEvent() { var blockContainer = this.blockContainerThis; + // block preparing apps + if (this.colorLevel == 0) { + return; + } + $(this.dom).on('click', function() { var menu = $(this).attr('data-menu'); @@ -90,7 +95,7 @@ define([ case 'profiling': case 'pdf': case 'groupby': - case 'merge': + case 'bind': case 'reshape': blockContainer.setSelectBlock(null); blockContainer.createAppsPage(menu, file, config); diff --git a/src/api_block/index.html b/src/api_block/index.html index 5736af56..b3128cdf 100644 --- a/src/api_block/index.html +++ b/src/api_block/index.html @@ -120,7 +120,7 @@ id='vp_apiblock_option_page'>
- Visual Python 1.1.13 + Visual Python 1.1.14
diff --git a/src/api_block/init.js b/src/api_block/init.js index 0d87f77e..012f4c0a 100644 --- a/src/api_block/init.js +++ b/src/api_block/init.js @@ -130,7 +130,7 @@ define([ /** Apps menu 생성 */ var appsList = [ 'import', 'file', 'variable', 'snippets', 'frame', 'subset', 'instance', 'groupby', - 'merge', 'reshape', 'chart', 'markdown', 'pdf', 'profiling' + 'bind', 'reshape', 'chart', 'markdown', 'pdf', 'profiling' ]; appsList.forEach(menu => { var app = new CreateAppsBtn(blockContainer, menu); @@ -378,7 +378,27 @@ define([ blockContainer.addNodeBlock(createdBlock); blockContainer.resetBlockList(); blockContainer.reRenderAllBlock_asc(); - } + } else if (title == "Background") { + // 1. add code block + // create block as group block + createdBlock = blockContainer.createBlock(BLOCK_CODELINE_TYPE.CODE, null, null, true); + // set code + createdBlock.setState({ + [STATE_codeLine]: code + }); + createdBlock.writeCode(code); + createdBlock.apply(); + if (isFirstBlock == true) { + // if it is first block, set as ROOT + createdBlock.setDirection(BLOCK_DIRECTION.ROOT); + } else { + var lastBottomBlock = blockContainer.getRootToLastBottomBlock(); + lastBottomBlock.appendBlock(createdBlock, BLOCK_DIRECTION.DOWN); + } + blockContainer.addNodeBlock(createdBlock); + blockContainer.resetBlockList(); + blockContainer.reRenderAllBlock_asc(); + } } // 2. add cell and run cell diff --git a/src/common/component/vpColumnSelector.js b/src/common/component/vpMultiSelector.js similarity index 70% rename from src/common/component/vpColumnSelector.js rename to src/common/component/vpMultiSelector.js index 118f37f7..b01916fe 100644 --- a/src/common/component/vpColumnSelector.js +++ b/src/common/component/vpMultiSelector.js @@ -1,7 +1,7 @@ /* * Project Name : Visual Python * Description : GUI-based Python code generator - * File Name : vpColumnSelector.js + * File Name : vpMultiSelector.js * Author : Black Logic * Note : Groupby app * License : GNU GPLv3 with Visual Python special exception @@ -42,46 +42,118 @@ define([ //======================================================================== - // [CLASS] ColumnSelector + // [CLASS] MultiSelector //======================================================================== - class ColumnSelector { + class MultiSelector { /** * * @param {string} frameSelector query for parent component - * @param {string} dataframe dataframe variable name - * @param {Array} selectedList - * @param {Array} includeList + * @param {Object} config parent:[], selectedList=[], includeList=[] */ - constructor(frameSelector, dataframe, selectedList=[], includeList=[]) { + constructor(frameSelector, config) { this.uuid = 'u' + vpCommon.getUUID(); this.frameSelector = frameSelector; - this.dataframe = dataframe; + + // configuration + this.config = config; + + var { mode, type, parent, selectedList=[], includeList=[], excludeList=[] } = config; + this.mode = mode; + this.parent = parent; this.selectedList = selectedList; this.includeList = includeList; - this.columnList = []; + this.excludeList = excludeList; + + this.dataList = []; this.pointer = { start: -1, end: -1 }; var that = this; - kernelApi.getColumnList(dataframe, function(result) { - var colList = JSON.parse(result); - colList = colList.map(function(x) { - return { - ...x, - value: x.label, - code: x.value - }; - }); - if (includeList && includeList.length > 0) { - that.columnList = colList.filter(col => includeList.includes(col.code)); - } else { - that.columnList = colList; + + switch (mode) { + case 'columns': + this._getColumnList(parent, function(dataList) { + that._executeCallback(dataList); + }); + break; + case 'variable': + this._getVariableList(type, function(dataList) { + that._executeCallback(dataList); + }) + break; + } + } + + _executeCallback(dataList) { + if (this.includeList && this.includeList.length > 0) { + dataList = dataList.filter(data => this.includeList.includes(data.code)); + } + if (this.excludeList && this.excludeList.length > 0) { + dataList = dataList.filter(data => !this.excludeList.includes(data.code)); + } + this.dataList = dataList; + + // load + this.load(); + } + + _getVariableList(type, callback) { + kernelApi.searchVarList(type, function(result) { + try { + var dataList = JSON.parse(result); + dataList = dataList.map(function(x, idx) { + return { + ...x, + value: x.varName, + code: x.varName, + type: x.varType, + location: idx + }; + }); + callback(dataList); + } catch (e) { + callback([]); } - that.load(); - that.bindEvent(); - that.bindDraggable(); }); } + + _getColumnList(parent, callback) { + if (parent && parent.length > 1) { + kernelApi.getCommonColumnList(parent, function(result) { + try { + var colList = JSON.parse(result); + colList = colList.map(function(x) { + return { + ...x, + value: x.label, + code: x.value, + type: x.dtype + }; + }); + callback(colList); + } catch (e) { + callback([]); + } + }); + } else { + kernelApi.getColumnList(parent, function(result) { + try { + var colList = JSON.parse(result); + colList = colList.map(function(x) { + return { + ...x, + value: x.label, + code: x.value, + type: x.dtype + }; + }); + callback(colList); + } catch (e) { + callback([]); + } + }); + } + } _wrapSelector(query='') { return vpCommon.formatString('.{0} {1}', this.uuid, query); @@ -89,23 +161,25 @@ define([ load() { $(vpCommon.wrapSelector(this.frameSelector)).html(this.render()); - vpCommon.loadCssForDiv(this._wrapSelector(), Jupyter.notebook.base_url + vpConst.BASE_PATH + vpConst.STYLE_PATH + 'common/component/columnSelector.css'); + vpCommon.loadCssForDiv(this._wrapSelector(), Jupyter.notebook.base_url + vpConst.BASE_PATH + vpConst.STYLE_PATH + 'common/component/multiSelector.css'); + this.bindEvent(); + this.bindDraggable(); } - getColumnList() { + getDataList() { var colTags = $(this._wrapSelector('.' + APP_SELECT_ITEM + '.added:not(.moving)')); - var colList = []; + var dataList = []; if (colTags.length > 0) { for (var i = 0; i < colTags.length; i++) { - var colName = $(colTags[i]).data('colname'); - var colDtype = $(colTags[i]).data('dtype'); - var colCode = $(colTags[i]).data('code'); - if (colCode) { - colList.push({ name: colName, dtype: colDtype, code: colCode}); + var name = $(colTags[i]).data('name'); + var type = $(colTags[i]).data('type'); + var code = $(colTags[i]).data('code'); + if (code) { + dataList.push({ name: name, type: type, code: code}); } } } - return colList; + return dataList; } render() { @@ -113,14 +187,14 @@ define([ var tag = new sb.StringBuilder(); tag.appendFormatLine('
', APP_SELECT_CONTAINER, this.uuid); - // col select - left + // select - left tag.appendFormatLine('
', APP_SELECT_LEFT); // tag.appendFormatLine('' // , APP_SELECT_SEARCH, 'Search Column'); var vpSearchSuggest = new vpSuggestInputText.vpSuggestInputText(); vpSearchSuggest.addClass(APP_SELECT_SEARCH); - vpSearchSuggest.setPlaceholder('Search Column'); - vpSearchSuggest.setSuggestList(function() { return that.columnList; }); + vpSearchSuggest.setPlaceholder('Search ' + this.mode); + vpSearchSuggest.setSuggestList(function() { return that.dataList; }); vpSearchSuggest.setSelectEvent(function(value) { $(this.wrapSelector()).val(value); $(this.wrapSelector()).trigger('change'); @@ -129,54 +203,64 @@ define([ tag.appendLine(vpSearchSuggest.toTagString()); tag.appendFormatLine('') - var selectionList = this.columnList.filter(col => !that.selectedList.includes(col.code)); - tag.appendLine(this.renderColumnSelectionBox(selectionList)); + var selectionList = this.dataList.filter(data => !that.selectedList.includes(data.code)); + tag.appendLine(this.renderSelectionBox(selectionList)); tag.appendLine('
'); // APP_SELECT_LEFT - // col select - buttons + // select - buttons tag.appendFormatLine('
', APP_SELECT_BTN_BOX); tag.appendFormatLine('' - , APP_SELECT_ADD_ALL_BTN, 'Add all columns', ''); + , APP_SELECT_ADD_ALL_BTN, 'Add all items', ''); tag.appendFormatLine('' - , APP_SELECT_ADD_BTN, 'Add selected columns', ''); + , APP_SELECT_ADD_BTN, 'Add selected items', ''); tag.appendFormatLine('' - , APP_SELECT_DEL_BTN, 'Remove selected columns', ''); + , APP_SELECT_DEL_BTN, 'Remove selected items', ''); tag.appendFormatLine('' - , APP_SELECT_DEL_ALL_BTN, 'Remove all columns', ''); + , APP_SELECT_DEL_ALL_BTN, 'Remove all items', ''); tag.appendLine('
'); // APP_SELECT_BTNS - // col select - right + // select - right tag.appendFormatLine('
', APP_SELECT_RIGHT); - var selectedList = this.columnList.filter(col => that.selectedList.includes(col.code)); - tag.appendLine(this.renderColumnSelectedBox(selectedList)); + var selectedList = this.dataList.filter(data => that.selectedList.includes(data.code)); + tag.appendLine(this.renderSelectedBox(selectedList)); tag.appendLine('
'); // APP_SELECT_RIGHT tag.appendLine('
'); // APP_SELECT_CONTAINER return tag.toString(); } - renderColumnSelectionBox(colList) { + renderSelectionBox(dataList) { var tag = new sb.StringBuilder(); tag.appendFormatLine('
', APP_SELECT_BOX, 'left', APP_DROPPABLE, 'no-selection'); - // get col data and make draggable items - colList && colList.forEach((col, idx) => { - // col.array parsing - var colInfo = vpCommon.safeString(col.array); - // render column box - tag.appendFormatLine('
{7}
' - , APP_SELECT_ITEM, APP_DRAGGABLE, col.location, col.value, col.dtype, col.code, col.label + ': \n' + colInfo, col.label); + // get data and make draggable items + dataList && dataList.forEach((data, idx) => { + // for column : data.array parsing + var info = vpCommon.safeString(data.array); + if (info) { + info = data.value + ':\n'; + } else { + info = ''; + } + // render item box + tag.appendFormatLine('
{7}
' + , APP_SELECT_ITEM, APP_DRAGGABLE, data.location, data.value, data.type, data.code, info, data.value); }); tag.appendLine('
'); // APP_SELECT_BOX return tag.toString(); } - renderColumnSelectedBox(colList) { + renderSelectedBox(dataList) { var tag = new sb.StringBuilder(); tag.appendFormatLine('
', APP_SELECT_BOX, 'right', APP_DROPPABLE, 'no-selection'); - // get col data and make draggable items - colList && colList.forEach((col, idx) => { - // col.array parsing - var colInfo = vpCommon.safeString(col.array); - // render column box - tag.appendFormatLine('
{8}
' - , APP_SELECT_ITEM, APP_DRAGGABLE, 'added', col.location, col.value, col.dtype, col.code, col.label + ': \n' + colInfo, col.label); + // get data and make draggable items + dataList && dataList.forEach((data, idx) => { + // for column : data.array parsing + var info = vpCommon.safeString(data.array); + if (info) { + info = data.value + ':\n'; + } else { + info = ''; + } + // render item box + tag.appendFormatLine('
{8}
' + , APP_SELECT_ITEM, APP_DRAGGABLE, 'added', data.location, data.value, data.type, data.code, info, data.value); }); tag.appendLine('
'); // APP_SELECT_BOX return tag.toString(); @@ -184,22 +268,22 @@ define([ bindEvent() { var that = this; - // item indexing - search columns + // item indexing - search $(this._wrapSelector('.' + APP_SELECT_SEARCH)).on('change', function(event) { var searchValue = $(this).val(); - // filter added columns + // filter added items var addedTags = $(that._wrapSelector('.' + APP_SELECT_RIGHT + ' .' + APP_SELECT_ITEM + '.added')); - var addedColumnList = []; + var addedList = []; for (var i = 0; i < addedTags.length; i++) { var value = $(addedTags[i]).attr('data-colname'); - addedColumnList.push(value); + addedList.push(value); } - var filteredColumnList = that.columnList.filter(x => x.value.includes(searchValue) && !addedColumnList.includes(x.value)); + var filteredList = that.dataList.filter(x => x.value.includes(searchValue) && !addedList.includes(x.value)); - // column indexing + // items indexing $(that._wrapSelector('.' + APP_SELECT_BOX + '.left')).replaceWith(function() { - return that.renderColumnSelectionBox(filteredColumnList); + return that.renderSelectionBox(filteredList); }); // draggable @@ -390,7 +474,7 @@ define([ } } - return ColumnSelector; + return MultiSelector; }); /* End of file */ \ No newline at end of file diff --git a/src/common/constant.js b/src/common/constant.js index cacf0795..499832fb 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -48,7 +48,7 @@ define ([ * toolbar btn properties */ const TOOLBAR_BTN_INFO = { - HELP: "Visual Python 1.1.13" + HELP: "Visual Python 1.1.14" // , ICON: "fa-angellist" , ICON: "vp-main-icon" , ID: "vpBtnToggle" diff --git a/src/common/kernelApi.js b/src/common/kernelApi.js index 52ab23a7..9b9ac769 100644 --- a/src/common/kernelApi.js +++ b/src/common/kernelApi.js @@ -69,6 +69,14 @@ define([ }); } + var getCommonColumnList = function(dataframeList, callback) { + executePython( + vpCommon.formatString('_vp_print(_vp_get_multi_columns_list([{0}]))', dataframeList.join(',')) + , function(result) { + callback(result); + }); + } + var getRowList = function(dataframe, callback) { executePython( vpCommon.formatString('_vp_print(_vp_get_rows_list({0}))', dataframe) @@ -87,6 +95,7 @@ define([ executePython: executePython, searchVarList: searchVarList, getColumnList: getColumnList, + getCommonColumnList: getCommonColumnList, getRowList: getRowList, getProfilingList: getProfilingList } diff --git a/src/common/vpBind.js b/src/common/vpBind.js new file mode 100644 index 00000000..2c7a0482 --- /dev/null +++ b/src/common/vpBind.js @@ -0,0 +1,1036 @@ +/* + * Project Name : Visual Python + * Description : GUI-based Python code generator + * File Name : vpBind.js + * Author : Black Logic + * Note : Bind app + * License : GNU GPLv3 with Visual Python special exception + * Date : 2021. 10. 05 + * Change Date : + */ + +//============================================================================ +// Define constant +//============================================================================ +define([ + 'nbextensions/visualpython/src/common/constant', + 'nbextensions/visualpython/src/common/StringBuilder', + 'nbextensions/visualpython/src/common/vpCommon', + 'nbextensions/visualpython/src/common/kernelApi', + 'nbextensions/visualpython/src/common/component/vpMultiSelector', + + 'codemirror/lib/codemirror', + 'codemirror/mode/python/python', + 'notebook/js/codemirror-ipython', + 'codemirror/addon/display/placeholder', + 'codemirror/addon/display/autorefresh' +], function (vpConst, sb, vpCommon, kernelApi, vpMultiSelector, codemirror) { + + //======================================================================== + // Define variable + //======================================================================== + const APP_PREFIX = 'vp-pp'; + const APP_CONTAINER = APP_PREFIX + '-container'; + const APP_TITLE = APP_PREFIX + '-title'; + const APP_CLOSE = APP_PREFIX + '-close'; + const APP_BODY = APP_PREFIX + '-body'; + + const APP_BUTTON = APP_PREFIX + '-btn'; + const APP_PREVIEW_BOX = APP_PREFIX + '-preview-box'; + const APP_BUTTON_BOX = APP_PREFIX + '-btn-box'; + const APP_BUTTON_PREVIEW = APP_PREFIX + '-btn-preview'; + const APP_BUTTON_CANCEL = APP_PREFIX + '-btn-cancel'; + const APP_BUTTON_RUNADD = APP_PREFIX + '-btn-runadd'; + const APP_BUTTON_RUN = APP_PREFIX + '-btn-run'; + const APP_BUTTON_DETAIL = APP_PREFIX + '-btn-detail'; + const APP_DETAIL_BOX = APP_PREFIX + '-detail-box'; + const APP_DETAIL_ITEM = APP_PREFIX + '-detail-item'; + + const APP_POPUP_BOX = APP_PREFIX + '-popup-box'; + const APP_POPUP_CLOSE = APP_PREFIX + '-popup-close'; + const APP_POPUP_BODY = APP_PREFIX + '-popup-body'; + const APP_POPUP_BUTTON_BOX = APP_PREFIX + '-popup-button-box'; + const APP_POPUP_CANCEL = APP_PREFIX + '-popup-cancel'; + const APP_POPUP_OK = APP_PREFIX + '-popup-ok'; + + + //======================================================================== + // [CLASS] Bind + //======================================================================== + class Bind { + /** + * constructor + * @param {object} pageThis + * @param {string} targetId + */ + constructor(pageThis, targetId) { + this.pageThis = pageThis; + this.targetId = targetId; + this.uuid = 'u' + vpCommon.getUUID(); + + this.previewOpened = false; + this.codepreview = undefined; + + this.howList = [ + { label: 'Inner', value: 'inner' }, + { label: 'Outer', value: 'outer' }, + { label: 'Left', value: 'left' }, + { label: 'Right', value: 'right' }, + { label: 'Cross', value: 'cross' }, + ] + } + + //==================================================================== + // Internal call function + //==================================================================== + /** + * Wrap Selector for data selector popup with its uuid + * @param {string} query + */ + _wrapSelector(query = '') { + return vpCommon.formatString('.{0}.{1} {2}', APP_PREFIX, this.uuid, query); + } + + _setPreview() { + + } + + _loadState(state) { + var { + type, concat, merge, allocateTo, resetIndex + } = state; + + // type + $(this._wrapSelector('#vp_bdType')).val(type); + + if (type == 'concat') { + // load concat state + this._loadSelectorInput(this._wrapSelector('#vp_bdVariable'), concat.variable); + $(this._wrapSelector('#vp_bdJoin')).val(concat.join); + $(this._wrapSelector('#vp_bdAxis')).val(concat.axis); + $(this._wrapSelector('#vp_bdSort')).val(concat.sort?'yes':'no'); + } else { + // load merge state + $(this._wrapSelector('#vp_bdLeftDataframe')).val(merge.left.variable); + $(this._wrapSelector('#vp_mpRightDataframe')).val(merge.right.variable); + + $(this._wrapSelector('#vp_bdHow')).val(merge.how); + this._loadSelectorInput(this._wrapSelector('#vp_bdOn'), merge.on); + if (on && on.length > 0) { + $(this._wrapSelector('#vp_bdLeftOnSelect')).attr('disabled', true); + $(this._wrapSelector('#vp_bdRightOnSelect')).attr('disabled', true); + } + this._loadSelectorInput(this._wrapSelector('#vp_bdLeftOn'), merge.left.on); + this._loadSelectorInput(this._wrapSelector('#vp_bdRightOn'), merge.right.on); + if (merge.left.on.length > 0 || merge.right.on.length > 0) { + $(this._wrapSelector('#vp_bdOnSelect')).attr('disabled', true); + } + + $(this._wrapSelector('#vp_bdLeftIndex')).prop('checked', merge.left.useIndex); + $(this._wrapSelector('#vp_bdRightIndex')).prop('checked', merge.right.useIndex); + + $(this._wrapSelector('#vp_bdLeftSuffix')).val(merge.left.suffix); + $(this._wrapSelector('#vp_bdRightSuffix')).val(merge.right.suffix); + } + $(this._wrapSelector('#vp_bdAllocateTo')).val(allocateTo); + $(this._wrapSelector('#vp_bdResetIndex')).prop('checked', resetIndex); + } + + _loadSelectorInput(tag, dataList) { + $(tag).val(dataList.map(data=>data.code).join(',')); + $(tag).data('list', dataList) + } + + _saveState() { + + } + + //==================================================================== + // External call function + //==================================================================== + open(config={}) { + this.config = { + ...this.config, + ...config + } + + this.init(this.config.state); + $(this._wrapSelector()).show(); + + // load state + if (this.config.state) { + this._loadState(this.config.state); + } + } + + close() { + this.unbindEvent(); + $(this._wrapSelector()).remove(); + } + + init(state = undefined) { + this.state = { + type: 'concat', + concat: { + variable: [], // DataFrame, Series + join: 'outer', + axis: 0, // 0: index, 1: column + sort: false + }, + merge: { + left: { + variable: '', + on: [], + useIndex: false, + suffix: '' + }, + right: { + variable: '', + on: [], + useIndex: false, + suffix: '' + }, + on: [], + how: 'inner', + }, + allocateTo: '', + resetIndex: false + } + this.popup = { + type: '', + targetSelector: '', + MultiSelector: undefined + } + + // load state + if (state) { + this.state = { + ...this.state, + ...state + }; + } + + this.bindEvent(); + this.render(); + vpCommon.loadCssForDiv(this._wrapSelector(), Jupyter.notebook.base_url + vpConst.BASE_PATH + vpConst.STYLE_PATH + 'common/popupPage.css'); + vpCommon.loadCssForDiv(this._wrapSelector(), Jupyter.notebook.base_url + vpConst.BASE_PATH + vpConst.STYLE_PATH + 'common/bind.css'); + + this.loadVariableList(); + } + + render() { + var page = new sb.StringBuilder(); + page.appendFormatLine('
', APP_PREFIX, this.uuid); + page.appendFormatLine('
', APP_CONTAINER, 'vp-bd-container'); + + // popup + page.appendLine(this.renderInnerPopup()); + + // title + page.appendFormat('
{1}
', + APP_TITLE, 'Bind'); + + // close button + page.appendFormatLine('
', + APP_CLOSE, '/nbextensions/visualpython/resource/close_big.svg'); + + // body start + page.appendFormatLine('
', APP_BODY); + page.appendFormatLine('
', 'vp-bd-grid-box'); + // bind type : concat merge + page.appendLine('
'); + page.appendFormatLine('', 'vp_bdType', 'vp-orange-text wp100', 'Bind type'); + page.appendFormatLine(''); + page.appendLine('
'); + // divider + page.appendLine('
'); + + // concat box + page.appendLine(this.renderConcatBox()); + // merge box + page.appendLine(this.renderMergeBox()); + + // divider + page.appendLine('
'); + // allocate to + page.appendLine('
'); + page.appendFormatLine('', 'vp_bdAllocateTo', 'wp100', 'Allocate to'); + page.appendFormatLine('', 'vp_bdAllocateTo', 'New variable name'); + // reset index + page.appendFormatLine('', 'vp_bdResetIndex', 'reset index'); + page.appendLine('
'); + + page.appendLine('
'); // vp-bd-grid-box + page.appendLine('
'); // APP_BODY + + // preview box + page.appendFormatLine('
', APP_PREVIEW_BOX, 'vp-apiblock-scrollbar'); + page.appendFormatLine('', 'vp_codePreview'); + page.appendLine('
'); + + // button box + page.appendFormatLine('
', APP_BUTTON_BOX); + page.appendFormatLine('' + , 'vp-button', APP_BUTTON, APP_BUTTON_PREVIEW, 'Code view'); + page.appendFormatLine('' + , 'vp-button cancel', APP_BUTTON, APP_BUTTON_CANCEL, 'Cancel'); + page.appendFormatLine('
', APP_BUTTON_RUNADD); + page.appendFormatLine('' + , 'vp-button activated', APP_BUTTON_RUN, 'Apply to Board & Run Cell', 'Run'); + page.appendFormatLine('' + , 'vp-button activated', APP_BUTTON_DETAIL, '/nbextensions/visualpython/resource/arrow_short_up.svg'); + page.appendFormatLine('
', APP_DETAIL_BOX, 'vp-cursor'); + page.appendFormatLine('
{3}
', APP_DETAIL_ITEM, 'apply', 'Apply to Board', 'Apply'); + page.appendFormatLine('
{3}
', APP_DETAIL_ITEM, 'add', 'Apply to Board & Add Cell', 'Add'); + page.appendLine('
'); // APP_DETAIL_BOX + page.appendLine('
'); // APP_BUTTON_RUNADD + page.appendLine('
'); // APP_BUTTON_BOX + + + page.appendLine('
'); // APP_CONTAINER + page.appendLine('
'); // APPS + + $('#vp-wrapper').append(page.toString()); + $(this._wrapSelector()).hide(); + } + + renderConcatBox() { + var page = new sb.StringBuilder(); + // concat box + page.appendFormatLine('
', 'vp-bd-type-box', 'concat', this.state.type=='concat'?'':'style="display: none;"'); + // variable + page.appendLine('
'); + page.appendFormatLine('', 'vp_bdVariable', 'vp-orange-text wp100', 'Variable'); + page.appendFormatLine('', 'vp_bdVariable', 'Variable'); + page.appendFormatLine('', 'vp_bdVariableSelect', 'vp-button wp50', 'Edit'); + page.appendLine('
'); + // join + page.appendLine('
'); + page.appendFormatLine('', 'vp_bdJoin', 'wp100', 'Join'); + page.appendFormatLine(''); + page.appendLine(''); + page.appendLine('
'); + // axis + page.appendLine('
'); + page.appendFormatLine('', 'vp_bdAxis', 'wp100', 'Axis'); + page.appendFormatLine(''); + page.appendLine('
'); + // sort + page.appendLine('
'); + page.appendFormatLine('', 'vp_bdSort', 'wp100', 'Sort'); + page.appendFormatLine(''); + page.appendLine('
'); + page.appendLine('
'); // vp-bd-type-box concat + return page.toString(); + } + + renderMergeBox() { + var page = new sb.StringBuilder(); + // merge box + page.appendFormatLine('
', 'vp-bd-type-box', 'merge', this.state.type=='merge'?'':'style="display: none;"'); + // left dataframe + page.appendLine('
'); + page.appendFormatLine('', 'vp_bdLeftDataframe', 'vp-orange-text wp100', 'Left Dataframe'); + page.appendFormatLine(''); + page.appendFormatLine('
', 'vp-bd-df-refresh', 'Refresh all dataframe list', '/nbextensions/visualpython/resource/refresh.svg'); + page.appendLine('
'); + // right dataframe + page.appendLine('
'); + page.appendFormatLine('', 'vp_bdRightDataframe', 'vp-orange-text wp100', 'Right Dataframe'); + page.appendFormatLine(''); + page.appendLine('
'); + // divider + page.appendLine('
'); + // how + page.appendLine('
'); + page.appendFormatLine('', 'vp_bdHow', 'wp100', 'How'); + page.appendFormatLine(''); + page.appendLine('
'); + // on + page.appendLine('
'); + page.appendFormatLine('', 'vp_bdOn', 'wp100', 'On'); + page.appendFormatLine('', 'vp_bdOn', 'Merge key'); + page.appendFormatLine('', 'vp_bdOnSelect', 'vp-button wp50', 'Edit'); + page.appendLine('
'); + // left on + page.appendLine('
'); + page.appendFormatLine('', 'vp_bdLeftOn', 'wp100', 'Left on'); + page.appendFormatLine('', 'vp_bdLeftOn', 'Left key'); + page.appendFormatLine('', 'vp_bdLeftOnSelect', 'vp-button wp50', 'Edit'); + // left use index + page.appendFormatLine('', 'vp_bdLeftIndex', 'use index'); + page.appendLine('
'); + // right on + page.appendLine('
'); + page.appendFormatLine('', 'vp_bdRightOn', 'wp100', 'Right on'); + page.appendFormatLine('', 'vp_bdRightOn', 'Right key'); + page.appendFormatLine('', 'vp_bdRightOnSelect', 'vp-button wp50', 'Edit'); + // right use index + page.appendFormatLine('', 'vp_bdRightIndex', 'use index'); + page.appendLine('
'); + // suffixes + page.appendLine('
'); + page.appendFormatLine('', 'wp100', 'Suffixes'); + page.appendFormatLine('', 'vp_bdLeftSuffix', 'Left suffix'); + page.appendFormatLine('', 'vp_bdRightSuffix', 'Right suffix'); + page.appendLine('
'); + page.appendLine('
'); // vp-bd-type-box merge + return page.toString(); + } + + /** + * Render variable list (for dataframe) + * @param {Array} varList + * @param {string} defaultValue previous value + */ + renderVariableList(id, varList, defaultValue='') { + var tag = new sb.StringBuilder(); + tag.appendFormatLine(''); // VP_VS_VARIABLES + return tag.toString(); + } + + /** + * Render inner popup for selecting columns + * @returns Inner popup page dom + */ + renderInnerPopup() { + var page = new sb.StringBuilder(); + page.appendFormatLine(''); // End of Popup + return page.toString(); + } + + /** + * Open Inner popup page for variable selection + * @param {Object} targetSelector + */ + openVariablePopup(targetSelector) { + this.popup.targetSelector = targetSelector; + var previousList = this.popup.targetSelector.data('list'); + if (previousList) { + previousList = previousList.map(data => data.code) + } + this.popup.MultiSelector = new vpMultiSelector( + this._wrapSelector('.' + APP_POPUP_BODY), + { mode: 'variable', type: ['DataFrame', 'Series'], selectedList: previousList } + ); + + // set title + $(this._wrapSelector('.' + APP_POPUP_BOX + ' .' + APP_TITLE)).text('Select variables'); + + // show popup box + $(this._wrapSelector('.' + APP_POPUP_BOX)).show(); + } + + /** + * Open Inner popup page for column selection + * @param {Array} targetVariable + * @param {Object} targetSelector + * @param {string} title + */ + openColumnPopup(targetVariable, targetSelector, title='Select Columns') { + this.popup.targetVariable = targetVariable; + this.popup.targetSelector = targetSelector; + var previousList = this.popup.targetSelector.data('list'); + if (previousList) { + previousList = previousList.map(col => col.code) + } + + this.popup.MultiSelector = new vpMultiSelector( + this._wrapSelector('.' + APP_POPUP_BODY), + { mode: 'columns', parent: targetVariable, selectedList: previousList } + ); + + // set title + $(this._wrapSelector('.' + APP_POPUP_BOX + ' .' + APP_TITLE)).text(title); + + // show popup box + $(this._wrapSelector('.' + APP_POPUP_BOX)).show(); + } + + /** + * Close Inner popup page + */ + closeInnerPopup() { + $(this._wrapSelector('.' + APP_POPUP_BOX)).hide(); + } + + /** + * Load variable list (dataframe) + */ + loadVariableList() { + var that = this; + // load using kernel + var dataTypes = ['DataFrame']; + kernelApi.searchVarList(dataTypes, function(result) { + try { + var varList = JSON.parse(result); + // render variable list + // get prevvalue + var prevValue = that.state.merge.left.variable; + // replace + $(that._wrapSelector('#vp_bdLeftDataframe')).replaceWith(function() { + return that.renderVariableList('vp_bdLeftDataframe', varList, prevValue); + }); + $(that._wrapSelector('#vp_bdLeftDataframe')).trigger('change'); + + prevValue = that.state.merge.right.variable; + $(that._wrapSelector('#vp_bdRightDataframe')).replaceWith(function() { + return that.renderVariableList('vp_bdRightDataframe', varList, prevValue); + }); + $(that._wrapSelector('#vp_bdRightDataframe')).trigger('change'); + } catch (ex) { + console.log('Bind:', result); + } + }); + } + + unbindEvent() { + $(document).unbind(vpCommon.formatString(".{0} .{1}", this.uuid, APP_BODY)); + + $(document).off('change', this._wrapSelector('#vp_bdType')); + + $(document).off('change', this._wrapSelector('#vp_bdVariable')); + $(document).off('click', this._wrapSelector('#vp_bdVariableSelect')); + $(document).off('change', this._wrapSelector('#vp_bdJoin')); + $(document).off('change', this._wrapSelector('#vp_bdAxis')); + $(document).off('change', this._wrapSelector('#vp_bdSort')); + + $(document).off('change', this._wrapSelector('#vp_bdLeftDataframe')); + $(document).off('change', this._wrapSelector('#vp_bdRightDataframe')); + $(document).off('click', this._wrapSelector('.vp-bd-df-refresh')); + $(document).off('change', this._wrapSelector('#vp_bdHow')); + $(document).off('change', this._wrapSelector('#vp_bdOn')); + $(document).off('click', this._wrapSelector('#vp_bdOnSelect')); + $(document).off('change', this._wrapSelector('#vp_bdLeftOn')); + $(document).off('click', this._wrapSelector('#vp_bdLeftOnSelect')); + $(document).off('change', this._wrapSelector('#vp_gbLeftIndex')); + $(document).off('change', this._wrapSelector('#vp_bdRightOn')); + $(document).off('click', this._wrapSelector('#vp_bdRightOnSelect')); + $(document).off('change', this._wrapSelector('#vp_gbRightIndex')); + $(document).off('change', this._wrapSelector('#vp_bdLeftSuffix')); + $(document).off('change', this._wrapSelector('#vp_bdRightSuffix')); + $(document).off('change', this._wrapSelector('#vp_bdAllocateTo')); + $(document).off('change', this._wrapSelector('#vp_bdResetIndex')); + + + $(document).off('click', this._wrapSelector('.' + APP_CLOSE)); + $(document).off('click', this._wrapSelector('.' + APP_BUTTON_PREVIEW)); + $(document).off('click', this._wrapSelector('.' + APP_BUTTON_CANCEL)); + $(document).off('click', this._wrapSelector('.' + APP_BUTTON_RUN)); + $(document).off('click', this._wrapSelector('.' + APP_BUTTON_DETAIL)); + $(document).off('click', this._wrapSelector('.' + APP_DETAIL_ITEM)); + $(document).off('click.' + this.uuid); + + $(document).off('keydown.' + this.uuid); + $(document).off('keyup.' + this.uuid); + + // popup box events + $(document).off('click', this._wrapSelector('.' + APP_POPUP_OK)); + $(document).off('click', this._wrapSelector('.' + APP_POPUP_CANCEL)); + $(document).off('click', this._wrapSelector('.' + APP_POPUP_CLOSE)); + } + + bindEvent() { + var that = this; + //==================================================================== + // User operation Events + //==================================================================== + $(document).on('change', this._wrapSelector('#vp_bdType'), function() { + var type = $(this).val(); + that.state.type = type; + if (type == 'concat') { + $(that._wrapSelector('.vp-bd-type-box.concat')).show(); + $(that._wrapSelector('.vp-bd-type-box.merge')).hide(); + } else { + $(that._wrapSelector('.vp-bd-type-box.merge')).show(); + $(that._wrapSelector('.vp-bd-type-box.concat')).hide(); + } + }); + + //==================================================================== + // Concat box Events + //====================================================================\ + // variable change event + $(document).on('change', this._wrapSelector('#vp_bdVariable'), function(event) { + var varList = event.dataList; + that.state.concat.variable = varList; + }); + + // variable select button event + $(document).on('click', this._wrapSelector('#vp_bdVariableSelect'), function() { + that.openVariablePopup($(that._wrapSelector('#vp_bdVariable'))); + }); + + // join + $(document).on('change', this._wrapSelector('#vp_bdJoin'), function() { + that.state.concat.join = $(this).val(); + }); + + // axis + $(document).on('change', this._wrapSelector('#vp_bdAxis'), function() { + that.state.concat.axis = $(this).val(); + }); + + // sort + $(document).on('change', this._wrapSelector('#vp_bdSort'), function() { + that.state.concat.sort = $(this).val() == 'yes'; + }); + + //==================================================================== + // Merge box Events + //==================================================================== + // Left variable change event + $(document).on('change', this._wrapSelector('#vp_bdLeftDataframe'), function() { + // if variable changed, clear groupby, display + var newVal = $(this).val(); + if (newVal != that.state.merge.left.variable) { + $(that._wrapSelector('#vp_bdOn')).val(''); + $(that._wrapSelector('#vp_bdLeftOn')).val(''); + that.state.merge.left.variable = newVal; + that.state.merge.left.on = []; + that.state.merge.on = []; + } + }); + // Right variable change event + $(document).on('change', this._wrapSelector('#vp_bdRightDataframe'), function() { + // if variable changed, clear groupby, display + var newVal = $(this).val(); + if (newVal != that.state.merge.right.variable) { + $(that._wrapSelector('#vp_bdOn')).val(''); + $(that._wrapSelector('#vp_bdRightOn')).val(''); + that.state.merge.right.variable = newVal; + that.state.merge.right.on = []; + that.state.merge.on = []; + } + }); + + // variable refresh event + $(document).on('click', this._wrapSelector('.vp-bd-df-refresh'), function() { + that.loadVariableList(); + }); + + // how + $(document).on('change', this._wrapSelector('#vp_bdHow'), function() { + that.state.merge.how = $(this).val(); + }); + + // on change event + $(document).on('change', this._wrapSelector('#vp_bdOn'), function(event) { + var colList = event.dataList; + that.state.merge.on = colList; + + if (colList && colList.length > 0) { + $(that._wrapSelector('#vp_bdLeftOnSelect')).attr('disabled', true); + $(that._wrapSelector('#vp_bdRightOnSelect')).attr('disabled', true); + } else { + $(that._wrapSelector('#vp_bdLeftOnSelect')).attr('disabled', false); + $(that._wrapSelector('#vp_bdRightOnSelect')).attr('disabled', false); + } + }); + + // on select button event + $(document).on('click', this._wrapSelector('#vp_bdOnSelect'), function() { + var targetVariable = [ that.state.merge.left.variable, that.state.merge.right.variable ]; + that.openColumnPopup(targetVariable, $(that._wrapSelector('#vp_bdOn')), 'Select columns from both dataframe'); + }); + + // Left on change event + $(document).on('change', this._wrapSelector('#vp_bdLeftOn'), function(event) { + var colList = event.dataList; + that.state.merge.left.on = colList; + + if ((colList && colList.length > 0) + || that.state.merge.right.on && that.state.merge.right.on.length > 0) { + $(that._wrapSelector('#vp_bdOnSelect')).attr('disabled', true); + } else { + $(that._wrapSelector('#vp_bdOnSelect')).attr('disabled', false); + } + }); + + // Left on select button event + $(document).on('click', this._wrapSelector('#vp_bdLeftOnSelect'), function() { + var targetVariable = [ that.state.merge.left.variable ]; + that.openColumnPopup(targetVariable, $(that._wrapSelector('#vp_bdLeftOn')), 'Select columns from left dataframe'); + }); + + // Left use index + $(document).on('change', this._wrapSelector('#vp_bdLeftIndex'), function() { + var useIndex = $(this).prop('checked'); + that.state.merge.left.useIndex = useIndex; + + if (useIndex || that.state.merge.right.useIndex) { + $(that._wrapSelector('#vp_bdOnSelect')).attr('disabled', true); + } else { + $(that._wrapSelector('#vp_bdOnSelect')).attr('disabled', false); + } + }); + + // Right on change event + $(document).on('change', this._wrapSelector('#vp_bdRightOn'), function(event) { + var colList = event.dataList; + that.state.merge.right.on = colList; + + if ((colList && colList.length > 0) + || that.state.merge.left.on && that.state.merge.left.on.length > 0) { + $(that._wrapSelector('#vp_bdOnSelect')).attr('disabled', true); + } else { + $(that._wrapSelector('#vp_bdOnSelect')).attr('disabled', false); + } + }); + + // Right on select button event + $(document).on('click', this._wrapSelector('#vp_bdRightOnSelect'), function() { + var targetVariable = [ that.state.merge.right.variable ]; + that.openColumnPopup(targetVariable, $(that._wrapSelector('#vp_bdRightOn')), 'Select columns from right dataframe'); + }); + + // Right use index + $(document).on('change', this._wrapSelector('#vp_bdRightIndex'), function() { + var useIndex = $(this).prop('checked'); + that.state.merge.right.useIndex = useIndex; + + if (useIndex || that.state.merge.left.useIndex) { + $(that._wrapSelector('#vp_bdOnSelect')).attr('disabled', true); + } else { + $(that._wrapSelector('#vp_bdOnSelect')).attr('disabled', false); + } + }); + + // Left suffix change event + $(document).on('change', this._wrapSelector('#vp_bdLeftSuffix'), function() { + that.state.merge.left.suffix = $(this).val(); + }); + + // Right suffix change event + $(document).on('change', this._wrapSelector('#vp_bdRightSuffix'), function() { + that.state.merge.right.suffix = $(this).val(); + }); + + // allocateTo event + $(document).on('change', this._wrapSelector('#vp_bdAllocateTo'), function() { + that.state.allocateTo = $(this).val(); + }); + + // reset index checkbox event + $(document).on('change', this._wrapSelector('#vp_bdResetIndex'), function() { + that.state.resetIndex = $(this).prop('checked'); + }); + + //================================================================ + // Page operation Events + //================================================================ + // close popup + $(document).on('click', this._wrapSelector('.' + APP_CLOSE), function(event) { + that.close(); + }); + + // click preview + $(document).on('click', this._wrapSelector('.' + APP_BUTTON_PREVIEW), function(evt) { + evt.stopPropagation(); + if (that.previewOpened) { + that.closePreview(); + } else { + that.openPreview(); + } + }); + + // click cancel + $(document).on('click', this._wrapSelector('.' + APP_BUTTON_CANCEL), function() { + that.close(); + }); + + // click run + $(document).on('click', this._wrapSelector('.' + APP_BUTTON_RUN), function() { + that.apply(true, true); + that.close(); + }); + + // click detail button + $(document).on('click', this._wrapSelector('.' + APP_BUTTON_DETAIL), function(evt) { + evt.stopPropagation(); + $(that._wrapSelector('.' + APP_DETAIL_BOX)).show(); + }); + + // click add / apply + $(document).on('click', this._wrapSelector('.' + APP_DETAIL_ITEM), function() { + var type = $(this).data('type'); + if (type == 'add') { + that.apply(true); + that.close(); + } else if (type == 'apply') { + that.apply(); + that.close(); + } + }); + + // click other + $(document).on('click.' + this.uuid, function(evt) { + if (!$(evt.target).hasClass(APP_BUTTON_DETAIL)) { + $(that._wrapSelector('.' + APP_DETAIL_BOX)).hide(); + } + if (!$(evt.target).hasClass(APP_BUTTON_PREVIEW) + && !$(evt.target).hasClass(APP_PREVIEW_BOX) + && $(that._wrapSelector('.' + APP_PREVIEW_BOX)).has(evt.target).length === 0) { + that.closePreview(); + } + }); + + //================================================================ + // Popup box Events + //================================================================ + // ok input popup + $(document).on('click', this._wrapSelector('.' + APP_POPUP_OK), function() { + // ok input popup + var dataList = that.popup.MultiSelector.getDataList(); + + $(that.popup.targetSelector).val(dataList.map(data => { return data.code }).join(',')); + $(that.popup.targetSelector).data('list', dataList); + $(that.popup.targetSelector).trigger({ type: 'change', dataList: dataList }); + that.closeInnerPopup(); + }); + + // cancel input popup + $(document).on('click', this._wrapSelector('.' + APP_POPUP_CANCEL), function() { + that.closeInnerPopup(); + }); + + // close input popup + $(document).on('click', this._wrapSelector('.' + APP_POPUP_CLOSE), function() { + that.closeInnerPopup(); + }); + } + + apply(addCell=false, runCell=false) { + var code = this.generateCode(); + + // save state for block + this._saveState(); + + if (this.pageThis) { + $(this.pagethis._wrapSelector('#' + this.targetId)).val(code); + $(this.pagethis._wrapSelector('#' + this.targetId)).trigger({ + type: 'apps_run', + title: 'Bind', + code: code, + state: this.state, + addCell: addCell, + runCell: runCell + }); + } else { + $(vpCommon.wrapSelector('#' + this.targetId)).val(code); + $(vpCommon.wrapSelector('#' + this.targetId)).trigger({ + type: 'apps_run', + title: 'Bind', + code: code, + state: this.state, + addCell: addCell, + runCell: runCell + }); + } + } + + /** + * Generate code + * @returns generatedCode + */ + generateCode() { + var code = new sb.StringBuilder(); + var { + type, concat, merge, allocateTo, resetIndex + } = this.state; + + //==================================================================== + // Allocation + //==================================================================== + if (allocateTo && allocateTo != '') { + code.appendFormat('{0} = ', allocateTo); + } + + //==================================================================== + // Dataframe variables + //==================================================================== + code.appendFormat('pd.{0}(', type); + + if (type == 'concat') { + //==================================================================== + // Concat + //==================================================================== + // FIXME: consider default + code.appendFormat("[{0}], join='{1}', axis={2}", concat.variable.map(data=>data.code).join(','), concat.join, concat.axis); + + //==================================================================== + // Sort + //==================================================================== + if (concat.sort) { + code.append(', sort=True'); + } + + //==================================================================== + // Reset index + //==================================================================== + if (resetIndex) { + code.append(', ignore_index=True'); + } + + code.append(')'); + } else { + //==================================================================== + // Merge + //==================================================================== + code.appendFormat('{0}, {1}', merge.left.variable, merge.right.variable); + + if (merge.on && merge.on.length > 0) { + //================================================================ + // On columns + //================================================================ + code.appendFormat(', on=[{0}]', on.map(col => col.code)); + } else { + //==================================================================== + // Left & Right On columns + //==================================================================== + if (merge.left.useIndex) { + code.append(', left_index=True'); + } else { + if (merge.left.on && merge.left.on.length > 0) { + code.appendFormat(', left_on=[{0}]', merge.left.on.map(col => col.code)); + } + } + + if (merge.right.useIndex) { + code.append(', right_index=True'); + } else { + if (merge.right.on && merge.right.on.length > 0) { + code.appendFormat(', right_on=[{0}]', merge.right.on.map(col => col.code)); + } + } + } + //==================================================================== + // How + //==================================================================== + if (merge.how) { + code.appendFormat(", how='{0}'", merge.how); + } + + //==================================================================== + // Suffixes + //==================================================================== + if (merge.left.suffix != '' || merge.right.suffix != '') { + code.appendFormat(", suffixes=('{0}', '{1}')", merge.left.suffix, merge.right.suffix); + } + + code.append(')'); + + //==================================================================== + // Reset index + //==================================================================== + if (resetIndex) { + code.append('.reset_index()'); + } + } + + if (allocateTo && allocateTo != '') { + code.appendLine(); + code.append(allocateTo); + } + + return code.toString(); + } + + /** + * Open preview box + */ + openPreview() { + $(this._wrapSelector('.' + APP_PREVIEW_BOX)).show(); + + if (!this.codepreview) { + // codemirror setting + this.codepreview = codemirror.fromTextArea($(this._wrapSelector('#vp_codePreview'))[0], { + mode: { + name: 'python', + version: 3, + singleLineStringErrors: false + }, // text-cell(markdown cell) set to 'htmlmixed' + height: '100%', + width: '100%', + indentUnit: 4, + matchBrackets: true, + readOnly:true, + autoRefresh: true, + theme: "ipython", + extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}, + scrollbarStyle: "null" + }); + } else { + this.codepreview.refresh(); + } + + // get current code + var code = this.generateCode(); + this.codepreview.setValue(code); + this.codepreview.save(); + + var that = this; + setTimeout(function() { + that.codepreview.refresh(); + },1); + + this.previewOpened = true; + } + + /** + * Close preview box + */ + closePreview() { + this.previewOpened = false; + $(this._wrapSelector('.' + APP_PREVIEW_BOX)).hide(); + } + } + + return Bind +}); /* function, define */ + +/* End of file */ \ No newline at end of file diff --git a/src/common/vpFrameEditor.js b/src/common/vpFrameEditor.js index 728eb8b4..e305b095 100644 --- a/src/common/vpFrameEditor.js +++ b/src/common/vpFrameEditor.js @@ -559,14 +559,9 @@ define([ content.appendLine(''); content.appendLine(''); content.appendFormatLine('', this.renderColumnList(this.state.columnList)); - content.appendLine(''); - var suggestInput = new vpSuggestInputText.vpSuggestInputText(); - suggestInput.setComponentID('vp_popupAddApply'); - suggestInput.addClass('vp-input vp-popup-apply-lambda'); - suggestInput.setSuggestList(function() { return ['x']; }); - suggestInput.setValue('x'); - suggestInput.setNormalFilter(false); - content.appendFormatLine('', suggestInput.toTagString()); + content.appendLine(''); + content.appendFormatLine('' + , 'vp_popupAddApply', 'vp-input vp-popup-apply-lambda', 'Type code manually'); content.appendLine('
{0}
{0}
'); content.appendLine(''); // end of vp-popup-tab apply content.appendLine(''); // end of vp-popup-addpage @@ -1084,7 +1079,7 @@ define([ } code.append(')'); } else if (tab == 'apply') { - code.appendFormat("{0}[{1}] = {2}[{3}].apply(lambda x: {4})", tempObj, name, tempObj, content.column, content.apply); + code.appendFormat("{0}[{1}] = {2}[{3}].apply({4})", tempObj, name, tempObj, content.column, content.apply); } break; case FRAME_EDIT_TYPE.ADD_ROW: diff --git a/src/common/vpGroupby.js b/src/common/vpGroupby.js index 45de38ab..8cab9a4d 100644 --- a/src/common/vpGroupby.js +++ b/src/common/vpGroupby.js @@ -17,14 +17,14 @@ define([ 'nbextensions/visualpython/src/common/StringBuilder', 'nbextensions/visualpython/src/common/vpCommon', 'nbextensions/visualpython/src/common/kernelApi', - 'nbextensions/visualpython/src/common/component/vpColumnSelector', + 'nbextensions/visualpython/src/common/component/vpMultiSelector', 'codemirror/lib/codemirror', 'codemirror/mode/python/python', 'notebook/js/codemirror-ipython', 'codemirror/addon/display/placeholder', 'codemirror/addon/display/autorefresh' -], function (vpConst, sb, vpCommon, kernelApi, vpColumnSelector, codemirror) { +], function (vpConst, sb, vpCommon, kernelApi, vpMultiSelector, codemirror) { //======================================================================== // Define variable @@ -305,7 +305,7 @@ define([ // groupby column page.appendLine('
'); page.appendFormatLine('', 'vp_gbBy', 'vp-orange-text wp80', 'Groupby'); - page.appendFormatLine('', 'vp_gbBy', 'Groupby coluns'); + page.appendFormatLine('', 'vp_gbBy', 'Groupby columns'); page.appendFormatLine('', 'vp_gbBySelect', 'vp-button wp50', 'Edit'); page.appendFormatLine('', 'vp_gbByGrouper', 'Grouper'); page.appendFormatLine(''); // end of df-box @@ -480,12 +479,15 @@ define([ } /** - * Render column selector using ColumnSelector module + * Render column selector using MultiSelector module * @param {Array} previousList previous selected columns * @param {Array} includeList columns to include */ - renderColumnSelector(previousList, includeList) { - this.popup.ColSelector = new vpColumnSelector(this._wrapSelector('.' + APP_POPUP_BODY), this.state.variable, previousList, includeList); + renderMultiSelector(previousList, includeList) { + this.popup.ColSelector = new vpMultiSelector( + this._wrapSelector('.' + APP_POPUP_BODY), + { mode: 'columns', parent: [this.state.variable], selectedList: previousList, includeList: includeList } + ); } /** @@ -539,7 +541,7 @@ define([ if (previousList) { previousList = previousList.map(col => col.code) } - this.renderColumnSelector(previousList, includeList); + this.renderMultiSelector(previousList, includeList); // set title $(this._wrapSelector('.' + APP_POPUP_BOX + ' .' + APP_TITLE)).text(title); @@ -660,6 +662,8 @@ define([ $(that._wrapSelector('#vp_gbBy')).val(''); $(that._wrapSelector('#vp_gbDisplay')).val(''); that.state.variable = newVal; + that.state.groupby = []; + that.state.display = []; } }); @@ -670,11 +674,11 @@ define([ // groupby change event $(document).on('change', this._wrapSelector('#vp_gbBy'), function(event) { - var colList = event.colList; + var colList = event.dataList; that.state.groupby = colList; if (colList && colList.length == 1 - && colList[0].dtype.includes('datetime')) { + && colList[0].type.includes('datetime')) { $(that._wrapSelector('#vp_gbByGrouper')).removeAttr('disabled'); } else { $(that._wrapSelector('#vp_gbByGrouper')).attr('disabled', true); @@ -710,7 +714,7 @@ define([ // display change event $(document).on('change', this._wrapSelector('#vp_gbDisplay'), function(event) { - var colList = event.colList; + var colList = event.dataList; that.state.display = colList; }); @@ -768,7 +772,7 @@ define([ // advanced item - column change event $(document).on('change', this._wrapSelector('.vp-gb-adv-col'), function(event) { - var colList = event.colList; + var colList = event.dataList; var idx = $(that._wrapSelector('.vp-gb-adv-col')).index(this); // if there's change, reset display namings @@ -927,11 +931,11 @@ define([ $(document).on('click', this._wrapSelector('.' + APP_POPUP_OK), function() { // ok input popup if (that.popup.type == 'column') { - var colList = that.popup.ColSelector.getColumnList(); + var dataList = that.popup.ColSelector.getDataList(); - $(that.popup.targetSelector).val(colList.map(col => { return col.code }).join(',')); - $(that.popup.targetSelector).data('list', colList); - $(that.popup.targetSelector).trigger({ type: 'change', colList: colList }); + $(that.popup.targetSelector).val(dataList.map(col => { return col.code }).join(',')); + $(that.popup.targetSelector).data('list', dataList); + $(that.popup.targetSelector).trigger({ type: 'change', dataList: dataList }); that.closeInnerPopup(); } else { var dict = {}; diff --git a/src/common/vpMerge.js b/src/common/vpMerge.js deleted file mode 100644 index acaf3e77..00000000 --- a/src/common/vpMerge.js +++ /dev/null @@ -1,353 +0,0 @@ -/* - * Project Name : Visual Python - * Description : GUI-based Python code generator - * File Name : vpMerge.js - * Author : Black Logic - * Note : Merge app - * License : GNU GPLv3 with Visual Python special exception - * Date : 2021. 10. 05 - * Change Date : - */ - -//============================================================================ -// Define constant -//============================================================================ -define([ - 'nbextensions/visualpython/src/common/constant', - 'nbextensions/visualpython/src/common/StringBuilder', - 'nbextensions/visualpython/src/common/vpCommon', - 'text!nbextensions/visualpython/css/common/popupPage.css', - - 'codemirror/lib/codemirror', - 'codemirror/mode/python/python', - 'notebook/js/codemirror-ipython', - 'codemirror/addon/display/placeholder', - 'codemirror/addon/display/autorefresh' -], function (vpConst, sb, vpCommon, appCss, codemirror) { - - //======================================================================== - // Define variable - //======================================================================== - const APP_PREFIX = 'vp-pp'; - const APP_CONTAINER = APP_PREFIX + '-container'; - const APP_TITLE = APP_PREFIX + '-title'; - const APP_CLOSE = APP_PREFIX + '-close'; - const APP_BODY = APP_PREFIX + '-body'; - - const APP_BUTTON = APP_PREFIX + '-btn'; - const APP_PREVIEW_BOX = APP_PREFIX + '-preview-box'; - const APP_BUTTON_BOX = APP_PREFIX + '-btn-box'; - const APP_BUTTON_PREVIEW = APP_PREFIX + '-btn-preview'; - const APP_BUTTON_CANCEL = APP_PREFIX + '-btn-cancel'; - const APP_BUTTON_RUNADD = APP_PREFIX + '-btn-runadd'; - const APP_BUTTON_RUN = APP_PREFIX + '-btn-run'; - const APP_BUTTON_DETAIL = APP_PREFIX + '-btn-detail'; - const APP_DETAIL_BOX = APP_PREFIX + '-detail-box'; - const APP_DETAIL_ITEM = APP_PREFIX + '-detail-item'; - - - //======================================================================== - // [CLASS] Merge - //======================================================================== - class Merge { - /** - * constructor - * @param {object} pageThis - * @param {string} targetId - */ - constructor(pageThis, targetId) { - this.pageThis = pageThis; - this.targetId = targetId; - this.uuid = 'u' + vpCommon.getUUID(); - - this.previewOpened = false; - this.codepreview = undefined; - } - - //==================================================================== - // Internal call function - //==================================================================== - /** - * Wrap Selector for data selector popup with its uuid - * @param {string} query - */ - _wrapSelector(query = '') { - return vpCommon.formatString('.{0}.{1} {2}', APP_PREFIX, this.uuid, query); - } - - _setPreview() { - - } - - _loadState(state) { - - } - - _saveState() { - - } - - //==================================================================== - // External call function - //==================================================================== - open(config={}) { - this.config = { - ...this.config, - ...config - } - - if (this.config.state) { - this.init(this.config.state); - } else { - this.init(); - } - $(this._wrapSelector()).show(); - - // load state - if (this.config.state) { - this._loadState(this.config.state); - } - } - - close() { - this.unbindEvent(); - $(this._wrapSelector()).remove(); - } - - init(state = undefined) { - this.state = { - - } - - // load state - if (state) { - this.state = { - ...this.state, - ...state - }; - } - - this.bindEvent(); - this.render(); - vpCommon.loadCssForDiv(this._wrapSelector(), Jupyter.notebook.base_url + vpConst.BASE_PATH + vpConst.STYLE_PATH + 'common/popupPage.css'); - vpCommon.loadCssForDiv(this._wrapSelector(), Jupyter.notebook.base_url + vpConst.BASE_PATH + vpConst.STYLE_PATH + 'common/merge.css'); - } - - render() { - var page = new sb.StringBuilder(); - page.appendFormatLine('
', APP_PREFIX, this.uuid); - page.appendFormatLine('
', APP_CONTAINER, 'vp-mg-container'); - - // title - page.appendFormat('
{1}
', - APP_TITLE, 'Merge'); - - // close button - page.appendFormatLine('
', - APP_CLOSE, '/nbextensions/visualpython/resource/close_big.svg'); - - // body start - page.appendFormatLine('
', APP_BODY); - // TODO: button - - page.appendLine('
'); // APP_BODY - - // preview box - page.appendFormatLine('
', APP_PREVIEW_BOX, 'vp-apiblock-scrollbar'); - page.appendFormatLine('', 'vp_codePreview'); - page.appendLine('
'); - - // button box - page.appendFormatLine('
', APP_BUTTON_BOX); - page.appendFormatLine('' - , 'vp-button', APP_BUTTON, APP_BUTTON_PREVIEW, 'Code view'); - page.appendFormatLine('' - , 'vp-button cancel', APP_BUTTON, APP_BUTTON_CANCEL, 'Cancel'); - page.appendFormatLine('
', APP_BUTTON_RUNADD); - page.appendFormatLine('' - , 'vp-button activated', APP_BUTTON_RUN, 'Apply to Board & Run Cell', 'Run'); - page.appendFormatLine('' - , 'vp-button activated', APP_BUTTON_DETAIL, '/nbextensions/visualpython/resource/arrow_short_up.svg'); - page.appendFormatLine('
', APP_DETAIL_BOX, 'vp-cursor'); - page.appendFormatLine('
{3}
', APP_DETAIL_ITEM, 'apply', 'Apply to Board', 'Apply'); - page.appendFormatLine('
{3}
', APP_DETAIL_ITEM, 'add', 'Apply to Board & Add Cell', 'Add'); - page.appendLine('
'); // APP_DETAIL_BOX - page.appendLine('
'); // APP_BUTTON_RUNADD - page.appendLine('
'); // APP_BUTTON_BOX - - - page.appendLine('
'); // APP_CONTAINER - page.appendLine('
'); // APPS - - $('#vp-wrapper').append(page.toString()); - $(this._wrapSelector()).hide(); - } - - unbindEvent() { - $(document).unbind(vpCommon.formatString(".{0} .{1}", this.uuid, APP_BODY)); - $(document).off('click', this._wrapSelector('.' + APP_CLOSE)); - $(document).off('click', this._wrapSelector('.' + APP_BUTTON_PREVIEW)); - $(document).off('click', this._wrapSelector('.' + APP_BUTTON_CANCEL)); - $(document).off('click', this._wrapSelector('.' + APP_BUTTON_RUN)); - $(document).off('click', this._wrapSelector('.' + APP_BUTTON_DETAIL)); - $(document).off('click', this._wrapSelector('.' + APP_DETAIL_ITEM)); - $(document).off('click.' + this.uuid); - - $(document).off('keydown.' + this.uuid); - $(document).off('keyup.' + this.uuid); - } - - bindEvent() { - var that = this; - - // close popup - $(document).on('click', this._wrapSelector('.' + APP_CLOSE), function(event) { - that.close(); - }); - - // click preview - $(document).on('click', this._wrapSelector('.' + APP_BUTTON_PREVIEW), function(evt) { - evt.stopPropagation(); - if (that.previewOpened) { - that.closePreview(); - } else { - that.openPreview(); - } - }); - - // click cancel - $(document).on('click', this._wrapSelector('.' + APP_BUTTON_CANCEL), function() { - that.close(); - }); - - // click run - $(document).on('click', this._wrapSelector('.' + APP_BUTTON_RUN), function() { - that.apply(true, true); - that.close(); - }); - - // click detail button - $(document).on('click', this._wrapSelector('.' + APP_BUTTON_DETAIL), function(evt) { - evt.stopPropagation(); - $(that._wrapSelector('.' + APP_DETAIL_BOX)).show(); - }); - - // click add / apply - $(document).on('click', this._wrapSelector('.' + APP_DETAIL_ITEM), function() { - var type = $(this).data('type'); - if (type == 'add') { - that.apply(true); - that.close(); - } else if (type == 'apply') { - that.apply(); - that.close(); - } - }); - - // click other - $(document).on('click.' + this.uuid, function(evt) { - if (!$(evt.target).hasClass(APP_BUTTON_DETAIL)) { - $(that._wrapSelector('.' + APP_DETAIL_BOX)).hide(); - } - if (!$(evt.target).hasClass(APP_BUTTON_PREVIEW) - && !$(evt.target).hasClass(APP_PREVIEW_BOX) - && $(that._wrapSelector('.' + APP_PREVIEW_BOX)).has(evt.target).length === 0) { - that.closePreview(); - } - }); - } - - apply(addCell=false, runCell=false) { - var code = this.generateCode(); - - // save state for block - this._saveState(); - - if (this.pageThis) { - $(this.pagethis._wrapSelector('#' + this.targetId)).val(code); - $(this.pagethis._wrapSelector('#' + this.targetId)).trigger({ - type: 'apps_run', - title: 'Merge', - code: code, - state: this.state, - addCell: addCell, - runCell: runCell - }); - } else { - $(vpCommon.wrapSelector('#' + this.targetId)).val(code); - $(vpCommon.wrapSelector('#' + this.targetId)).trigger({ - type: 'apps_run', - title: 'Merge', - code: code, - state: this.state, - addCell: addCell, - runCell: runCell - }); - } - } - - /** - * Generate code - * @returns generatedCode - */ - generateCode() { - var code = new sb.StringBuilder(); - // TODO: generate code - - return code.toString(); - } - - /** - * Open preview box - */ - openPreview() { - $(this._wrapSelector('.' + APP_PREVIEW_BOX)).show(); - - if (!this.codepreview) { - // codemirror setting - this.codepreview = codemirror.fromTextArea($(this._wrapSelector('#vp_codePreview'))[0], { - mode: { - name: 'python', - version: 3, - singleLineStringErrors: false - }, // text-cell(markdown cell) set to 'htmlmixed' - height: '100%', - width: '100%', - indentUnit: 4, - matchBrackets: true, - readOnly:true, - autoRefresh: true, - theme: "ipython", - extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}, - scrollbarStyle: "null" - }); - } else { - this.codepreview.refresh(); - } - - // get current code - var code = this.generateCode(); - this.codepreview.setValue(code); - this.codepreview.save(); - - var that = this; - setTimeout(function() { - that.codepreview.refresh(); - },1); - - this.previewOpened = true; - } - - /** - * Close preview box - */ - closePreview() { - this.previewOpened = false; - $(this._wrapSelector('.' + APP_PREVIEW_BOX)).hide(); - } - } - - return Merge -}); /* function, define */ - -/* End of file */ \ No newline at end of file diff --git a/src/common/vpPDF.js b/src/common/vpPDF.js index 7e63ff95..6f6cf745 100644 --- a/src/common/vpPDF.js +++ b/src/common/vpPDF.js @@ -152,7 +152,7 @@ define([ // title page.appendFormat('
{1}
', - VP_PDF_TITLE, 'PyMuPDF - Extract text from pdf'); + VP_PDF_TITLE, 'Extract text from PDF'); // close button page.appendFormatLine('
', diff --git a/src/common/vpReshape.js b/src/common/vpReshape.js index cb22d8da..fd31fbee 100644 --- a/src/common/vpReshape.js +++ b/src/common/vpReshape.js @@ -16,14 +16,15 @@ define([ 'nbextensions/visualpython/src/common/constant', 'nbextensions/visualpython/src/common/StringBuilder', 'nbextensions/visualpython/src/common/vpCommon', - 'text!nbextensions/visualpython/css/common/popupPage.css', + 'nbextensions/visualpython/src/common/kernelApi', + 'nbextensions/visualpython/src/common/component/vpMultiSelector', 'codemirror/lib/codemirror', 'codemirror/mode/python/python', 'notebook/js/codemirror-ipython', 'codemirror/addon/display/placeholder', 'codemirror/addon/display/autorefresh' -], function (vpConst, sb, vpCommon, appCss, codemirror) { +], function (vpConst, sb, vpCommon, kernelApi, vpMultiSelector, codemirror) { //======================================================================== // Define variable @@ -45,6 +46,12 @@ define([ const APP_DETAIL_BOX = APP_PREFIX + '-detail-box'; const APP_DETAIL_ITEM = APP_PREFIX + '-detail-item'; + const APP_POPUP_BOX = APP_PREFIX + '-popup-box'; + const APP_POPUP_CLOSE = APP_PREFIX + '-popup-close'; + const APP_POPUP_BODY = APP_PREFIX + '-popup-body'; + const APP_POPUP_BUTTON_BOX = APP_PREFIX + '-popup-button-box'; + const APP_POPUP_CANCEL = APP_PREFIX + '-popup-cancel'; + const APP_POPUP_OK = APP_PREFIX + '-popup-ok'; //======================================================================== // [CLASS] Reshape @@ -82,13 +89,41 @@ define([ } _loadState(state) { + var { + variable, type, pivot, melt, allocateTo, resetIndex + } = state; + $(this._wrapSelector('#vp_rsDataframe')).val(variable); + $(this._wrapSelector('#vp_rsType')).val(type); + + // pivot + this._loadColumnSelectorInput(this._wrapSelector('#vp_rsIndex'), pivot.index); + this._loadColumnSelectorInput(this._wrapSelector('#vp_rsColumns'), pivot.columns); + this._loadColumnSelectorInput(this._wrapSelector('#vp_rsValues'), pivot.values); + + // melt + this._loadColumnSelectorInput(this._wrapSelector('#vp_rsIdVars'), melt.idVars); + this._loadColumnSelectorInput(this._wrapSelector('#vp_rsValueVars'), melt.valueVars); + + // allocateTo + $(this._wrapSelector('#vp_rsAllocateTo')).val(allocateTo); + $(this._wrapSelector('#vp_rsResetIndex')).prop('checked', resetIndex); } _saveState() { } + _resetColumnSelector(target) { + $(target).val(''); + $(target).data('list', []); + } + + _loadColumnSelectorInput(tag, colList) { + $(tag).val(colList.map(col=>col.code).join(',')); + $(tag).data('list', colList) + } + //==================================================================== // External call function //==================================================================== @@ -98,11 +133,7 @@ define([ ...config } - if (this.config.state) { - this.init(this.config.state); - } else { - this.init(); - } + this.init(this.config.state); $(this._wrapSelector()).show(); // load state @@ -116,17 +147,50 @@ define([ $(this._wrapSelector()).remove(); } - init() { - vpCommon.loadCss(Jupyter.notebook.base_url + vpConst.BASE_PATH + vpConst.STYLE_PATH + 'common/popupPage.css'); + init(state = undefined) { + this.state = { + variable: '', + type: 'pivot', + resetIndex: false, + pivot: { + index: [], + columns: [], + values: [] + }, + melt: { + idVars: [], + ValueVars: [] + } + } + this.popup = { + type: '', + targetSelector: '', + ColSelector: undefined + } - this.render(); + // load state + if (state) { + this.state = { + ...this.state, + ...state + }; + } + this.bindEvent(); + this.render(); + vpCommon.loadCss(Jupyter.notebook.base_url + vpConst.BASE_PATH + vpConst.STYLE_PATH + 'common/popupPage.css'); + vpCommon.loadCss(Jupyter.notebook.base_url + vpConst.BASE_PATH + vpConst.STYLE_PATH + 'common/reshape.css'); + + this.loadVariableList(); } render() { var page = new sb.StringBuilder(); page.appendFormatLine('
', APP_PREFIX, this.uuid); - page.appendFormatLine('
', APP_CONTAINER); + page.appendFormatLine('
', APP_CONTAINER, 'vp-rs-container'); + + // popup + page.appendLine(this.renderInnerPopup()); // title page.appendFormat('
{1}
', @@ -138,8 +202,76 @@ define([ // body start page.appendFormatLine('
', APP_BODY); - // TODO: button - + page.appendFormatLine('
', 'vp-rs-df-box'); // df-box + // dataframe + page.appendLine('
'); + page.appendFormatLine('', 'vp_rsDataframe', 'vp-orange-text wp100', 'Dataframe'); + page.appendFormatLine(''); + page.appendFormatLine('
', 'vp-rs-df-refresh', 'Refresh dataframe list', '/nbextensions/visualpython/resource/refresh.svg'); + page.appendLine('
'); + // reshape type + page.appendLine('
'); + page.appendFormatLine('', 'vp_rsType', 'vp-orange-text wp100', 'Reshape Type'); + page.appendFormatLine(''); + page.appendLine('
'); + // divider + page.appendLine('
'); + // pivot page + page.appendFormatLine('
', 'vp-rs-type-box', 'pivot', this.state.type=='pivot'?'':'style="display:none;"'); // pivot box + // pivot page + page.appendFormatLine('
{1}
', 'vp-rs-type-title', 'Pivot'); + // index + page.appendLine('
'); + page.appendFormatLine('', 'vp_rsIndex', 'wp100', 'Index'); + page.appendFormatLine('', 'vp_rsIndex', 'Index key'); + page.appendFormatLine('', 'vp_rsIndexSelect', 'vp-button wp50', 'Edit'); + page.appendLine('
'); + // columns + page.appendLine('
'); + page.appendFormatLine('', 'vp_rsColumns', 'vp-orange-text wp100', 'Columns'); + page.appendFormatLine('', 'vp_rsColumns', 'Columns key'); + page.appendFormatLine('', 'vp_rsColumnsSelect', 'vp-button wp50', 'Edit'); + page.appendLine('
'); + // values + page.appendLine('
'); + page.appendFormatLine('', 'vp_rsValues', 'wp100', 'Values'); + page.appendFormatLine('', 'vp_rsValues', 'Values key'); + page.appendFormatLine('', 'vp_rsValuesSelect', 'vp-button wp50', 'Edit'); + page.appendLine('
'); + page.appendLine('
'); // end of pivot box + // melt page + page.appendFormatLine('
', 'vp-rs-type-box', 'melt', this.state.type=='melt'?'':'style="display:none;"'); // melt box + page.appendFormatLine('
{1}
', 'vp-rs-type-title', 'Melt'); + // id vars + page.appendLine('
'); + page.appendFormatLine('', 'vp_rsIdVars', 'wp100', 'Id'); + page.appendFormatLine('', 'vp_rsIdVars', 'Id vars'); + page.appendFormatLine('', 'vp_rsIdVarsSelect', 'vp-button wp50', 'Edit'); + page.appendLine('
'); + // value vars + page.appendLine('
'); + page.appendFormatLine('', 'vp_rsValueVars', 'wp100', 'Value'); + page.appendFormatLine('', 'vp_rsValueVars', 'Value vars'); + page.appendFormatLine('', 'vp_rsValueVarsSelect', 'vp-button wp50', 'Edit'); + page.appendLine('
'); + page.appendLine('
'); // end of melt box + // divider + page.appendLine('
'); + // allocate to + page.appendLine('
'); + page.appendFormatLine('', 'vp_rsAllocateTo', 'wp100', 'Allocate to'); + page.appendFormatLine('', 'vp_rsAllocateTo', 'New variable name'); + // reset index + page.appendFormatLine('', 'vp_rsResetIndex', 'reset index'); + page.appendLine('
'); + page.appendLine('
'); // end of vp-rs-df-box page.appendLine('
'); // APP_BODY // preview box @@ -173,8 +305,136 @@ define([ $(this._wrapSelector()).hide(); } + /** + * Render variable list (for dataframe) + * @param {Array} varList + * @param {string} defaultValue previous value + */ + renderVariableList(id, varList, defaultValue='') { + var tag = new sb.StringBuilder(); + tag.appendFormatLine(''); // VP_VS_VARIABLES + return tag.toString(); + } + + /** + * Render inner popup for selecting columns + * @returns Inner popup page dom + */ + renderInnerPopup() { + var page = new sb.StringBuilder(); + page.appendFormatLine(''); // End of Popup + return page.toString(); + } + + /** + * Render column selector using ColumnSelector module + * @param {Array} previousList previous selected columns + * @param {Array} excludeList columns to exclude + */ + renderColumnSelector(targetVariable, previousList, excludeList) { + this.popup.ColSelector = new vpMultiSelector( + this._wrapSelector('.' + APP_POPUP_BODY), + { mode: 'columns', parent: targetVariable, selectedList: previousList, excludeList: excludeList } + ); + } + + /** + * Open Inner popup page for column selection + * @param {Object} targetSelector + * @param {string} title + * @param {Array} excludeList + */ + openInnerPopup(targetVariable, targetSelector, title='Select columns', excludeList=[]) { + this.popup.targetVariable = targetVariable; + this.popup.targetSelector = targetSelector; + var previousList = this.popup.targetSelector.data('list'); + if (previousList) { + previousList = previousList.map(col => col.code) + } + this.renderColumnSelector(targetVariable, previousList, excludeList); + + // set title + $(this._wrapSelector('.' + APP_POPUP_BOX + ' .' + APP_TITLE)).text(title); + + // show popup box + $(this._wrapSelector('.' + APP_POPUP_BOX)).show(); + } + + /** + * Close Inner popup page + */ + closeInnerPopup() { + $(this._wrapSelector('.' + APP_POPUP_BOX)).hide(); + } + + /** + * Load variable list (dataframe) + */ + loadVariableList() { + var that = this; + // load using kernel + var dataTypes = ['DataFrame']; + kernelApi.searchVarList(dataTypes, function(result) { + try { + var varList = JSON.parse(result); + // render variable list + // get prevvalue + var prevValue = that.state.variable; + // replace + $(that._wrapSelector('#vp_rsDataframe')).replaceWith(function() { + return that.renderVariableList('vp_rsDataframe', varList, prevValue); + }); + $(that._wrapSelector('#vp_rsDataframe')).trigger('change'); + } catch (ex) { + console.log('Bind:', result); + } + }); + } + unbindEvent() { $(document).unbind(vpCommon.formatString(".{0} .{1}", this.uuid, APP_BODY)); + + $(document).off('change', this._wrapSelector('#vp_rsDataframe')); + $(document).off('click', this._wrapSelector('.vp-rs-df-refresh')); + $(document).off('change', this._wrapSelector('#vp_rsType')); + $(document).off('change', this._wrapSelector('#vp_rsIndex')); + $(document).off('click', this._wrapSelector('#vp_rsIndexSelect')); + $(document).off('change', this._wrapSelector('#vp_rsColumns')); + $(document).off('click', this._wrapSelector('#vp_rsColumnsSelect')); + $(document).off('change', this._wrapSelector('#vp_rsValues')); + $(document).off('click', this._wrapSelector('#vp_rsValuesSelect')); + $(document).off('change', this._wrapSelector('#vp_rsIdVars')); + $(document).off('click', this._wrapSelector('#vp_rsIdVarsSelect')); + $(document).off('change', this._wrapSelector('#vp_rsValueVars')); + $(document).off('click', this._wrapSelector('#vp_rsValueVarsSelect')); + $(document).off('change', this._wrapSelector('#vp_rsAllocateTo')); + $(document).off('change', this._wrapSelector('#vp_rsResetIndex')); + $(document).off('click', this._wrapSelector('.' + APP_CLOSE)); $(document).off('click', this._wrapSelector('.' + APP_BUTTON_PREVIEW)); $(document).off('click', this._wrapSelector('.' + APP_BUTTON_CANCEL)); @@ -185,66 +445,217 @@ define([ $(document).off('keydown.' + this.uuid); $(document).off('keyup.' + this.uuid); + + // popup box events + $(document).off('click', this._wrapSelector('.' + APP_POPUP_OK)); + $(document).off('click', this._wrapSelector('.' + APP_POPUP_CANCEL)); + $(document).off('click', this._wrapSelector('.' + APP_POPUP_CLOSE)); } bindEvent() { var that = this; - - // close popup - $(document).on('click', this._wrapSelector('.' + APP_CLOSE), function(event) { - that.close(); - }); - - // click preview - $(document).on('click', this._wrapSelector('.' + APP_BUTTON_PREVIEW), function(evt) { - evt.stopPropagation(); - if (that.previewOpened) { - that.closePreview(); - } else { - that.openPreview(); - } - }); - - // click cancel - $(document).on('click', this._wrapSelector('.' + APP_BUTTON_CANCEL), function() { - that.close(); - }); - - // click run - $(document).on('click', this._wrapSelector('.' + APP_BUTTON_RUN), function() { - that.apply(true, true); - that.close(); - }); - - // click detail button - $(document).on('click', this._wrapSelector('.' + APP_BUTTON_DETAIL), function(evt) { - evt.stopPropagation(); - $(that._wrapSelector('.' + APP_DETAIL_BOX)).show(); - }); - - // click add / apply - $(document).on('click', this._wrapSelector('.' + APP_DETAIL_ITEM), function() { - var type = $(this).data('type'); - if (type == 'add') { - that.apply(true); + //==================================================================== + // User operation Events + //==================================================================== + // variable change event + $(document).on('change', this._wrapSelector('#vp_rsDataframe'), function() { + // if variable changed + var newVal = $(this).val(); + if (newVal != that.state.variable) { + that.state.variable = newVal; + // initial child values + that._resetColumnSelector(that._wrapSelector('#vp_rsIndex')); + that._resetColumnSelector(that._wrapSelector('#vp_rsColumns')); + that._resetColumnSelector(that._wrapSelector('#vp_rsValues')); + + that._resetColumnSelector(that._wrapSelector('#vp_rsIdVars')); + that._resetColumnSelector(that._wrapSelector('#vp_rsValueVars')); + + that.state.pivot = { + index: [], columns: [], values: [] + }; + that.state.melt = { + idVars: [], valueVars: [] + }; + } + }); + + // variable refresh event + $(document).on('click', this._wrapSelector('.vp-rs-df-refresh'), function() { + that.loadVariableList(); + }); + + // on change event + $(document).on('change', this._wrapSelector('#vp_rsType'), function(event) { + var type = $(this).val(); + that.state.type = type; + // change visibility + if (type == 'pivot') { + $(that._wrapSelector('.vp-rs-type-box.melt')).hide(); + $(that._wrapSelector('.vp-rs-type-box.pivot')).show(); + } else { + $(that._wrapSelector('.vp-rs-type-box.pivot')).hide(); + $(that._wrapSelector('.vp-rs-type-box.melt')).show(); + } + }); + + // index change event + $(document).on('change', this._wrapSelector('#vp_rsIndex'), function(event) { + var colList = event.dataList; + that.state.pivot.index = colList; + }); + + // index select button event + $(document).on('click', this._wrapSelector('#vp_rsIndexSelect'), function() { + var targetVariable = [ that.state.variable ]; + var excludeList = [ ...that.state.pivot.columns, ...that.state.pivot.values ].map(obj => obj.code); + that.openInnerPopup(targetVariable, $(that._wrapSelector('#vp_rsIndex')), 'Select columns', excludeList); + }); + + // columns change event + $(document).on('change', this._wrapSelector('#vp_rsColumns'), function(event) { + var colList = event.dataList; + that.state.pivot.columns = colList; + }); + + // columns select button event + $(document).on('click', this._wrapSelector('#vp_rsColumnsSelect'), function() { + var targetVariable = [ that.state.variable ]; + var excludeList = [ ...that.state.pivot.index, ...that.state.pivot.values ].map(obj => obj.code); + that.openInnerPopup(targetVariable, $(that._wrapSelector('#vp_rsColumns')), 'Select columns', excludeList); + }); + + // values change event + $(document).on('change', this._wrapSelector('#vp_rsValues'), function(event) { + var colList = event.dataList; + that.state.pivot.values = colList; + }); + + // values select button event + $(document).on('click', this._wrapSelector('#vp_rsValuesSelect'), function() { + var targetVariable = [ that.state.variable ]; + var excludeList = [ ...that.state.pivot.index, ...that.state.pivot.columns ].map(obj => obj.code); + that.openInnerPopup(targetVariable, $(that._wrapSelector('#vp_rsValues')), 'Select columns', excludeList); + }); + + // id vars change event + $(document).on('change', this._wrapSelector('#vp_rsIdVars'), function(event) { + var colList = event.dataList; + that.state.melt.idVars = colList; + }); + + // id vars select button event + $(document).on('click', this._wrapSelector('#vp_rsIdVarsSelect'), function() { + var targetVariable = [ that.state.variable ]; + var excludeList = that.state.melt.valueVars.map(obj => obj.code); + that.openInnerPopup(targetVariable, $(that._wrapSelector('#vp_rsIdVars')), 'Select columns', excludeList); + }); + + // value vars change event + $(document).on('change', this._wrapSelector('#vp_rsValueVars'), function(event) { + var colList = event.dataList; + that.state.melt.valueVars = colList; + }); + + // value vars select button event + $(document).on('click', this._wrapSelector('#vp_rsValueVarsSelect'), function() { + var targetVariable = [ that.state.variable ]; + var excludeList = that.state.melt.idVars.map(obj => obj.code); + that.openInnerPopup(targetVariable, $(that._wrapSelector('#vp_rsValueVars')), 'Select columns', excludeList); + }); + + // allocateTo event + $(document).on('change', this._wrapSelector('#vp_rsAllocateTo'), function() { + that.state.allocateTo = $(this).val(); + }); + + // reset index checkbox event + $(document).on('change', this._wrapSelector('#vp_rsResetIndex'), function() { + that.state.resetIndex = $(this).prop('checked'); + }); + + //================================================================ + // Page operation Events + //================================================================ + // close popup + $(document).on('click', this._wrapSelector('.' + APP_CLOSE), function(event) { that.close(); - } else if (type == 'apply') { - that.apply(); + }); + + // click preview + $(document).on('click', this._wrapSelector('.' + APP_BUTTON_PREVIEW), function(evt) { + evt.stopPropagation(); + if (that.previewOpened) { + that.closePreview(); + } else { + that.openPreview(); + } + }); + + // click cancel + $(document).on('click', this._wrapSelector('.' + APP_BUTTON_CANCEL), function() { that.close(); - } - }); + }); - // click other - $(document).on('click.' + this.uuid, function(evt) { - if (!$(evt.target).hasClass('.' + APP_BUTTON_DETAIL)) { - $(that._wrapSelector('.' + APP_DETAIL_BOX)).hide(); - } - if (!$(evt.target).hasClass(APP_BUTTON_PREVIEW) - && !$(evt.target).hasClass(APP_PREVIEW_BOX) - && $(that._wrapSelector('.' + APP_PREVIEW_BOX)).has(evt.target).length === 0) { - that.closePreview(); - } - }); + // click run + $(document).on('click', this._wrapSelector('.' + APP_BUTTON_RUN), function() { + that.apply(true, true); + that.close(); + }); + + // click detail button + $(document).on('click', this._wrapSelector('.' + APP_BUTTON_DETAIL), function(evt) { + evt.stopPropagation(); + $(that._wrapSelector('.' + APP_DETAIL_BOX)).show(); + }); + + // click add / apply + $(document).on('click', this._wrapSelector('.' + APP_DETAIL_ITEM), function() { + var type = $(this).data('type'); + if (type == 'add') { + that.apply(true); + that.close(); + } else if (type == 'apply') { + that.apply(); + that.close(); + } + }); + + // click other + $(document).on('click.' + this.uuid, function(evt) { + if (!$(evt.target).hasClass('.' + APP_BUTTON_DETAIL)) { + $(that._wrapSelector('.' + APP_DETAIL_BOX)).hide(); + } + if (!$(evt.target).hasClass(APP_BUTTON_PREVIEW) + && !$(evt.target).hasClass(APP_PREVIEW_BOX) + && $(that._wrapSelector('.' + APP_PREVIEW_BOX)).has(evt.target).length === 0) { + that.closePreview(); + } + }); + + //================================================================ + // Popup box Events + //================================================================ + // ok input popup + $(document).on('click', this._wrapSelector('.' + APP_POPUP_OK), function() { + // ok input popup + var dataList = that.popup.ColSelector.getDataList(); + + $(that.popup.targetSelector).val(dataList.map(col => { return col.code }).join(',')); + $(that.popup.targetSelector).data('list', dataList); + $(that.popup.targetSelector).trigger({ type: 'change', dataList: dataList }); + that.closeInnerPopup(); that.closeInnerPopup(); + }); + + // cancel input popup + $(document).on('click', this._wrapSelector('.' + APP_POPUP_CANCEL), function() { + that.closeInnerPopup(); + }); + + // close input popup + $(document).on('click', this._wrapSelector('.' + APP_POPUP_CLOSE), function() { + that.closeInnerPopup(); + }); } apply(addCell=false, runCell=false) { @@ -282,8 +693,89 @@ define([ */ generateCode() { var code = new sb.StringBuilder(); - // TODO: generate code - + var { variable, type, allocateTo, resetIndex, pivot, melt } = this.state; + + //==================================================================== + // Allocation + //==================================================================== + if (allocateTo && allocateTo != '') { + code.appendFormat('{0} = ', allocateTo); + } + + //==================================================================== + // Dataframe variables + //==================================================================== + code.appendFormat('{0}.{1}(', variable, type); + + var options = []; + if (type == 'pivot') { + //================================================================ + // pivot + //================================================================ + // index (optional) + if (pivot.index && pivot.index.length > 0) { + if (pivot.index.length == 1) { + options.push(vpCommon.formatString("index={0}", pivot.index[0].code)); + } else { + options.push(vpCommon.formatString("index=[{0}]", pivot.index.map(col => col.code).join(','))); + } + } + + // columns + if (pivot.columns && pivot.columns.length > 0) { + if (pivot.columns.length == 1) { + options.push(vpCommon.formatString("columns={0}", pivot.columns[0].code)); + } else { + options.push(vpCommon.formatString("columns=[{0}]", pivot.columns.map(col => col.code).join(','))); + } + } + + // values (optional) + if (pivot.values && pivot.values.length > 0) { + if (pivot.values.length == 1) { + options.push(vpCommon.formatString("values={0}", pivot.values[0].code)); + } else { + options.push(vpCommon.formatString("values=[{0}]", pivot.values.map(col => col.code).join(','))); + } + } + + } else { + //================================================================ + // melt + //================================================================ + // id vars (optional) + if (melt.idVars && melt.idVars.length > 0) { + if (melt.idVars.length == 1) { + options.push(vpCommon.formatString("id_vars={0}", melt.idVars[0].code)); + } else { + options.push(vpCommon.formatString("id_vars=[{0}]", melt.idVars.map(col => col.code).join(','))); + } + } + + // value vars (optional) + if (melt.valueVars && melt.valueVars.length > 0) { + if (melt.valueVars.length == 1) { + options.push(vpCommon.formatString("value_vars={0}", melt.valueVars[0].code)); + } else { + options.push(vpCommon.formatString("value_vars=[{0}]", melt.valueVars.map(col => col.code).join(','))); + } + } + } + + code.appendFormat('{0})', options.join(', ')); + + //==================================================================== + // Reset index + //==================================================================== + if (resetIndex) { + code.append('.reset_index()'); + } + + if (allocateTo && allocateTo != '') { + code.appendLine(); + code.append(allocateTo); + } + return code.toString(); } diff --git a/src/file_io/fileio.html b/src/file_io/fileio.html index 632f064d..f2b447de 100644 --- a/src/file_io/fileio.html +++ b/src/file_io/fileio.html @@ -63,17 +63,18 @@ diff --git a/src/file_io/fileio.js b/src/file_io/fileio.js index 7d50a492..4ca46df1 100644 --- a/src/file_io/fileio.js +++ b/src/file_io/fileio.js @@ -117,16 +117,16 @@ define([ label: 'Sample File', component: 'option_select', options: [ - 'iris.csv', 'Titanic_train.csv', 'Titanic_test.csv', 'cancer.csv', + 'iris.csv', 'titanic.csv', 'cancer.csv', 'fish.csv', 'accidentData.csv', 'campusRecruitment.csv', 'houseData_500.csv', 'lolRankedData_500.csv', 'weatherData_500.csv', 'welfareCenter.csv', - 'mnist_train_1000.csv' + 'mnist_train_1000.csv', 'economic_index.csv', 'tips.csv' ], options_label: [ - 'iris', 'Titanic_train', 'Titanic_test', 'cancer', + 'iris', 'titanic', 'cancer', 'fish', 'accidentData', 'campusRecruitment', 'houseData_500', 'lolRankedData_500', 'weatherData_500', 'welfareCenter', - 'mnist_train_1000' + 'mnist_train_1000', 'economic index', 'tips' ] } ], diff --git a/src/matplotlib/import.js b/src/matplotlib/import.js index 9bdc3500..a5cdfa2a 100644 --- a/src/matplotlib/import.js +++ b/src/matplotlib/import.js @@ -228,7 +228,7 @@ define([ code.appendLine('import matplotlib.pyplot as plt'); code.appendLine('import json'); // code.append(`print(json.dumps(plt.style.available))`); - code.append(`print(json.dumps([{ 'label': s, 'value': "'"+s+"'" } for s in plt.style.available]))`); + code.append(`print(json.dumps([{ 'label': s, 'value': s } for s in plt.style.available]))`); this.kernelExecute(code.toString(), function(result) { // 사용가능한 스타일 시트 목록 var varList = JSON.parse(result); @@ -261,7 +261,7 @@ define([ code.appendLine('import json'); code.appendLine("import matplotlib.font_manager as fm"); code.appendLine("_ttflist = fm.fontManager.ttflist"); - code.append(`print(json.dumps([{"label": f.name, "value":("'" + f.name + "'")} for f in _ttflist]))`); + code.append(`print(json.dumps([{"label": f.name, "value": f.name} for f in _ttflist]))`); this.kernelExecute(code.toString(), function(result) { // 사용가능한 폰트 목록 var varList = JSON.parse(result); @@ -273,7 +273,7 @@ define([ if (mdvalue != undefined && mdvalue != '') { suggestInput.setValue(mdvalue); } else { - suggestInput.setValue("'Gulim'"); + suggestInput.setValue("Gulim"); } suggestInput.setSuggestList(function() { return varList; }); // suggestInput.setNormalFilter(false); @@ -294,7 +294,7 @@ define([ // 코드 생성 // 필수 입력 항목 - sbCode.appendFormatLine('import matplotlib.pyplot as {0}', $(this.wrapSelector('#i0')).val()); + sbCode.appendLine('import matplotlib.pyplot as plt'); sbCode.appendFormatLine('%matplotlib {0}', $(this.wrapSelector('#magic')).val()); // style range, sheet @@ -317,7 +317,7 @@ define([ sbCode.appendLine(''); sbCode.appendLine("from matplotlib.pylab import rcParams"); if (fontfamily != '') { - sbCode.appendFormatLine("rcParams['font.family'] = {0}", fontfamily); + sbCode.appendFormatLine("rcParams['font.family'] = '{0}'", fontfamily); } if (fontsize != '') { sbCode.appendFormatLine("rcParams['font.size'] = {0}", fontsize); diff --git a/src/matplotlib/plot.html b/src/matplotlib/plot.html index e2d3b870..7e32f408 100644 --- a/src/matplotlib/plot.html +++ b/src/matplotlib/plot.html @@ -16,11 +16,14 @@
- + + + + - + @@ -30,12 +33,11 @@ - + -->
ColumnMethod
+ -
diff --git a/src/matplotlib/plot.js b/src/matplotlib/plot.js index a72f828e..78a8fb1f 100644 --- a/src/matplotlib/plot.js +++ b/src/matplotlib/plot.js @@ -7,8 +7,9 @@ define([ , 'nbextensions/visualpython/src/common/vpFuncJS' , 'nbextensions/visualpython/src/container/vpContainer' , 'nbextensions/visualpython/src/pandas/common/pandasGenerator' + , 'nbextensions/visualpython/src/common/component/vpSuggestInputText' , 'nbextensions/visualpython/src/pandas/fileNavigation/index' -], function (requirejs, $, vpCommon, vpConst, sb, vpFuncJS, vpContainer, pdGen, fileNavigation) { +], function (requirejs, $, vpCommon, vpConst, sb, vpFuncJS, vpContainer, pdGen, vpSuggestInputText, fileNavigation) { // 옵션 속성 const funcOptProp = { stepCount : 1 @@ -124,13 +125,49 @@ define([ var sbPageContent = new sb.StringBuilder(); var sbTagString = new sb.StringBuilder(); + // Box 1. Import + var accBoxImport = this.createOptionContainer('Import Options'); + // accBoxImport.setOpenBox(true); + sbTagString.clear(); + sbTagString.appendFormatLine('
', 'vp-import-box'); + // figure size + sbTagString.appendLine('
'); + sbTagString.appendFormatLine('', 'vp_plFigureWidth', '', 'Figure size'); + sbTagString.appendFormatLine('', 'vp_plFigureWidth', 'width', 12); + sbTagString.appendFormatLine('', 'vp_plFigureHeight', 'height', 8); + sbTagString.appendLine('
'); + // style sheet + sbTagString.appendLine('
'); + sbTagString.appendFormatLine('', 'vp_plStyle', '', 'Style sheet'); + sbTagString.appendFormatLine('', 'vp_plStyle', 'style name'); + sbTagString.appendLine('
'); + // divider + sbTagString.appendLine('
'); + // system font + sbTagString.appendLine('
'); + sbTagString.appendFormatLine('', 'vp_plFontName', '', 'System font'); + sbTagString.appendFormatLine('', 'vp_plFontName', 'font name'); + sbTagString.appendLine('
'); + // font size + sbTagString.appendLine('
'); + sbTagString.appendFormatLine('', 'vp_plFontSize', '', 'Font size'); + sbTagString.appendFormatLine('', 'vp_plFontSize', 'size', 10); + sbTagString.appendLine('
'); + // import button + sbTagString.appendLine('
'); + sbTagString.appendFormatLine('', 'vp_plImportRun', 'vp-button activated vp-pl-import-run', 'Apply'); + sbTagString.appendLine('
'); + + sbTagString.appendLine('
'); + accBoxImport.appendContent(sbTagString.toString()); + sbPageContent.appendLine(accBoxImport.toTagString()); // Popup Box. variable view box sbTagString.clear(); sbTagString.appendLine('
'); sbTagString.appendLine('
'); // variable list - sbTagString.appendLine('
'); + sbTagString.appendLine('
'); sbTagString.appendLine(''); sbTagString.appendLine(''); sbTagString.appendLine(''); @@ -145,28 +182,27 @@ define([ // detail sbTagString.appendLine('
'); sbTagString.appendLine('
'); - sbTagString.appendLine(''); - sbTagString.appendLine(''); - sbTagString.appendLine(''); - sbTagString.appendLine(''); - sbTagString.appendLine(''); - sbTagString.appendLine(''); + sbTagString.appendLine(''); + sbTagString.appendLine(''); + sbTagString.appendLine(''); + sbTagString.appendLine(''); + // sbTagString.appendLine(''); + sbTagString.appendLine(''); sbTagString.appendLine('
ColumnMethod
Column
'); sbTagString.appendLine('
'); // footer sbTagString.appendLine(''); sbTagString.appendLine('
'); sbPageContent.appendLine(sbTagString.toString()); - // Box 1. Required Input & Output + // Box 2. Required Input & Output var accBoxRequire = this.createOptionContainer(vpConst.API_REQUIRE_OPTION_BOX_CAPTION); accBoxRequire.setOpenBox(true); sbTagString.clear(); - // 대상변수 자동입력 칸 //FIXME: sbTagString.appendLine(''); sbTagString.appendFormatLine('
{2}
', 'vp-thead', vpConst.COLOR_FONT_ORANGE, 'Chart Type'); @@ -265,11 +301,11 @@ define([ , 'vp_userOption', 'key=value, key=value ...'); tblLayoutRequire.addRow('User Option', sbTagString.toString()); - // 박스에 추가 + // add to box accBoxRequire.appendContent(tblLayoutRequire.toTagString()); sbPageContent.appendLine(accBoxRequire.toTagString()); - // Box 2. Additional Options + // Box 3. Additional Options var tblAdditional = this.createVERSimpleLayout("15%"); var accBoxAdditional = this.createOptionContainer('Additional Options'); accBoxAdditional.setOpenBox(true); @@ -322,7 +358,7 @@ define([ sbTagString.appendFormatLine('
', 'vp_openFileNavigationBtn', 'vp-file-browser-button'); tblAdditional.addRow('Save Figure', sbTagString.toString()); - // 박스에 추가 + // add to box accBoxAdditional.appendContent(tblAdditional.toTagString()); sbPageContent.appendLine(accBoxAdditional.toTagString()); @@ -331,7 +367,8 @@ define([ this.setPage(sbPageContent.toString()); - // 차트 서브플롯 페이지 구성 + // Chart subplot option + this.bindImportOptions(); this.bindSubplotOption1(); this.bindCmapSelector(); @@ -364,6 +401,76 @@ define([ $(this.wrapSelector('.vp_functionName')).text(funcOptProp.funcName); } + /** + * Bind Import options event + */ + MatplotPackage.prototype.bindImportOptions = function() { + var that = this; + + //==================================================================== + // Stylesheet suggestinput + //==================================================================== + var stylesheetTag = $(this.wrapSelector('#vp_plStyle')); + // search available stylesheet list + var code = new sb.StringBuilder(); + // FIXME: convert it to kernelApi + code.appendLine('import matplotlib.pyplot as plt'); + code.appendLine('import json'); + code.append(`print(json.dumps([{ 'label': s, 'value': s } for s in plt.style.available]))`); + this.kernelExecute(code.toString(), function(result) { + // get available stylesheet list + var varList = JSON.parse(result); + var suggestInput = new vpSuggestInputText.vpSuggestInputText(); + suggestInput.setComponentID('vp_plStyle'); + suggestInput.setSuggestList(function() { return varList; }); + suggestInput.setPlaceholder('style name'); + // suggestInput.setNormalFilter(false); + $(stylesheetTag).replaceWith(function() { + return suggestInput.toTagString(); + }); + }); + + //==================================================================== + // System font suggestinput + //==================================================================== + var fontFamilyTag = $(this.wrapSelector('#vp_plFontName')); + // search system font list + var code = new sb.StringBuilder(); + // FIXME: convert it to kernelApi + code.appendLine('import json'); + code.appendLine("import matplotlib.font_manager as fm"); + code.appendLine("_ttflist = fm.fontManager.ttflist"); + code.append("print(json.dumps([{'label': f.name, 'value': f.name } for f in _ttflist]))"); + this.kernelExecute(code.toString(), function(result) { + // get available font list + var varList = JSON.parse(result); + var suggestInput = new vpSuggestInputText.vpSuggestInputText(); + suggestInput.setComponentID('vp_plFontName'); + suggestInput.setSuggestList(function() { return varList; }); + suggestInput.setPlaceholder('font name'); + // suggestInput.setNormalFilter(false); + $(fontFamilyTag).replaceWith(function() { + return suggestInput.toTagString(); + }); + }); + + //==================================================================== + // Events + //==================================================================== + $(this.wrapSelector('#vp_plImportRun')).click(function() { + // generateImportCode + var code = that.generateImportCode(); + // run cell + $(vpCommon.wrapSelector('#vp_appsCode')).trigger({ + type: 'popup_run', + title: 'Background', + code: code, + addCell: true, + runCell: true + }); + }); + } + /** * 서브플롯 옵션 페이지 구성 */ @@ -978,6 +1085,39 @@ define([ return code; } + /** + * Generate Import options code + * @returns code + */ + MatplotPackage.prototype.generateImportCode = function() { + var code = new sb.StringBuilder(); + + // get parameters + var figWidth = $(this.wrapSelector('#vp_plFigureWidth')).val(); + var figHeight = $(this.wrapSelector('#vp_plFigureHeight')).val(); + var styleName = $(this.wrapSelector('#vp_plStyle')).val(); + var fontName = $(this.wrapSelector('#vp_plFontName')).val(); + var fontSize = $(this.wrapSelector('#vp_plFontSize')).val(); + + code.appendLine('import matplotlib.pyplot as plt'); + code.appendFormatLine("plt.rc('figure', figsize=({0}, {1}))", figWidth, figHeight); + if (styleName && styleName.length > 0) { + code.appendFormatLine("plt.style.use('{0}')", styleName); + } + code.appendLine(); + + code.appendLine('from matplotlib import rcParams'); + if (fontName && fontName.length > 0) { + code.appendFormatLine("rcParams['font.family'] = '{0}'", fontName); + } + if (fontSize && fontSize.length > 0) { + code.appendFormatLine("rcParams['font.size'] = {0}", fontSize); + } + code.append("rcParams['axes.unicode_minus'] = False"); + + return code.toString(); + } + /** * 코드 생성 * @param {boolean} exec 실행여부 diff --git a/src/vp.js b/src/vp.js index d9b53e63..b912b77b 100644 --- a/src/vp.js +++ b/src/vp.js @@ -552,6 +552,13 @@ // 기본설정 불러오기 readDefaultConfig(); + // Operations on kernel restart + events.on('kernel_ready.Kernel', function (evt, info) { + console.log('vp operations for kernel ready...'); + // read vp functions + read_kernel_functions(); + }); + return { vpInit: vpInit, readConfig: readConfig };