{"id":4239,"date":"2023-07-12T15:01:15","date_gmt":"2023-07-12T15:01:15","guid":{"rendered":"https:\/\/statorials.org\/tr\/pandalar-tarih-ve-saat-sutunlarini-birlestirir\/"},"modified":"2023-07-12T15:01:15","modified_gmt":"2023-07-12T15:01:15","slug":"pandalar-tarih-ve-saat-sutunlarini-birlestirir","status":"publish","type":"post","link":"https:\/\/statorials.org\/tr\/pandalar-tarih-ve-saat-sutunlarini-birlestirir\/","title":{"rendered":"Pandalar: tarih ve saat s\u00fctunlar\u0131 nas\u0131l birle\u015ftirilir"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Pandas DataFrame&#8217;in tarih ve saat s\u00fctunlar\u0131n\u0131 tek bir s\u00fctunda birle\u015ftirmek i\u00e7in a\u015fa\u011f\u0131daki s\u00f6zdizimini kullanabilirsiniz:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>df[' <span style=\"color: #ff0000;\">datetime<\/span> '] = pd. <span style=\"color: #3366ff;\">to_datetime<\/span> (df[' <span style=\"color: #ff0000;\">date<\/span> '] + ' ' + df[' <span style=\"color: #ff0000;\">time<\/span> '])\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Bu s\u00f6zdiziminin, <strong>tarih<\/strong> ve <strong>saat<\/strong> s\u00fctunlar\u0131n\u0131n her ikisinin de ge\u00e7erli dizeler oldu\u011funu varsayd\u0131\u011f\u0131n\u0131 unutmay\u0131n.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Her iki s\u00fctun da zaten dize de\u011filse, bunlar\u0131 dizelere d\u00f6n\u00fc\u015ft\u00fcrmek i\u00e7in <strong>astype(str)<\/strong> komutunu kullanabilirsiniz:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>df[' <span style=\"color: #ff0000;\">datetime<\/span> '] = pd. <span style=\"color: #3366ff;\">to_datetime<\/span> (df[' <span style=\"color: #ff0000;\">date<\/span> ']. <span style=\"color: #3366ff;\">astype<\/span> ( <span style=\"color: #008000;\">str<\/span> ) + ' ' + df[' <span style=\"color: #ff0000;\">time<\/span> ']. <span style=\"color: #3366ff;\">astype<\/span> ( <span style=\"color: #008000;\">str<\/span> ))<\/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: Pandalarda Tarih ve Saat S\u00fctunlar\u0131n\u0131 Birle\u015ftirme<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Diyelim ki bir tarih s\u00fctunu ve bir zaman s\u00fctunu i\u00e7eren a\u015fa\u011f\u0131daki pandalar DataFrame&#8217;e sahibiz:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import<\/span> pandas <span style=\"color: #008000;\">as<\/span> pd\n\n<span style=\"color: #008080;\">#createDataFrame<span style=\"color: #000000;\">\ndf = pd. <span style=\"color: #3366ff;\">DataFrame<\/span> ({' <span style=\"color: #ff0000;\">date<\/span> ': ['10-1-2023', '10-4-2023', '10-6-2023', '10-6-2023',\n                            '10-14-2023', '10-15-2023', '10-29-2023'],\n                   ' <span style=\"color: #ff0000;\">time<\/span> ': ['4:15:00', '7:16:04', '9:25:00', '10:13:45',\n                            '15:30:00', '18:15:00', '23:15:00']})\n\n<span style=\"color: #008080;\">#view DataFrame\n<\/span><span style=\"color: #008000;\">print<\/span> (df)\n\n         date time\n0 10-1-2023 4:15:00\n1 10-4-2023 7:16:04\n2 10-6-2023 9:25:00\n3 10-6-2023 10:13:45\n4 10-14-2023 15:30:00\n5 10-15-2023 18:15:00\n6 10-29-2023 23:15:00\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Diyelim ki <strong>tarih<\/strong> ve <strong>saat<\/strong> s\u00fctunlar\u0131ndaki de\u011ferleri birle\u015ftiren <strong>datetime<\/strong> ad\u0131nda yeni bir s\u00fctun olu\u015fturmak istiyoruz.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Bunu yapmak 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;\">#create new datetime column<\/span>\ndf[' <span style=\"color: #ff0000;\">datetime<\/span> '] = pd. <span style=\"color: #3366ff;\">to_datetime<\/span> (df[' <span style=\"color: #ff0000;\">date<\/span> '] + ' ' + df[' <span style=\"color: #ff0000;\">time<\/span> '])\n\n<span style=\"color: #008080;\">#view updated DataFrame<\/span>\n<span style=\"color: #008000;\">print<\/span> (df)\n\n         datetime datetime\n0 10-1-2023 4:15:00 2023-10-01 04:15:00\n1 10-4-2023 7:16:04 2023-10-04 07:16:04\n2 10-6-2023 9:25:00 2023-10-06 09:25:00\n3 10-6-2023 10:13:45 2023-10-06 10:13:45\n4 10-14-2023 15:30:00 2023-10-14 15:30:00\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Yeni <strong>tarihsaat<\/strong> s\u00fctununun, <strong>tarih<\/strong> ve <strong>saat<\/strong> s\u00fctunlar\u0131ndaki de\u011ferleri tek bir s\u00fctunda ba\u015far\u0131yla birle\u015ftirdi\u011fini unutmay\u0131n.<\/span><\/p>\n<p> <span style=\"color: #000000;\">DataFrame&#8217;deki her s\u00fctunun veri t\u00fcrlerini kontrol etmek i\u00e7in <strong>dtypes<\/strong> i\u015flevini de 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;\">#view data type of each column\n<\/span>df. <span style=\"color: #3366ff;\">dtypes\n\n<span style=\"color: #000000;\">date object\ntime object\ndatetime datetime64[ns]\ndtype:object\n<\/span><\/span><\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">Sonu\u00e7tan, <strong>tarih<\/strong> ve <strong>saat<\/strong> s\u00fctunlar\u0131n\u0131n her ikisinin de nesneler (yani dizeler) oldu\u011funu ve yeni <strong>tarihsaat<\/strong> s\u00fctununun bir tarihsaat oldu\u011funu g\u00f6rebiliriz.<\/span><\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Not<\/strong> : Pandas <strong>to_datetime()<\/strong> i\u015flevinin tam belgelerini <a href=\"https:\/\/pandas.pydata.org\/docs\/reference\/api\/pandas.to_datetime.html\" target=\"_blank\" rel=\"noopener\">burada<\/a> bulabilirsiniz.<\/span><\/p>\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\/panda-tarih-araligi\/\" target=\"_blank\" rel=\"noopener\">Pandalar&#8217;da tarih aral\u0131\u011f\u0131 nas\u0131l olu\u015fturulur?<\/a><br \/> <a href=\"https:\/\/statorials.org\/tr\/pandalarin-zaman-damgasi-tarih-saat\/\" target=\"_blank\" rel=\"noopener\">Pandalar&#8217;da zaman damgas\u0131n\u0131 tarih\/saat&#8217;e d\u00f6n\u00fc\u015ft\u00fcrme<\/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;in tarih ve saat s\u00fctunlar\u0131n\u0131 tek bir s\u00fctunda birle\u015ftirmek i\u00e7in a\u015fa\u011f\u0131daki s\u00f6zdizimini kullanabilirsiniz: df[&#8216; datetime &#8216;] = pd. to_datetime (df[&#8216; date &#8216;] + &#8216; &#8216; + df[&#8216; time &#8216;]) Bu s\u00f6zdiziminin, tarih ve saat s\u00fctunlar\u0131n\u0131n her ikisinin de ge\u00e7erli dizeler oldu\u011funu varsayd\u0131\u011f\u0131n\u0131 unutmay\u0131n. Her iki s\u00fctun da zaten dize de\u011filse, bunlar\u0131 dizelere d\u00f6n\u00fc\u015ft\u00fcrmek i\u00e7in [&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-4239","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: Tarih ve saat s\u00fctunlar\u0131 nas\u0131l birle\u015ftirilir - Statorials<\/title>\n<meta name=\"description\" content=\"Bu e\u011fitimde, bir pandan\u0131n DataFrame&#039;indeki tarih ve saat s\u00fctunlar\u0131n\u0131n nas\u0131l birle\u015ftirilece\u011fi 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-tarih-ve-saat-sutunlarini-birlestirir\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pandalar: Tarih ve saat s\u00fctunlar\u0131 nas\u0131l birle\u015ftirilir - Statorials\" \/>\n<meta property=\"og:description\" content=\"Bu e\u011fitimde, bir pandan\u0131n DataFrame&#039;indeki tarih ve saat s\u00fctunlar\u0131n\u0131n nas\u0131l birle\u015ftirilece\u011fi bir \u00f6rnekle a\u00e7\u0131klanmaktad\u0131r.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/tr\/pandalar-tarih-ve-saat-sutunlarini-birlestirir\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-12T15:01:15+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-tarih-ve-saat-sutunlarini-birlestirir\/\",\"url\":\"https:\/\/statorials.org\/tr\/pandalar-tarih-ve-saat-sutunlarini-birlestirir\/\",\"name\":\"Pandalar: Tarih ve saat s\u00fctunlar\u0131 nas\u0131l birle\u015ftirilir - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/tr\/#website\"},\"datePublished\":\"2023-07-12T15:01:15+00:00\",\"dateModified\":\"2023-07-12T15:01:15+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/tr\/#\/schema\/person\/365dc158a39a7c8ae256355451e3de48\"},\"description\":\"Bu e\u011fitimde, bir pandan\u0131n DataFrame&#39;indeki tarih ve saat s\u00fctunlar\u0131n\u0131n nas\u0131l birle\u015ftirilece\u011fi bir \u00f6rnekle a\u00e7\u0131klanmaktad\u0131r.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/tr\/pandalar-tarih-ve-saat-sutunlarini-birlestirir\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/tr\/pandalar-tarih-ve-saat-sutunlarini-birlestirir\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/tr\/pandalar-tarih-ve-saat-sutunlarini-birlestirir\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Ev\",\"item\":\"https:\/\/statorials.org\/tr\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pandalar: tarih ve saat s\u00fctunlar\u0131 nas\u0131l birle\u015ftirilir\"}]},{\"@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: Tarih ve saat s\u00fctunlar\u0131 nas\u0131l birle\u015ftirilir - Statorials","description":"Bu e\u011fitimde, bir pandan\u0131n DataFrame&#39;indeki tarih ve saat s\u00fctunlar\u0131n\u0131n nas\u0131l birle\u015ftirilece\u011fi 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-tarih-ve-saat-sutunlarini-birlestirir\/","og_locale":"tr_TR","og_type":"article","og_title":"Pandalar: Tarih ve saat s\u00fctunlar\u0131 nas\u0131l birle\u015ftirilir - Statorials","og_description":"Bu e\u011fitimde, bir pandan\u0131n DataFrame&#39;indeki tarih ve saat s\u00fctunlar\u0131n\u0131n nas\u0131l birle\u015ftirilece\u011fi bir \u00f6rnekle a\u00e7\u0131klanmaktad\u0131r.","og_url":"https:\/\/statorials.org\/tr\/pandalar-tarih-ve-saat-sutunlarini-birlestirir\/","og_site_name":"Statorials","article_published_time":"2023-07-12T15:01:15+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-tarih-ve-saat-sutunlarini-birlestirir\/","url":"https:\/\/statorials.org\/tr\/pandalar-tarih-ve-saat-sutunlarini-birlestirir\/","name":"Pandalar: Tarih ve saat s\u00fctunlar\u0131 nas\u0131l birle\u015ftirilir - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/tr\/#website"},"datePublished":"2023-07-12T15:01:15+00:00","dateModified":"2023-07-12T15:01:15+00:00","author":{"@id":"https:\/\/statorials.org\/tr\/#\/schema\/person\/365dc158a39a7c8ae256355451e3de48"},"description":"Bu e\u011fitimde, bir pandan\u0131n DataFrame&#39;indeki tarih ve saat s\u00fctunlar\u0131n\u0131n nas\u0131l birle\u015ftirilece\u011fi bir \u00f6rnekle a\u00e7\u0131klanmaktad\u0131r.","breadcrumb":{"@id":"https:\/\/statorials.org\/tr\/pandalar-tarih-ve-saat-sutunlarini-birlestirir\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/tr\/pandalar-tarih-ve-saat-sutunlarini-birlestirir\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/tr\/pandalar-tarih-ve-saat-sutunlarini-birlestirir\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Ev","item":"https:\/\/statorials.org\/tr\/"},{"@type":"ListItem","position":2,"name":"Pandalar: tarih ve saat s\u00fctunlar\u0131 nas\u0131l birle\u015ftirilir"}]},{"@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\/4239","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=4239"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/posts\/4239\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/media?parent=4239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/categories?post=4239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/tags?post=4239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}