Change language for return value of weekdayname - vba

I'm printing some weekdays to a spreadsheet using the weekdayname-function. This works fine, except that the weekdays are written in the local language (Norwegian), instead of in English as I want it to. Is there any way to specify what language the function returns its results it, or am I stuck making my own UDF?

Try this
Debug.Print Application.WorksheetFunction.Text(1,"[$-414]DDDD")
Returns søndag for WeekDay 1 for Norwegian_Bokmal (414)
For a complete list of ID's see the link List of Language Packs and Their Codes for Windows 2000 Domain Controllers
In case that link ever dies, here is the complete list
Locale/language Language ID in hexadecimal
-------------------------------------------------------
Afrikaans 436
Albanian 041c
Arabic_Saudi_Arabia 401
Arabic_Iraq 801
Arabic_Egypt 0c01
Arabic_Libya 1001
Arabic_Algeria 1401
Arabic_Morocco 1801
Arabic_Tunisia 1c01
Arabic_Oman 2001
Arabic_Yemen 2401
Arabic_Syria 2801
Arabic_Jordan 2c01
Arabic_Lebanon 3 001
Arabic_Kuwait 3401
Arabic_UAE 3801
Arabic_Bahrain 3c01
Arabic_Qatar 4001
Armenian 042b
Azeri_Latin 042c
Azeri_Cyrillic 082c
Basque 042d
Belarusian 423
Bulgarian 402
Catalan 403
Chinese_Taiwan 404
Chinese_PRC 804
Chinese_Hong_Kong 0c04
Chinese_Singapore 1004
Chinese_Macau 1404
Croatian 041a
Czech 405
Danish 406
Dutch_Standard 413
Dutch_Belgian 813
English_United_States 409
English_United_Kingdom 809
English_Australian 0c09
English_Canadian 1009
English_New_Zealand 1409
English_Irish 1809
English_South_Africa 1c09
English_Jamaica 2009
English_Caribbean 2409
English_Belize 2809
English_Trinidad 2c09
English_Zimbabwe 3009
English_Philippines 3409
Estonian 425
Faeroese 438
Farsi 429
Finnish 040b
French_Standard 040c
French_Belgian 080c
French_Canadian 0c0c
French_Swiss 100c
French_Luxembourg 140c
French_Monaco 180c
Georgian 437
German_Standard 407
German_Swiss 807
German_Austrian 0c07
German_Luxembourg 1007
German_Liechtenstein 1407
Greek 408
Hebrew 040d
Hindi 439
Hungarian 040e
Icelandic 040f
Indonesian 421
Italian_Standard 410
Italian_Swiss 810
Japanese 411
Kazakh 043f
Konkani 457
Korean 412
Latvian 426
Lithuanian 427
FYRO Macedonian 042f
Malay_Malaysia 043e
Malay_Brunei_Darussalam 083e
Marathi 044e
Norwegian_Bokmal 414
Norwegian_Nynorsk 814
Polish 415
Portuguese_Brazilian 416
Portuguese_Standard 816
Romanian 418
Russian 419
Sanskrit 044f
Serbian_Latin 081a
Serbian_Cyrillic 0c1a
Slovak 041b
Slovenian 424
Spanish_Traditional_Sort 040a
Spanish_Mexican 080a
Spanish_Modern_Sort 0c0a
Spanish_Guatemala 100a
Spanish_Costa_Rica 140a
Spanish_Panama 180a
Spanish_Dominican_Republic 1c0a
Spanish_Venezuela 200a
Spanish_Colombia 240a
Spanish_Peru 280a
Spanish_Argentina 2c0a
Spanish_Ecuador 300a
Spanish_Chile 340a
Spanish_Uruguay 380a
Spanish_Paraguay 3c0a
Spanish_Bolivia 400a
Spanish_El_Salvador 440a
Spanish_Honduras 480a
Spanish_Nicaragua 4c0a
Spanish_Puerto_Rico 500a
Swahili 441
Swedish 041d
Swedish_Finland 081d
Tamil 449
Tatar 444
Thai 041e
Turkish 041f
Ukrainian 422
Urdu 420
Uzbek_Latin 443
Uzbek_Cyrillic 843
Vietnamese 042a

Related

Loss nan problem when using TFBertForSequenceClassification

