{
  "metadata": {
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3",
      "language": "python"
    },
    "analyzedDataset": "job_postings_prepared",
    "creator": "sean",
    "createdOn": 1688404614010,
    "tags": [],
    "customFields": {},
    "hide_input": false,
    "language_info": {
      "name": "python",
      "version": "3.6.8",
      "mimetype": "text/x-python",
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "pygments_lexer": "ipython3",
      "nbconvert_exporter": "python",
      "file_extension": ".py"
    },
    "modifiedBy": "sean"
  },
  "nbformat": 4,
  "nbformat_minor": 1,
  "cells": [
    {
      "execution_count": 1,
      "cell_type": "code",
      "metadata": {},
      "source": [
        "%pylab inline"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "text": "Populating the interactive namespace from numpy and matplotlib\n",
          "name": "stdout"
        }
      ]
    },
    {
      "execution_count": 2,
      "cell_type": "code",
      "metadata": {},
      "source": [
        "import dataiku\nfrom dataiku import pandasutils as pdu\nimport pandas as pd"
      ],
      "outputs": []
    },
    {
      "execution_count": 3,
      "cell_type": "code",
      "metadata": {},
      "source": [
        "# Read the dataset as a Pandas dataframe in memory\n# Note: here, we only read the first 100K rows. Other sampling options are available\ndataset_job_postings_prepared \u003d dataiku.Dataset(\"job_postings_prepared\")\ndf \u003d dataset_job_postings_prepared.get_dataframe(limit\u003d100000)"
      ],
      "outputs": []
    },
    {
      "execution_count": 5,
      "cell_type": "code",
      "metadata": {},
      "source": [
        "# Define a function to extract the minimum salary\ndef extract_min_salary(salary_range):\n    if pd.isna(salary_range):  # Keep missing values as missing\n        return None\n    try:\n        min_salary \u003d int(salary_range.split(\u0027-\u0027)[0])  # Extract minimum salary\n        return min_salary\n    except:\n        return None  # Handle invalid values\n\n# Apply the function and convert to integer type\ndf[\u0027min_salary\u0027] \u003d df[\u0027salary_range\u0027].apply(extract_min_salary).astype(\u0027Int64\u0027)"
      ],
      "outputs": []
    },
    {
      "execution_count": 0,
      "cell_type": "code",
      "metadata": {},
      "source": [
        ""
      ],
      "outputs": []
    }
  ]
}