{"id":3728,"date":"2023-07-15T21:51:16","date_gmt":"2023-07-15T21:51:16","guid":{"rendered":"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/"},"modified":"2023-07-15T21:51:16","modified_gmt":"2023-07-15T21:51:16","slug":"pandalar-yilin-ay-gununden-tarih-sutunu-olusturur","status":"publish","type":"post","link":"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/","title":{"rendered":"Pandalar: y\u0131l, ay ve g\u00fcnden olu\u015fan bir tarih s\u00fctunu olu\u015fturun"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Pandas DataFrame&#8217;de y\u0131l, ay ve g\u00fcn s\u00fctunlar\u0131ndan bir tarih s\u00fctunu olu\u015fturmak i\u00e7in a\u015fa\u011f\u0131daki temel s\u00f6zdizimini kullanabilirsiniz:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>df[' <span style=\"color: #ff0000;\">date<\/span> '] = pd. <span style=\"color: #3366ff;\">to_datetime<\/span> (dict(year=df. <span style=\"color: #3366ff;\">year<\/span> , month=df. <span style=\"color: #3366ff;\">month<\/span> , day=df. <span style=\"color: #3366ff;\">day<\/span> ))\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">A\u015fa\u011f\u0131daki \u00f6rnek, bu s\u00f6zdiziminin pratikte nas\u0131l kullan\u0131laca\u011f\u0131n\u0131 g\u00f6sterir.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>\u00d6rnek: Pandas&#8217;ta y\u0131l, ay ve g\u00fcnden bir tarih s\u00fctunu olu\u015fturun<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Diyelim ki bir \u015firketin farkl\u0131 tarihlerde yapt\u0131\u011f\u0131 sat\u0131\u015flar\u0131 g\u00f6steren a\u015fa\u011f\u0131daki panda DataFrame&#8217;imiz var:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008000;\">import<\/span> pandas <span style=\"color: #008000;\">as<\/span> pd\n\n<span style=\"color: #008080;\">#createDataFrame<\/span>\ndf = pd. <span style=\"color: #3366ff;\">DataFrame<\/span> ({' <span style=\"color: #ff0000;\">year<\/span> ': [2021, 2022, 2022, 2022, 2022, 2022, 2022, 2022],\n                   ' <span style=\"color: #ff0000;\">month<\/span> ': [7, 1, 1, 2, 5, 10, 11, 12],\n                   ' <span style=\"color: #ff0000;\">day<\/span> ': [4, 15, 25, 27, 27, 24, 10, 18],\n                   ' <span style=\"color: #ff0000;\">sales<\/span> ': [140, 200, 250, 180, 130, 87, 90, 95]})\n\n<span style=\"color: #008080;\">#view DataFrame\n<\/span><span style=\"color: #008000;\">print<\/span> (df)\n\n   year month day sales\n0 2021 7 4 140\n1 2022 1 15 200\n2 2022 1 25 250\n3 2022 2 27 180\n4 2022 5 27 130\n5 2022 10 24 87\n6 2022 11 10 90\n7 2022 12 18 95\n<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Her sat\u0131r i\u00e7in bir tarih olu\u015fturmak amac\u0131yla DataFrame&#8217;deki <strong>y\u0131l<\/strong> , <strong>ay<\/strong> ve <strong>g\u00fcn<\/strong> s\u00fctunlar\u0131n\u0131n de\u011ferlerini birle\u015ftiren <strong>tarih<\/strong> ad\u0131 verilen yeni bir s\u00fctun olu\u015fturmak i\u00e7in a\u015fa\u011f\u0131daki s\u00f6zdizimini kullanabiliriz:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\">#create date columns from year, month, and day columns\n<\/span>df[' <span style=\"color: #ff0000;\">date<\/span> '] = pd. <span style=\"color: #3366ff;\">to_datetime<\/span> (dict(year=df. <span style=\"color: #3366ff;\">year<\/span> , month=df. <span style=\"color: #3366ff;\">month<\/span> , day=df. <span style=\"color: #3366ff;\">day<\/span> ))\n\n<span style=\"color: #008080;\">#view updated DataFrame\n<span style=\"color: #008000;\">print<\/span><\/span> (df)\n\n   year month day sales date\n0 2021 7 4 140 2021-07-04\n1 2022 1 15 200 2022-01-15\n2 2022 1 25 250 2022-01-25\n3 2022 2 27 180 2022-02-27\n4 2022 5 27 130 2022-05-27\n5 2022 10 24 87 2022-10-24\n6 2022 11 10 90 2022-11-10\n7 2022 12 18 95 2022-12-18\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><strong>Tarih<\/strong> s\u00fctununun, her sat\u0131rdaki <strong>y\u0131l<\/strong> , <strong>ay<\/strong> ve <strong>g\u00fcn<\/strong> s\u00fctunlar\u0131ndaki de\u011ferlere g\u00f6re tarih de\u011ferleri i\u00e7erdi\u011fini unutmay\u0131n.<\/span><\/p>\n<p> <span style=\"color: #000000;\">DataFrame&#8217;deki her bir s\u00fctun hakk\u0131nda bilgi almak i\u00e7in <strong>df.info()<\/strong> i\u015flevini kullan\u0131rsak, yeni <strong>tarih<\/strong> s\u00fctununun <strong>datetime64<\/strong> veri t\u00fcr\u00fcne sahip oldu\u011funu g\u00f6rebiliriz:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#display information about each column in DataFrame\n<span style=\"color: #000000;\">df. <span style=\"color: #3366ff;\">info<\/span> ()\n\n&lt;class 'pandas.core.frame.DataFrame'&gt;\nRangeIndex: 8 entries, 0 to 7\nData columns (total 5 columns):\n # Column Non-Null Count Dtype         \n--- ------ -------------- -----         \n 0 year 8 non-null int64         \n 1 month 8 non-null int64         \n 2 day 8 non-null int64         \n 3 dirty 8 non-null int64         \n 4 date 8 non-null datetime64[ns]\ndtypes: datetime64[ns](1), int64(4)\nmemory usage: 388.0 bytes<\/span><\/span><\/strong><\/pre>\n<h2> <span style=\"color: #000000;\"><strong>Ek kaynaklar<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">A\u015fa\u011f\u0131daki e\u011fitimlerde pandalarda di\u011fer yayg\u0131n i\u015flemlerin nas\u0131l ger\u00e7ekle\u015ftirilece\u011fi a\u00e7\u0131klanmaktad\u0131r:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/tr\/ekle-tarih-pandalarindan-gunleri-cikar\/\" target=\"_blank\" rel=\"noopener\">Pandalar&#8217;da bir tarihe g\u00fcn ekleme ve \u00e7\u0131karma<\/a><br \/> <a href=\"https:\/\/statorials.org\/tr\/pandalar-iki-tarih-arasindaki-cizgileri-seciyor\/\" target=\"_blank\" rel=\"noopener\">Pandalarda iki tarih aras\u0131ndaki sat\u0131rlar nas\u0131l se\u00e7ilir<\/a><br \/> <a href=\"https:\/\/statorials.org\/tr\/pandalarin-tarih-farki\/\" target=\"_blank\" rel=\"noopener\">Pandalarda iki tarih aras\u0131ndaki fark nas\u0131l hesaplan\u0131r?<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pandas DataFrame&#8217;de y\u0131l, ay ve g\u00fcn s\u00fctunlar\u0131ndan bir tarih s\u00fctunu olu\u015fturmak i\u00e7in a\u015fa\u011f\u0131daki temel s\u00f6zdizimini kullanabilirsiniz: df[&#8216; date &#8216;] = pd. to_datetime (dict(year=df. year , month=df. month , day=df. day )) A\u015fa\u011f\u0131daki \u00f6rnek, bu s\u00f6zdiziminin pratikte nas\u0131l kullan\u0131laca\u011f\u0131n\u0131 g\u00f6sterir. \u00d6rnek: Pandas&#8217;ta y\u0131l, ay ve g\u00fcnden bir tarih s\u00fctunu olu\u015fturun Diyelim ki bir \u015firketin farkl\u0131 tarihlerde [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-3728","post","type-post","status-publish","format-standard","hentry","category-rehber"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Pandalar: Y\u0131l, ay ve g\u00fcnden olu\u015fan bir tarih s\u00fctunu olu\u015fturun - Statorials<\/title>\n<meta name=\"description\" content=\"Bu e\u011fitimde, y\u0131l ve ay s\u00fctunlar\u0131ndan tarih s\u00fctununun nas\u0131l olu\u015fturulaca\u011f\u0131 bir \u00f6rnekle a\u00e7\u0131klanmaktad\u0131r.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pandalar: Y\u0131l, ay ve g\u00fcnden olu\u015fan bir tarih s\u00fctunu olu\u015fturun - Statorials\" \/>\n<meta property=\"og:description\" content=\"Bu e\u011fitimde, y\u0131l ve ay s\u00fctunlar\u0131ndan tarih s\u00fctununun nas\u0131l olu\u015fturulaca\u011f\u0131 bir \u00f6rnekle a\u00e7\u0131klanmaktad\u0131r.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-15T21:51:16+00:00\" \/>\n<meta name=\"author\" content=\"Dr.benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Yazan:\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr.benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/\",\"url\":\"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/\",\"name\":\"Pandalar: Y\u0131l, ay ve g\u00fcnden olu\u015fan bir tarih s\u00fctunu olu\u015fturun - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/tr\/#website\"},\"datePublished\":\"2023-07-15T21:51:16+00:00\",\"dateModified\":\"2023-07-15T21:51:16+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/tr\/#\/schema\/person\/365dc158a39a7c8ae256355451e3de48\"},\"description\":\"Bu e\u011fitimde, y\u0131l ve ay s\u00fctunlar\u0131ndan tarih s\u00fctununun nas\u0131l olu\u015fturulaca\u011f\u0131 bir \u00f6rnekle a\u00e7\u0131klanmaktad\u0131r.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Ev\",\"item\":\"https:\/\/statorials.org\/tr\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pandalar: y\u0131l, ay ve g\u00fcnden olu\u015fan bir tarih s\u00fctunu olu\u015fturun\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/tr\/#website\",\"url\":\"https:\/\/statorials.org\/tr\/\",\"name\":\"Statorials\",\"description\":\"\u0130statistik okuryazarl\u0131\u011f\u0131 rehberiniz!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/tr\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"tr\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/tr\/#\/schema\/person\/365dc158a39a7c8ae256355451e3de48\",\"name\":\"Dr.benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"tr\",\"@id\":\"https:\/\/statorials.org\/tr\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/tr\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/tr\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr.benjamin anderson\"},\"description\":\"Merhaba, ben Benjamin, emekli bir istatistik profes\u00f6r\u00fc ve Statorials \u00f6\u011fretmenine d\u00f6n\u00fc\u015ft\u00fcm. \u0130statistik alan\u0131ndaki kapsaml\u0131 deneyimim ve uzmanl\u0131\u011f\u0131mla, \u00f6\u011frencilerimi Statorials arac\u0131l\u0131\u011f\u0131yla g\u00fc\u00e7lendirmek i\u00e7in bilgilerimi payla\u015fmaya can at\u0131yorum. Daha fazlas\u0131n\u0131 bil\",\"sameAs\":[\"https:\/\/statorials.org\/tr\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pandalar: Y\u0131l, ay ve g\u00fcnden olu\u015fan bir tarih s\u00fctunu olu\u015fturun - Statorials","description":"Bu e\u011fitimde, y\u0131l ve ay s\u00fctunlar\u0131ndan tarih s\u00fctununun nas\u0131l olu\u015fturulaca\u011f\u0131 bir \u00f6rnekle a\u00e7\u0131klanmaktad\u0131r.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/","og_locale":"tr_TR","og_type":"article","og_title":"Pandalar: Y\u0131l, ay ve g\u00fcnden olu\u015fan bir tarih s\u00fctunu olu\u015fturun - Statorials","og_description":"Bu e\u011fitimde, y\u0131l ve ay s\u00fctunlar\u0131ndan tarih s\u00fctununun nas\u0131l olu\u015fturulaca\u011f\u0131 bir \u00f6rnekle a\u00e7\u0131klanmaktad\u0131r.","og_url":"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/","og_site_name":"Statorials","article_published_time":"2023-07-15T21:51:16+00:00","author":"Dr.benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"Dr.benjamin anderson","Tahmini okuma s\u00fcresi":"2 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/","url":"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/","name":"Pandalar: Y\u0131l, ay ve g\u00fcnden olu\u015fan bir tarih s\u00fctunu olu\u015fturun - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/tr\/#website"},"datePublished":"2023-07-15T21:51:16+00:00","dateModified":"2023-07-15T21:51:16+00:00","author":{"@id":"https:\/\/statorials.org\/tr\/#\/schema\/person\/365dc158a39a7c8ae256355451e3de48"},"description":"Bu e\u011fitimde, y\u0131l ve ay s\u00fctunlar\u0131ndan tarih s\u00fctununun nas\u0131l olu\u015fturulaca\u011f\u0131 bir \u00f6rnekle a\u00e7\u0131klanmaktad\u0131r.","breadcrumb":{"@id":"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/tr\/pandalar-yilin-ay-gununden-tarih-sutunu-olusturur\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Ev","item":"https:\/\/statorials.org\/tr\/"},{"@type":"ListItem","position":2,"name":"Pandalar: y\u0131l, ay ve g\u00fcnden olu\u015fan bir tarih s\u00fctunu olu\u015fturun"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/tr\/#website","url":"https:\/\/statorials.org\/tr\/","name":"Statorials","description":"\u0130statistik okuryazarl\u0131\u011f\u0131 rehberiniz!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/tr\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"tr"},{"@type":"Person","@id":"https:\/\/statorials.org\/tr\/#\/schema\/person\/365dc158a39a7c8ae256355451e3de48","name":"Dr.benjamin anderson","image":{"@type":"ImageObject","inLanguage":"tr","@id":"https:\/\/statorials.org\/tr\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/tr\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/tr\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr.benjamin anderson"},"description":"Merhaba, ben Benjamin, emekli bir istatistik profes\u00f6r\u00fc ve Statorials \u00f6\u011fretmenine d\u00f6n\u00fc\u015ft\u00fcm. \u0130statistik alan\u0131ndaki kapsaml\u0131 deneyimim ve uzmanl\u0131\u011f\u0131mla, \u00f6\u011frencilerimi Statorials arac\u0131l\u0131\u011f\u0131yla g\u00fc\u00e7lendirmek i\u00e7in bilgilerimi payla\u015fmaya can at\u0131yorum. Daha fazlas\u0131n\u0131 bil","sameAs":["https:\/\/statorials.org\/tr"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/posts\/3728","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/comments?post=3728"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/posts\/3728\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/media?parent=3728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/categories?post=3728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/tags?post=3728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}