Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created June 19, 2020 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/a538048aac3effdbd9d82e974f327dae to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/a538048aac3effdbd9d82e974f327dae to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"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>firstname</th>\n",
" <th>lastname</th>\n",
" <th>EmpId</th>\n",
" <th>Pay</th>\n",
" <th>Skill</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Indhu</td>\n",
" <td>mathy</td>\n",
" <td>12</td>\n",
" <td>5000</td>\n",
" <td>Python,SQL</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Karthi</td>\n",
" <td>Palani</td>\n",
" <td>15</td>\n",
" <td>10000</td>\n",
" <td>Java,Hadoop</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Sarvesh</td>\n",
" <td>Palani</td>\n",
" <td>21</td>\n",
" <td>15000</td>\n",
" <td>C,Java</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" firstname lastname EmpId Pay Skill\n",
"0 Indhu mathy 12 5000 Python,SQL\n",
"1 Karthi Palani 15 10000 Java,Hadoop\n",
"2 Sarvesh Palani 21 15000 C,Java"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"developer={'firstname':['Indhu','Karthi','Sarvesh'],\n",
" 'lastname':['mathy','Palani','Palani'],\n",
" 'EmpId':[12,15,21],\n",
" 'Pay':[5000,10000,15000],\n",
" 'Skill':['Python,SQL','Java,Hadoop','C,Java']}\n",
"df=pd.DataFrame(developer)\n",
"df"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(3, 5)"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.shape"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 3 entries, 0 to 2\n",
"Data columns (total 5 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 firstname 3 non-null object\n",
" 1 lastname 3 non-null object\n",
" 2 EmpId 3 non-null int64 \n",
" 3 Pay 3 non-null int64 \n",
" 4 Skill 3 non-null object\n",
"dtypes: int64(2), object(3)\n",
"memory usage: 148.0+ bytes\n"
]
}
],
"source": [
"df.info()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"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>firstname</th>\n",
" <th>lastname</th>\n",
" <th>EmpId</th>\n",
" <th>Pay</th>\n",
" <th>Skill</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Indhu</td>\n",
" <td>mathy</td>\n",
" <td>12</td>\n",
" <td>5000</td>\n",
" <td>Python,SQL</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" firstname lastname EmpId Pay Skill\n",
"0 Indhu mathy 12 5000 Python,SQL"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.head(1)"
]
},
{
"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>firstname</th>\n",
" <th>lastname</th>\n",
" <th>EmpId</th>\n",
" <th>Pay</th>\n",
" <th>Skill</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Sarvesh</td>\n",
" <td>Palani</td>\n",
" <td>21</td>\n",
" <td>15000</td>\n",
" <td>C,Java</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" firstname lastname EmpId Pay Skill\n",
"2 Sarvesh Palani 21 15000 C,Java"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.tail(1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.1"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment