{"id":3493,"date":"2023-04-12T15:33:27","date_gmt":"2023-04-12T15:33:27","guid":{"rendered":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/"},"modified":"2026-01-20T16:11:07","modified_gmt":"2026-01-20T16:11:07","slug":"loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2","status":"publish","type":"post","link":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/","title":{"rendered":"How Do I Load Data to IBM Planning Analytics Using TM1py and Pandas? \u2013 Part 2"},"content":{"rendered":"<table width=\"0\">\n<tbody>\n<tr>\n<td width=\"143\">Title:<\/td>\n<td width=\"479\"><em>Loading Data to IBM Planning Analytics using TM1Py and Pandas<\/em>\u00a0Part 2<\/td>\n<\/tr>\n<tr>\n<td width=\"143\">Author(s):<\/td>\n<td width=\"479\"><em>Paul Caggiano<\/em><\/td>\n<\/tr>\n<tr>\n<td width=\"143\">Application:<\/td>\n<td width=\"479\"><em>Planning Analytics, Python<\/em><\/td>\n<\/tr>\n<tr>\n<td width=\"143\">Software Version:<\/td>\n<td width=\"479\"><em>Planning Analytics Version 11.8.01300.1; Python 3.9.12<\/em><\/td>\n<\/tr>\n<tr>\n<td width=\"143\">Keywords:<\/td>\n<td width=\"479\"><em>TM1Py, Python, Planning Analytics, TM1, Pandas<\/em><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>This article is Part 2 of the series exploring how to integrate TM1Py with your IBM Planning Analytics (PA) instance to improve efficiency when loading data generated by a Python script. Part 1 of this series, covers how to create a connection between TM1Py and your PA instance. In this article, we will prepare our dataframe for an upload to PA.<\/p>\n<p><strong>Uploading Data from a Pandas Dataframe<\/strong><\/p>\n<p>As mentioned, TM1Py comes with the ability to write directly to PA from a Pandas dataframe. The dataframe must have the same number of columns as the number of dimensions in the target cube, plus an additional column for the value, similar to an upload file. The columns must be in the same order as dimensions in the cube. Take the example below showing the cube dimension order, as well as the Pandas dataframe containing values output by an automated forecast.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2571\" src=\"https:\/\/quebit.com\/askquebit\/wp-content\/uploads\/2023\/01\/Picture1-2-300x132.png\" alt=\"\" width=\"407\" height=\"179\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2572\" src=\"https:\/\/quebit.com\/askquebit\/wp-content\/uploads\/2023\/01\/Picture3-1.png\" alt=\"\" width=\"213\" height=\"167\" \/><\/p>\n<p>Once the dataframe is prepared, an optional step is to convert numeric element names to \u201cobjects\u201d. For example, in our dataframe the \u201cPeriods\u201d column will default to type \u201cint\u201d, however TM1py will return an error if the element names are not of the type \u201cobject\u201d. Additionally, it is a good practice to convert Values to type \u201cint\u201d as these are our numerical values. The code below will accomplish this.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2573\" src=\"https:\/\/quebit.com\/askquebit\/wp-content\/uploads\/2023\/01\/Picture22-300x66.png\" alt=\"\" width=\"959\" height=\"211\" \/><\/p>\n<p>This code utilizes a dictionary, the variable <em>data_types_dict<\/em>, to set the columns shown to the data types desired; \u201cPeriods\u201d to a string\/object and \u201cValues\u201d to an int. Then, we reassign the original dataframe, variable <em>df<\/em>, to the dataframe that references our new data types using the <em>astype()<\/em> function from Pandas. More information on functions for the Pandas library can be found <a href=\"https:\/\/pandas.pydata.org\/docs\/user_guide\/index.html#user-guide\">here<\/a>.<\/p>\n<p>Now that the dataframe is set up for use with your cube in PA, we can start preparing the cube for our data, and send it to PA. This is covered in Part 3<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Title: Loading Data to IBM Planning Analytics using TM1Py and Pandas\u00a0Part 2 Author(s): Paul Caggiano Application: Planning Analytics, Python Software Version: Planning Analytics Version 11.8.01300.1; Python 3.9.12 Keywords: TM1Py, Python, Planning Analytics, TM1, Pandas &nbsp; This article is Part 2 of the series exploring how to integrate TM1Py with your IBM Planning Analytics (PA) instance&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[24],"tags":[38,36,51],"class_list":["post-3493","post","type-post","status-publish","format-standard","hentry","category-ibm","tag-how-tos","tag-planning-analytics","tag-planning-analytics-how-tos"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How Do I Load Data to IBM Planning Analytics Using TM1py and Pandas? \u2013 Part 2 - QueBIT<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How Do I Load Data to IBM Planning Analytics Using TM1py and Pandas? \u2013 Part 2 - QueBIT\" \/>\n<meta property=\"og:description\" content=\"Title: Loading Data to IBM Planning Analytics using TM1Py and Pandas\u00a0Part 2 Author(s): Paul Caggiano Application: Planning Analytics, Python Software Version: Planning Analytics Version 11.8.01300.1; Python 3.9.12 Keywords: TM1Py, Python, Planning Analytics, TM1, Pandas &nbsp; This article is Part 2 of the series exploring how to integrate TM1Py with your IBM Planning Analytics (PA) instance&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/\" \/>\n<meta property=\"og:site_name\" content=\"QueBIT\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-12T15:33:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-20T16:11:07+00:00\" \/>\n<meta name=\"author\" content=\"agoddard\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"agoddard\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\\\/\"},\"author\":{\"name\":\"agoddard\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/#\\\/schema\\\/person\\\/e52d72da0fd2f5f70d189343fe4f5084\"},\"headline\":\"How Do I Load Data to IBM Planning Analytics Using TM1py and Pandas? \u2013 Part 2\",\"datePublished\":\"2023-04-12T15:33:27+00:00\",\"dateModified\":\"2026-01-20T16:11:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\\\/\"},\"wordCount\":368,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/Picture1-2-300x132.png\",\"keywords\":[\"How To\u2019s\",\"Planning Analytics\",\"Planning Analytics How To's\"],\"articleSection\":[\"IBM\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/quebit.com\\\/askquebit\\\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\\\/\",\"url\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\\\/\",\"name\":\"How Do I Load Data to IBM Planning Analytics Using TM1py and Pandas? \u2013 Part 2 - QueBIT\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/Picture1-2-300x132.png\",\"datePublished\":\"2023-04-12T15:33:27+00:00\",\"dateModified\":\"2026-01-20T16:11:07+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/#\\\/schema\\\/person\\\/e52d72da0fd2f5f70d189343fe4f5084\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/quebit.com\\\/askquebit\\\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\\\/#primaryimage\",\"url\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/Picture1-2-300x132.png\",\"contentUrl\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/Picture1-2-300x132.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How Do I Load Data to IBM Planning Analytics Using TM1py and Pandas? \u2013 Part 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/#website\",\"url\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/\",\"name\":\"QueBIT\",\"description\":\"QueBIT\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/#\\\/schema\\\/person\\\/e52d72da0fd2f5f70d189343fe4f5084\",\"name\":\"agoddard\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d817b364cff1d66116debde8d1c85e5e76eeece9c5ae731b19276a6040231455?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d817b364cff1d66116debde8d1c85e5e76eeece9c5ae731b19276a6040231455?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d817b364cff1d66116debde8d1c85e5e76eeece9c5ae731b19276a6040231455?s=96&d=mm&r=g\",\"caption\":\"agoddard\"},\"sameAs\":[\"https:\\\/\\\/quebit.com\\\/askquebit\"],\"url\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/author\\\/agoddard\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How Do I Load Data to IBM Planning Analytics Using TM1py and Pandas? \u2013 Part 2 - QueBIT","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:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/","og_locale":"en_US","og_type":"article","og_title":"How Do I Load Data to IBM Planning Analytics Using TM1py and Pandas? \u2013 Part 2 - QueBIT","og_description":"Title: Loading Data to IBM Planning Analytics using TM1Py and Pandas\u00a0Part 2 Author(s): Paul Caggiano Application: Planning Analytics, Python Software Version: Planning Analytics Version 11.8.01300.1; Python 3.9.12 Keywords: TM1Py, Python, Planning Analytics, TM1, Pandas &nbsp; This article is Part 2 of the series exploring how to integrate TM1Py with your IBM Planning Analytics (PA) instance&hellip;","og_url":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/","og_site_name":"QueBIT","article_published_time":"2023-04-12T15:33:27+00:00","article_modified_time":"2026-01-20T16:11:07+00:00","author":"agoddard","twitter_card":"summary_large_image","twitter_misc":{"Written by":"agoddard","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/#article","isPartOf":{"@id":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/"},"author":{"name":"agoddard","@id":"https:\/\/quebit.com\/askquebit\/#\/schema\/person\/e52d72da0fd2f5f70d189343fe4f5084"},"headline":"How Do I Load Data to IBM Planning Analytics Using TM1py and Pandas? \u2013 Part 2","datePublished":"2023-04-12T15:33:27+00:00","dateModified":"2026-01-20T16:11:07+00:00","mainEntityOfPage":{"@id":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/"},"wordCount":368,"commentCount":0,"image":{"@id":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/#primaryimage"},"thumbnailUrl":"https:\/\/quebit.com\/askquebit\/wp-content\/uploads\/2023\/01\/Picture1-2-300x132.png","keywords":["How To\u2019s","Planning Analytics","Planning Analytics How To's"],"articleSection":["IBM"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/","url":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/","name":"How Do I Load Data to IBM Planning Analytics Using TM1py and Pandas? \u2013 Part 2 - QueBIT","isPartOf":{"@id":"https:\/\/quebit.com\/askquebit\/#website"},"primaryImageOfPage":{"@id":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/#primaryimage"},"image":{"@id":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/#primaryimage"},"thumbnailUrl":"https:\/\/quebit.com\/askquebit\/wp-content\/uploads\/2023\/01\/Picture1-2-300x132.png","datePublished":"2023-04-12T15:33:27+00:00","dateModified":"2026-01-20T16:11:07+00:00","author":{"@id":"https:\/\/quebit.com\/askquebit\/#\/schema\/person\/e52d72da0fd2f5f70d189343fe4f5084"},"breadcrumb":{"@id":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/#primaryimage","url":"https:\/\/quebit.com\/askquebit\/wp-content\/uploads\/2023\/01\/Picture1-2-300x132.png","contentUrl":"https:\/\/quebit.com\/askquebit\/wp-content\/uploads\/2023\/01\/Picture1-2-300x132.png"},{"@type":"BreadcrumbList","@id":"https:\/\/quebit.com\/askquebit\/loading-data-to-ibm-planning-analytics-using-tm1py-and-pandas-part-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/quebit.com\/askquebit\/"},{"@type":"ListItem","position":2,"name":"How Do I Load Data to IBM Planning Analytics Using TM1py and Pandas? \u2013 Part 2"}]},{"@type":"WebSite","@id":"https:\/\/quebit.com\/askquebit\/#website","url":"https:\/\/quebit.com\/askquebit\/","name":"QueBIT","description":"QueBIT","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/quebit.com\/askquebit\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/quebit.com\/askquebit\/#\/schema\/person\/e52d72da0fd2f5f70d189343fe4f5084","name":"agoddard","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d817b364cff1d66116debde8d1c85e5e76eeece9c5ae731b19276a6040231455?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d817b364cff1d66116debde8d1c85e5e76eeece9c5ae731b19276a6040231455?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d817b364cff1d66116debde8d1c85e5e76eeece9c5ae731b19276a6040231455?s=96&d=mm&r=g","caption":"agoddard"},"sameAs":["https:\/\/quebit.com\/askquebit"],"url":"https:\/\/quebit.com\/askquebit\/author\/agoddard\/"}]}},"_links":{"self":[{"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/posts\/3493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/comments?post=3493"}],"version-history":[{"count":2,"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/posts\/3493\/revisions"}],"predecessor-version":[{"id":5083,"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/posts\/3493\/revisions\/5083"}],"wp:attachment":[{"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/media?parent=3493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/categories?post=3493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/tags?post=3493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}