{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "64fa2a28-affe-4924-981e-c992d5bcc4e2",
   "metadata": {
    "tags": []
   },
   "source": [
    "Importing Libraries in JupyterLab: A Beginner's Guide\n",
    "\n",
    "JupyterLab, a powerful interactive environment for Python, allows you to seamlessly work with various libraries to enhance your data analysis, visualization, and machine learning projects. This guide will equip you with the essential knowledge on how to import libraries and get started with using them in your JupyterLab notebooks.\n",
    "\n",
    "1. Understanding Libraries:\n",
    "\n",
    "Libraries (or packages) are collections of pre-written Python code that provide functionalities for specific tasks. They save you time by offering well-tested, efficient solutions to common programming problems.\n",
    "Examples of popular libraries in data science include NumPy (numerical computing), pandas (data manipulation), matplotlib (visualization), and scikit-learn (machine learning). </br>\n",
    "\n",
    "2. Pre-installed Libraries:\n",
    "\n",
    "JupyterLab typically comes with a set of core libraries already installed. You can check these by running the following code in a code cell:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "873c39b0-9a20-4244-9615-7d1130318412",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "print(sys.modules)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "429f1246-87a9-4e0e-9e44-9869deb84daa",
   "metadata": {},
   "source": [
    "This will list all the built-in and installed modules available in your environment.\n",
    "\n",
    "3. Installing Additional Libraries:\n",
    "\n",
    "If you need libraries beyond the pre-installed ones, you can install them directly within JupyterLab using the !pip install command:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "afaf8a30-ef1f-4421-953a-c9d0964ff0bc",
   "metadata": {},
   "outputs": [],
   "source": [
    "!pip install pandas numpy"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dcdbaddf-09cb-4647-901e-075ff47d5524",
   "metadata": {},
   "source": [
    "4. Importing Libraries:\n",
    "\n",
    "Once a library is installed, you can import it into your notebook using the import statement:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "806f85db-765e-41c6-bcea-2b957caf8e51",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "59f523b0-49f2-44f6-9687-d4122c06566a",
   "metadata": {},
   "source": [
    "As a convention, many users give imported libraries shorter aliases for easier use. For example, pd for pandas and np for numpy. <br>\n",
    "\n",
    "5. Using Library Functions and Classes:\n",
    "\n",
    "After importing a library, you can access its functions and classes to perform various tasks. Refer to the library's documentation for comprehensive details on the provided functionalities.\n",
    "Example with NumPy and pandas:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "bf588c65-fa84-4dd1-a73e-d5d5c81b52ae",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 2 3 4]\n",
      "</br>\n",
      "   col1 col2\n",
      "0     1    a\n",
      "1     2    b\n",
      "2     3    c\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "# Create a NumPy array\n",
    "arr = np.array([1, 2, 3, 4])\n",
    "print(arr)\n",
    "print(\\n)\n",
    "\n",
    "# Create a pandas DataFrame\n",
    "data = {'col1': [1, 2, 3], 'col2': ['a', 'b', 'c']}\n",
    "df = pd.DataFrame(data)\n",
    "print(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "51e479c6-ca0d-487e-8b18-06709b174285",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.7 (Recommended)",
   "language": "python",
   "name": "syntasa_kernel_python_37"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
