{
  "source_file": "0930",
  "source_platform": "个人博客",
  "author": "Jay Alammar",
  "title_listed": "A Gentle Visual Intro to Data Analysis in Python Using Pandas",
  "keywords": "Pandas,数据分析,可视化",
  "domain": "数据处理",
  "content_type": "图解教程",
  "is_paid_flag": "否",
  "url": "https://jalammar.github.io/gentle-visual-intro-to-data-analysis-python-pandas/",
  "publish_date": "2018-11",
  "corpus_stage": "数据处理",
  "notes": "Pandas数据分析可视化入门",
  "id": "053ea416f3e6",
  "collected_at": "2026-10-02T14:22:15",
  "title": "A Gentle Visual Intro to Data Analysis in Python Using Pandas – Jay Alammar – Visualizing machine learning one concept at a time.",
  "body_markdown": "A Gentle Visual Intro to Data Analysis in Python Using Pandas\nDiscussions:\nHacker News (195 points, 51 comments)\n,\nReddit r/Python (140 points, 18 comments)\nIf you’re planning to learn data analysis, machine learning, or data science tools in python, you’re most likely going to be using the wonderful\npandas\nlibrary. Pandas is an open source library for data manipulation and analysis in python.\nLoading Data\nOne of the easiest ways to think about that, is that you can load tables (and excel files) and then slice and dice them in multiple ways:\nPandas allows us to load a spreadsheet and manipulate it programmatically in python. The central concept in pandas is the type of object called a\nDataFrame\n– basically a table of values which has a label for each row and column. Let’s load this basic CSV file containing data from a music streaming service:\ndf = pandas.read_csv('music.csv')\nNow the variable\ndf\nis a pandas DataFrame:\nSelection\nWe can select any column using its label:\nWe can select one or multiple rows using their numbers:\nWe can select any slice of the table using a both column label and row numbers using\nloc\n(but here it would be inclusive of both bounding row numbers):\nFiltering\nNow it gets more interesting. We can easily filter rows using the values of a specific row. For example, here are our jazz musicians:\nHere are the artists who have more than 1,800,000 listeners:\nDealing with Missing Values\nMany datasets you’ll deal with in your data science journey will have missing values. Let’s say our data frame has a missing value:\nPandas provides multiple ways to deal with this. The easiest is to just drop rows with missing values:\nAnother way would be to fill-in the missing value using\nfillna()\n(with 0, for example).\nGrouping\nThings start to get really interesting when you start grouping rows with certain criteria and aggregating their data. For example, let’s group our dataset by genre and see how many listeners and plays each genre has:\nPandas grouped the the two “Jazz” rows into one, and since we used\nsum()\nfor aggregation, it added together the listeners and plays for the two Jazz artists and shows the sums in the combined Jazz column.\nThis is not only nifty, but is an extremely powerful data analysis method. Now that you know\ngroupby()\n, you wield immense power to fold datasets and uncover insights from them. Aggregation is the first\npillar of statistical wisdom\n, and so is one of the foundational tools of statistics.\nIn addition to\nsum()\n, pandas provides multiple aggregation functions including\nmean()\nto compute the average value,\nmin()\n,\nmax()\n, and multiple other functions. More on\ngroupyby()\nin the\nGroup By User Guide\n.\nIf you use\ngroupby()\nto its full potential, and use nothing else in pandas, then you’d be putting pandas to great use. But the library can still offer you much, much more.\nCreating New Columns from Existing Columns\nOften in the data analysis process, we find ourselves needing to create new columns from existing ones. Pandas makes this a breeze.\nBy telling Pandas to divide a column by another column, it realizes that we want to do is divide the individual values respectively (i.e. each row’s “Plays” value by that row’s “Listeners” value).\nGet Hands On!\nYou can get started playing with Pandas in your browser right now through this basic\nnotebook hosted in Google Colab\n. The notebook is also\navailable on Github\nif you have your local environment set up.\nLearn More Pandas\nWant to learn more? Be sure to check out the\n10 Minutes to pandas\ntutorial in the official Pandas docs. Thanks to\nMarc Garcia\nfor initiating the thoughts for these visualizations and continuing to improve the pandas documentation.\nYour feedback is appreciated!\nDid you find this tutorial helpful? Any suggestions for improvement? Please let me know (\n@JayAlammar\n) know on Twitter. Thanks!\nWritten on October 29, 2018",
  "metadata": {
    "title": "A Gentle Visual Intro to Data Analysis in Python Using Pandas – Jay Alammar – Visualizing machine learning one concept at a time.",
    "description": "Discussions:\nHacker News (195 points, 51 comments), Reddit r/Python (140 points, 18 comments)\n\n\nIf you’re planning to learn data analysis, machine learning, or data science tools in python, you’re most likely going to be using the wonderful pandas library. Pandas is an open source library for data manipulation and analysis in python.\n\nLoading Data\nOne of the easiest ways to think about that, is that you can load tables (and excel files) and then slice and dice them in multiple ways:",
    "keywords": null,
    "author": "Jay Alammar",
    "og:description": "Discussions:\nHacker News (195 points, 51 comments), Reddit r/Python (140 points, 18 comments)\n\n\nIf you’re planning to learn data analysis, machine learning, or data science tools in python, you’re most likely going to be using the wonderful pandas library. Pandas is an open source library for data manipulation and analysis in python.\n\nLoading Data\nOne of the easiest ways to think about that, is that you can load tables (and excel files) and then slice and dice them in multiple ways:",
    "og:title": "A Gentle Visual Intro to Data Analysis in Python Using Pandas"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": ""
  },
  "code_blocks": [
    {
      "file": "attachments/053ea416f3e6/code/body-000.txt",
      "chars": 34,
      "language": "text"
    }
  ],
  "images": [
    {
      "status": "ok",
      "url": "https://jalammar.github.io/images/pandas-intro/0 excel-to-pandas.png",
      "bytes": 225976,
      "reused": false,
      "local_path": "attachments/053ea416f3e6/images/body-6c4ae6b8742c0ec32804.png",
      "src": "https://jalammar.github.io/images/pandas-intro/0 excel-to-pandas.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://jalammar.github.io/images/pandas-intro/1 view_pandas_dataframe.png",
      "bytes": 65924,
      "reused": false,
      "local_path": "attachments/053ea416f3e6/images/body-e20ca46a1e05c0b0c470.png",
      "src": "https://jalammar.github.io/images/pandas-intro/1 view_pandas_dataframe.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://jalammar.github.io/images/pandas-intro/2 select-column.png",
      "bytes": 39983,
      "reused": false,
      "local_path": "attachments/053ea416f3e6/images/body-1c3cf6c827dffc1127ea.png",
      "src": "https://jalammar.github.io/images/pandas-intro/2 select-column.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://jalammar.github.io/images/pandas-intro/3 select-rows.png",
      "bytes": 45388,
      "reused": false,
      "local_path": "attachments/053ea416f3e6/images/body-8bd71ac1d19deec9d731.png",
      "src": "https://jalammar.github.io/images/pandas-intro/3 select-rows.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://jalammar.github.io/images/pandas-intro/4 select_column-and-rows.png",
      "bytes": 36387,
      "reused": false,
      "local_path": "attachments/053ea416f3e6/images/body-895fc7bf472a0430c386.png",
      "src": "https://jalammar.github.io/images/pandas-intro/4 select_column-and-rows.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://jalammar.github.io/images/pandas-intro/pandas-filter-1.png",
      "bytes": 51468,
      "reused": false,
      "local_path": "attachments/053ea416f3e6/images/body-3439428b9373b993e838.png",
      "src": "https://jalammar.github.io/images/pandas-intro/pandas-filter-1.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://jalammar.github.io/images/pandas-intro/5 filter.png",
      "bytes": 51643,
      "reused": false,
      "local_path": "attachments/053ea416f3e6/images/body-fc9e621f37fbaa6caf51.png",
      "src": "https://jalammar.github.io/images/pandas-intro/5 filter.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://jalammar.github.io/images/pandas-intro/6 set missing value.png",
      "bytes": 62723,
      "reused": false,
      "local_path": "attachments/053ea416f3e6/images/body-02c1a319b79f6a45a11c.png",
      "src": "https://jalammar.github.io/images/pandas-intro/6 set missing value.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://jalammar.github.io/images/pandas-intro/7 filter missing values.png",
      "bytes": 57376,
      "reused": false,
      "local_path": "attachments/053ea416f3e6/images/body-709f3c09ccfd4229ab7d.png",
      "src": "https://jalammar.github.io/images/pandas-intro/7 filter missing values.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://jalammar.github.io/images/pandas-intro/8 group-by.png",
      "bytes": 60890,
      "reused": false,
      "local_path": "attachments/053ea416f3e6/images/body-e738fbead1c3ccb19f2f.png",
      "src": "https://jalammar.github.io/images/pandas-intro/8 group-by.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://jalammar.github.io/images/pandas-intro/9 create-new-column.png",
      "bytes": 67664,
      "reused": false,
      "local_path": "attachments/053ea416f3e6/images/body-b0a62b87c94e01d5c07d.png",
      "src": "https://jalammar.github.io/images/pandas-intro/9 create-new-column.png",
      "alt": "",
      "downloaded": true
    }
  ],
  "audio": [],
  "videos": [],
  "links": [
    {
      "href": "https://news.ycombinator.com/item?id=18351685",
      "label": "Hacker News (195 points, 51 comments)",
      "type": "a"
    },
    {
      "href": "https://www.reddit.com/r/Python/comments/9scznd/a_gentle_visual_intro_to_data_analysis_in_python/",
      "label": "Reddit r/Python (140 points, 18 comments)",
      "type": "a"
    },
    {
      "href": "https://pandas.pydata.org/",
      "label": "pandas",
      "type": "a"
    },
    {
      "href": "https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.fillna.html",
      "label": "fillna()",
      "type": "a"
    },
    {
      "href": "https://www.amazon.com/Seven-Pillars-Statistical-Wisdom/dp/0674088913",
      "label": "pillar of statistical wisdom",
      "type": "a"
    },
    {
      "href": "https://pandas.pydata.org/pandas-docs/stable/groupby.html",
      "label": "Group By User Guide",
      "type": "a"
    },
    {
      "href": "https://colab.research.google.com/github/jalammar/pandas-intro/blob/master/Pandas_Intro.ipynb",
      "label": "notebook hosted in Google Colab",
      "type": "a"
    },
    {
      "href": "https://github.com/jalammar/pandas-intro/blob/master/Pandas_Intro.ipynb",
      "label": "available on Github",
      "type": "a"
    },
    {
      "href": "https://pandas.pydata.org/pandas-docs/stable/10min.html",
      "label": "10 Minutes to pandas",
      "type": "a"
    },
    {
      "href": "https://twitter.com/datapythonista",
      "label": "Marc Garcia",
      "type": "a"
    },
    {
      "href": "https://twitter.com/JayAlammar",
      "label": "@JayAlammar",
      "type": "a"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-14T10:52:31Z",
  "source_url": "https://jalammar.github.io/gentle-visual-intro-to-data-analysis-python-pandas/",
  "papers": [],
  "actual_video_files": [],
  "body_chars": 3876,
  "expected_body_images": 11,
  "discovery_status": "ok",
  "delivery_status": "ok",
  "missing_reason": "",
  "raw_html": "attachments/053ea416f3e6/pages/source.html",
  "local_html": "attachments/053ea416f3e6/pages/article.html",
  "body_base_path": "attachments/053ea416f3e6/pages/",
  "body_markdown_path": "attachments/053ea416f3e6/pages/article.md"
}