Created
April 8, 2021 18:21
-
-
Save PANDATD/af122ec894afb86a0e9724d1d78fd2eb 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": 5, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "import pandas as pd \n", | |
| "# keyword module_name as alias" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "- Creating Data Frame from Dictionary \n", | |
| "- This is easy any eficient way to create data frame " | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 6, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "users ={\n", | |
| " 'Name':['Tejas', 'Vignesh', 'Yashraj'],\n", | |
| " 'Fav-subjects':[('Data-scince','python','linux'),('WebDevlopment','hacking','machine-learinng'),\n", | |
| " ('Digital Electronics','drone-manufacturing','wireless communication')],\n", | |
| " 'Age':[19,19,19]\n", | |
| "}" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 7, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "\"Dict of users {'Name': ['Tejas', 'Vignesh', 'Yashraj'], 'Fav-subjects': [('Data-scince', 'python', 'linux'), ('WebDevlopment', 'hacking', 'machine-learinng'), ('Digital Electronics', 'drone-manufacturing', 'wireless communication')], 'Age': [19, 19, 19]} \"" | |
| ] | |
| }, | |
| "execution_count": 7, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "f\"Dict of users {users} \"" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "#### Syntax\n", | |
| "- *dataframeobject = pd.DataFrame(dict_name)*" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 8, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "df = pd.DataFrame(users)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 9, | |
| "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>Name</th>\n", | |
| " <th>Fav-subjects</th>\n", | |
| " <th>Age</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>0</th>\n", | |
| " <td>Tejas</td>\n", | |
| " <td>(Data-scince, python, linux)</td>\n", | |
| " <td>19</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>1</th>\n", | |
| " <td>Vignesh</td>\n", | |
| " <td>(WebDevlopment, hacking, machine-learinng)</td>\n", | |
| " <td>19</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>2</th>\n", | |
| " <td>Yashraj</td>\n", | |
| " <td>(Digital Electronics, drone-manufacturing, wir...</td>\n", | |
| " <td>19</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " Name Fav-subjects Age\n", | |
| "0 Tejas (Data-scince, python, linux) 19\n", | |
| "1 Vignesh (WebDevlopment, hacking, machine-learinng) 19\n", | |
| "2 Yashraj (Digital Electronics, drone-manufacturing, wir... 19" | |
| ] | |
| }, | |
| "execution_count": 9, | |
| "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