GOAL
Introduce methods of organizing data and using graphs to draw meaningful correlations from the data
Basic Scientific Computing for Research Projects
DJ - Maybe this can be the Potential Outline
Feel free to use or delete any slides after here… ;-)
3
PART 1
Data Sets
Data Sets
Common Data Set formats:
Public Datasets
�
5
JSON Files
5
JSON = JavaScript Object Notation
JSON files are very popular for storing and transmitting data between applications.
So what makes a JSON file? key:value pairs!
When we refer to JSON files, we are really just referring to files that follow a set of guidelines for representing data!
JSON files behave very similar to dictionaries & are great to work with once you’re familiar with them!
6
CSV Files
6
CSV stands for Comma Separated Values.
As you may have guessed, CSV files contain a series of items, each of which is separated by commas (see image on left).
CSV files are another way to format data within a file so that it is organized and easy to work with.
CSV files are plain-text files – i.e. they don’t preserve any formatting. This makes them easy to create and easy to upload into other tools like spreadsheets.
While CSV files are straightforward and consume less memory than JSON files, they do not support the same scalability and versatility and they cannot nest data.
x | y1 | y2 | y3 |
1.96 | 3.90 | 4.76 | 5.48 |
3.28 | 4.87 | 5.22 | 6.39 |
4.15 | 5.83 | 6.26 | 7.25 |
4.92 | 7.08 | 7.24 | 8.33 |
6.31 | 7.55 | 8.86 | 9.09 |
6.89 | 8.10 | 8.94 | 10.10 |
8.03 | 8.88 | 9.34 | 11.17 |
7
Parsing JSON
7
After you open a JSON file you have to be able to extract information from it
This is known as parsing!
To do so, here are the general rules you should follow:
How to Parse JSON |
Add import json at the top of your program. |
Open the file using with open(), then use json.load() to get the file into a readable format for your program. |
Extract the data using similar properties to those we used for dictionaries |
8
PART 2
Helpful Built-In Functions
9
Operation | Definition | Syntax | Example |
.upper() | The .upper() method returns a copy of the original string with all lowercase letters converted to uppercase. It does not modify the original string (strings in Python are immutable). | string.upper() | |
.lower() | The .lower() method returns a copy of the original string with all uppercase letters converted to lowercase. Like .upper(), it does not modify the original string. | string.lower() | |
(output)
(output)
10
Operation | Definition | Syntax | Example |
.split() | The .split() method splits a string into a list where each word is a list item. You can specify the separator, otherwise, it will split on any whitespace (space, newline, tab, etc.). | string.split() | |
.strip() | The .strip() method removes any leading (spaces at the beginning) and trailing (spaces at the end) characters (space is the default). | string.strip() | |
(output) ^
(output) ^
Using the type() function
11
CODE
OUTPUT
12
Let’s Code
Loading Datasets (JSON & CSV)
Now it's Your Turn!
14
Now it is your turn to come up with an example using the skills you have learned from this module!
This is pretty open ended! Think about your favorite movie, tv show, book, mathematical formula, or maybe video game. Use the tools you have used to draw a conclusion within a certain theme.
Create an example using all the following skills:
Types Of Graphs
Graph Customizations
Adding more parameters leads to other customizations. Below are some parameters you can use for customizing graphs.
17
Tools you have Learned
Tools You Have Learned
18
Thank you!
Any text here?