{"id":4429,"date":"2023-12-05T22:25:00","date_gmt":"2023-12-05T15:25:00","guid":{"rendered":"https:\/\/meteo.itb.ac.id\/?p=4429"},"modified":"2026-08-14T22:27:11","modified_gmt":"2026-08-14T15:27:11","slug":"tutorial-on-reading-csv-files-in-python-using-pandas","status":"publish","type":"post","link":"https:\/\/meteo.itb.ac.id\/?p=4429&lang=en","title":{"rendered":"Tutorial on reading CSV files in Python using pandas"},"content":{"rendered":"\n<p>This tutorial demonstrates how to open meteorological data from a .csv file using the Python pandas module.<\/p>\n\n\n\n<p>Suppose you have a weather station dataset in a .csv file named &#8216;weather_data.csv&#8217;. We can begin by importing the pandas module and opening the file using the <code>pandas.read_csv()<\/code> function.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import pandas as pd\n\nfpath='weather_data.csv'  #direktori file dibuat di variabel fpath\ndf=pd.read_csv(fpath)<\/pre>\n\n\n\n<p>After the file is imported, you can preview the data using the <code>head()<\/code> function to view the columns.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">df.head()<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"745\" height=\"283\" src=\"https:\/\/www.meteo.itb.ac.id\/wp-content\/uploads\/sites\/340\/2023\/12\/pandas_df_head-1.png\" alt=\"\" class=\"wp-image-2236\" srcset=\"https:\/\/meteo.itb.ac.id\/wp-content\/uploads\/sites\/340\/2023\/12\/pandas_df_head-1.png 745w, https:\/\/meteo.itb.ac.id\/wp-content\/uploads\/sites\/340\/2023\/12\/pandas_df_head-1-300x114.png 300w, https:\/\/meteo.itb.ac.id\/wp-content\/uploads\/sites\/340\/2023\/12\/pandas_df_head-1-1320x500.png 1320w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial demonstrates how to open meteorological data from a .csv file using the Python pandas module. Suppose you have a weather station dataset in a .csv file named &#8216;weather_data.csv&#8217;. We can begin by importing the pandas module and opening the file using the pandas.read_csv() function. import pandas as pd fpath=&#8217;weather_data.csv&#8217; #direktori file dibuat di &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/meteo.itb.ac.id\/?p=4429&#038;lang=en\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Tutorial on reading CSV files in Python using pandas&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1347,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-4429","post","type-post","status-publish","format-standard","hentry","category-announcement"],"_links":{"self":[{"href":"https:\/\/meteo.itb.ac.id\/index.php?rest_route=\/wp\/v2\/posts\/4429","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meteo.itb.ac.id\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meteo.itb.ac.id\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meteo.itb.ac.id\/index.php?rest_route=\/wp\/v2\/users\/1347"}],"replies":[{"embeddable":true,"href":"https:\/\/meteo.itb.ac.id\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4429"}],"version-history":[{"count":1,"href":"https:\/\/meteo.itb.ac.id\/index.php?rest_route=\/wp\/v2\/posts\/4429\/revisions"}],"predecessor-version":[{"id":4430,"href":"https:\/\/meteo.itb.ac.id\/index.php?rest_route=\/wp\/v2\/posts\/4429\/revisions\/4430"}],"wp:attachment":[{"href":"https:\/\/meteo.itb.ac.id\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meteo.itb.ac.id\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4429"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meteo.itb.ac.id\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}