/
Google_Play.ipynb
3231 lines (3231 loc) · 571 KB
/
Google_Play.ipynb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Google_Play.ipynb",
"provenance": [],
"collapsed_sections": [],
"mount_file_id": "1lFWKDXsT_aeKqqrqT7_n-8D39fjv4WkO",
"authorship_tag": "ABX9TyMHDG9CWAIaISHIzr40wWX/",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/karinnecristina/Data-Science/blob/master/Google_Play.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "aq6WvQjWFQ3q",
"colab_type": "text"
},
"source": [
"#**Análise dos dados da Google Play Store**\n",
"\n",
"\n",
"\n",
"![alt text](https://drive.google.com/uc?id=1YLGpuCftOiytiBp2GuvrHI0tF5p8axl_)\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "g0IPMLAQPgQl",
"colab_type": "text"
},
"source": [
"A Play Store é a loja de aplicativos do Google, é através dela que os usuários de celulares com sistema operacional Android conseguem baixar apps como WhatsApp, Facebook, Spotify, Netflix e vários outros para seus dispositivos. Apesar do uso ser gratuito, ela também conta com ofertas de aplicativos e serviços pagos."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "m4FM5u0eRhiO",
"colab_type": "text"
},
"source": [
"##**Objetivo**\n",
"\n",
"Os dados dos aplicativos da Play Store têm um enorme potencial para levar as empresas que desenvolvem essas aplicações ao sucesso.O objetivo deste projeto é analisar esses dados com o intuito de ajudar os desenvolvedores a entender que tipo de aplicativo provavelmente atrairá mais usuários.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "IsG7LSeySWZG",
"colab_type": "text"
},
"source": [
" ### **Obtenção dos Dados**\n",
"\n",
"Os dados usados nessa análise são referentes ao ano de 2018 e foram obtidos a partir do site [Kaggle.com](https://www.kaggle.com/lava18/google-play-store-apps)"
]
},
{
"cell_type": "code",
"metadata": {
"id": "Bebl4ypjPYlk",
"colab_type": "code",
"colab": {}
},
"source": [
"# Importando os pacotes necessários\n",
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"from wordcloud import WordCloud"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "eqJhTyulMIgz",
"colab_type": "code",
"colab": {}
},
"source": [
"# Lendo o arquivo:\n",
"df_app = pd.read_csv('/content/drive/My Drive/Curso_Dataquest/googleplaystore.csv')"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "Q1BtWFN6WECG",
"colab_type": "text"
},
"source": [
" ### **Análise dos Dados**\n",
"\n",
"Esta etapa tem por objetivo criar uma consciência situacional inicial e permitir um entendimento de como os dados estão estruturados."
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "1diVzypO1iab"
},
"source": [
"<Enter>\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Xo1MEbNtcJ8o",
"colab_type": "text"
},
"source": [
"**Dicionário das variáveis**\n",
"\n",
"* App - Nome do aplicativo\n",
"* Category - Categoria à qual o aplicativo pertence\n",
"* Rating - classificação do aplicativo \n",
"* Reviews - Número de avaliações de usuários do aplicativo\n",
"* Size - Tamanho do aplicativo\n",
"* Installs - Número de downloads / instalações de usuário para o aplicativo \n",
"* Type - Pago ou Gratuito\n",
"* Price - preço\n",
"* Content Rating - Faixa etária em que o aplicativo é direcionado - Crianças / maiores de 21 anos / Adulto\n",
"* Genres - Um aplicativo pode pertencer a vários gêneros (além da categoria principal). Por exemplo, um jogo musical familiar pertence aos gêneros Música, Jogo, Família.\n",
"* Last Updated - Data em que o aplicativo foi atualizado pela última vez na Play Store\n",
"* Current Ver - Versão atual do aplicativo disponível na Play Store\n",
"* Android Ver - Versão mínima exigida do Android"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "II-kMx_BezxX",
"colab_type": "text"
},
"source": [
"Vamos dar uma olhada nas primeiras linhas do Dataframe."
]
},
{
"cell_type": "code",
"metadata": {
"id": "N651pCxDTuUr",
"colab_type": "code",
"outputId": "8617d6e4-651b-4061-9113-05cb5a010575",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 204
}
},
"source": [
"# Primeiras 5 linhas:\n",
"df_app.head()"
],
"execution_count": 3,
"outputs": [
{
"output_type": "execute_result",
"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>App</th>\n",
" <th>Category</th>\n",
" <th>Rating</th>\n",
" <th>Reviews</th>\n",
" <th>Size</th>\n",
" <th>Installs</th>\n",
" <th>Type</th>\n",
" <th>Price</th>\n",
" <th>Content Rating</th>\n",
" <th>Genres</th>\n",
" <th>Last Updated</th>\n",
" <th>Current Ver</th>\n",
" <th>Android Ver</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Photo Editor & Candy Camera & Grid & ScrapBook</td>\n",
" <td>ART_AND_DESIGN</td>\n",
" <td>4.1</td>\n",
" <td>159</td>\n",
" <td>19M</td>\n",
" <td>10,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Everyone</td>\n",
" <td>Art & Design</td>\n",
" <td>January 7, 2018</td>\n",
" <td>1.0.0</td>\n",
" <td>4.0.3 and up</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Coloring book moana</td>\n",
" <td>ART_AND_DESIGN</td>\n",
" <td>3.9</td>\n",
" <td>967</td>\n",
" <td>14M</td>\n",
" <td>500,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Everyone</td>\n",
" <td>Art & Design;Pretend Play</td>\n",
" <td>January 15, 2018</td>\n",
" <td>2.0.0</td>\n",
" <td>4.0.3 and up</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>U Launcher Lite – FREE Live Cool Themes, Hide ...</td>\n",
" <td>ART_AND_DESIGN</td>\n",
" <td>4.7</td>\n",
" <td>87510</td>\n",
" <td>8.7M</td>\n",
" <td>5,000,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Everyone</td>\n",
" <td>Art & Design</td>\n",
" <td>August 1, 2018</td>\n",
" <td>1.2.4</td>\n",
" <td>4.0.3 and up</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Sketch - Draw & Paint</td>\n",
" <td>ART_AND_DESIGN</td>\n",
" <td>4.5</td>\n",
" <td>215644</td>\n",
" <td>25M</td>\n",
" <td>50,000,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Teen</td>\n",
" <td>Art & Design</td>\n",
" <td>June 8, 2018</td>\n",
" <td>Varies with device</td>\n",
" <td>4.2 and up</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Pixel Draw - Number Art Coloring Book</td>\n",
" <td>ART_AND_DESIGN</td>\n",
" <td>4.3</td>\n",
" <td>967</td>\n",
" <td>2.8M</td>\n",
" <td>100,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Everyone</td>\n",
" <td>Art & Design;Creativity</td>\n",
" <td>June 20, 2018</td>\n",
" <td>1.1</td>\n",
" <td>4.4 and up</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" App ... Android Ver\n",
"0 Photo Editor & Candy Camera & Grid & ScrapBook ... 4.0.3 and up\n",
"1 Coloring book moana ... 4.0.3 and up\n",
"2 U Launcher Lite – FREE Live Cool Themes, Hide ... ... 4.0.3 and up\n",
"3 Sketch - Draw & Paint ... 4.2 and up\n",
"4 Pixel Draw - Number Art Coloring Book ... 4.4 and up\n",
"\n",
"[5 rows x 13 columns]"
]
},
"metadata": {
"tags": []
},
"execution_count": 3
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "BqTSheRTELDs",
"colab_type": "text"
},
"source": [
"###**Quantos linhas e quantas colunas o nosso conjunto de dados possui? Quais os tipos das variáveis?**"
]
},
{
"cell_type": "code",
"metadata": {
"id": "DLaxvR0VEcB2",
"colab_type": "code",
"outputId": "71b4f0e2-8e8d-482f-a867-4a8d5b14d013",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 306
}
},
"source": [
"# Tamanho do Dataframe:\n",
"print(f'Número de linhas: {len(df_app.index)}')\n",
"print(f'Número de colunas: {len(df_app.columns)}\\n')\n",
"\n",
"# Identificando o tipo de cada variável:\n",
"display(df_app.dtypes)"
],
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"text": [
"Número de linhas: 10841\n",
"Número de colunas: 13\n",
"\n"
],
"name": "stdout"
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"App object\n",
"Category object\n",
"Rating float64\n",
"Reviews object\n",
"Size object\n",
"Installs object\n",
"Type object\n",
"Price object\n",
"Content Rating object\n",
"Genres object\n",
"Last Updated object\n",
"Current Ver object\n",
"Android Ver object\n",
"dtype: object"
]
},
"metadata": {
"tags": []
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "pTCcchjBCb8m",
"colab_type": "text"
},
"source": [
"#**Limpeza e transformação dos dados**"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "v9vkmZZJRvT4",
"colab_type": "text"
},
"source": [
"Precisamos garantir que os dados que estamos analisando sejam precisos, caso contrário, os resultados de nossa análise estarão errados."
]
},
{
"cell_type": "code",
"metadata": {
"id": "1urEzkoTHUGE",
"colab_type": "code",
"outputId": "d541ec69-bbdd-43bf-d44d-b481e9201362",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 204
}
},
"source": [
"# Corrigindo o nome das colunas:\n",
"df_app.columns = df_app.columns.str.replace(' ', '_')\n",
"\n",
"# Visualizando os dados novamente:\n",
"df_app.head()"
],
"execution_count": 5,
"outputs": [
{
"output_type": "execute_result",
"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>App</th>\n",
" <th>Category</th>\n",
" <th>Rating</th>\n",
" <th>Reviews</th>\n",
" <th>Size</th>\n",
" <th>Installs</th>\n",
" <th>Type</th>\n",
" <th>Price</th>\n",
" <th>Content_Rating</th>\n",
" <th>Genres</th>\n",
" <th>Last_Updated</th>\n",
" <th>Current_Ver</th>\n",
" <th>Android_Ver</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Photo Editor & Candy Camera & Grid & ScrapBook</td>\n",
" <td>ART_AND_DESIGN</td>\n",
" <td>4.1</td>\n",
" <td>159</td>\n",
" <td>19M</td>\n",
" <td>10,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Everyone</td>\n",
" <td>Art & Design</td>\n",
" <td>January 7, 2018</td>\n",
" <td>1.0.0</td>\n",
" <td>4.0.3 and up</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Coloring book moana</td>\n",
" <td>ART_AND_DESIGN</td>\n",
" <td>3.9</td>\n",
" <td>967</td>\n",
" <td>14M</td>\n",
" <td>500,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Everyone</td>\n",
" <td>Art & Design;Pretend Play</td>\n",
" <td>January 15, 2018</td>\n",
" <td>2.0.0</td>\n",
" <td>4.0.3 and up</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>U Launcher Lite – FREE Live Cool Themes, Hide ...</td>\n",
" <td>ART_AND_DESIGN</td>\n",
" <td>4.7</td>\n",
" <td>87510</td>\n",
" <td>8.7M</td>\n",
" <td>5,000,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Everyone</td>\n",
" <td>Art & Design</td>\n",
" <td>August 1, 2018</td>\n",
" <td>1.2.4</td>\n",
" <td>4.0.3 and up</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Sketch - Draw & Paint</td>\n",
" <td>ART_AND_DESIGN</td>\n",
" <td>4.5</td>\n",
" <td>215644</td>\n",
" <td>25M</td>\n",
" <td>50,000,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Teen</td>\n",
" <td>Art & Design</td>\n",
" <td>June 8, 2018</td>\n",
" <td>Varies with device</td>\n",
" <td>4.2 and up</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Pixel Draw - Number Art Coloring Book</td>\n",
" <td>ART_AND_DESIGN</td>\n",
" <td>4.3</td>\n",
" <td>967</td>\n",
" <td>2.8M</td>\n",
" <td>100,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Everyone</td>\n",
" <td>Art & Design;Creativity</td>\n",
" <td>June 20, 2018</td>\n",
" <td>1.1</td>\n",
" <td>4.4 and up</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" App ... Android_Ver\n",
"0 Photo Editor & Candy Camera & Grid & ScrapBook ... 4.0.3 and up\n",
"1 Coloring book moana ... 4.0.3 and up\n",
"2 U Launcher Lite – FREE Live Cool Themes, Hide ... ... 4.0.3 and up\n",
"3 Sketch - Draw & Paint ... 4.2 and up\n",
"4 Pixel Draw - Number Art Coloring Book ... 4.4 and up\n",
"\n",
"[5 rows x 13 columns]"
]
},
"metadata": {
"tags": []
},
"execution_count": 5
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "HastMHr0vsx2",
"colab_type": "text"
},
"source": [
"Vou iniciar a análise verificando se há registos duplicados no Dataframe, pois não nos interessa analisar o mesmo aplicativo mais de uma vez."
]
},
{
"cell_type": "code",
"metadata": {
"id": "I3j3DLpwiztF",
"colab_type": "code",
"outputId": "239d1022-6952-400d-f2f2-522e7c38dc6f",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
}
},
"source": [
"# Verificando valores duplicados:\n",
"if any(df_app.App.duplicated()) is True:\n",
" print(f'Existe valores duplicados na coluna \"App\"? {True}')\n",
"else:\n",
" print(f'Existe valores duplicados na coluna \"App\"? {False}')"
],
"execution_count": 6,
"outputs": [
{
"output_type": "stream",
"text": [
"Existe valores duplicados na coluna \"App\"? True\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "TvXL33nRMUdO",
"colab_type": "text"
},
"source": [
"Bom, infelizmente temos registros duplicados, portanto, precisamos remover essas entradas duplicadas e manter apenas uma entrada por aplicativo. Uma coisa que poderíamos fazer é remover as linhas duplicadas aleatoriamente, mas vamos encontrar uma maneira melhor."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "J9aTYnOvwV87",
"colab_type": "text"
},
"source": [
"Quanto maior o número de \"Reviews\", mais recentes devem ser os dados. Em vez de remover duplicatas aleatoriamente, manteremos apenas a linha com o maior número de avaliações e removeremos as outras entradas."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "UiDVYGJ1NEyG",
"colab_type": "text"
},
"source": [
"Não sabemos a ordem dos registros e se não ordenarmos podemos correr o risco de eliminar um aplicativo que tem uma avaliação alta. Para ordenar pelo número de \"Reviews\" precisamos mudar seu tipo de dado para numérico. Quando tentei fazer a transformação recebi o seguinte erro **\"ValueError: invalid literal for int() with base 10: '3.0M'\"**.\n",
"Vamos identificar quais linhas têm esse problema:"
]
},
{
"cell_type": "code",
"metadata": {
"id": "iEejF9opJbZ-",
"colab_type": "code",
"outputId": "5c0d48b7-c82a-48e7-c5a3-b7c5dd10cdb2",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 80
}
},
"source": [
"# Identificando registro:\n",
"df_app[~df_app.Reviews.str.isnumeric()]"
],
"execution_count": 7,
"outputs": [
{
"output_type": "execute_result",
"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>App</th>\n",
" <th>Category</th>\n",
" <th>Rating</th>\n",
" <th>Reviews</th>\n",
" <th>Size</th>\n",
" <th>Installs</th>\n",
" <th>Type</th>\n",
" <th>Price</th>\n",
" <th>Content_Rating</th>\n",
" <th>Genres</th>\n",
" <th>Last_Updated</th>\n",
" <th>Current_Ver</th>\n",
" <th>Android_Ver</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>10472</th>\n",
" <td>Life Made WI-Fi Touchscreen Photo Frame</td>\n",
" <td>1.9</td>\n",
" <td>19.0</td>\n",
" <td>3.0M</td>\n",
" <td>1,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Everyone</td>\n",
" <td>NaN</td>\n",
" <td>February 11, 2018</td>\n",
" <td>1.0.19</td>\n",
" <td>4.0 and up</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" App Category ... Current_Ver Android_Ver\n",
"10472 Life Made WI-Fi Touchscreen Photo Frame 1.9 ... 4.0 and up NaN\n",
"\n",
"[1 rows x 13 columns]"
]
},
"metadata": {
"tags": []
},
"execution_count": 7
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "5QWuNw2lTbIX",
"colab_type": "text"
},
"source": [
"Apenas um dos registros possue esse problema além disso os registros das outras colunas estão inconsistentes, na coluna \"Category\" por exemplo essa linha possui um valor de 1.9, então vou remover essa linha e transformar o tipo do dado.\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "VROUWKDjJf8S",
"colab_type": "code",
"colab": {}
},
"source": [
"# Removendo o registro:\n",
"df_app.drop(df_app.index[10472], inplace=True)"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "YHFD6iEvJ-7k",
"colab_type": "code",
"colab": {}
},
"source": [
"# Convertendo o tipo dos dados:\n",
"df_app.Reviews = pd.to_numeric(df_app.Reviews)"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "ixwdFvTWVV0-",
"colab_type": "text"
},
"source": [
"Agora vou remover os valores duplicados mantendo os registros que tem a avaliação mais alta."
]
},
{
"cell_type": "code",
"metadata": {
"id": "eMDxULD4pbEe",
"colab_type": "code",
"colab": {}
},
"source": [
"# Removendo os aplicativos duplicados:\n",
"df_app = df_app.sort_values(by='Reviews', ascending=False).drop_duplicates('App', keep='first')\n",
"\n",
"# Reorganizando os indices:\n",
"df_app = df_app.reset_index(drop=True)"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "Psgq8OUQ2fC3",
"colab_type": "code",
"outputId": "552d38bd-b623-48f6-d0a1-e526fd4720ee",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 204
}
},
"source": [
"df_app.head()"
],
"execution_count": 11,
"outputs": [
{
"output_type": "execute_result",
"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>App</th>\n",
" <th>Category</th>\n",
" <th>Rating</th>\n",
" <th>Reviews</th>\n",
" <th>Size</th>\n",
" <th>Installs</th>\n",
" <th>Type</th>\n",
" <th>Price</th>\n",
" <th>Content_Rating</th>\n",
" <th>Genres</th>\n",
" <th>Last_Updated</th>\n",
" <th>Current_Ver</th>\n",
" <th>Android_Ver</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Facebook</td>\n",
" <td>SOCIAL</td>\n",
" <td>4.1</td>\n",
" <td>78158306</td>\n",
" <td>Varies with device</td>\n",
" <td>1,000,000,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Teen</td>\n",
" <td>Social</td>\n",
" <td>August 3, 2018</td>\n",
" <td>Varies with device</td>\n",
" <td>Varies with device</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>WhatsApp Messenger</td>\n",
" <td>COMMUNICATION</td>\n",
" <td>4.4</td>\n",
" <td>69119316</td>\n",
" <td>Varies with device</td>\n",
" <td>1,000,000,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Everyone</td>\n",
" <td>Communication</td>\n",
" <td>August 3, 2018</td>\n",
" <td>Varies with device</td>\n",
" <td>Varies with device</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Instagram</td>\n",
" <td>SOCIAL</td>\n",
" <td>4.5</td>\n",
" <td>66577446</td>\n",
" <td>Varies with device</td>\n",
" <td>1,000,000,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Teen</td>\n",
" <td>Social</td>\n",
" <td>July 31, 2018</td>\n",
" <td>Varies with device</td>\n",
" <td>Varies with device</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Messenger – Text and Video Chat for Free</td>\n",
" <td>COMMUNICATION</td>\n",
" <td>4.0</td>\n",
" <td>56646578</td>\n",
" <td>Varies with device</td>\n",
" <td>1,000,000,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Everyone</td>\n",
" <td>Communication</td>\n",
" <td>August 1, 2018</td>\n",
" <td>Varies with device</td>\n",
" <td>Varies with device</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Clash of Clans</td>\n",
" <td>GAME</td>\n",
" <td>4.6</td>\n",
" <td>44893888</td>\n",
" <td>98M</td>\n",
" <td>100,000,000+</td>\n",
" <td>Free</td>\n",
" <td>0</td>\n",
" <td>Everyone 10+</td>\n",
" <td>Strategy</td>\n",
" <td>July 15, 2018</td>\n",
" <td>10.322.16</td>\n",
" <td>4.1 and up</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" App ... Android_Ver\n",
"0 Facebook ... Varies with device\n",
"1 WhatsApp Messenger ... Varies with device\n",
"2 Instagram ... Varies with device\n",
"3 Messenger – Text and Video Chat for Free ... Varies with device\n",
"4 Clash of Clans ... 4.1 and up\n",
"\n",
"[5 rows x 13 columns]"
]
},
"metadata": {
"tags": []
},
"execution_count": 11
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "07hZDxIGYQPX",
"colab_type": "text"
},
"source": [
"Vamos analisar mais a fundo cada um dos atributos."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "RPjqfFgLbzK9",
"colab_type": "text"
},
"source": [
"##*Size*"
]
},
{
"cell_type": "code",
"metadata": {
"id": "sPbSVaAgdHK1",
"colab_type": "code",
"outputId": "bbafa95b-7cd7-4703-d0ed-f3394e717337",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 986
}
},
"source": [
"# Valores únicos:\n",
"display(df_app.Size.unique())"
],
"execution_count": 12,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"array(['Varies with device', '98M', '76M', '97M', '74M', '40M', '52M',\n",
" '14M', '15M', '88M', '24M', '85M', '94M', '99M', '63M', '92M',\n",
" '17M', '62M', '71M', '34M', '95M', '67M', '58M', '100M', '59M',\n",
" '53M', '96M', '16M', '26M', '41M', '9.9M', '51M', '32M', '11M',\n",
" '55M', '60M', '79M', '69M', '42M', '77M', '57M', '82M', '75M',\n",
" '36M', '3.3M', '68M', '22M', '7.6M', '50M', '33M', '7.4M', '89M',\n",
" '18M', '25M', '78M', '46M', '49M', '9.7M', '37M', '72M', '39M',\n",
" '87M', '6.1M', '5.1M', '70M', '28M', '29M', '61M', '7.1M', '48M',\n",
" '21M', '35M', '54M', '12M', '56M', '3.8M', '8.7M', '91M', '27M',\n",