{ "metadata": { "language_info": { "codemirror_mode": { "name": "python", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8" }, "kernelspec": { "name": "python", "display_name": "Python (Pyodide)", "language": "python" } }, "nbformat_minor": 4, "nbformat": 4, "cells": [ { "cell_type": "code", "source": "import pandas as pd", "metadata": { "trusted": true }, "execution_count": 1, "outputs": [] }, { "cell_type": "code", "source": "df=[1,2,3,4]\nprint(pd.DataFrame(df))", "metadata": { "trusted": true }, "execution_count": 2, "outputs": [ { "name": "stdout", "text": " 0\n0 1\n1 2\n2 3\n3 4\n", "output_type": "stream" } ] }, { "cell_type": "code", "source": "print(pd.Series(df))", "metadata": { "trusted": true }, "execution_count": 3, "outputs": [ { "name": "stdout", "text": "0 1\n1 2\n2 3\n3 4\ndtype: int64\n", "output_type": "stream" } ] }, { "cell_type": "code", "source": "Employ=pd.read_csv(\"employees.csv\")", "metadata": { "trusted": true }, "execution_count": 115, "outputs": [] }, { "cell_type": "code", "source": "Employ_dub=Employ.head(20)", "metadata": { "trusted": true }, "execution_count": 116, "outputs": [] }, { "cell_type": "code", "source": "Employ_dub", "metadata": { "trusted": true }, "execution_count": 117, "outputs": [ { "execution_count": 117, "output_type": "execute_result", "data": { "text/plain": " First Name Gender Start Date Last Login Time Salary Bonus % \\\n0 Douglas Male 8/6/1993 12:42 PM 97308 6.945 \n1 Thomas Male 3/31/1996 6:53 AM 61933 4.170 \n2 Maria Female 4/23/1993 11:17 AM 130590 11.858 \n3 Jerry Male 3/4/2005 1:00 PM 138705 9.340 \n4 Larry Male 1/24/1998 4:47 PM 101004 1.389 \n5 Dennis Male 4/18/1987 1:35 AM 115163 10.125 \n6 Ruby Female 8/17/1987 4:20 PM 65476 10.012 \n7 NaN Female 7/20/2015 10:43 AM 45906 11.598 \n8 Angela Female 11/22/2005 6:29 AM 95570 18.523 \n9 Frances Female 8/8/2002 6:51 AM 139852 7.524 \n10 Louise Female 8/12/1980 9:01 AM 63241 15.132 \n11 Julie Female 10/26/1997 3:19 PM 102508 12.637 \n12 Brandon Male 12/1/1980 1:08 AM 112807 17.492 \n13 Gary Male 1/27/2008 11:40 PM 109831 5.831 \n14 Kimberly Female 1/14/1999 7:13 AM 41426 14.543 \n15 Lillian Female 6/5/2016 6:09 AM 59414 1.256 \n16 Jeremy Male 9/21/2010 5:56 AM 90370 7.369 \n17 Shawn Male 12/7/1986 7:45 PM 111737 6.414 \n18 Diana Female 10/23/1981 10:27 AM 132940 19.082 \n19 Donna Female 7/22/2010 3:48 AM 81014 1.894 \n\n Senior Management Team \n0 True Marketing \n1 True NaN \n2 False Finance \n3 True Finance \n4 True Client Services \n5 False Legal \n6 True Product \n7 NaN Finance \n8 True Engineering \n9 True Business Development \n10 True NaN \n11 True Legal \n12 True Human Resources \n13 False Sales \n14 True Finance \n15 False Product \n16 False Human Resources \n17 False Product \n18 False Client Services \n19 False Product ", "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
First NameGenderStart DateLast Login TimeSalaryBonus %Senior ManagementTeam
0DouglasMale8/6/199312:42 PM973086.945TrueMarketing
1ThomasMale3/31/19966:53 AM619334.170TrueNaN
2MariaFemale4/23/199311:17 AM13059011.858FalseFinance
3JerryMale3/4/20051:00 PM1387059.340TrueFinance
4LarryMale1/24/19984:47 PM1010041.389TrueClient Services
5DennisMale4/18/19871:35 AM11516310.125FalseLegal
6RubyFemale8/17/19874:20 PM6547610.012TrueProduct
7NaNFemale7/20/201510:43 AM4590611.598NaNFinance
8AngelaFemale11/22/20056:29 AM9557018.523TrueEngineering
9FrancesFemale8/8/20026:51 AM1398527.524TrueBusiness Development
10LouiseFemale8/12/19809:01 AM6324115.132TrueNaN
11JulieFemale10/26/19973:19 PM10250812.637TrueLegal
12BrandonMale12/1/19801:08 AM11280717.492TrueHuman Resources
13GaryMale1/27/200811:40 PM1098315.831FalseSales
14KimberlyFemale1/14/19997:13 AM4142614.543TrueFinance
15LillianFemale6/5/20166:09 AM594141.256FalseProduct
16JeremyMale9/21/20105:56 AM903707.369FalseHuman Resources
17ShawnMale12/7/19867:45 PM1117376.414FalseProduct
18DianaFemale10/23/198110:27 AM13294019.082FalseClient Services
19DonnaFemale7/22/20103:48 AM810141.894FalseProduct
\n
" }, "metadata": {} } ] }, { "cell_type": "code", "source": "", "metadata": { "trusted": true }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": "#total info about the employee\nEmploy_dub.info()", "metadata": { "trusted": true }, "execution_count": 26, "outputs": [ { "name": "stdout", "text": "\nRangeIndex: 20 entries, 0 to 19\nData columns (total 8 columns):\n # Column Non-Null Count Dtype \n--- ------ -------------- ----- \n 0 First Name 19 non-null object \n 1 Gender 20 non-null object \n 2 Start Date 20 non-null object \n 3 Last Login Time 20 non-null object \n 4 Salary 20 non-null int64 \n 5 Bonus % 20 non-null float64\n 6 Senior Management 19 non-null object \n 7 Team 18 non-null object \ndtypes: float64(1), int64(1), object(6)\nmemory usage: 868.0+ bytes\n", "output_type": "stream" } ] }, { "cell_type": "code", "source": "Employ_dub.isnull()", "metadata": { "trusted": true }, "execution_count": 27, "outputs": [ { "execution_count": 27, "output_type": "execute_result", "data": { "text/plain": " First Name Gender Start Date Last Login Time Salary Bonus % \\\n0 False False False False False False \n1 False False False False False False \n2 False False False False False False \n3 False False False False False False \n4 False False False False False False \n5 False False False False False False \n6 False False False False False False \n7 True False False False False False \n8 False False False False False False \n9 False False False False False False \n10 False False False False False False \n11 False False False False False False \n12 False False False False False False \n13 False False False False False False \n14 False False False False False False \n15 False False False False False False \n16 False False False False False False \n17 False False False False False False \n18 False False False False False False \n19 False False False False False False \n\n Senior Management Team \n0 False False \n1 False True \n2 False False \n3 False False \n4 False False \n5 False False \n6 False False \n7 True False \n8 False False \n9 False False \n10 False True \n11 False False \n12 False False \n13 False False \n14 False False \n15 False False \n16 False False \n17 False False \n18 False False \n19 False False ", "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
First NameGenderStart DateLast Login TimeSalaryBonus %Senior ManagementTeam
0FalseFalseFalseFalseFalseFalseFalseFalse
1FalseFalseFalseFalseFalseFalseFalseTrue
2FalseFalseFalseFalseFalseFalseFalseFalse
3FalseFalseFalseFalseFalseFalseFalseFalse
4FalseFalseFalseFalseFalseFalseFalseFalse
5FalseFalseFalseFalseFalseFalseFalseFalse
6FalseFalseFalseFalseFalseFalseFalseFalse
7TrueFalseFalseFalseFalseFalseTrueFalse
8FalseFalseFalseFalseFalseFalseFalseFalse
9FalseFalseFalseFalseFalseFalseFalseFalse
10FalseFalseFalseFalseFalseFalseFalseTrue
11FalseFalseFalseFalseFalseFalseFalseFalse
12FalseFalseFalseFalseFalseFalseFalseFalse
13FalseFalseFalseFalseFalseFalseFalseFalse
14FalseFalseFalseFalseFalseFalseFalseFalse
15FalseFalseFalseFalseFalseFalseFalseFalse
16FalseFalseFalseFalseFalseFalseFalseFalse
17FalseFalseFalseFalseFalseFalseFalseFalse
18FalseFalseFalseFalseFalseFalseFalseFalse
19FalseFalseFalseFalseFalseFalseFalseFalse
\n
" }, "metadata": {} } ] }, { "cell_type": "code", "source": "#checking for the null values in the dataset of employee\nEmploy_dub.isnull().sum()", "metadata": { "trusted": true }, "execution_count": 28, "outputs": [ { "execution_count": 28, "output_type": "execute_result", "data": { "text/plain": "First Name 1\nGender 0\nStart Date 0\nLast Login Time 0\nSalary 0\nBonus % 0\nSenior Management 1\nTeam 2\ndtype: int64" }, "metadata": {} } ] }, { "cell_type": "code", "source": "#changing the name of the dataset\ned=Employ_dub", "metadata": { "trusted": true }, "execution_count": 29, "outputs": [] }, { "cell_type": "code", "source": "#dimension of the dataset\ned.shape", "metadata": { "trusted": true }, "execution_count": 30, "outputs": [ { "execution_count": 30, "output_type": "execute_result", "data": { "text/plain": "(20, 8)" }, "metadata": {} } ] }, { "cell_type": "code", "source": "ed.columns", "metadata": { "trusted": true }, "execution_count": 31, "outputs": [ { "execution_count": 31, "output_type": "execute_result", "data": { "text/plain": "Index(['First Name', 'Gender', 'Start Date', 'Last Login Time', 'Salary',\n 'Bonus %', 'Senior Management', 'Team'],\n dtype='object')" }, "metadata": {} } ] }, { "cell_type": "code", "source": "#working on the dictionary for a while:", "metadata": { "trusted": true }, "execution_count": 32, "outputs": [] }, { "cell_type": "code", "source": "#creating test objects:\nimport numpy as np\nff=pd.DataFrame(np.random.rand(20,5))", "metadata": { "trusted": true }, "execution_count": 39, "outputs": [] }, { "cell_type": "code", "source": "ff", "metadata": { "trusted": true }, "execution_count": 40, "outputs": [ { "execution_count": 40, "output_type": "execute_result", "data": { "text/plain": " 0 1 2 3 4\n0 0.020780 0.365190 0.673825 0.800112 0.188644\n1 0.660845 0.265913 0.445028 0.889438 0.601047\n2 0.646987 0.926823 0.722838 0.475271 0.827945\n3 0.871724 0.290353 0.099578 0.109949 0.229182\n4 0.704794 0.884062 0.751327 0.595746 0.612269\n5 0.371269 0.560512 0.510264 0.247923 0.618853\n6 0.150398 0.116999 0.934865 0.315723 0.221538\n7 0.556336 0.875514 0.471526 0.539511 0.271221\n8 0.428221 0.546766 0.921274 0.500520 0.400341\n9 0.150170 0.802378 0.608124 0.342871 0.076631\n10 0.099049 0.280748 0.865939 0.214541 0.083318\n11 0.042867 0.701639 0.051457 0.691385 0.051529\n12 0.530845 0.248395 0.433733 0.049458 0.314959\n13 0.142230 0.746634 0.536247 0.096499 0.123294\n14 0.139630 0.056464 0.595644 0.764071 0.193826\n15 0.709624 0.590262 0.816268 0.187931 0.366224\n16 0.982939 0.260358 0.918897 0.531278 0.304655\n17 0.381823 0.003594 0.052597 0.921529 0.022103\n18 0.227944 0.706832 0.137266 0.129158 0.882734\n19 0.226257 0.818213 0.326071 0.230419 0.668891", "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
01234
00.0207800.3651900.6738250.8001120.188644
10.6608450.2659130.4450280.8894380.601047
20.6469870.9268230.7228380.4752710.827945
30.8717240.2903530.0995780.1099490.229182
40.7047940.8840620.7513270.5957460.612269
50.3712690.5605120.5102640.2479230.618853
60.1503980.1169990.9348650.3157230.221538
70.5563360.8755140.4715260.5395110.271221
80.4282210.5467660.9212740.5005200.400341
90.1501700.8023780.6081240.3428710.076631
100.0990490.2807480.8659390.2145410.083318
110.0428670.7016390.0514570.6913850.051529
120.5308450.2483950.4337330.0494580.314959
130.1422300.7466340.5362470.0964990.123294
140.1396300.0564640.5956440.7640710.193826
150.7096240.5902620.8162680.1879310.366224
160.9829390.2603580.9188970.5312780.304655
170.3818230.0035940.0525970.9215290.022103
180.2279440.7068320.1372660.1291580.882734
190.2262570.8182130.3260710.2304190.668891
\n
" }, "metadata": {} } ] }, { "cell_type": "code", "source": "ff.info()", "metadata": { "trusted": true }, "execution_count": 41, "outputs": [ { "name": "stdout", "text": "\nRangeIndex: 20 entries, 0 to 19\nData columns (total 5 columns):\n # Column Non-Null Count Dtype \n--- ------ -------------- ----- \n 0 0 20 non-null float64\n 1 1 20 non-null float64\n 2 2 20 non-null float64\n 3 3 20 non-null float64\n 4 4 20 non-null float64\ndtypes: float64(5)\nmemory usage: 868.0 bytes\n", "output_type": "stream" } ] }, { "cell_type": "code", "source": "#data functon:\ndate=pd.DataFrame(\n{\n\"date\":['10/9/2020','11/09/2020','12/09/2020'],\n\"students\":[10,20,30]})\n", "metadata": { "trusted": true }, "execution_count": 43, "outputs": [ { "execution_count": 43, "output_type": "execute_result", "data": { "text/plain": " date students\n0 10/9/2020 10\n1 11/09/2020 20\n2 12/09/2020 30", "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
datestudents
010/9/202010
111/09/202020
212/09/202030
\n
" }, "metadata": {} } ] }, { "cell_type": "code", "source": "ed.value_counts()", "metadata": { "trusted": true }, "execution_count": 52, "outputs": [ { "execution_count": 52, "output_type": "execute_result", "data": { "text/plain": "First Name Gender Start Date Last Login Time Salary Bonus % Senior Management Team \nAngela Female 11/22/2005 6:29 AM 95570 18.523 True Engineering 1\nJerry Male 3/4/2005 1:00 PM 138705 9.340 True Finance 1\nRuby Female 8/17/1987 4:20 PM 65476 10.012 True Product 1\nMaria Female 4/23/1993 11:17 AM 130590 11.858 False Finance 1\nLillian Female 6/5/2016 6:09 AM 59414 1.256 False Product 1\nLarry Male 1/24/1998 4:47 PM 101004 1.389 True Client Services 1\nKimberly Female 1/14/1999 7:13 AM 41426 14.543 True Finance 1\nJulie Female 10/26/1997 3:19 PM 102508 12.637 True Legal 1\nJeremy Male 9/21/2010 5:56 AM 90370 7.369 False Human Resources 1\nBrandon Male 12/1/1980 1:08 AM 112807 17.492 True Human Resources 1\nGary Male 1/27/2008 11:40 PM 109831 5.831 False Sales 1\nFrances Female 8/8/2002 6:51 AM 139852 7.524 True Business Development 1\nDouglas Male 8/6/1993 12:42 PM 97308 6.945 True Marketing 1\nDonna Female 7/22/2010 3:48 AM 81014 1.894 False Product 1\nDiana Female 10/23/1981 10:27 AM 132940 19.082 False Client Services 1\nDennis Male 4/18/1987 1:35 AM 115163 10.125 False Legal 1\nShawn Male 12/7/1986 7:45 PM 111737 6.414 False Product 1\ndtype: int64" }, "metadata": {} } ] }, { "cell_type": "code", "source": "ed[['Gender','Salary']]", "metadata": { "trusted": true }, "execution_count": 62, "outputs": [ { "execution_count": 62, "output_type": "execute_result", "data": { "text/plain": " Gender Salary\n0 Male 97308\n1 Male 61933\n2 Female 130590\n3 Male 138705\n4 Male 101004\n5 Male 115163\n6 Female 65476\n7 Female 45906\n8 Female 95570\n9 Female 139852\n10 Female 63241\n11 Female 102508\n12 Male 112807\n13 Male 109831\n14 Female 41426\n15 Female 59414\n16 Male 90370\n17 Male 111737\n18 Female 132940\n19 Female 81014", "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
GenderSalary
0Male97308
1Male61933
2Female130590
3Male138705
4Male101004
5Male115163
6Female65476
7Female45906
8Female95570
9Female139852
10Female63241
11Female102508
12Male112807
13Male109831
14Female41426
15Female59414
16Male90370
17Male111737
18Female132940
19Female81014
\n
" }, "metadata": {} } ] }, { "cell_type": "code", "source": "#selection by position:rows data:\ned.iloc[8:12]", "metadata": { "trusted": true }, "execution_count": 69, "outputs": [ { "execution_count": 69, "output_type": "execute_result", "data": { "text/plain": " First Name Gender Start Date Last Login Time Salary Bonus % \\\n8 Angela Female 11/22/2005 6:29 AM 95570 18.523 \n9 Frances Female 8/8/2002 6:51 AM 139852 7.524 \n10 Louise Female 8/12/1980 9:01 AM 63241 15.132 \n11 Julie Female 10/26/1997 3:19 PM 102508 12.637 \n\n Senior Management Team \n8 True Engineering \n9 True Business Development \n10 True NaN \n11 True Legal ", "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
First NameGenderStart DateLast Login TimeSalaryBonus %Senior ManagementTeam
8AngelaFemale11/22/20056:29 AM9557018.523TrueEngineering
9FrancesFemale8/8/20026:51 AM1398527.524TrueBusiness Development
10LouiseFemale8/12/19809:01 AM6324115.132TrueNaN
11JulieFemale10/26/19973:19 PM10250812.637TrueLegal
\n
" }, "metadata": {} } ] }, { "cell_type": "code", "source": "ed.loc[8]", "metadata": { "trusted": true }, "execution_count": 64, "outputs": [ { "execution_count": 64, "output_type": "execute_result", "data": { "text/plain": "First Name Angela\nGender Female\nStart Date 11/22/2005\nLast Login Time 6:29 AM\nSalary 95570\nBonus % 18.523\nSenior Management True\nTeam Engineering\nName: 8, dtype: object" }, "metadata": {} } ] }, { "cell_type": "code", "source": "#data cleaning:\ned.isnull().sum()", "metadata": { "trusted": true }, "execution_count": 73, "outputs": [ { "execution_count": 73, "output_type": "execute_result", "data": { "text/plain": "First Name 1\nGender 0\nStart Date 0\nLast Login Time 0\nSalary 0\nBonus % 0\nSenior Management 1\nTeam 2\ndtype: int64" }, "metadata": {} } ] }, { "cell_type": "code", "source": "#total null values:\ned.isnull().sum().sum()", "metadata": { "trusted": true }, "execution_count": 74, "outputs": [ { "execution_count": 74, "output_type": "execute_result", "data": { "text/plain": "4" }, "metadata": {} } ] }, { "cell_type": "code", "source": "ed.notnull().sum().sum()", "metadata": { "trusted": true }, "execution_count": 77, "outputs": [ { "execution_count": 77, "output_type": "execute_result", "data": { "text/plain": "156" }, "metadata": {} } ] }, { "cell_type": "code", "source": "#fpr practice on drop we will take the copy of the original data:\ned2=ed", "metadata": { "trusted": true }, "execution_count": 78, "outputs": [] }, { "cell_type": "code", "source": "ed2", "metadata": { "trusted": true }, "execution_count": 79, "outputs": [ { "execution_count": 79, "output_type": "execute_result", "data": { "text/plain": " First Name Gender Start Date Last Login Time Salary Bonus % \\\n0 Douglas Male 8/6/1993 12:42 PM 97308 6.945 \n1 Thomas Male 3/31/1996 6:53 AM 61933 4.170 \n2 Maria Female 4/23/1993 11:17 AM 130590 11.858 \n3 Jerry Male 3/4/2005 1:00 PM 138705 9.340 \n4 Larry Male 1/24/1998 4:47 PM 101004 1.389 \n5 Dennis Male 4/18/1987 1:35 AM 115163 10.125 \n6 Ruby Female 8/17/1987 4:20 PM 65476 10.012 \n7 NaN Female 7/20/2015 10:43 AM 45906 11.598 \n8 Angela Female 11/22/2005 6:29 AM 95570 18.523 \n9 Frances Female 8/8/2002 6:51 AM 139852 7.524 \n10 Louise Female 8/12/1980 9:01 AM 63241 15.132 \n11 Julie Female 10/26/1997 3:19 PM 102508 12.637 \n12 Brandon Male 12/1/1980 1:08 AM 112807 17.492 \n13 Gary Male 1/27/2008 11:40 PM 109831 5.831 \n14 Kimberly Female 1/14/1999 7:13 AM 41426 14.543 \n15 Lillian Female 6/5/2016 6:09 AM 59414 1.256 \n16 Jeremy Male 9/21/2010 5:56 AM 90370 7.369 \n17 Shawn Male 12/7/1986 7:45 PM 111737 6.414 \n18 Diana Female 10/23/1981 10:27 AM 132940 19.082 \n19 Donna Female 7/22/2010 3:48 AM 81014 1.894 \n\n Senior Management Team \n0 True Marketing \n1 True NaN \n2 False Finance \n3 True Finance \n4 True Client Services \n5 False Legal \n6 True Product \n7 NaN Finance \n8 True Engineering \n9 True Business Development \n10 True NaN \n11 True Legal \n12 True Human Resources \n13 False Sales \n14 True Finance \n15 False Product \n16 False Human Resources \n17 False Product \n18 False Client Services \n19 False Product ", "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
First NameGenderStart DateLast Login TimeSalaryBonus %Senior ManagementTeam
0DouglasMale8/6/199312:42 PM973086.945TrueMarketing
1ThomasMale3/31/19966:53 AM619334.170TrueNaN
2MariaFemale4/23/199311:17 AM13059011.858FalseFinance
3JerryMale3/4/20051:00 PM1387059.340TrueFinance
4LarryMale1/24/19984:47 PM1010041.389TrueClient Services
5DennisMale4/18/19871:35 AM11516310.125FalseLegal
6RubyFemale8/17/19874:20 PM6547610.012TrueProduct
7NaNFemale7/20/201510:43 AM4590611.598NaNFinance
8AngelaFemale11/22/20056:29 AM9557018.523TrueEngineering
9FrancesFemale8/8/20026:51 AM1398527.524TrueBusiness Development
10LouiseFemale8/12/19809:01 AM6324115.132TrueNaN
11JulieFemale10/26/19973:19 PM10250812.637TrueLegal
12BrandonMale12/1/19801:08 AM11280717.492TrueHuman Resources
13GaryMale1/27/200811:40 PM1098315.831FalseSales
14KimberlyFemale1/14/19997:13 AM4142614.543TrueFinance
15LillianFemale6/5/20166:09 AM594141.256FalseProduct
16JeremyMale9/21/20105:56 AM903707.369FalseHuman Resources
17ShawnMale12/7/19867:45 PM1117376.414FalseProduct
18DianaFemale10/23/198110:27 AM13294019.082FalseClient Services
19DonnaFemale7/22/20103:48 AM810141.894FalseProduct
\n
" }, "metadata": {} } ] }, { "cell_type": "code", "source": "#removing the totyal columns if they are with the null values:\ned3=ed2.dropna(axis=1)\nprint(\"prasent null values:\",ed3.isnull().sum().sum())", "metadata": { "trusted": true }, "execution_count": 90, "outputs": [ { "name": "stdout", "text": "prasent null values: 0\n", "output_type": "stream" } ] }, { "cell_type": "code", "source": "ed2.fillna(10,inplace=True)", "metadata": { "trusted": true }, "execution_count": 96, "outputs": [ { "name": "stderr", "text": ":1: SettingWithCopyWarning: \nA value is trying to be set on a copy of a slice from a DataFrame\n\nSee the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n ed2.fillna(10,inplace=True)\n", "output_type": "stream" } ] }, { "cell_type": "code", "source": "ed2.isnull().sum()", "metadata": { "trusted": true }, "execution_count": 97, "outputs": [ { "execution_count": 97, "output_type": "execute_result", "data": { "text/plain": "First Name 0\nGender 0\nStart Date 0\nLast Login Time 0\nSalary 0\nBonus % 0\nSenior Management 0\nTeam 0\ndtype: int64" }, "metadata": {} } ] }, { "cell_type": "code", "source": "ed2", "metadata": { "trusted": true }, "execution_count": 98, "outputs": [ { "execution_count": 98, "output_type": "execute_result", "data": { "text/plain": " First Name Gender Start Date Last Login Time Salary Bonus % \\\n0 Douglas Male 8/6/1993 12:42 PM 97308 6.945 \n1 Thomas Male 3/31/1996 6:53 AM 61933 4.170 \n2 Maria Female 4/23/1993 11:17 AM 130590 11.858 \n3 Jerry Male 3/4/2005 1:00 PM 138705 9.340 \n4 Larry Male 1/24/1998 4:47 PM 101004 1.389 \n5 Dennis Male 4/18/1987 1:35 AM 115163 10.125 \n6 Ruby Female 8/17/1987 4:20 PM 65476 10.012 \n7 10 Female 7/20/2015 10:43 AM 45906 11.598 \n8 Angela Female 11/22/2005 6:29 AM 95570 18.523 \n9 Frances Female 8/8/2002 6:51 AM 139852 7.524 \n10 Louise Female 8/12/1980 9:01 AM 63241 15.132 \n11 Julie Female 10/26/1997 3:19 PM 102508 12.637 \n12 Brandon Male 12/1/1980 1:08 AM 112807 17.492 \n13 Gary Male 1/27/2008 11:40 PM 109831 5.831 \n14 Kimberly Female 1/14/1999 7:13 AM 41426 14.543 \n15 Lillian Female 6/5/2016 6:09 AM 59414 1.256 \n16 Jeremy Male 9/21/2010 5:56 AM 90370 7.369 \n17 Shawn Male 12/7/1986 7:45 PM 111737 6.414 \n18 Diana Female 10/23/1981 10:27 AM 132940 19.082 \n19 Donna Female 7/22/2010 3:48 AM 81014 1.894 \n\n Senior Management Team \n0 True Marketing \n1 True 10 \n2 False Finance \n3 True Finance \n4 True Client Services \n5 False Legal \n6 True Product \n7 10 Finance \n8 True Engineering \n9 True Business Development \n10 True 10 \n11 True Legal \n12 True Human Resources \n13 False Sales \n14 True Finance \n15 False Product \n16 False Human Resources \n17 False Product \n18 False Client Services \n19 False Product ", "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
First NameGenderStart DateLast Login TimeSalaryBonus %Senior ManagementTeam
0DouglasMale8/6/199312:42 PM973086.945TrueMarketing
1ThomasMale3/31/19966:53 AM619334.170True10
2MariaFemale4/23/199311:17 AM13059011.858FalseFinance
3JerryMale3/4/20051:00 PM1387059.340TrueFinance
4LarryMale1/24/19984:47 PM1010041.389TrueClient Services
5DennisMale4/18/19871:35 AM11516310.125FalseLegal
6RubyFemale8/17/19874:20 PM6547610.012TrueProduct
710Female7/20/201510:43 AM4590611.59810Finance
8AngelaFemale11/22/20056:29 AM9557018.523TrueEngineering
9FrancesFemale8/8/20026:51 AM1398527.524TrueBusiness Development
10LouiseFemale8/12/19809:01 AM6324115.132True10
11JulieFemale10/26/19973:19 PM10250812.637TrueLegal
12BrandonMale12/1/19801:08 AM11280717.492TrueHuman Resources
13GaryMale1/27/200811:40 PM1098315.831FalseSales
14KimberlyFemale1/14/19997:13 AM4142614.543TrueFinance
15LillianFemale6/5/20166:09 AM594141.256FalseProduct
16JeremyMale9/21/20105:56 AM903707.369FalseHuman Resources
17ShawnMale12/7/19867:45 PM1117376.414FalseProduct
18DianaFemale10/23/198110:27 AM13294019.082FalseClient Services
19DonnaFemale7/22/20103:48 AM810141.894FalseProduct
\n
" }, "metadata": {} } ] }, { "cell_type": "code", "source": "ed5=Employ.head(20)\ned5", "metadata": { "trusted": true }, "execution_count": 118, "outputs": [ { "execution_count": 118, "output_type": "execute_result", "data": { "text/plain": " First Name Gender Start Date Last Login Time Salary Bonus % \\\n0 Douglas Male 8/6/1993 12:42 PM 97308 6.945 \n1 Thomas Male 3/31/1996 6:53 AM 61933 4.170 \n2 Maria Female 4/23/1993 11:17 AM 130590 11.858 \n3 Jerry Male 3/4/2005 1:00 PM 138705 9.340 \n4 Larry Male 1/24/1998 4:47 PM 101004 1.389 \n5 Dennis Male 4/18/1987 1:35 AM 115163 10.125 \n6 Ruby Female 8/17/1987 4:20 PM 65476 10.012 \n7 NaN Female 7/20/2015 10:43 AM 45906 11.598 \n8 Angela Female 11/22/2005 6:29 AM 95570 18.523 \n9 Frances Female 8/8/2002 6:51 AM 139852 7.524 \n10 Louise Female 8/12/1980 9:01 AM 63241 15.132 \n11 Julie Female 10/26/1997 3:19 PM 102508 12.637 \n12 Brandon Male 12/1/1980 1:08 AM 112807 17.492 \n13 Gary Male 1/27/2008 11:40 PM 109831 5.831 \n14 Kimberly Female 1/14/1999 7:13 AM 41426 14.543 \n15 Lillian Female 6/5/2016 6:09 AM 59414 1.256 \n16 Jeremy Male 9/21/2010 5:56 AM 90370 7.369 \n17 Shawn Male 12/7/1986 7:45 PM 111737 6.414 \n18 Diana Female 10/23/1981 10:27 AM 132940 19.082 \n19 Donna Female 7/22/2010 3:48 AM 81014 1.894 \n\n Senior Management Team \n0 True Marketing \n1 True NaN \n2 False Finance \n3 True Finance \n4 True Client Services \n5 False Legal \n6 True Product \n7 NaN Finance \n8 True Engineering \n9 True Business Development \n10 True NaN \n11 True Legal \n12 True Human Resources \n13 False Sales \n14 True Finance \n15 False Product \n16 False Human Resources \n17 False Product \n18 False Client Services \n19 False Product ", "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
First NameGenderStart DateLast Login TimeSalaryBonus %Senior ManagementTeam
0DouglasMale8/6/199312:42 PM973086.945TrueMarketing
1ThomasMale3/31/19966:53 AM619334.170TrueNaN
2MariaFemale4/23/199311:17 AM13059011.858FalseFinance
3JerryMale3/4/20051:00 PM1387059.340TrueFinance
4LarryMale1/24/19984:47 PM1010041.389TrueClient Services
5DennisMale4/18/19871:35 AM11516310.125FalseLegal
6RubyFemale8/17/19874:20 PM6547610.012TrueProduct
7NaNFemale7/20/201510:43 AM4590611.598NaNFinance
8AngelaFemale11/22/20056:29 AM9557018.523TrueEngineering
9FrancesFemale8/8/20026:51 AM1398527.524TrueBusiness Development
10LouiseFemale8/12/19809:01 AM6324115.132TrueNaN
11JulieFemale10/26/19973:19 PM10250812.637TrueLegal
12BrandonMale12/1/19801:08 AM11280717.492TrueHuman Resources
13GaryMale1/27/200811:40 PM1098315.831FalseSales
14KimberlyFemale1/14/19997:13 AM4142614.543TrueFinance
15LillianFemale6/5/20166:09 AM594141.256FalseProduct
16JeremyMale9/21/20105:56 AM903707.369FalseHuman Resources
17ShawnMale12/7/19867:45 PM1117376.414FalseProduct
18DianaFemale10/23/198110:27 AM13294019.082FalseClient Services
19DonnaFemale7/22/20103:48 AM810141.894FalseProduct
\n
" }, "metadata": {} } ] }, { "cell_type": "code", "source": "ed2.isnull().sum()", "metadata": { "trusted": true }, "execution_count": 111, "outputs": [ { "execution_count": 111, "output_type": "execute_result", "data": { "text/plain": "First Name 0\nGender 0\nStart Date 0\nLast Login Time 0\nSalary 0\nBonus % 0\nSenior Management 0\nTeam 0\ndtype: int64" }, "metadata": {} } ] }, { "cell_type": "code", "source": "date", "metadata": { "trusted": true }, "execution_count": 120, "outputs": [ { "execution_count": 120, "output_type": "execute_result", "data": { "text/plain": " date students\n0 10/9/2020 10\n1 11/09/2020 20\n2 12/09/2020 30", "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
datestudents
010/9/202010
111/09/202020
212/09/202030
\n
" }, "metadata": {} } ] }, { "cell_type": "code", "source": "date.dtypes", "metadata": { "trusted": true }, "execution_count": 124, "outputs": [ { "execution_count": 124, "output_type": "execute_result", "data": { "text/plain": "date object\nstudents int64\ndtype: object" }, "metadata": {} } ] }, { "cell_type": "code", "source": "#rename for the date with the check:\ndate.rename(columns={'date':'check'})", "metadata": { "trusted": true }, "execution_count": 131, "outputs": [ { "execution_count": 131, "output_type": "execute_result", "data": { "text/plain": " check students\n0 10/9/2020 10\n1 11/09/2020 20\n2 12/09/2020 30", "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
checkstudents
010/9/202010
111/09/202020
212/09/202030
\n
" }, "metadata": {} } ] }, { "cell_type": "code", "source": "date.sort_values('students',ascending=False)", "metadata": { "trusted": true }, "execution_count": 134, "outputs": [ { "execution_count": 134, "output_type": "execute_result", "data": { "text/plain": " date students\n2 12/09/2020 30\n1 11/09/2020 20\n0 10/9/2020 10", "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
datestudents
212/09/202030
111/09/202020
010/9/202010
\n
" }, "metadata": {} } ] }, { "cell_type": "code", "source": "", "metadata": { "trusted": true }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": "", "metadata": { "trusted": true }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": "", "metadata": {}, "execution_count": null, "outputs": [] } ] }