Guidance project 1 function understanding

Screen Link:

My Code:

# Project 1

The project is about analyzing the revenue of apps developped by the company. The company makes app and put them in app stores. Users are free to download at no cost. Revenue is obtained through ad sales. The more people interact with the ads, the more revenue for the company. Clearly the more people download the apps the better, but we also want to find out which apps are mosre likely to garner more interaction from users.

def explore_data(dataset, start, end, rows_and_columns=False):
    dataset_slice = dataset[start:end]    
    for row in dataset_slice:
        print('\n') # adds a new (empty) line after each row

    if rows_and_columns:
        print('Number of rows:', len(dataset))
        print('Number of columns:', len(dataset[0]))

file1=open("AppleStore.csv", encoding="utf8")
file2=open("googleplaystore.csv", encoding="utf8")
from csv import reader
read_file1= reader(file1)
apple_data= list(read_file1)
read_file2= reader(file2)
android_data= list(read_file2)
apple_header= apple_data[0]

explore_data(apple_data, 1, 3,rows_and_columns=True)
explore_data(android_data ,1, 3, rows_and_columns=True)


Here is the [LINK]( for the documentation of the data set about the Apple play store *iOS*

*will add the other link later*

- From a first glence of apple data we see that App,Category',Rating',Reviews',Size',Installs',Type',Price',Content Rating',Genres',Last Updated',Current Ver', Android Ver are all important in the android app category.

What I expected to happen:

I expected to get to apple data as well. It only shows android data although I asked for both. Why might this be?

What actually happened:

Replace this line with the output/error


Please use print function here like

print(explore_data(apple_data, 1, 3,rows_and_columns=True))
print() #it will print a new line
print(explore_data(android_data, 1, 3,rows_and_columns=True))

And you can remove the rest of the code.


When you are calling explore_data() function, you are not storing your data in any variable, so it is giving you the only output from its last call since it uses temporary memory.

In jupyter notebook, you can call the function on two separate cell too without print function.


1 Like