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
import pandas as pd | |
import json | |
#first map the text json with json loads, then turn this series in to dict then read df from dict | |
#if there were no nans you could pass orient='column' | |
df_context = pd.DataFrame.from_dict(df.context.map(lambda x: json.loads(x.replace('""', '"')), na_action='ignore').to_dict()).transpose() |
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
#Make a list of your sort e.g. | |
cat_list = [ 'Stockout', 'Sell-Out', 'Inventory', 'Run Rate', 'Dead Inv', 'Dead Inv QTY'] | |
#Get the column you want to sort and turn it into a Categorical | |
df['Category'] = pd.Categorical(df['Category'], cat_list, ordered=True) | |
#Then Sort | |
df.sort_values(['Account', 'Category'], ascending=[False, True]) #Sorts Account alphabetically and Category as above |
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
SOMESPONSE.then(response=>response.json()) | |
.then(data=>{ console.log(data); }) |
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
#%% | |
for col in df.columns: | |
print("="*30,col,"="*30) | |
print("Max length for {} is {}".format(col, df[col].str.len().max())) | |
print("Number of unique items {}".format(df[col].nunique())) | |
if len(df[col].unique()) > 20: | |
print(np.random.choice(df[col].unique(), 20)) | |
else: | |
print(df[col].unique()) | |
print("\n") |
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
''' This code should be placed in ThisWorkbook | |
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) | |
Application.StatusBar = False | |
End Sub |
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
import win32api | |
import xlwings as xw | |
wb = xw.books.active | |
win32api.MessageBox(wb.app.hwnd, "Data transfered successfully", "Success") |
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
import win32api | |
import xlwings as xw | |
wb = xw.books.active | |
win32api.MessageBox(wb.app.hwnd, "Data transfered successfully", "Success") |
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 https://stackoverflow.com/questions/50587769/how-to-write-start-of-excel-reporting-into-eventlog | |
Public Enum EventType | |
xlLogSuccess = 0 | |
xlLogError = 1 | |
xlLogWarning = 2 | |
xlLogInformation = 4 | |
xlLogAudit_Success = 8 | |
xlLogAudit_Failure = 16 | |
End Enum |
NewerOlder