import pandas as pd
import re
fandango_2015 = pd.read_csv('fandango_2015.csv')
fandango_2015.head(30)
Unnamed: 0 | FILM | Fandango_Stars | Fandango_Rating | Fandango_votes | Fandango_Difference | YEAR | movie_url | movie_budget | box_office | |
---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | Avengers: Age of Ultron (2015) | 5.0 | 4.5 | 14846 | 0.5 | 2015 | avengers__age_of_ultron_2015 | NaN | NaN |
1 | 1 | Cinderella (2015) | 5.0 | 4.5 | 12640 | 0.5 | 2015 | cinderella_2015 | $84.21-95 million[5][6] | $542.4 million[5] |
2 | 2 | Ant-Man (2015) | 5.0 | 4.5 | 12055 | 0.5 | 2015 | ant_man_2015 | $130–169.3 million[2][3][4] | $519.3 million[2] |
3 | 3 | Do You Believe? (2015) | 5.0 | 4.5 | 1793 | 0.5 | 2015 | do_you_believe__2015 | $2.3 million[2] | $14.4 million[3] |
4 | 4 | Hot Tub Time Machine 2 (2015) | 3.5 | 3.0 | 1021 | 0.5 | 2015 | hot_tub_time_machine_2_2015 | $14–18 million[4][5] | $13.1 million[4] |
5 | 5 | The Water Diviner (2015) | 4.5 | 4.0 | 397 | 0.5 | 2015 | the_water_diviner_2015 | $22.5 million[3] | $38.2 million[3] |
6 | 6 | Irrational Man (2015) | 4.0 | 3.5 | 252 | 0.5 | 2015 | irrational_man_2015 | $11 million[2] | $27.4 million[3] |
7 | 8 | Shaun the Sheep Movie (2015) | 4.5 | 4.0 | 896 | 0.5 | 2015 | shaun_the_sheep_movie_2015 | $25 million[6] | $106.2 million[7] |
8 | 9 | Love & Mercy (2015) | 4.5 | 4.0 | 864 | 0.5 | 2015 | love___mercy_2015 | $10 million[2] | $28.6 million[3] |
9 | 10 | Far From The Madding Crowd (2015) | 4.5 | 4.0 | 804 | 0.5 | 2015 | far_from_the_madding_crowd_2015 | £12 million[3] | $30.2 million[4] |
10 | 11 | Black Sea (2015) | 4.0 | 3.5 | 218 | 0.5 | 2015 | black_sea_2015 | NaN | NaN |
11 | 15 | Taken 3 (2015) | 4.5 | 4.1 | 6757 | 0.4 | 2015 | taken_3_2015 | $48 million[2] | $326.4 million[2] |
12 | 16 | Ted 2 (2015) | 4.5 | 4.1 | 6437 | 0.4 | 2015 | ted_2_2015 | $68 million[2][3][4] | $216.7 million[5] |
13 | 17 | Southpaw (2015) | 5.0 | 4.6 | 5597 | 0.4 | 2015 | southpaw_2015 | $30 million[3] | $94 million[4] |
14 | 19 | Pixels (2015) | 4.5 | 4.1 | 3886 | 0.4 | 2015 | pixels_2015 | $88–129 million[4][5] | $244.9 million[5] |
15 | 20 | McFarland, USA (2015) | 5.0 | 4.6 | 3364 | 0.4 | 2015 | mcfarland__usa_2015 | $17 million[1] | $45.7 million[2] |
16 | 21 | Insidious: Chapter 3 (2015) | 4.5 | 4.1 | 3276 | 0.4 | 2015 | insidious__chapter_3_2015 | $11 million[5] | $113 million[6] |
17 | 22 | The Man From U.N.C.L.E. (2015) | 4.5 | 4.1 | 2686 | 0.4 | 2015 | the_man_from_u_n_c_l_e__2015 | $75–84 million[2][3] | $107 million[4] |
18 | 23 | Run All Night (2015) | 4.5 | 4.1 | 2066 | 0.4 | 2015 | run_all_night_2015 | $50–61.6 million[2][3] | $71.6 million[3] |
19 | 24 | Trainwreck (2015) | 4.5 | 4.1 | 8381 | 0.4 | 2015 | trainwreck_2015 | $35 million[2] | $140.8 million[3] |
20 | 26 | Ex Machina (2015) | 4.5 | 4.1 | 3458 | 0.4 | 2015 | ex_machina_2015 | $15 million[4] | $36.9 million[5] |
21 | 27 | Still Alice (2015) | 4.5 | 4.1 | 1258 | 0.4 | 2015 | still_alice_2015 | $4 million | $44.8 million |
22 | 29 | The End of the Tour (2015) | 4.5 | 4.1 | 121 | 0.4 | 2015 | the_end_of_the_tour_2015 | NaN | $3 million[2] |
23 | 30 | Red Army (2015) | 4.5 | 4.1 | 54 | 0.4 | 2015 | red_army_2015 | NaN | NaN |
24 | 31 | When Marnie Was There (2015) | 4.5 | 4.1 | 46 | 0.4 | 2015 | when_marnie_was_there_2015 | ¥1.15 billion($10.5 million) | ¥3.85 billion($36 million) |
25 | 32 | The Hunting Ground (2015) | 4.5 | 4.1 | 42 | 0.4 | 2015 | the_hunting_ground_2015 | NaN | $405,917[1] |
26 | 33 | The Boy Next Door (2015) | 4.0 | 3.6 | 2800 | 0.4 | 2015 | the_boy_next_door_2015 | $4 million[3][4] | $52.4 million[4] |
27 | 34 | Aloha (2015) | 3.5 | 3.1 | 2284 | 0.4 | 2015 | aloha_2015 | $37–52 million[3][4] | $26.3 million[4] |
28 | 35 | The Loft (2015) | 4.0 | 3.6 | 811 | 0.4 | 2015 | the_loft_2015 | NaN | NaN |
29 | 36 | 5 Flights Up (2015) | 4.0 | 3.6 | 79 | 0.4 | 2015 | 5_flights_up_2015 | NaN | $2 million[2] |
# cleaning string
regex = r"\[\d+]+"
currency_regex = r"[$£¥]"
fandango_2015.movie_budget = fandango_2015.movie_budget.str.replace(regex, '', regex=True)\
.str.replace(currency_regex, '', regex=True).str.replace(r"[million|billion]", '', regex=True)
fandango_2015.head(30)
Unnamed: 0 | FILM | Fandango_Stars | Fandango_Rating | Fandango_votes | Fandango_Difference | YEAR | movie_url | movie_budget | box_office | |
---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | Avengers: Age of Ultron (2015) | 5.0 | 4.5 | 14846 | 0.5 | 2015 | avengers__age_of_ultron_2015 | NaN | NaN |
1 | 1 | Cinderella (2015) | 5.0 | 4.5 | 12640 | 0.5 | 2015 | cinderella_2015 | 84.21-95 | $542.4 million[5] |
2 | 2 | Ant-Man (2015) | 5.0 | 4.5 | 12055 | 0.5 | 2015 | ant_man_2015 | 130–169.3 | $519.3 million[2] |
3 | 3 | Do You Believe? (2015) | 5.0 | 4.5 | 1793 | 0.5 | 2015 | do_you_believe__2015 | 2.3 | $14.4 million[3] |
4 | 4 | Hot Tub Time Machine 2 (2015) | 3.5 | 3.0 | 1021 | 0.5 | 2015 | hot_tub_time_machine_2_2015 | 14–18 | $13.1 million[4] |
5 | 5 | The Water Diviner (2015) | 4.5 | 4.0 | 397 | 0.5 | 2015 | the_water_diviner_2015 | 22.5 | $38.2 million[3] |
6 | 6 | Irrational Man (2015) | 4.0 | 3.5 | 252 | 0.5 | 2015 | irrational_man_2015 | 11 | $27.4 million[3] |
7 | 8 | Shaun the Sheep Movie (2015) | 4.5 | 4.0 | 896 | 0.5 | 2015 | shaun_the_sheep_movie_2015 | 25 | $106.2 million[7] |
8 | 9 | Love & Mercy (2015) | 4.5 | 4.0 | 864 | 0.5 | 2015 | love___mercy_2015 | 10 | $28.6 million[3] |
9 | 10 | Far From The Madding Crowd (2015) | 4.5 | 4.0 | 804 | 0.5 | 2015 | far_from_the_madding_crowd_2015 | 12 | $30.2 million[4] |
10 | 11 | Black Sea (2015) | 4.0 | 3.5 | 218 | 0.5 | 2015 | black_sea_2015 | NaN | NaN |
11 | 15 | Taken 3 (2015) | 4.5 | 4.1 | 6757 | 0.4 | 2015 | taken_3_2015 | 48 | $326.4 million[2] |
12 | 16 | Ted 2 (2015) | 4.5 | 4.1 | 6437 | 0.4 | 2015 | ted_2_2015 | 68 | $216.7 million[5] |
13 | 17 | Southpaw (2015) | 5.0 | 4.6 | 5597 | 0.4 | 2015 | southpaw_2015 | 30 | $94 million[4] |
14 | 19 | Pixels (2015) | 4.5 | 4.1 | 3886 | 0.4 | 2015 | pixels_2015 | 88–129 | $244.9 million[5] |
15 | 20 | McFarland, USA (2015) | 5.0 | 4.6 | 3364 | 0.4 | 2015 | mcfarland__usa_2015 | 17 | $45.7 million[2] |
16 | 21 | Insidious: Chapter 3 (2015) | 4.5 | 4.1 | 3276 | 0.4 | 2015 | insidious__chapter_3_2015 | 11 | $113 million[6] |
17 | 22 | The Man From U.N.C.L.E. (2015) | 4.5 | 4.1 | 2686 | 0.4 | 2015 | the_man_from_u_n_c_l_e__2015 | 75–84 | $107 million[4] |
18 | 23 | Run All Night (2015) | 4.5 | 4.1 | 2066 | 0.4 | 2015 | run_all_night_2015 | 50–61.6 | $71.6 million[3] |
19 | 24 | Trainwreck (2015) | 4.5 | 4.1 | 8381 | 0.4 | 2015 | trainwreck_2015 | 35 | $140.8 million[3] |
20 | 26 | Ex Machina (2015) | 4.5 | 4.1 | 3458 | 0.4 | 2015 | ex_machina_2015 | 15 | $36.9 million[5] |
21 | 27 | Still Alice (2015) | 4.5 | 4.1 | 1258 | 0.4 | 2015 | still_alice_2015 | 4 | $44.8 million |
22 | 29 | The End of the Tour (2015) | 4.5 | 4.1 | 121 | 0.4 | 2015 | the_end_of_the_tour_2015 | NaN | $3 million[2] |
23 | 30 | Red Army (2015) | 4.5 | 4.1 | 54 | 0.4 | 2015 | red_army_2015 | NaN | NaN |
24 | 31 | When Marnie Was There (2015) | 4.5 | 4.1 | 46 | 0.4 | 2015 | when_marnie_was_there_2015 | 1.15 (10.5 ) | ¥3.85 billion($36 million) |
25 | 32 | The Hunting Ground (2015) | 4.5 | 4.1 | 42 | 0.4 | 2015 | the_hunting_ground_2015 | NaN | $405,917[1] |
26 | 33 | The Boy Next Door (2015) | 4.0 | 3.6 | 2800 | 0.4 | 2015 | the_boy_next_door_2015 | 4 | $52.4 million[4] |
27 | 34 | Aloha (2015) | 3.5 | 3.1 | 2284 | 0.4 | 2015 | aloha_2015 | 37–52 | $26.3 million[4] |
28 | 35 | The Loft (2015) | 4.0 | 3.6 | 811 | 0.4 | 2015 | the_loft_2015 | NaN | NaN |
29 | 36 | 5 Flights Up (2015) | 4.0 | 3.6 | 79 | 0.4 | 2015 | 5_flights_up_2015 | NaN | $2 million[2] |
Still got some problems for the movie "When Marnie was there".
marnie_regex = r"\d.+\s\("
fandango_2015.movie_budget = fandango_2015.movie_budget.str.replace(marnie_regex, '', regex=True)
fandango_2015.head(30)
Unnamed: 0 | FILM | Fandango_Stars | Fandango_Rating | Fandango_votes | Fandango_Difference | YEAR | movie_url | movie_budget | box_office | |
---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | Avengers: Age of Ultron (2015) | 5.0 | 4.5 | 14846 | 0.5 | 2015 | avengers__age_of_ultron_2015 | NaN | NaN |
1 | 1 | Cinderella (2015) | 5.0 | 4.5 | 12640 | 0.5 | 2015 | cinderella_2015 | 84.21-95 | $542.4 million[5] |
2 | 2 | Ant-Man (2015) | 5.0 | 4.5 | 12055 | 0.5 | 2015 | ant_man_2015 | 130–169.3 | $519.3 million[2] |
3 | 3 | Do You Believe? (2015) | 5.0 | 4.5 | 1793 | 0.5 | 2015 | do_you_believe__2015 | 2.3 | $14.4 million[3] |
4 | 4 | Hot Tub Time Machine 2 (2015) | 3.5 | 3.0 | 1021 | 0.5 | 2015 | hot_tub_time_machine_2_2015 | 14–18 | $13.1 million[4] |
5 | 5 | The Water Diviner (2015) | 4.5 | 4.0 | 397 | 0.5 | 2015 | the_water_diviner_2015 | 22.5 | $38.2 million[3] |
6 | 6 | Irrational Man (2015) | 4.0 | 3.5 | 252 | 0.5 | 2015 | irrational_man_2015 | 11 | $27.4 million[3] |
7 | 8 | Shaun the Sheep Movie (2015) | 4.5 | 4.0 | 896 | 0.5 | 2015 | shaun_the_sheep_movie_2015 | 25 | $106.2 million[7] |
8 | 9 | Love & Mercy (2015) | 4.5 | 4.0 | 864 | 0.5 | 2015 | love___mercy_2015 | 10 | $28.6 million[3] |
9 | 10 | Far From The Madding Crowd (2015) | 4.5 | 4.0 | 804 | 0.5 | 2015 | far_from_the_madding_crowd_2015 | 12 | $30.2 million[4] |
10 | 11 | Black Sea (2015) | 4.0 | 3.5 | 218 | 0.5 | 2015 | black_sea_2015 | NaN | NaN |
11 | 15 | Taken 3 (2015) | 4.5 | 4.1 | 6757 | 0.4 | 2015 | taken_3_2015 | 48 | $326.4 million[2] |
12 | 16 | Ted 2 (2015) | 4.5 | 4.1 | 6437 | 0.4 | 2015 | ted_2_2015 | 68 | $216.7 million[5] |
13 | 17 | Southpaw (2015) | 5.0 | 4.6 | 5597 | 0.4 | 2015 | southpaw_2015 | 30 | $94 million[4] |
14 | 19 | Pixels (2015) | 4.5 | 4.1 | 3886 | 0.4 | 2015 | pixels_2015 | 88–129 | $244.9 million[5] |
15 | 20 | McFarland, USA (2015) | 5.0 | 4.6 | 3364 | 0.4 | 2015 | mcfarland__usa_2015 | 17 | $45.7 million[2] |
16 | 21 | Insidious: Chapter 3 (2015) | 4.5 | 4.1 | 3276 | 0.4 | 2015 | insidious__chapter_3_2015 | 11 | $113 million[6] |
17 | 22 | The Man From U.N.C.L.E. (2015) | 4.5 | 4.1 | 2686 | 0.4 | 2015 | the_man_from_u_n_c_l_e__2015 | 75–84 | $107 million[4] |
18 | 23 | Run All Night (2015) | 4.5 | 4.1 | 2066 | 0.4 | 2015 | run_all_night_2015 | 50–61.6 | $71.6 million[3] |
19 | 24 | Trainwreck (2015) | 4.5 | 4.1 | 8381 | 0.4 | 2015 | trainwreck_2015 | 35 | $140.8 million[3] |
20 | 26 | Ex Machina (2015) | 4.5 | 4.1 | 3458 | 0.4 | 2015 | ex_machina_2015 | 15 | $36.9 million[5] |
21 | 27 | Still Alice (2015) | 4.5 | 4.1 | 1258 | 0.4 | 2015 | still_alice_2015 | 4 | $44.8 million |
22 | 29 | The End of the Tour (2015) | 4.5 | 4.1 | 121 | 0.4 | 2015 | the_end_of_the_tour_2015 | NaN | $3 million[2] |
23 | 30 | Red Army (2015) | 4.5 | 4.1 | 54 | 0.4 | 2015 | red_army_2015 | NaN | NaN |
24 | 31 | When Marnie Was There (2015) | 4.5 | 4.1 | 46 | 0.4 | 2015 | when_marnie_was_there_2015 | 10.5 ) | ¥3.85 billion($36 million) |
25 | 32 | The Hunting Ground (2015) | 4.5 | 4.1 | 42 | 0.4 | 2015 | the_hunting_ground_2015 | NaN | $405,917[1] |
26 | 33 | The Boy Next Door (2015) | 4.0 | 3.6 | 2800 | 0.4 | 2015 | the_boy_next_door_2015 | 4 | $52.4 million[4] |
27 | 34 | Aloha (2015) | 3.5 | 3.1 | 2284 | 0.4 | 2015 | aloha_2015 | 37–52 | $26.3 million[4] |
28 | 35 | The Loft (2015) | 4.0 | 3.6 | 811 | 0.4 | 2015 | the_loft_2015 | NaN | NaN |
29 | 36 | 5 Flights Up (2015) | 4.0 | 3.6 | 79 | 0.4 | 2015 | 5_flights_up_2015 | NaN | $2 million[2] |
marnie_regex = r"\s\)"
fandango_2015.movie_budget = fandango_2015.movie_budget.str.replace(marnie_regex, '', regex=True)
fandango_2015.head(30)
Unnamed: 0 | FILM | Fandango_Stars | Fandango_Rating | Fandango_votes | Fandango_Difference | YEAR | movie_url | movie_budget | box_office | |
---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | Avengers: Age of Ultron (2015) | 5.0 | 4.5 | 14846 | 0.5 | 2015 | avengers__age_of_ultron_2015 | NaN | NaN |
1 | 1 | Cinderella (2015) | 5.0 | 4.5 | 12640 | 0.5 | 2015 | cinderella_2015 | 84.21-95 | $542.4 million[5] |
2 | 2 | Ant-Man (2015) | 5.0 | 4.5 | 12055 | 0.5 | 2015 | ant_man_2015 | 130–169.3 | $519.3 million[2] |
3 | 3 | Do You Believe? (2015) | 5.0 | 4.5 | 1793 | 0.5 | 2015 | do_you_believe__2015 | 2.3 | $14.4 million[3] |
4 | 4 | Hot Tub Time Machine 2 (2015) | 3.5 | 3.0 | 1021 | 0.5 | 2015 | hot_tub_time_machine_2_2015 | 14–18 | $13.1 million[4] |
5 | 5 | The Water Diviner (2015) | 4.5 | 4.0 | 397 | 0.5 | 2015 | the_water_diviner_2015 | 22.5 | $38.2 million[3] |
6 | 6 | Irrational Man (2015) | 4.0 | 3.5 | 252 | 0.5 | 2015 | irrational_man_2015 | 11 | $27.4 million[3] |
7 | 8 | Shaun the Sheep Movie (2015) | 4.5 | 4.0 | 896 | 0.5 | 2015 | shaun_the_sheep_movie_2015 | 25 | $106.2 million[7] |
8 | 9 | Love & Mercy (2015) | 4.5 | 4.0 | 864 | 0.5 | 2015 | love___mercy_2015 | 10 | $28.6 million[3] |
9 | 10 | Far From The Madding Crowd (2015) | 4.5 | 4.0 | 804 | 0.5 | 2015 | far_from_the_madding_crowd_2015 | 12 | $30.2 million[4] |
10 | 11 | Black Sea (2015) | 4.0 | 3.5 | 218 | 0.5 | 2015 | black_sea_2015 | NaN | NaN |
11 | 15 | Taken 3 (2015) | 4.5 | 4.1 | 6757 | 0.4 | 2015 | taken_3_2015 | 48 | $326.4 million[2] |
12 | 16 | Ted 2 (2015) | 4.5 | 4.1 | 6437 | 0.4 | 2015 | ted_2_2015 | 68 | $216.7 million[5] |
13 | 17 | Southpaw (2015) | 5.0 | 4.6 | 5597 | 0.4 | 2015 | southpaw_2015 | 30 | $94 million[4] |
14 | 19 | Pixels (2015) | 4.5 | 4.1 | 3886 | 0.4 | 2015 | pixels_2015 | 88–129 | $244.9 million[5] |
15 | 20 | McFarland, USA (2015) | 5.0 | 4.6 | 3364 | 0.4 | 2015 | mcfarland__usa_2015 | 17 | $45.7 million[2] |
16 | 21 | Insidious: Chapter 3 (2015) | 4.5 | 4.1 | 3276 | 0.4 | 2015 | insidious__chapter_3_2015 | 11 | $113 million[6] |
17 | 22 | The Man From U.N.C.L.E. (2015) | 4.5 | 4.1 | 2686 | 0.4 | 2015 | the_man_from_u_n_c_l_e__2015 | 75–84 | $107 million[4] |
18 | 23 | Run All Night (2015) | 4.5 | 4.1 | 2066 | 0.4 | 2015 | run_all_night_2015 | 50–61.6 | $71.6 million[3] |
19 | 24 | Trainwreck (2015) | 4.5 | 4.1 | 8381 | 0.4 | 2015 | trainwreck_2015 | 35 | $140.8 million[3] |
20 | 26 | Ex Machina (2015) | 4.5 | 4.1 | 3458 | 0.4 | 2015 | ex_machina_2015 | 15 | $36.9 million[5] |
21 | 27 | Still Alice (2015) | 4.5 | 4.1 | 1258 | 0.4 | 2015 | still_alice_2015 | 4 | $44.8 million |
22 | 29 | The End of the Tour (2015) | 4.5 | 4.1 | 121 | 0.4 | 2015 | the_end_of_the_tour_2015 | NaN | $3 million[2] |
23 | 30 | Red Army (2015) | 4.5 | 4.1 | 54 | 0.4 | 2015 | red_army_2015 | NaN | NaN |
24 | 31 | When Marnie Was There (2015) | 4.5 | 4.1 | 46 | 0.4 | 2015 | when_marnie_was_there_2015 | 10.5 | ¥3.85 billion($36 million) |
25 | 32 | The Hunting Ground (2015) | 4.5 | 4.1 | 42 | 0.4 | 2015 | the_hunting_ground_2015 | NaN | $405,917[1] |
26 | 33 | The Boy Next Door (2015) | 4.0 | 3.6 | 2800 | 0.4 | 2015 | the_boy_next_door_2015 | 4 | $52.4 million[4] |
27 | 34 | Aloha (2015) | 3.5 | 3.1 | 2284 | 0.4 | 2015 | aloha_2015 | 37–52 | $26.3 million[4] |
28 | 35 | The Loft (2015) | 4.0 | 3.6 | 811 | 0.4 | 2015 | the_loft_2015 | NaN | NaN |
29 | 36 | 5 Flights Up (2015) | 4.0 | 3.6 | 79 | 0.4 | 2015 | 5_flights_up_2015 | NaN | $2 million[2] |
def clean_test(s):
if re.search('–', s):
splitted = s.split('–')
print(splitted)
else:
splitted = s.split('-')
print(splitted)
clean_test('37–52')
clean_test('84.21-95')
['37', '52'] ['84.21', '95']
def budget_neat(df):
budget = df['movie_budget']
if budget is not None:
#splitting the budget with more than 1 value
stripped = budget.strip()
#need this if statement cause some '-' are differntly encoded
if re.search('–', stripped):
splitted = stripped.split('–')
#converting values into float
floated = [float(i) for i in splitted]
#calculating the mean
mean_value = sum(floated) / len(floated)
return mean_value
else:
splitted = budget.split('-')
floated = [float(i) for i in splitted]
#calculating the mean
mean_value = sum(floated) / len(floated)
return mean_value
else:
return None
fandango_2015.movie_budget = fandango_2015.apply(budget_neat, axis=1)
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-24-191534a60a6e> in <module> ----> 1 fandango_2015.movie_budget = fandango_2015.apply(budget_neat, axis=1) ~\anaconda3\lib\site-packages\pandas\core\frame.py in apply(self, func, axis, raw, result_type, args, **kwds) 7546 kwds=kwds, 7547 ) -> 7548 return op.get_result() 7549 7550 def applymap(self, func) -> "DataFrame": ~\anaconda3\lib\site-packages\pandas\core\apply.py in get_result(self) 178 return self.apply_raw() 179 --> 180 return self.apply_standard() 181 182 def apply_empty_result(self): ~\anaconda3\lib\site-packages\pandas\core\apply.py in apply_standard(self) 269 270 def apply_standard(self): --> 271 results, res_index = self.apply_series_generator() 272 273 # wrap results ~\anaconda3\lib\site-packages\pandas\core\apply.py in apply_series_generator(self) 298 for i, v in enumerate(series_gen): 299 # ignore SettingWithCopy here in case the user mutates --> 300 results[i] = self.f(v) 301 if isinstance(results[i], ABCSeries): 302 # If we have a view on v, we need to make a copy because <ipython-input-23-654445db3aed> in budget_neat(df) 3 if budget is not None: 4 #splitting the budget with more than 1 value ----> 5 stripped = budget.strip() 6 #need this if statement cause some '-' are differntly encoded 7 if re.search('–', stripped): AttributeError: 'float' object has no attribute 'strip'
fandango_2015.movie_budget
0 NaN 1 84.21-95 2 130–169.3 3 2.3 4 14–18 ... 124 175 125 10 126 8.1 127 NaN 128 NaN Name: movie_budget, Length: 129, dtype: object