Close Menu
    Trending
    • Optimizing Data Transfer in Distributed AI/ML Training Workloads
    • Achieving 5x Agentic Coding Performance with Few-Shot Prompting
    • Why the Sophistication of Your Prompt Correlates Almost Perfectly with the Sophistication of the Response, as Research by Anthropic Found
    • From Transactions to Trends: Predict When a Customer Is About to Stop Buying
    • America’s coming war over AI regulation
    • “Dr. Google” had its issues. Can ChatGPT Health do better?
    • Evaluating Multi-Step LLM-Generated Content: Why Customer Journeys Require Structural Metrics
    • Why SaaS Product Management Is the Best Domain for Data-Driven Professionals in 2026
    ProfitlyAI
    • Home
    • Latest News
    • AI Technology
    • Latest AI Innovations
    • AI Tools & Technologies
    • Artificial Intelligence
    ProfitlyAI
    Home » Data Visualization Explained (Part 4): A Review of Python Essentials
    Artificial Intelligence

    Data Visualization Explained (Part 4): A Review of Python Essentials

    ProfitlyAIBy ProfitlyAIOctober 25, 2025No Comments8 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    in my knowledge visualization collection. See the next:

    Up up to now in my knowledge visualization collection, I’ve coated the foundational parts of visualization design. These ideas are important to grasp earlier than truly designing and constructing visualizations, as they make sure that the underlying knowledge is completed justice. When you’ve got not carried out so already, I strongly encourage you to learn my earlier articles (linked above).

    At this level, you might be prepared to start out constructing visualizations of our personal. I’ll cowl numerous methods to take action in future articles—and within the spirit of knowledge science, many of those strategies would require programming. To make sure you are prepared for this subsequent step, this text will include a quick overview of Python necessities, adopted by a dialogue of their relevance to coding knowledge visualizations.

    The Fundamentals—Expressions, Variables, Features

    Expressions, variables, and capabilities are the first constructing blocks of all Python code—and certainly, code in any language. Let’s check out how they work.

    Expressions

    An expression is a press release which evaluates to some worth. The best doable expression is a continuing worth of any sort. As an example, under are three easy expressions: The primary is an integer, the second is a string, and the third is a floating-point worth.

    7
    '7'
    7.0

    Extra complicated expressions usually include mathematical operations. We will add, subtract, multiply, or divide numerous numbers:

    3 + 7
    820 - 300
    7 * 53
    121 / 11
    6 + 13 - 3 * 4

    By definition, these expressions are evaluated right into a single worth by Python, following the mathematical order of operations outlined by the acronym PEMDAS (Parentheses, Exponents, Multiplication, Division, Addition, Subtraction) [1]. For instance, the ultimate expression above evaluates to the quantity 7.0. (Do you see why?)

    Variables

    Expressions are nice, however they aren’t tremendous helpful by themselves. When programming, you normally want to save lots of the worth of sure expressions with the intention to use them in later elements of our program. A variable is a container which holds the worth of an expression and allows you to entry it later. Listed here are the very same expressions as within the first instance above, however this time with their worth saved in numerous variables:

    int_seven = 7
    text_seven = '7'
    float_seven = 7.0

    Variables in Python have a couple of essential properties:

    • A variable’s identify (the phrase to the left of the equal signal) should be one phrase, and it can not begin with a quantity. If it’s essential to embrace a number of phrases in your variable names, the conference is to separate them with underscores (as within the examples above).
    • You do not need to specify an information sort once we are working with variables in Python, as you might be used to doing in case you have expertise programming in a special language. It’s because Python is a dynamically typed language.
    • Another programming language distinguish between the declaration and the task of a variable. In Python, we simply assign variables in the identical line that we declare them, so there isn’t a want for the excellence.

    When variables are declared, Python will all the time consider the expression on the best aspect of the equal signal right into a single worth earlier than assigning it to the variable. (This connects again to how Python evaluates complicated expressions). Right here is an instance:

    yet_another_seven = (2 * 2) + (9 / 3)

    The variable above is assigned to the worth 7.0, not the compound expression (2 * 2) + (9 / 3).

    Features

    A perform could be regarded as a type of machine. It takes one thing (or a number of issues) in, runs some code that transforms the article(s) you handed in, and outputs again precisely one worth. In Python, capabilities are used for 2 main causes:

    1. To control enter variables of curiosity and give you an output we want (very like mathematical capabilities).
    2. To keep away from code repetition. By packaging code inside a perform, we are able to simply name the perform every time we have to run that code (versus writing the identical code many times).

    The simplest strategy to perceive methods to outline capabilities in Python is to take a look at an instance. Under, we’ve got written a easy perform which doubles the worth of a quantity:

    def double(num):
        doubled_value = num * 2
        return doubled_value
    
    print(double(2))    # outputs 4
    print(double(4))    # outputs 8

    There are a variety of essential factors in regards to the above instance you need to make sure you perceive:

    • The def key phrase tells Python that you simply wish to outline a perform. The phrase immediately after def is the identify of the perform, so the perform above is known as double.
    • After the identify, there’s a set of parentheses, inside which you set the perform’s parameters (a elaborate time period which simply imply the perform’s inputs). Necessary: In case your perform doesn’t want any parameters, you continue to want to incorporate the parentheses—simply don’t put something inside them.
    • On the finish of the def assertion, a colon should be used, in any other case Python is not going to be completely happy (i.e., it should throw an error). Collectively, all the line with the def assertion is known as the perform signature.
    • All the traces after the def assertion include the code that makes up the perform, indented one degree inward. Collectively, these traces make up the perform physique.
    • The final line of the perform above is the return assertion, which specifies the output of a perform utilizing the return key phrase. A return assertion doesn’t essentially have to be the final line of a perform, however after it’s encountered, Python will exit the perform, and no extra traces of code can be run. Extra complicated capabilities could have a number of return statements.
    • You name a perform by writing its identify, and placing the specified inputs in parentheses. In case you are calling a perform with no inputs, you continue to want to incorporate the parentheses.

    Python and Knowledge Visualization

    Now then, let me handle the query you might be asking your self: Why all this Python overview to start with? In any case, there are various methods you may visualize knowledge, they usually actually aren’t all restricted by data of Python, and even programming generally.

    That is true, however as an information scientist, it’s possible that you will want to program sooner or later—and inside programming, it’s exceedingly possible the language you employ can be Python. Whenever you’ve simply been handed an information cleansing and evaluation pipeline by the information engineers in your group, it pays to know methods to rapidly and successfully flip it right into a set of actionable and presentable visible insights.

    Python is essential to know for knowledge visualization typically talking, for a number of causes:

    • It’s an accessible language. In case you are simply transitioning into knowledge science and visualization work, will probably be a lot simpler to program visualizations in Python than will probably be to work with lower-level instruments akin to D3 in JavaScript.
    • There are a lot of totally different and in style libraries in Python, all of which give the flexibility to visualise knowledge with code that builds immediately on the Python fundamentals we realized above. Examples embrace Matplotlib, Seaborn, Plotly, and Vega-Altair (beforehand generally known as simply Altair). I’ll discover a few of these, particularly Altair, in future articles.
    • Moreover, the libraries above all combine seamlessly into pandas, the foundational knowledge science library in Python. Knowledge in pandas could be immediately included into the code logic from these libraries to construct visualizations; you usually gained’t even must export or rework it earlier than you can begin visualizing.
    • The fundamental ideas mentioned on this article could seem elementary, however they go a good distance towards enabling knowledge visualization:
      • Computing expressions accurately and understanding these written by others is important to making sure you might be visualizing an correct illustration of the information.
      • You’ll usually must retailer particular values or units of values for later incorporation right into a visualization—you’ll want variables for that.
        • Generally, you may even retailer complete visualizations in a variable for later use or show.
      • The extra superior libraries, akin to Plotly and Altair, help you name built-in (and generally even user-defined) capabilities to customise visualizations.
      • Fundamental data of Python will allow you to combine your visualizations into easy purposes that may be shared with others, utilizing instruments akin to Plotly Dash and Streamlit. These instruments goal to simplify the method of constructing purposes for knowledge scientists who’re new to programming, and the foundational ideas coated on this article can be sufficient to get you began utilizing them.

    If that’s not sufficient to persuade you, I’d urge you to click on on one of many hyperlinks above and begin exploring a few of these visualization instruments your self. When you begin seeing what you are able to do with them, you gained’t return.

    In my opinion, I’ll be again within the subsequent article to current my very own tutorial for constructing visualizations. (A number of of those instruments could make an look.) Till then!

    References



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleTDS Newsletter: What Happens When AI Reaches Its Limits?
    Next Article AI Agents: From Assistants for Efficiency to Leaders of Tomorrow?
    ProfitlyAI
    • Website

    Related Posts

    Artificial Intelligence

    Optimizing Data Transfer in Distributed AI/ML Training Workloads

    January 23, 2026
    Artificial Intelligence

    Achieving 5x Agentic Coding Performance with Few-Shot Prompting

    January 23, 2026
    Artificial Intelligence

    Why the Sophistication of Your Prompt Correlates Almost Perfectly with the Sophistication of the Response, as Research by Anthropic Found

    January 23, 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    OpenAI har upptäckt och stoppat över 40 nätverk som missbrukat ChatGPT

    October 11, 2025

    How to Increase Coding Iteration Speed

    December 13, 2025

    New to LLMs? Start Here  | Towards Data Science

    May 23, 2025

    A Chinese firm has just launched a constantly changing set of AI benchmarks

    June 23, 2025

    Genspark Super Agent en avancerad autonom AI-agent

    April 6, 2025
    Categories
    • AI Technology
    • AI Tools & Technologies
    • Artificial Intelligence
    • Latest AI Innovations
    • Latest News
    Most Popular

    Amazon CEO’s New Memo Signals a Brutal Truth: More AI, Fewer Humans

    June 24, 2025

    The AI Hype Index: College students are hooked on ChatGPT

    May 28, 2025

    How to Connect an MCP Server for an AI-Powered, Supply-Chain Network Optimization Agent

    September 23, 2025
    Our Picks

    Optimizing Data Transfer in Distributed AI/ML Training Workloads

    January 23, 2026

    Achieving 5x Agentic Coding Performance with Few-Shot Prompting

    January 23, 2026

    Why the Sophistication of Your Prompt Correlates Almost Perfectly with the Sophistication of the Response, as Research by Anthropic Found

    January 23, 2026
    Categories
    • AI Technology
    • AI Tools & Technologies
    • Artificial Intelligence
    • Latest AI Innovations
    • Latest News
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2025 ProfitlyAI All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.