Created
April 8, 2021 18:04
-
-
Save PANDATD/f8abd66a69551b345dc7fa524e2e3c26 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "# Importing pandas module " | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 2, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "import pandas as pd \n", | |
| "# keyword module_name as alias" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 3, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "my_col = ['Age', 'Sex','Location'] # column list \n", | |
| "my_idx = ['Yash','Sakashi','Kunal'] # index list\n", | |
| "my_data = [[20, 'male', 'pune'],\n", | |
| " [19, 'female', 'pune'],\n", | |
| " [21, 'male', 'pune'],\n", | |
| " ]# data list" | |
| ] | |
| }, | |
| { | |
| "cell_type": "raw", | |
| "metadata": {}, | |
| "source": [ | |
| "Syntax :- \n", | |
| "DataFrameObject = pd.DataFrame(data = data_list, index = idx_list, coloumns = col_list ) " | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 4, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "df = pd.DataFrame(data = my_data, index = my_idx, columns = my_col)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 5, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/html": [ | |
| "<div>\n", | |
| "<style scoped>\n", | |
| " .dataframe tbody tr th:only-of-type {\n", | |
| " vertical-align: middle;\n", | |
| " }\n", | |
| "\n", | |
| " .dataframe tbody tr th {\n", | |
| " vertical-align: top;\n", | |
| " }\n", | |
| "\n", | |
| " .dataframe thead th {\n", | |
| " text-align: right;\n", | |
| " }\n", | |
| "</style>\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>Age</th>\n", | |
| " <th>Sex</th>\n", | |
| " <th>Location</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>Yash</th>\n", | |
| " <td>20</td>\n", | |
| " <td>male</td>\n", | |
| " <td>pune</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>Sakashi</th>\n", | |
| " <td>19</td>\n", | |
| " <td>female</td>\n", | |
| " <td>pune</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>Kunal</th>\n", | |
| " <td>21</td>\n", | |
| " <td>male</td>\n", | |
| " <td>pune</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " Age Sex Location\n", | |
| "Yash 20 male pune\n", | |
| "Sakashi 19 female pune\n", | |
| "Kunal 21 male pune" | |
| ] | |
| }, | |
| "execution_count": 5, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "df" | |
| ] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Python 3.8.6 64-bit", | |
| "language": "python", | |
| "name": "python38664bit4822670b26e8438dbb2f63c7f38ab160" | |
| }, | |
| "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.8.6" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 4 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment