{"id":2076,"date":"2024-05-22T06:58:35","date_gmt":"2024-05-22T04:58:35","guid":{"rendered":"https:\/\/inseri.swiss\/?p=1502"},"modified":"2024-11-11T06:58:35","modified_gmt":"2024-11-11T06:58:35","slug":"global-student-visa-cost","status":"publish","type":"post","link":"https:\/\/zi.uzh.ch\/whp\/science-it\/inseri\/2024\/05\/global-student-visa-cost\/","title":{"rendered":"Global Student Visa Cost"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In this example we are using a dataset available on Zenodo as a csv file (see <a href=\"https:\/\/doi.org\/10.5281\/zenodo.4572529\">https:\/\/doi.org\/10.5281\/zenodo.4572529<\/a>). We will focus on the student visa cost. The aim is to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>display the cost in an interactive table,<\/li>\n\n\n\n<li>for a selected country display, display in a chart the most expensive 10 target countries.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/doi.org\/10.5281\/zenodo.4572529\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/zenodo.org\/badge\/DOI\/10.5281\/zenodo.4572529.svg\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<div class=\"wp-block-inseri-core-zenodo\" data-attributes=\"{&quot;blockId&quot;:&quot;eAMqWsqCjZbSiXQDR3gPG&quot;,&quot;doi&quot;:&quot;10.5281\/zenodo.4572529&quot;,&quot;files&quot;:[&quot;GMP_GlobalVisaCostDataset_version1.1.csv&quot;,&quot;readme.txt&quot;],&quot;isVisible&quot;:false,&quot;label&quot;:&quot;Choose a file&quot;,&quot;metadata&quot;:{&quot;name&quot;:&quot;Zenodo-CSV&quot;},&quot;selectedFile&quot;:&quot;GMP_GlobalVisaCostDataset_version1.1.csv&quot;}\">is loading &#8230;<\/div>\n\n\n\n<div class=\"wp-block-inseri-core-python\" data-attributes=\"{&quot;autoTrigger&quot;:true,&quot;blockId&quot;:&quot;mErBmA5IVztUjpkvflAAQ&quot;,&quot;content&quot;:&quot;from%20io%20import%20StringIO%0Aimport%20pandas%20as%20pd%0Aimport%20numpy%20as%20np%0A%0Acsv_file%20%3D%20StringIO(csv_text)%0Adf_all%20%3D%20pd.read_csv(csv_file%2C%20sep%3D%22%5Ct%22).replace(%7Bnp.nan%3ANone%7D)%0Adf%3D%20df_all.iloc%5B%3A%2C%5B0%2C1%2C5%5D%5D.dropna()%0Adf_as_records%20%3D%20df.to_dict(orient%3D%22records%22)%0A%0Asource_country%20%3D%20list(df.iloc%5B%3A%2C0%5D.sort_values().unique())%0A&quot;,&quot;editable&quot;:false,&quot;height&quot;:150,&quot;inputCode&quot;:&quot;&quot;,&quot;inputs&quot;:{&quot;csv_text&quot;:&quot;eAMqWsqCjZbSiXQDR3gPG\/file&quot;},&quot;isVisible&quot;:false,&quot;label&quot;:&quot;&quot;,&quot;metadata&quot;:{&quot;name&quot;:&quot;Python-CSV&quot;},&quot;mode&quot;:&quot;editor&quot;,&quot;outputs&quot;:[[&quot;df_as_records&quot;,&quot;application\/json&quot;],[&quot;source_country&quot;,&quot;application\/json&quot;]]}\">is loading &#8230;<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Please see below the student visa cost as an interactive table. Feel free to use the search functionality.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Double click<\/strong> on a country name below in the table to use it as a source country for displaying the most expensive 10 student visa target countries.<\/p>\n\n\n\n<div class=\"wp-block-inseri-core-data-table\" data-attributes=\"{&quot;blockId&quot;:&quot;mHN4smsavOJvIpGRdV3X0&quot;,&quot;extraOptions&quot;:{&quot;enableCellClick&quot;:true,&quot;enableEditing&quot;:false,&quot;enableRowClick&quot;:true},&quot;inputColumns&quot;:&quot;&quot;,&quot;inputData&quot;:&quot;mErBmA5IVztUjpkvflAAQ\/df_as_records&quot;,&quot;metadata&quot;:{&quot;name&quot;:&quot;DataTable&quot;},&quot;options&quot;:{&quot;enableBottomToolbar&quot;:true,&quot;enableColumnActions&quot;:true,&quot;enableColumnFilters&quot;:false,&quot;enableColumnOrdering&quot;:false,&quot;enableDensityToggle&quot;:true,&quot;enableFullScreenToggle&quot;:true,&quot;enableGlobalFilter&quot;:true,&quot;enableHiding&quot;:true,&quot;enablePagination&quot;:true,&quot;enableRowVirtualization&quot;:false,&quot;enableSorting&quot;:true,&quot;enableTopToolbar&quot;:true}}\">is loading &#8230;<\/div>\n\n\n\n<div class=\"wp-block-inseri-core-python\" data-attributes=\"{&quot;autoTrigger&quot;:true,&quot;blockId&quot;:&quot;0xd2FCYdpawg93DRDxA9t&quot;,&quot;content&quot;:&quot;import%20pandas%20as%20pd%0A%0A%0Adf%20%3D%20pd.DataFrame.from_records(df_as_records)%0A%0Aselected_country%20%3D%20selected_cell%5B%22cell%22%5D%0A%0Adf%20%3D%20df%5Bdf.source%20%3D%3D%20selected_country%5D%0A%0Adf%20%3D%20df.sort_values(by%3D%5B%22student_visa%22%5D%2C%20ascending%3DFalse)%0Adf%20%3D%20df.head(10)%0A%0Aimport%20micropip%0Aawait%20micropip.install('plotly')%3B%0Aimport%20plotly.express%20as%20px%0A%0Afig%20%3D%20px.bar(x%3Ddf.target%2C%20y%3Ddf.student_visa%2C%20title%3Df%22%7Bselected_country%7D%20as%20a%20Source%20Contry%20-%20Top%2010%20Most%20Expensive%20Student%20Visa%22%2C%20labels%3D%7B%22x%22%3A%22Target%20Country%22%2C%20%22y%22%3A%22Cost%20(US%24)%22%7D)%0A%0Ares%20%3D%20fig.to_dict()%0A%0Aimport%20plotly.io%20as%20pio%0A%0Afig_as_json%20%3D%20pio.to_json(fig)%0A%0A%23%20make%20sure%20you%20load%20the%20string%20(json%20standard%20library%20is%20needed)%0Aimport%20json%0A%23%20res%20is%20output%20of%20this%20block%0Ares%20%3D%20json.loads(fig_as_json)%0A&quot;,&quot;editable&quot;:false,&quot;height&quot;:150,&quot;inputCode&quot;:&quot;&quot;,&quot;inputs&quot;:{&quot;df_as_records&quot;:&quot;mErBmA5IVztUjpkvflAAQ\/df_as_records&quot;,&quot;selected_cell&quot;:&quot;mHN4smsavOJvIpGRdV3X0\/cell&quot;},&quot;isVisible&quot;:false,&quot;label&quot;:&quot;&quot;,&quot;metadata&quot;:{&quot;name&quot;:&quot;Python-Plotly&quot;},&quot;mode&quot;:&quot;editor&quot;,&quot;outputs&quot;:[[&quot;res&quot;,&quot;application\/json&quot;]]}\">is loading &#8230;<\/div>\n\n\n\n<div class=\"wp-block-inseri-core-plotly\" data-attributes=\"{&quot;blockId&quot;:&quot;IoDLm2mFZ1nt7elHfNJnD&quot;,&quot;height&quot;:500,&quot;inputConfig&quot;:&quot;&quot;,&quot;inputData&quot;:&quot;&quot;,&quot;inputFull&quot;:&quot;0xd2FCYdpawg93DRDxA9t\/res&quot;,&quot;inputLayout&quot;:&quot;&quot;,&quot;metadata&quot;:{&quot;name&quot;:&quot;Plotly&quot;},&quot;outputs&quot;:[]}\">is loading &#8230;<\/div>\n\n\n\n<div class=\"wp-block-inseri-core-cytoscape\" data-attributes=\"{&quot;blockId&quot;:&quot;IT13a6Psk8lDZGAiv5zvb&quot;,&quot;height&quot;:376,&quot;inputKey&quot;:&quot;__root\/data-flow&quot;,&quot;layout&quot;:&quot;dagre&quot;,&quot;layoutKey&quot;:&quot;&quot;,&quot;metadata&quot;:{&quot;name&quot;:&quot;DataFlow&quot;},&quot;styleKey&quot;:&quot;&quot;}\">is loading &#8230;<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-f56f613f wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:60%\"><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-inseri-core-export alignright\" data-attributes=\"{&quot;align&quot;:&quot;right&quot;,&quot;blockId&quot;:&quot;vaxQQCzmrnvQCf4meQgfk&quot;,&quot;metadata&quot;:{&quot;name&quot;:&quot;export&quot;},&quot;postId&quot;:1502}\">is loading &#8230;<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-inseri-core-share alignright\" data-attributes=\"{&quot;align&quot;:&quot;right&quot;,&quot;blockId&quot;:&quot;KTETwIissQyi0jL3ZpuwV&quot;,&quot;copiedText&quot;:&quot;Copied&quot;,&quot;metadata&quot;:{&quot;name&quot;:&quot;share&quot;},&quot;showIcon&quot;:true,&quot;text&quot;:&quot;Share&quot;}\">is loading &#8230;<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this example we are using a dataset available on Zenodo as a csv file (see https:\/\/doi.org\/10.5281\/zenodo.4572529). We will focus on the student visa cost. The aim is to: Please see below the student visa cost as an interactive table. Feel free to use the search functionality. Double click on a country name below in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[36,37,40,47,48,50,52,55],"class_list":["post-2076","post","type-post","status-publish","format-standard","hentry","category-showcase","tag-cytoscape","tag-data-table","tag-export","tag-plotly-chart","tag-python-code","tag-share","tag-text-editor","tag-zenodo-repository"],"_links":{"self":[{"href":"https:\/\/zi.uzh.ch\/whp\/science-it\/inseri\/wp-json\/wp\/v2\/posts\/2076","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zi.uzh.ch\/whp\/science-it\/inseri\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zi.uzh.ch\/whp\/science-it\/inseri\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zi.uzh.ch\/whp\/science-it\/inseri\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zi.uzh.ch\/whp\/science-it\/inseri\/wp-json\/wp\/v2\/comments?post=2076"}],"version-history":[{"count":1,"href":"https:\/\/zi.uzh.ch\/whp\/science-it\/inseri\/wp-json\/wp\/v2\/posts\/2076\/revisions"}],"predecessor-version":[{"id":2131,"href":"https:\/\/zi.uzh.ch\/whp\/science-it\/inseri\/wp-json\/wp\/v2\/posts\/2076\/revisions\/2131"}],"wp:attachment":[{"href":"https:\/\/zi.uzh.ch\/whp\/science-it\/inseri\/wp-json\/wp\/v2\/media?parent=2076"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zi.uzh.ch\/whp\/science-it\/inseri\/wp-json\/wp\/v2\/categories?post=2076"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zi.uzh.ch\/whp\/science-it\/inseri\/wp-json\/wp\/v2\/tags?post=2076"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}