I have a problem when training a model for multi-label text classification.
I'm working at Colab as follows:
def create_sentiment_bert():
config = BertConfig.from_pretrained("monologg/kobert", num_labels=52)
model = TFBertForSequenceClassification.from_pretrained("monologg/kobert", config=config, from_pt=True)
opt = tf.keras.optimizers.Adam(learning_rate=4.0e-6)
loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=False)
metric = tf.keras.metrics.SparseCategoricalAccuracy("accuracy")
model.compile(optimizer=opt, loss=loss, metrics=[metric])
return model
sentiment_model = create_sentiment_bert()
sentiment_model.fit(train_x, train_y, epochs=2, shuffle=True, batch_size=250, validation_data=(test_x, test_y))
The result is as follows:
Epoch 1/2
739/14065 [>.............................] - ETA: 35:31 - loss: nan - accuracy: 0.0000e+00
I have checked out my data: no nan or null or invalid values.
I tried different optimizers, # of epochs, learning rate, but had the same problem.
The number of labels is 52 and the distribution is as follows:
[Label] [Count]
501 694624
601 651306
401 257665
210 250352
307 170665
301 153318
306 147948
201 141382
302 113917
402 102040
606 101434
506 73492
305 69876
604 62056
403 57956
104 56800
107 55503
607 40293
503 36272
505 34757
303 26884
308 24539
304 22135
205 20744
509 19465
206 16665
508 15334
208 13335
603 13240
504 12299
602 10684
202 10366
209 8267
106 6564
502 5880
211 5804
207 2794
507 1967
108 1860
204 1633
105 1545
109 682
605 426
102 276
101 274
405 268
212 204
213 153
103 103
203 90
404 65
608 37
I'm a beginner in this area. Please help me. Thanks in advance!
Why do you have from_logits = False? The classifier head returns logits so unless you put a softmax activation within your model, you need to calculate the loss from logits.

Series with count larger than certain number

Given this code in iPython
df1=df["BillingContactCountry"].value_counts()
df1
I get
United States 4138
Germany 1963
United Kingdom 732
Switzerland 528
Australia 459
Canada 369
Japan 344
France 303
Netherlands 285
I want to get a series with count larger than 303, what should I do?
You needboolean indexing:
print (df1[df1 > 303])
United States 4138
Germany 1963
United Kingdom 732
Switzerland 528
Australia 459
Canada 369
Japan 344
Name: BillingContactCountry, dtype: int64

pandas merging two multi-level series

I have two multi-level Series and would like to merge them according to both index. The first Series looks like this:
# of restaurants
BORO CUISINE
BRONX American 425
Chinese 330
Pizza 206
BROOKLYN American 1254
Chinese 750
Cafe/Coffee/Tea 350
The second one has more rows and is like this:
# of votes
BORO CUISINE
BRONX American 2425
Caribbean 320
Chinese 3130
Pizza 3336
BROOKLYN American 21254
Caribbean 2320
Chinese 7250
Cafe/Coffee/Tea 3350
Pizza 13336
Setup:
s1 = pd.Series({('BRONX', 'American'): 425, ('BROOKLYN', 'Chinese'): 750, ('BROOKLYN', 'Cafe/Coffee/Tea'): 350, ('BRONX', 'Pizza'): 206, ('BROOKLYN', 'American'): 1254, ('BRONX', 'Chinese'): 330})
s2 = pd.Series({('BRONX', 'Caribbean'): 320, ('BRONX', 'American'): 2425, ('BROOKLYN', 'Chinese'): 7250, ('BROOKLYN', 'Cafe/Coffee/Tea'): 3350, ('BRONX', 'Pizza'): 3336, ('BROOKLYN', 'American'): 21254, ('BROOKLYN', 'Pizza'): 13336, ('BRONX', 'Chinese'): 3130, ('BROOKLYN', 'Caribbean'): 2320})
s1 = s1.rename_axis(['BORO','CUISINE']).rename('restaurants')
s2 = s2.rename_axis(['BORO','CUISINE']).rename('votes')
print (s1)
BORO CUISINE
BRONX American 425
Chinese 330
Pizza 206
BROOKLYN American 1254
Chinese 750
Cafe/Coffee/Tea 350
Name: restaurants, dtype: int64
print (s2)
BORO CUISINE
BRONX American 2425
Caribbean 320
Chinese 3130
Pizza 3336
BROOKLYN American 21254
Caribbean 2320
Chinese 7250
Cafe/Coffee/Tea 3350
Pizza 13336
Name: votes, dtype: int64
Use concat with parameter join if need inner join:
print (pd.concat([s1,s2], axis=1, join='inner'))
restaurants votes
BORO CUISINE
BRONX American 425 2425
Chinese 330 3130
Pizza 206 3336
BROOKLYN American 1254 21254
Cafe/Coffee/Tea 350 3350
Chinese 750 7250
#join='outer' is by default, so can be omited
print (pd.concat([s1,s2], axis=1))
restaurants votes
BORO CUISINE
BRONX American 425.0 2425
Caribbean NaN 320
Chinese 330.0 3130
Pizza 206.0 3336
BROOKLYN American 1254.0 21254
Cafe/Coffee/Tea 350.0 3350
Caribbean NaN 2320
Chinese 750.0 7250
Pizza NaN 13336
Another solution is use merge with reset_index:
#by default how='inner', so can be omited
print (pd.merge(s1.reset_index(), s2.reset_index(), on=['BORO','CUISINE']))
BORO CUISINE restaurants votes
0 BRONX American 425 2425
1 BRONX Chinese 330 3130
2 BRONX Pizza 206 3336
3 BROOKLYN American 1254 21254
4 BROOKLYN Chinese 750 7250
5 BROOKLYN Cafe/Coffee/Tea 350 3350
#outer join
print (pd.merge(s1.reset_index(), s2.reset_index(), on=['BORO','CUISINE'], how='outer'))
BORO CUISINE restaurants votes
0 BRONX American 425.0 2425
1 BRONX Chinese 330.0 3130
2 BRONX Pizza 206.0 3336
3 BROOKLYN American 1254.0 21254
4 BROOKLYN Chinese 750.0 7250
5 BROOKLYN Cafe/Coffee/Tea 350.0 3350
6 BRONX Caribbean NaN 320
7 BROOKLYN Caribbean NaN 2320
8 BROOKLYN Pizza NaN 13336

