-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bus cost refactor #1161
Merged
Merged
Bus cost refactor #1161
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
258d87d
add refactor concepts, notes
50b56d7
started NB for all refactor work
csuyat-dot 0326a43
renamed old NBs to seperate from current work
csuyat-dot da829dd
started new bus_cost_utils.py to start dropping in shared functions. …
csuyat-dot de61eae
testing new function to flag if cpb is outlier
csuyat-dot 16fc0df
comparing outliers in new and old DFs
csuyat-dot f6a8867
improved cpb aggregate function
csuyat-dot 359e707
tested new cpb_aggregate function against old version. bus count, tot…
csuyat-dot 0b239b9
testng new ways to reduce variables in favor of pivot tables
csuyat-dot 82d6181
comparing pivot tables against new cpb agg function. updated input an…
csuyat-dot 173694d
ran updated scripts, everything exported to gcs with no errors. new m…
csuyat-dot cd2c247
made sure charts and graphs are still workinh. started work on trimmi…
csuyat-dot 519b07b
more changes
csuyat-dot 1887b14
switching the weighted average caclulation for average cost per bus a…
csuyat-dot 7312850
more organization
csuyat-dot 877d41f
started writing conclusion. created new function to min/max values of…
csuyat-dot 8ece2d7
consolidated some of the summary cells down to 1 cell per section
csuyat-dot 167d356
small edits
csuyat-dot dc485c4
more organizing of cells and creating headings for better navigation
csuyat-dot b9bc6c1
turned zeb projects list to a variable, updated all the proceeding va…
csuyat-dot 8b58b8e
added bus size chart that excluded the not-specified responses
csuyat-dot 2ea2948
final changes before overwriting initial scripts
csuyat-dot 9ba8be8
overwrote fta cleaner script. double checked and ensured script is go…
csuyat-dot 5786212
overwrote TIRCP cleaner script. ran with no errors, files saving to G…
csuyat-dot d0b4691
overwrote dgs cleaner script. ran with no errors. wrote to GCS. GTG
csuyat-dot b44a240
added min max summary and outlier flag to utils file. cpb cleaner scr…
csuyat-dot 50fa908
started to copy over cells, functions, variables and tables to the fi…
csuyat-dot c2cedd7
minor bug fixed for markdown to work in final nb
csuyat-dot 2a4120e
moved charts over to final NB
csuyat-dot 7be2f2c
moved min max function to NB. reorganized the charts and disabled the…
csuyat-dot d021015
updating Makefile with additional commands, was able to run makefile …
csuyat-dot 13ac4ac
full run of Makefile. analysis nb now shows mainly ZEB metrics
csuyat-dot a433c2c
updated output file name for TIRCP cleaner to be consistent with othe…
csuyat-dot 492cbc1
update readme
csuyat-dot 95787fb
removed old, initial exploratory notebooks
csuyat-dot 8322540
left notes on refacor_notes
csuyat-dot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
moved min max function to NB. reorganized the charts and disabled the…
… overall charts
- Loading branch information
commit 7be2f2c8ecfab26131d088b6f9e39b4d2b0491de
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In your notebook:
df_agg["new_is_cpb_outlier"] = outlier_flag(df_agg, "new_zscore_cost_per_bus")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
.apply
takes a lambda function, which operates on a row. There are 2 ways to write it, and this all depends on what you need to access in the row. If you have just 1 column (z-score), you can write it either way. If you need to access 2 column values, you will have to write it likedf.apply(lambda x: some condition, axis=1)
Here, we want to access 2 columns in the lambda condition (
state
andtemperature
)Ex:
df.apply(lambda x: 1 if ( (x.state == "CA" ) and (x.temperature < 80) ) else 0, axis=1)
The difference in syntax is that you place the
.apply
in a different place, and there's also theaxis=1 (operate on row)
that's present.