Closed shawnwiggins closed 1 year ago
Hi Shawn:
Thank you for this very useful message. Best,
Bin
From: Shawn Wiggins @.> Sent: Monday, September 18, 2023 5:26 PM To: ccsf-math-108/materials-fa23 @.> Cc: Bin Shao @.>; Team mention @.> Subject: [ccsf-math-108/materials-fa23] Lab 04 Task 07 (Issue #5)
Issue - Now Fixed
The date data in corporate_contributions is in string format. This was causing an issue with the visualization for Task 07 where the dates are organized incorrectly.
Solution
The following code has been added to the cell above Task 03 to convert the strings to datetime format, so the data will be interpreted as dates:
from datetime import datetime input_format = "%m/%d/%Y" dates = corporate_contributions.column('Date') dates = [datetime.strptime(date_string, input_format) for date_string in dates] corporate_contributions = corporate_contributions.with_column('Date', dates)
Students are not responsible for this code and for understanding the details of the datetime data type.
Originally the visualization in Task 07 was guiding students to use iplot, but with the following customization, a decent graph can be produced with the updated date data and the plot method:
plt.title('Contributions Over Time') plt.gcf().set_size_inches(15, 5) plt.xticks(rotation=45) plt.show()
Note to @ccsf-math-108/staffhttps://github.com/orgs/ccsf-math-108/teams/staff and @ccsf-math-108/berkeley-ambassadorshttps://github.com/orgs/ccsf-math-108/teams/berkeley-ambassadors
— Reply to this email directly, view it on GitHubhttps://github.com/ccsf-math-108/materials-fa23/issues/5, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A5SD3SJVC72YCYXK5LAPEKTX3DRFHANCNFSM6AAAAAA45PLIIA. You are receiving this because you are on a team that was mentioned.Message ID: @.***>
Issue - Now Fixed
The date data in
corporate_contributions
is in string format. This was causing an issue with the visualization for Task 07 where the dates are organized incorrectly.Solution
The following code has been added to the cell above Task 03 to convert the strings to
datetime
format, so the data will be interpreted as dates:Students are not responsible for this code and for understanding the details of the
datetime
data type.Originally the visualization in Task 07 was guiding students to use
iplot
, but with the following customization, a decent graph can be produced with the updated date data and theplot
method:Note to @ccsf-math-108/staff and @ccsf-math-108/berkeley-ambassadors