How to get multiresult with multicondition in Sql Server

I need help to solve this.
Hopefully someone can giving me advices.
For a sample, I've got data like :
PROCLIB.MARCH 1
First 10 Rows Only
Flight Date Depart Orig Dest Miles Boarded Capacity
-----------------------------------------------------------------
114 01MAR94 7:10 LGA LAX 2475 172 210
202 01MAR94 10:43 LGA ORD 740 151 210
219 01MAR94 9:31 LGA LON 3442 198 250
622 01MAR94 12:19 LGA FRA 3857 207 250
132 01MAR94 15:35 LGA YYZ 366 115 178
271 01MAR94 13:17 LGA PAR 3635 138 250
302 01MAR94 20:22 LGA WAS 229 105 180
114 02MAR94 7:10 LGA LAX 2475 119 210
202 02MAR94 10:43 LGA ORD 740 120 210
219 02MAR94 9:31 LGA LON 3442 147 250
and i have condition for ('LAX,ORD'), 'LAX','LON','YYZ',('PAR,LON,FRA'),'FRA' ...AND ELSE
What should i do with that data to show report as that condition in SQL?
Parameter that I made is
Dest like #dest -> (from table condition(('LAX, ORD'), 'LAX','LON',('PAR,LON,FRA'),'FRA',..etc)) +'%'
And Date like #date + '%'
And Depart like #depart + '%'
If I choose 'LAX' as #dest, then only 'LAX' will show
If I choose 'LAX,ORD' as #dest, then only 'LAX' and 'ORD' will show
Please I need help, advice and suggestion for this.
Thanks
If your #dest value is 'LAX,ORD', one query that will solve your solution is
select *
from PROCLIB.MARCH
where dest in ('LAX','ORD')
To parameterise that, you need it to become a table.
Dest
====
LAX
ORD
and the query becomes
select *
from PROCLIB.MARCH
where dest in (select Dest from #DestTable)
If you want to pass #dest as a string parameter, then you need to split it somehow into a table. A search for SQL split function will give a number of options.
If your query is encapsulated in a stored procedure, a better method is to pass the values as a table valued parameter. See http://blog.sqlauthority.com/2008/08/31/sql-server-table-valued-parameters-in-sql-server-2008/

How to read data on a specific row from excel by asking the name of that row?

I have the following excel file:
W1000x554 1032 408 52.1 29.5 70700 12300
W1000x539 1030 407 51.1 28.4 68700 12000
W1000x483 1020 404 46 25.4 61500 10700
W1000x443 1012 402 41.9 23.6 56400 9670
W1000x412 1008 402 40 21.1 52500 9100
W1000x371 1000 400 36.1 19 47300 8140
W1000x321 990 400 31 16.5 40900 6960
W1000x296 982 400 27.1 16.5 37800 6200
W1000x584 1056 314 64 36.1 74500 12500
I want to define a function that can ask the user for one of the first column's names and then read all the relevant data of that row later.
For example if the user defines W1000x412 then read : 1008 402 40 21.1 52500 9100.
Any ideas?
I suspect what #Marc means is that a formula such as in J2 below (copied across and down as necessary) will 'pick out' the values you want. It is not clear to me from your question whether these should be kept separate (as in Row2 of example) or strung together (CONCATENATE [&] as in J7 of example, where these are space [" "] delimited):
I am also not entirely sure about your 'define a function' but have assumed you do not require a UDF.
I have used Row1 to provide the offset for VLOOKUP, to save adjusting manually the formula for each column.
ColumnI is the expected user input, that might be best by selection from a Data Validation List with Source $A$2:$A$10.