{"id":76606,"date":"2025-02-06T21:01:40","date_gmt":"2025-02-06T21:01:40","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=76606"},"modified":"2025-02-06T21:03:55","modified_gmt":"2025-02-06T21:03:55","slug":"python-matplotlib-plot-data","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=76606","title":{"rendered":"Python: MatPlotLib: Plot Data"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>import pandas as pd\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\n\n\ncolumns = &#91;\"J_ID\", \"P_ID\", \"D_ID\", \"Year\", \"JOB_TITLE\", \"Department_Name\", \"Total Salary\", \"Commission\"]\ndf = pd.read_csv(\"datamart.csv\", usecols=columns)\n\n\n# Create a 3D plot\nfig = plt.figure(figsize=(20, 15))\nax = fig.add_subplot(111, projection='3d')\n\n# Scatter plot\nax.scatter(df&#91;'Year'], df&#91;'J_ID'], df&#91;'D_ID'], c=df&#91;'Total Salary'], cmap='viridis', marker='X')\n\n# Labels\nax.set_xlabel('Year')\nax.set_ylabel('Job Title (Categorized)')\nax.set_zlabel('Departments')\n\n# Title\nax.set_title('3D Plot of Total Salary by Year and Job Title and Department')\n\n\nfor i in range(df.shape&#91;0]):\n    if i%7 == 0:\n        ax.text(df&#91;'Year']&#91;i], df&#91;'J_ID']&#91;1], df&#91;'D_ID']&#91;i], '(' + str(df&#91;'Year']&#91;i]) + ',' + str(df&#91;\"JOB_TITLE\"]&#91;i]) + ',' + str(df&#91;\"Department_Name\"]&#91;i]) + ',' + str(df&#91;'Total Salary']&#91;i]) + \")\")\n\n# Show plot\nplt.show()\n\n\n<\/code><\/pre>\n\n\n\n<div class=\"wp-block-media-text has-media-on-the-right is-stacked-on-mobile\"><div class=\"wp-block-media-text__content\">\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"762\" src=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image.png?resize=750%2C762\" alt=\"\" class=\"wp-image-76607\" srcset=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image.png?resize=1008%2C1024 1008w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image.png?resize=295%2C300 295w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image.png?resize=768%2C780 768w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image.png?resize=750%2C762 750w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image.png?w=1466 1466w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<p><\/p>\n<\/div><figure class=\"wp-block-media-text__media\"><\/figure><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"762\" src=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image-2.png?resize=750%2C762\" alt=\"\" class=\"wp-image-76611\" srcset=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image-2.png?resize=1008%2C1024 1008w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image-2.png?resize=295%2C300 295w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image-2.png?resize=768%2C780 768w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image-2.png?resize=750%2C762 750w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image-2.png?w=1466 1466w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Sample Data:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"553\" height=\"635\" src=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image-1.png?resize=553%2C635\" alt=\"\" class=\"wp-image-76608\" style=\"width:812px;height:auto\" srcset=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image-1.png?w=553 553w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image-1.png?resize=261%2C300 261w\" sizes=\"auto, (max-width: 553px) 100vw, 553px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Sample Data:<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-76606","post","type-post","status-publish","format-standard","hentry","category-root","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":76075,"url":"http:\/\/bangla.sitestree.com\/?p=76075","url_meta":{"origin":76606,"position":0},"title":"K-Means Clustering","author":"Sayed","date":"May 18, 2024","format":false,"excerpt":"Click on the images to see them clearly #!\/usr\/bin\/env python coding: utf-8 In[1]: k-means clustering from numpy import unique from numpy import where from sklearn.datasets import make_classification from sklearn.cluster import KMeans from matplotlib import pyplot import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as\u2026","rel":"","context":"In &quot;\u09ac\u09cd\u09b2\u0997 \u0964 Blog&quot;","block_context":{"text":"\u09ac\u09cd\u09b2\u0997 \u0964 Blog","link":"http:\/\/bangla.sitestree.com\/?cat=182"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-40.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-40.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-40.png?resize=525%2C300 1.5x"},"classes":[]},{"id":17044,"url":"http:\/\/bangla.sitestree.com\/?p=17044","url_meta":{"origin":76606,"position":1},"title":"Calculate Your Categorized Expenses for Tax Purpose","author":"Sayed","date":"May 9, 2020","format":false,"excerpt":"Calculate Your Categorized Expenses for Tax Purpose. The purpose of this note (i.e. code) is to calculate expenses (revenues) by categories. For the context, read the notes from Write Tax and Financial Software Code examples in relation to writing Tax and Financial Softwaremedium.com At this point, you have spreadsheets for\u2026","rel":"","context":"In &quot;\u09ac\u09cd\u09b2\u0997 \u0964 Blog&quot;","block_context":{"text":"\u09ac\u09cd\u09b2\u0997 \u0964 Blog","link":"http:\/\/bangla.sitestree.com\/?cat=182"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26390,"url":"http:\/\/bangla.sitestree.com\/?p=26390","url_meta":{"origin":76606,"position":2},"title":"Basic Data Handling Functions in Python using pandas library #Python #Python #Introduction to Python","author":"Author-Check- Article-or-Video","date":"April 23, 2021","format":false,"excerpt":"\u00a0 # import pandas library import pandas as pd # read the online file by the URL provides above, and assign it to variable \"df\" path=\"https:\/\/......\" df = pd.read_csv(path,header=None) print(\"Done\") # show the first 5 rows using dataframe.head() method df.head(5) # create headers list headers = [\"name\", \"price\", \"make\"] #show\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14558,"url":"http:\/\/bangla.sitestree.com\/?p=14558","url_meta":{"origin":76606,"position":3},"title":"Implement Gradient Descend:","author":"Sayed","date":"January 5, 2019","format":false,"excerpt":"\" Gradient descent is a first-order iterative optimization algorithm for finding the minimum of a function. To find a local minimum of a function usinggradient descent, one takes steps proportional to the negative of the gradient (or approximategradient) of the function at the current point. Gradient descent - Wikipedia https:\/\/en.wikipedia.org\/wiki\/Gradient_descent\u2026","rel":"","context":"In &quot;Math and Statistics for Data Science, and Engineering&quot;","block_context":{"text":"Math and Statistics for Data Science, and Engineering","link":"http:\/\/bangla.sitestree.com\/?cat=1908"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":24915,"url":"http:\/\/bangla.sitestree.com\/?p=24915","url_meta":{"origin":76606,"position":4},"title":"Implement Gradient Descend: #Root","author":"Author-Check- Article-or-Video","date":"April 13, 2021","format":false,"excerpt":"\" Gradient descent is a first-order iterative optimization algorithm for finding the minimum of a function. To find a local minimum of a function usinggradient descent, one takes steps proportional to the negative of the gradient (or approximategradient) of the function at the current point. Gradient descent - Wikipedia https:\/\/en.wikipedia.org\/wiki\/Gradient_descent\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":16966,"url":"http:\/\/bangla.sitestree.com\/?p=16966","url_meta":{"origin":76606,"position":5},"title":"Python: Generate Expense Report from RBC MasterCard Transaction Data","author":"Sayed","date":"March 21, 2020","format":false,"excerpt":"Python: Generate Expense Report from RBC MasterCard Transaction Data For the context read the following two first Python: Read RBC Canada: Mastercard PDF Statement Transaction Data into CSV file By Sayed Ahmed medium.com Python: Merge Multiple csv files into one to facilitate reporting on transaction data over time By Sayed\u2026","rel":"","context":"In &quot;\u09ac\u09cd\u09b2\u0997 \u0964 Blog&quot;","block_context":{"text":"\u09ac\u09cd\u09b2\u0997 \u0964 Blog","link":"http:\/\/bangla.sitestree.com\/?cat=182"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76606","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=76606"}],"version-history":[{"count":2,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76606\/revisions"}],"predecessor-version":[{"id":76612,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76606\/revisions\/76612"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=76606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=76606"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=76606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}