You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're really exited that you're about to contribute to the [open curriculum](https://learn.co/content-license) on [Learn.co](https://learn.co). If this is your first time contributing, please continue reading to learn how to make the most meaningful and useful impact possible.
4
+
5
+
## Raising an Issue to Encourage a Contribution
6
+
7
+
If you notice a problem with the curriculum that you believe needs improvement
8
+
but you're unable to make the change yourself, you should raise a Github issue
9
+
containing a clear description of the problem. Include relevant snippets of
10
+
the content and/or screenshots if applicable. Curriculum owners regularly review
11
+
issue lists and your issue will be prioritized and addressed as appropriate.
12
+
13
+
## Submitting a Pull Request to Suggest an Improvement
14
+
15
+
If you see an opportunity for improvement and can make the change yourself go
16
+
ahead and use a typical git workflow to make it happen:
17
+
18
+
* Fork this curriculum repository
19
+
* Make the change on your fork, with descriptive commits in the standard format
20
+
* Open a Pull Request against this repo
21
+
22
+
A curriculum owner will review your change and approve or comment on it in due
23
+
course.
24
+
25
+
# Why Contribute?
26
+
27
+
Curriculum on Learn is publicly and freely available under Learn's
28
+
[Educational Content License](https://learn.co/content-license). By
29
+
embracing an open-source contribution model, our goal is for the curriculum
30
+
on Learn to become, in time, the best educational content the world has
31
+
ever seen.
32
+
33
+
We need help from the community of Learners to maintain and improve the
34
+
educational content. Everything from fixing typos, to correcting
35
+
out-dated information, to improving exposition, to adding better examples,
36
+
to fixing tests—all contributions to making the curriculum more effective are
Copy file name to clipboardexpand all lines: README.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
2
-
# Going further with dictionaries
2
+
# Going further with dictionaries
3
3
4
4
### Introduction
5
5
@@ -23,7 +23,7 @@ Now if we download this spreadsheet in the form of an .xlsx file we can start to
23
23
24
24
We've already placed that file into this lesson, and you can see it [here](https://github.com/learn-co-curriculum/excel-to-python), where the contents of this lesson are also located.
25
25
26
-
### From Local File to Python
26
+
### From Local File to Python
27
27
28
28
Now that we have this file in the folder we are working with, we can get this data into Python code in a few lines.
29
29
@@ -48,17 +48,17 @@ cities[0]
48
48
49
49
The code above relies on using an outside library called `pandas`, as it's good at reading excel files. A library is just a set of reusable functions. The `pandas` library is available for free online. We tell our current Jupyter notebook that we are about to use it with the line `import pandas`.
50
50
51
-
And that gives us an object, like a dictionary, which has a method on it called `read_excel`. Similar so how we can call `{'foo': 'bar'}.keys()`. That's the benefit of a library, we can get methods that do not come out of the box with Python. So we use the `read_excel` data to read our excel file, by providing the name of the file, `cities.xlsx`, and the preceding `./` just indicates that the file is found in the current folder. Finally with the line `travel_df.to_dict('records')` we return a list of our dictionaries representing our data. You can see that when we access the first element of this list, we it returns our first dictionary.
51
+
And that gives us an object, like a dictionary, which has a method on it called `read_excel`. Similar so how we can call `{'foo': 'bar'}.keys()`. That's the benefit of a library, we can get methods that do not come out of the box with Python. So we use the `read_excel` data to read our excel file, by providing the name of the file, `cities.xlsx`, and the preceding `./` just indicates that the file is found in the current folder. Finally with the line `travel_df.to_dict('records')` we return a list of our dictionaries representing our data. You can see that when we access the first element of this list, it returns our first dictionary.
52
52
53
53
Here is the code again, with some comments, if you are interested.
54
54
55
55
56
56
```python
57
-
# Here we use a library, which is some code not part of standard Python, to this process easier
57
+
# Here we use a library, which is some code not part of standard Python, to make this process easier
58
58
import pandas
59
-
# If we use the `import pandas` we have access to the pandas library
59
+
# If we use the `import pandas` we have access to the pandas library
60
60
travel_df = pandas.read_excel('./cities.xlsx')
61
-
# We call the pandas.read_excel method and pass through the string './cities.xlsx' as the file is called cities.xlsx. By saying './' we are saying
61
+
# We call the pandas.read_excel method and pass through the string './cities.xlsx' as the file is called cities.xlsx. By saying './' we are saying
62
62
# go to the current folder, lists-lab, and find the 'cities.xlsx' file there
63
63
cities = travel_df.to_dict('records')
64
64
```
@@ -199,7 +199,7 @@ Once again, we call the method, and then coerce it into a list, by using the `li
199
199
200
200
### Creating Dictionaries
201
201
202
-
So far, we have seen one way of creating dictionaries:
202
+
So far, we have seen one way of creating dictionaries:
Copy file name to clipboardexpand all lines: index.ipynb
+5-7
Original file line number
Diff line number
Diff line change
@@ -138,7 +138,7 @@
138
138
"source": [
139
139
"The code above relies on using an outside library called `pandas`, as it's good at reading excel files. A library is just a set of reusable functions. The `pandas` library is available for free online. We tell our current Jupyter notebook that we are about to use it with the line `import pandas`. \n",
140
140
"\n",
141
-
"And that gives us an object, like a dictionary, which has a method on it called `read_excel`. Similar so how we can call `{'foo': 'bar'}.keys()`. That's the benefit of a library, we can get methods that do not come out of the box with Python. So we use the `read_excel` data to read our excel file, by providing the name of the file, `cities.xlsx`, and the preceding `./` just indicates that the file is found in the current folder. Finally with the line `travel_df.to_dict('records')` we return a list of our dictionaries representing our data. You can see that when we access the first element of this list, we it returns our first dictionary. "
141
+
"And that gives us an object, like a dictionary, which has a method on it called `read_excel`. Similar so how we can call `{'foo': 'bar'}.keys()`. That's the benefit of a library, we can get methods that do not come out of the box with Python. So we use the `read_excel` data to read our excel file, by providing the name of the file, `cities.xlsx`, and the preceding `./` just indicates that the file is found in the current folder. Finally with the line `travel_df.to_dict('records')` we return a list of our dictionaries representing our data. You can see that when we access the first element of this list, it returns our first dictionary. "
142
142
]
143
143
},
144
144
{
@@ -150,13 +150,11 @@
150
150
},
151
151
{
152
152
"cell_type": "code",
153
-
"execution_count": 2,
154
-
"metadata": {
155
-
"collapsed": true
156
-
},
153
+
"execution_count": 1,
154
+
"metadata": {},
157
155
"outputs": [],
158
156
"source": [
159
-
"# Here we use a library, which is some code not part of standard Python, to this process easier \n",
157
+
"# Here we use a library, which is some code not part of standard Python, to make this process easier \n",
160
158
"import pandas\n",
161
159
"# If we use the `import pandas` we have access to the pandas library \n",
0 commit comments