This file contains hidden or 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
def dp(dist_mat): | |
""" | |
Find minimum-cost path through matrix `dist_mat` using dynamic programming. | |
The cost of a path is defined as the sum of the matrix entries on that | |
path. See the following for details of the algorithm: | |
- http://en.wikipedia.org/wiki/Dynamic_time_warping | |
- https://www.ee.columbia.edu/~dpwe/resources/matlab/dtw/dp.m |
This file contains hidden or 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
#Source Aurelion Geron https://colab.research.google.com/github/ageron/handson-ml3/blob/main/14_deep_computer_vision_with_cnns.ipynb#scrollTo=jisXP9jfpKz2 | |
import numpy as np | |
def conv_output_size(input_size, kernel_size, strides=1, padding="valid"): | |
if padding=="valid": | |
z = input_size - kernel_size + strides | |
output_size = z // strides | |
num_ignored = z % strides | |
return output_size, num_ignored | |
else: |
This file contains hidden or 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
#Credit : https://brittarude.github.io/blog/2021/08/01/Location-and-geo-information-in-twitter | |
new_search = "EdTech -filter:retweets" | |
tweets = tweepy.Cursor(api.search_tweets, | |
q=new_search, | |
place_country="DE", | |
lang="de", | |
since='2020-07-14').items(100) | |
users_locs = [[tweet.text, tweet.user.location, tweet.place] for tweet in tweets] |
This file contains hidden or 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
let | |
Source = Odbc.DataSource("dsn=CData SugarCRM Sys", [HierarchicalNavigation=true]), | |
CData_Database = Source{[Name="CData",Kind="Database"]}[Data], | |
SugarCRM_Schema = CData_Database{[Name="SugarCRM",Kind="Schema"]}[Data], | |
Accounts_Table = SugarCRM_Schema{[Name="Accounts",Kind="Table"]}[Data], | |
table_to_work_with = Table.SelectColumns(Accounts_Table,{"Id", "Tag"}), | |
tags_table = Table.TransformColumnTypes(table_to_work_with,{{"Tag", type text}}), | |
split_by_colon = Table.SplitColumn(tags_table, "Tag", Splitter.SplitTextByDelimiter(":", QuoteStyle.Csv), {"Tag.1", "Tag.2", "Tag.3", "Tag.4", "Tag.5", "Tag.6", "Tag.7", "Tag.8", "Tag.9", "Tag.10", "Tag.11", "Tag.12", "Tag.13", "Tag.14", "Tag.15", "Tag.16", "Tag.17"}), | |
tag_cols = List.Range (Table.ColumnNames(split_by_colon) , 2), |
This file contains hidden or 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
= Table.TransformColumnTypes (reset_header, List.Transform (transform_cols_list, each {_, type text})) | |
= List.Select(transform_cols_list, each Text.StartsWith (_, "Federal")) |
This file contains hidden or 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
Create two cells with names FilePath and FileName in Excel | |
FilePath cell has formula : G:\My Drive\BBSI\Round 2 PDFs\ | |
FileName Cell has formula : =MID(CELL("filename",A2),FIND("[",CELL("filename",A2))+1,FIND("]", CELL("filename",A2))-FIND("[",CELL("filename",A2))-1) | |
Create a function name function_get_current_file in Power Query: | |
function_get_current_file | |
()=> | |
let | |
current_dir = Excel.CurrentWorkbook(){[Name="FilePath"]}[Content]{0}[Column1], |
This file contains hidden or 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
get_curr_cols = Table.ColumnNames (set_section_headers), | |
get_null_cols = List.Generate( | |
() => [counter = 0, x = get_curr_cols, result="False"] , | |
each [counter] < List.Count([x]), | |
each [counter=[counter]+1 , | |
x= get_curr_cols, | |
result= if List.NonNullCount(Table.Column(set_section_headers, [x]{counter})) <= 0 then "True" else "False" | |
], | |
each [result] ), |
This file contains hidden or 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
= group_by_employee{[Column1 = "Lastname, FirstName" ]}[merge_employee] | |
//Here group_by_employee is the last step of a query and so it is a table containing a column of employee names. The next column mer_employee | |
contains a Table of all data for that employee |
This file contains hidden or 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
let | |
Source = Pdf.Tables(File.Contents("G:\My Drive\BBSI\Paychex 2022-01-28 Payroll_Journal_Wed_Jan_26_14_02_00_EST_2022.pdf"), [Implementation="1.3"]), | |
this_page = Source{[Id="Page015"]}[Data], | |
//There is consistently two header and two footer rows that need to be removed | |
remove_botttom_three = Table.RemoveLastN(this_page,3), | |
remove_wccode = Table.ReplaceValue( remove_botttom_three, each [Column1], each if Text.StartsWith([Column1],"(") then null else [Column1] , Replacer.ReplaceValue,{"Column1"} ), | |
remove_title_and_company_name = Table.Skip(remove_wccode,2), |
This file contains hidden or 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
curr_col_list = Table.ColumnNames(fill_section_down), | |
last_col = List.LastN(curr_col_list, 1), | |
first_cols = List.FirstN(curr_col_list, List.Count(curr_col_list) - 1), | |
new_col_order = List.Combine(last_col, first_cols), | |
reordered_table = Table.ReorderColumns(remove_first_col, new_col_order), |
NewerOlder