Home > Learning, Lesson, Problem, Projects/Experiments, Python > Python: Pandas Lesson 7

Python: Pandas Lesson 7

Learning : Create simple zoo application P1
Subject: The Menu and functions names

Althought we mostly using pandas in reading datafile and analysing it, Here we are thinking as if we have an interface for an application, and we are offering some menu and function to the user so he can use the apps.
As we went throught learnning pandas and from all past lessons we saw alot’s of functions and commands that are enuph to start developing a small application to manage our zoo data. Starting from this post we will bulid parts of our application, so lets start.

The Menu The menu is the way or the tool that will help the user to perform deffernt action on the data. Here is the function of the the_menu and it will return the user selection.

Althought we mostly using pandas in reading datafile and analysing it, but Here we are think as if we have an interface of application, and the we are offering a menu to the user were he can select a function user will

The Menu

def the_menu ():

print(‘\n ::—–{ The menu }—-::’)

print(‘1. Load New csv File’)

print(‘2. Show Sample Data’)

print(‘3. Show Columns’)

print(‘4. Data Type’)

print(‘5. Sort.’)

print(‘6. Missing Data’)

print(‘7. Add New Record.’)

print(‘8. Edit a record.’)

print(‘9. Delete a Record.’)

print(’10. Save the File.’)

return (input(‘\n Enter your selection: ‘))

# calling the menu.

def the_menu(): The code above will print our menu on the screen and asking the user to select the action and return a number of the menu. From there we will run other functions, we may change or add to the menu if we need to.

First I will define each menu-line to have an overall view of the functionality in the app:
1. Load New csv File: We will ask the user to write the file name he want to upload, and we will assume that the file is in the same directory and if the file not exist we will create one.
2. Show Sample Data: Print out sample data from the dataframe using df.sampl().
3. Show Columns: List all the columns in the dataframe.
4. Data Type: Show the data Type of each column.
5. Sort: The user will select the sorting column.
6. Missing Data: This command will give the user a report of how many data are available in the columns and if there is any missing data.
7. Add New Record: Adding new row to the data file.
8. Edit a record: Editing a row.
9. Delete a Record: Deleting a row from the data file.
10. Save the File To save the file, and we will save it under new name.

Whats in the next lesson:
:: Writing the menu selection loops.
:: Writing the first two functions in the application.

:: Pandas Lessons Post ::

Lesson 1 Lesson 2 Lesson 3 Lesson 4
Lesson 5 Lesson 6 Lesson 7 Lesson 8
Lesson 9 Lesson 10 Lesson 11 Lesson 12

Follow me on Twitter..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s