Categories
Mastering Development

How to Un-Sort The legends in the graph in R?

I am not an expert in R. I am having an issue, the legends are sorted alphabetically. I cannot arrange them manually because I have 87 patients and each patient has 300 days and the status (category) changes every day so i want to plot the graph exactly like it has in the source. ggplot(data […]

Categories
Mastering Development

How to extract row before and after when flag change from 0 to 1

I have one dataframe , i want to extract 2 rows before flag change from 0 to one and get row where value ‘B’ is minimum , also extract two rows after flag 1 and get row with minimum value of ‘B’ df=pd.DataFrame({‘A’:[1,3,4,7,8,11,1,15,20,15,16,87], ‘B’:[1,3,4,6,8,11,1,19,20,15,16,87], ‘flag’:[0,0,0,0,1,1,1,0,0,0,0,0]}) df_out=pd.DataFrame({‘A’:[4,1], ‘B’:[4,1], ‘flag’:[0,1]})

Categories
Mastering Development

Fit Variance gamma to data

I am using R studio to estimate paramters for data under Variance Gamma. I want to fit this data to the data and find estimates of parameters. The code I have is x<-c(1291,849,238,140,118,108,87,70,63,58,50,47,21,21,19) library(VarianceGamma) init<-c(0,0.5,0,0.5) vgFit(x, freq = NULL, breaks = NULL, paramStart = init, startMethod = "Nelder-Mead", startValues = "SL", method = "Nelder-Mead", hessian […]

Categories
Mastering Development

How to remove outliers from multiple columns in pyspark using mean and standard deviation

I have the below data frame and I want to remove outliers from defined columns. In the below example price and income. Outliers should be removed for each group of data. In this example its ‘cd’ and ‘segment’ columns. Outliers should be removed based 5 standard deviations. data = [ (‘a’, ‘1’,20,10), (‘a’, ‘1’,30,16), (‘a’, […]

Categories
Mastering Development

Imputation based on predefined values

In this df, only apple has NAs and I’d like them to take only the values 21, 31 or 32. > head(df) # A tibble: 6 x 5 apple apricot avocado banana `bell pepper` <fct> <fct> <fct> <fct> <fct> 1 31 68 66 31 4 2 22 22 75 48 1 3 NA 34 75 […]

Categories
Mastering Development

is there nice way to find peak and valley

0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,4,4,6,14,25,43,71,93,123,194,279,356,460,470,460,468,439,303,266,200,97,79,58,218,677,1193,1331,812,501,212,869,1262,1093,725,329,241,558,1077,1216,901,463,226,262,671,1103,1199,791,344,163,151,292,742,1200,1113,678,299,176,207,542,1086,1251,899,426,170,104,117,187,274,396,419,515,477,500,471,400,303,177,142,88,44,37,16,5,6,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,2,6,8,19,27,50,70,103,155,215,285,386,447,443,469,463,434,313,244,174,92,79,78,204,601,1215,1320,845,525,208,839,1321,1085,715,331,265,556,1080,1179,851,509,235,261,693,1121,1168,749,364,168,130,301,735,1152,1116,697,324,157,196,520,1092,1217,905,483,187,98,112,177,260,326,444,563,484,486,464,433,329,209,138,77,41,22,8,5,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,3,2,4,14,15,24,51,61,74,127,205,304,331,507,475,443,439,435,331,267,168,103,84,55,203,700,1250,1342,811,465,213,930,1263,1085,653,323,266,563,1053,1226,884,447,254,260,701,1103,1187,766,352,155,134,299,699,1206,1088,702,358,156,221,507,1127,1252,866,426,163,129,117,206,263,388,428,519,466,482,445,389,314,207,132,83,57,28,17,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,3,4,7,6,16,24,50,63,110,121,219,305,305,439,497,508,453,430,338,234,182,99,69,70,220,679,1266,1288,818,482,222,891,1279,1061,650,332,279,557,1052,1233,917,409,213,277,700,1126,1181,764,333,138,134,290,819,1258,1004,680,302,153,251,485,1092,1233,904,445,193,124,112,187,254,370,446,511,504,484,494,382,303,201,168,68,38,28,18,5,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,2,5,10,13,20,37,52,82,158,214,269,369,436,468,487,518,465,350,254,188,101,78,75,189,560,1244,1326,761,488,132,882,1253,1288,753,305,266,528,1010,1198,959,480,234,244,635,1208,1094,867,382,162,117,257,693,1203,1166,728,371,138,224,502,1044,1156,926,456,185,122,108,171,246,355,440,515,450,515,459,393,293,217,142,82,49,22,12,4,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,3,7,7,13,20,45,65,89,136,228,281,354,434,502,507,506,429,300,284,183,109,77,70,156,603,1188,1335,812,505,157,805,1278,1320,729,331,245,536,1024,1194,931,511,248,234,618,1108,1129,849,430,178,107,215,714,1162,1165,769,363,135,215,483,1001,1193,991,454,167,127,93,156,226,322,434,543,484,491,455,452,311,222,139,83,40,29,10,4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,2,2,2,8,11,29,33,46,102,155,216,277,362,400,524,456,477,461,345,282,190,108,83,60,195,611,1198,1347,780,486,180,956,1214,1273,709,283,249,617,1054,1180,907,477,224,246,697,1179,1054,828,380,153,131,277,744,1152,1168,699,321,167,217,457,996,1195,987,475,168,113,102,161,253,303,469,474,464,497,477,389,318,234,141,103,45,40,7,6,1,3,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,20,41,80,109,158,164,325,328,436,487,478,457,480,314,304,194,108,61,78,219,591,1229,1312,745,517,152,862,1240,1305,751,289,261,581,1040,1169,901,497,229,285,628,1195,1147,783,362,170,121,261,730,1176,1160,718,340,144,219,477,1037,1230,929,438,168,121,95,161,235,357,471,500,460,471,451,383,311,247,160,85,53,27,9,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,6,10,14,24,43,56,102,157,204,297,372,422,517,465,434,429,335,221,171,115,81,61,178,663,1193,1323,838,537,153,887,1180,1130,752,334,260,548,1064,1224,896,482,202,252,617,1187,1260,791,353,156,109,283,710,1200,1122,775,336,156,243,447,974,1138,949,447,186,116,128,168,275,378,453,486,565,500,431,393,289,260,140,95,65,32,8,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,2,3,4,10,18,26,39,63,99,165,205,315,348,437,514,511,447,392,332,242,128,85,69,70,160,637,1238,1291,875,549,156,862,1162,1140,753,353,267,565,1030,1218,891,500,234,249,611,1151,1241,792,381,176,110,263,725,1204,1115,778,324,167,185,515,978,1167,916,495,169,92,109,173,254,390,438,497,545,553,439,403,290,231,141,102,50,19,14,3,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,5,13,17,27,45,63,91,162,215,294,346,403,469,509,474,373,322,266,169,93,75,70,193,644,1307,1318,805,524,162,874,1178,1113,733,332,268,537,1073,1252,900,474,208,288,604,1182,1220,748,389,187,113,306,719,1210,1081,781,333,149,163,540,996,1145,881,518,150,115,129,187,264,391,415,440,509,564,475,378,327,218,161,90,45,35,10,4,2,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,4,3,0,13,17,35,34,70,106,179,205,294,349,360,517,473,449,435,317,266,177,82,63,73,191,670,1278,1322,786,524,172,859,1201,1187,704,308,270,608,1088,1175,872,454,238,231,597,1131,1252,813,412,150,104,270,734,1224,1081,777,348,145,194,465,1030,1130,880,491,189,119,108,175,271,368,451,479,557,544,476,390,323,212,137,85,42,31,11,5,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,6,8,11,23,30,60,97,156,174,288,373,430,517,509,479,389,357,257,171,94,77,58,192,691,1103,1331,833,473,184,823,1324,1204,680,295,197,596,987,1351,956,445,239,241,645,1266,1036,784,368,160,102,218,775,1085,1115,765,373,171,177,489,996,1164,834,567,228,113,107,164,227,325,435,507,542,507,514,414,326,278,154,108,63,27,12,6,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,2,4,18,20,41,67,78,158,209,269,403,411,509,443,508,430,337,256,186,113,64,68,217,656,1144,1279,868,468,192,811,1324,1118,745,320,250,557,993,1288,964,479,241,256,594,1195,1081,740,433,186,125,256,709,1146,1093,729,365,171,169,435,1027,1186,896,535,192,119,98,144,254,355,423,519,524,526,467,437,363,251,151,95,54,28,17,2,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,11,18,28,37,55,104,140,199,283,372,422,524,445,457,427,357,273,181,106,69,93,200,695,1121,1285,877,504,183,824,1306,1150,659,300,252,570,1056,1290,883,479,243,240,576,1231,1125,769,402,169,108,223,771,1101,1193,704,341,159,191,490,946,1169,876,552,224,112,104,165,262,313,463,489,502,525,495,402,326,256,170,100,56,38,27,6,5,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,9,10,25,45,56,100,152,187,304,368,419,499,470,499,427,309,277,153,119,70,84,213,662,1151,1297,830,524,190,822,1291,1198,673,303,241,598,1053,1307,914,439,221,218,590,1177,1158,798,378,164,97,279,747,1081,1172,733,310,154,198,439,1000,1216,883,512,201,112,109,183,246,350,458,510,493,504,520,414,365,219,167,89,54,30,17,5,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,4,4,8,12,18,33,59,65,110,142,213,271,368,398,489,492,468,438,318,268,151,96,76,73,295,776,1401,1096,666,369,130,608,1105,1391,858,411,269,578,1113,1340,854,483,206,319,793,1190,1083,703,285,79,50,129,423,948,1311,960,545,207,134,314,731,1145,1283,605,310,160,125,203,263,361,436,521,540,503,524,391,311,165,143,78,29,25,10,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,8,8,18,30,37,59,105,166,215,301,382,383,465,500,480,429,330,268,177,101,64,74,243,746,1392,1127,734,337,107,583,1115,1377,878,440,247,549,1104,1332,927,461,228,309,789,1239,1039,703,278,96,38,133,461,958,1217,983,553,243,133,271,782,1184,1183,669,287,181,131,222,228,349,439,539,530,519,472,385,323,199,137,72,33,19,5,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,4,7,11,20,28,46,63,121,141,212,287,345,401,513,494,435,434,302,268,182,107,82,85,283,741,1386,1168,690,355,124,649,1102,1342,847,415,267,601,1090,1375,864,429,230,328,877,1184,1072,696,242,68,38,130,422,987,1240,987,534,199,127,309,775,1137,1193,690,297,171,129,182,263,352,460,511,530,498,464,411,340,193,132,76,38,18,9,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,4,3,3,16,19,24,46,67,107,146,208,285,352,390,535,498,473,381,300,286,175,110,80,79,254,801,1403,1145,690,329,124,610,1097,1417,869,403,286,591,1120,1295,858,438,223,296,863,1273,1018,681,252,75,45,138,446,988,1307,912,534,203,122,301,742,1191,1174,654,328,150,136,188,260,368,424,506,550,538,481,420,290,191,150,61,36,16,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,5,4,2,11,13,22,34,78,91,138,198,304,374,389,458,480,471,456,344,263,200,119,73,111,300,815,1420,1125,669,309,116,666,1182,1279,790,405,284,626,991,1283,949,439,219,348,833,1275,1181,644,240,74,48,133,458,1017,1178,994,512,183,125,252,767,1194,1083,716,314,166,118,160,230,377,402,503,552,513,505,422,316,238,131,71,42,28,8,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,3,5,6,10,25,31,66,94,121,186,278,417,415,485,549,467,423,314,262,183,117,72,100,272,800,1379,1184,640,337,93,622,1095,1354,851,421,288,585,1089,1267,924,434,259,327,853,1262,1177,630,248,79,51,128,448,1037,1144,971,522,205,124,279,792,1192,1133,676,310,148,136,178,224,336,419,542,516,535,497,412,318,201,139,68,41,22,11,2,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,6,10,9,17,34,33,78,83,168,209,300,380,354,488,537,432,463,322,238,194,122,78,73,316,903,1398,1089,682,274,88,654,1131,1296,869,391,278,611,1063,1262,921,452,243,352,868,1229,1108,680,248,72,47,124,472,1053,1202,937,516,186,109,280,757,1238,1098,663,325,153,127,171,253,328,423,497,500,549,481,430,294,226,151,81,43,25,11,3,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,5,2,11,6,20,25,30,64,102,146,188,255,428,383,453,556,444,437,370,240,204,101,82,100,278,825,1429,1104,648,307,125,656,1132,1298,834,409,260,618,1093,1263,907,448,215,354,866,1229,1159,630,243,82,55,130,493,1047,1147,988,496,194,153,265,730,1237,1106,669,327,154,127,160,218,354,428,505,527,509,513,424,309,199,154,86,56,23,7,4,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,4,7,6,13,24,47,69,99,173,217,288,406,406,456,463,446,419,298,253,165,126,69,89,308,776,1376,1115,667,363,110,620,1195,1269,899,412,285,567,1100,1267,940,535,248,317,779,1222,1060,669,289,74,54,141,436,1004,1270,933,560,251,131,336,746,1199,1066,766,289,133,116,189,254,329,433,472,544,485,507,393,321,209,124,94,40,19,9,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,4,8,9,14,28,38,70,99,155,247,302,375,387,497,478,460,408,333,240,141,108,67,72,283,791,1382,1113,653,351,134,550,1282,1310,839,433,304,581,1102,1283,918,507,250,311,726,1315,1090,648,256,82,43,130,452,979,1274,990,537,230,147,291,827,1228,1099,665,270,150,103,177,235,301,479,494,532,518,481,402,315,204,139,78,27,15,9,2,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,2,6,4,17,14,38,51,61,103,157,199,308,379,402,449,468,441,422,323,245,176,99,82,100,284,792,1348,1152,650,357,142,641,1224,1252,851,423,304,584,1161,1309,881,465,234,293,816,1259,1071,623,267,62,50,146,458,1053,1288,937,504,212,141,311,784,1205,1116,692,256,145,137,151,220,345,449,481,533,534,478,415,308,195,140,104,46,17,9,5,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,2,1,3,10,22,37,45,62,102,130,209,292,346,412,484,478,497,415,348,254,145,96,81,93,315,782,1413,1104,645,320,133,620,1203,1287,884,424,302,611,1075,1296,906,499,227,318,805,1280,1073,660,222,58,41,134,447,1026,1295,1004,500,201,140,276,849,1190,1078,707,283,137,115,187,261,336,453,470,518,519,505,383,287,206,138,86,26,22,6,3,4,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,3,4,10,17,19,44,59,91,154,215,255,367,449,510,483,478,442,334,275,188,104,66,81,310,841,1323,1152,571,316,123,638,1132,1310,843,445,271,581,1135,1213,912,426,216,366,830,1289,1094,654,249,89,47,124,446,1020,1259,941,527,204,138,314,703,1251,1114,700,310,162,83,187,227,301,420,476,561,544,518,389,369,220,138,98,53,22,13,5,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,2,4,8,13,23,35,59,96,140,183,280,358,422,538,481,508,479,313,277,190,121,72,79,296,778,1324,1165,590,345,124,631,1128,1286,861,437,295,574,1141,1177,872,466,228,289,834,1345,1059,660,281,89,55,141,440,960,1284,1014,506,204,126,305,771,1217,1103,680,325,140,112,137,235,315,435,482,496,579,523,418,322,248,129,110,44,24,16,5,3,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,1,0,2,0,1,4,3,13,11,29,47,59,99,146,231,279,350,384,530,505,479,445,353,261,173,121,75,92,262,834,1336,1155,616,310,135,634,1117,1269,877,429,308,552,1111,1220,919,426,184,353,787,1270,1147,710,222,67,53,145,451,989,1237,987,551,197,128,301,776,1233,1159,643,299,125,108,139,214,323,438,487,508,521,517,459,345,251,158,98,41,22,10,3,4,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,3,3,12,14,30,37,53,90,129,222,273,365,463,576,464,473,439,314,229,190,141,68,72,268,849,1308,1113,625,320,142,645,1149,1232,860,490,287,596,1126,1207,902,444,188,369,762,1300,1106,668,248,83,47,129,460,983,1344,949,491,213,122,320,722,1197,1141,704,289,154,114,136,236,335,435,486,514,564,494,443,349,234,129,96,41,23,15,3,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,7,9,11,16,28,45,86,117,164,185,300,374,445,481,503,517,394,355,268,191,101,62,57,115,509,1118,1317,944,526,159,678,1227,1342,803,400,279,601,1159,1335,824,425,196,251,658,1193,1152,808,328,116,60,143,476,1037,1183,964,432,183,118,247,708,1081,1219,847,283,194,164,181,214,328,426,497,508,519,518,369,322,184,130,79,33,20,9,1,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,6,0,8,13,32,53,70,92,158,213,284,374,453,518,498,516,406,339,249,174,107,73,66,113,512,1027,1385,935,539,151,656,1223,1306,894,395,261,634,1070,1371,821,478,192,252,640,1233,1180,747,317,126,70,148,425,1080,1205,951,448,185,107,223,647,1105,1231,889,293,209,142,187,243,372,439,477,528,543,488,351,279,177,113,69,43,21,8,1,2,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,1,5,8,5,27,43,40,69,117,165,198,294,382,462,473,446,513,462,326,278,169,104,63,48,138,528,1110,1341,900,514,188,673,1245,1326,772,420,263,606,1119,1307,892,443,196,252,709,1227,1134,739,310,94,52,153,496,1034,1248,941,430,153,103,242,703,1105,1244,823,294,190,158,189,246,357,487,456,510,537,513,348,290,183,106,67,36,12,3,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,3,3,7,9,12,24,44,61,101,161,233,316,398,473,475,497,478,446,317,227,173,125,65,54,127,517,1130,1290,943,543,163,667,1237,1313,786,433,257,646,1095,1330,845,459,183,214,660,1268,1158,740,351,90,60,168,522,1063,1132,973,426,174,105,246,666,1113,1239,849,299,205,138,184,259,393,465,464,480,554,482,347,290,173,122,71,31,10,8,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,1,4,3,8,16,24,41,83,98,153,209,281,383,436,481,480,486,418,362,292,140,103,51,51,115,600,1184,1346,854,465,141,669,1232,1298,843,401,270,630,1095,1381,850,398,162,265,720,1287,1167,750,306,99,51,152,488,1025,1286,915,467,172,103,223,623,1197,1197,824,332,214,125,148,225,310,433,465,531,530,465,406,325,200,143,83,26,25,14,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,2,15,11,20,29,61,118,161,205,287,371,441,513,501,486,384,323,280,164,108,61,54,121,545,1153,1277,913,491,173,681,1239,1284,809,403,297,640,1074,1320,888,432,176,261,706,1231,1156,806,281,129,65,134,475,1043,1293,891,468,197,86,211,634,1190,1258,804,319,236,132,148,245,295,440,482,549,571,465,333,305,225,127,81,37,21,10,3,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,2,5,6,16,20,37,45,80,116,156,204,323,328,428,508,464,474,401,326,266,168,102,71,54,110,588,1150,1332,886,488,173,684,1247,1296,756,405,305,664,1087,1325,830,420,183,292,724,1287,1153,707,281,107,57,149,554,1073,1246,885,434,161,87,232,652,1180,1219,800,355,215,153,161,248,312,450,480,538,544,509,342,288,217,114,63,30,22,8,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,10,2,13,17,29,58,58,111,158,221,305,348,450,494,461,494,418,329,275,161,93,61,34,119,620,1140,1305,862,461,177,687,1221,1375,772,391,299,664,1115,1240,890,396,192,273,738,1267,1120,768,279,106,44,157,501,1075,1286,891,425,158,117,224,672,1154,1208,854,327,206,123,141,245,303,434,474,537,553,504,378,302,227,123,84,33,12,9,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,5,4,15,18,29,32,71,124,149,261,298,365,409,459,495,476,434,281,253,158,95,50,54,122,488,1207,1273,917,588,148,791,1207,1231,796,368,261,626,1084,1182,837,391,199,301,714,1327,1118,744,329,112,65,148,531,1047,1298,1007,409,172,122,253,651,1158,1188,769,305,212,120,160,264,319,435,512,565,540,515,420,333,204,115,72,32,12,5,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,1,4,1,1,2,3,21,18,24,44,63,115,144,246,274,360,454,458,525,492,430,288,233,165,81,55,36,126,508,1184,1287,964,523,121,734,1238,1263,837,364,279,570,1138,1181,855,404,160,240,712,1290,1177,764,335,123,46,150,541,1064,1278,988,438,169,111,238,618,1152,1163,876,309,188,138,161,255,359,458,515,515,555,526,397,289,190,115,83,29,27,5,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,1,1,0,2,1,2,3,5,13,18,21,44,68,112,157,220,339,346,439,478,523,471,394,278,242,170,95,56,52,142,550,1164,1331,902,526,123,792,1204,1264,804,374,264,598,1118,1200,799,404,190,275,688,1365,1160,750,301,90,46,153,547,1067,1282,989,409,157,113,250,626,1170,1154,844,291,182,129,179,265,332,435,508,537,526,491,454,288,211,134,87,43,19,10,4,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,9,6,14,35,55,70,116,156,231,296,356,420,473,550,470,422,255,248,143,74,71,45,139,512,1190,1411,864,489,127,767,1268,1264,778,363,283,643,1128,1125,858,396,150,290,729,1354,1105,741,337,86,56,165,534,1031,1288,996,434,169,117,243,632,1169,1190,794,293,206,149,161,268,336,444,505,523,551,524,440,299,213,99,65,30,11,6,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,4,3,6,19,28,36,58,96,123,204,259,312,461,476,471,503,405,365,251,187,120,68,56,158,503,1182,1362,875,511,158,680,1252,1204,840,356,287,653,1113,1219,809,393,163,285,742,1255,1200,768,302,109,53,146,527,1049,1337,868,455,165,129,239,599,1256,1076,815,345,192,130,171,218,285,407,500,579,578,498,429,350,259,130,103,46,23,8,3,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,2,5,7,21,13,52,71,92,125,207,305,337,426,456,463,513,400,345,268,186,125,43,58,149,538,1126,1315,954,455,163,750,1282,1176,788,356,324,633,1137,1155,830,391,181,264,708,1194,1206,812,352,118,71,131,536,1083,1308,874,462,157,123,241,669,1281,1044,794,325,210,106,154,218,276,429,485,517,597,534,430,388,237,143,91,31,23,7,6,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,2,0,1,1,3,2,5,12,18,22,37,59,97,137,204,264,366,432,442,442,521,422,343,274,178,124,63,56,178,545,1129,1385,895,454,146,713,1255,1166,839,351,299,640,1051,1241,839,388,185,291,754,1232,1178,794,310,116,68,162,537,1078,1292,820,490,179,120,239,667,1314,1042,804,296,177,110,143,206,283,442,498,528,602,529,423,362,244,143,91,30,30,8,3,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,8,3,13,28,38,63,107,133,222,276,362,448,482,478,508,416,364,219,154,95,62,58,163,524,1106,1406,899,446,169,720,1267,1154,823,369,293,642,1128,1191,799,379,184,293,776,1210,1199,732,315,124,65,135,545,1064,1361,826,458,151,131,263,682,1218,1106,788,316,182,113,133,243,308,402,503,528,562,536,461,367,232,156,84,51,24,6,6,4,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,3,12,13,12,23,49,91,109,175,235,353,345,495,484,509,437,353,292,185,151,97,57,135,459,1194,1337,976,524,164,679,1273,1258,847,360,283,583,1080,1227,879,461,203,201,600,1290,1313,717,392,108,53,116,457,1027,1201,986,549,214,97,228,573,1111,1198,835,356,238,125,120,193,288,401,461,515,554,520,454,364,240,163,97,52,35,9,4,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,8,6,17,22,21,56,75,108,187,255,298,374,466,473,515,438,369,289,194,149,96,57,112,477,1141,1331,989,551,141,706,1195,1310,868,378,247,559,1088,1241,938,420,179,212,609,1269,1259,756,400,128,52,129,435,1033,1269,1007,525,191,115,189,557,1118,1177,857,392,224,139,136,198,266,384,451,530,501,560,471,358,253,163,92,51,39,17,3,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,5,6,5,7,23,34,45,89,120,176,236,320,390,463,478,475,460,360,298,186,131,101,58,122,529,1143,1353,994,525,127,753,1233,1265,819,365,290,567,1095,1205,916,441,187,221,653,1308,1256,729,339,121,62,115,468,1053,1203,965,549,204,86,220,581,1094,1231,821,386,207,137,146,185,273,385,495,517,542,512,435,365,252,173,92,41,25,9,6,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,3,3,3,11,17,12,26,55,80,123,155,242,303,379,469,513,520,385,398,265,203,151,99,62,137,503,1177,1348,993,555,128,719,1199,1263,874,352,302,605,1053,1204,868,439,212,217,612,1289,1254,781,360,115,56,122,444,1039,1211,1013,508,207,103,180,573,1100,1210,881,378,212,123,139,206,277,378,435,517,554,510,431,371,282,170,94,51,30,11,7,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,1,5,14,10,17,30,43,75,131,172,223,331,370,532,473,526,444,381,296,228,143,94,63,128,462,1121,1351,892,550,133,681,1266,1166,809,406,263,572,1113,1192,960,422,182,216,660,1228,1223,780,366,129,54,136,437,996,1286,975,513,196,102,240,552,1141,1210,787,363,206,122,137,167,251,371,497,475,518,603,475,430,284,202,130,70,35,11,8,5,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,3,4,8,8,14,38,44,79,125,173,242,324,355,498,491,515,492,379,315,219,154,87,55,113,437,1073,1376,913,552,147,615,1204,1266,837,406,263,575,1075,1184,938,474,200,226,626,1183,1214,889,357,113,44,130,422,1020,1310,961,487,202,111,218,545,1151,1252,779,375,218,100,147,176,270,356,450,557,489,575,470,419,299,185,134,72,35,13,9,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,7,7,11,20,37,43,70,124,178,234,353,365,504,458,488,515,381,298,240,143,92,78,121,443,1160,1354,901,540,136,685,1231,1174,821,357,241,553,1090,1259,914,440,205,223,649,1204,1239,832,348,114,49,132,456,997,1269,965,529,199,103,208,556,1122,1233,822,379,206,104,123,194,241,365,474,491,547,549,494,425,304,198,115,67,37,19,4,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 […]

Categories
Mastering Development

How to add color border or similar highlight to specifc element of heatmap in python?

I want to highlight specific element in heat map(on both row and column of heatmap) Is their a way to do highlight particular element on both axis . The desire result should look like where the vector element got highlighted on both axis. Or similar to the example given below. I am using seaborn and […]

Categories
Mastering Development

Using Filter function in R. Need to assign NA and keep length of dataset the same for Horse Racing Database

I’m still new to the group and R. I had some really helpful feedback on my last query so hoping I can get some more support with the following: I am working on a horse racing database that at this stage has 4 variables: race horse number, race id, distance of race and the rating […]

Categories
Database Development

T-SQL: how to show the corresponding column’s row to an aggregating function’s result?

Everyone, I have a question – how to show the (possibly ambiguous) column that corresponds to the value retrieved by an aggregating function? Related to the dataset below, the task is to find the DepartmentID with the lowest average Salary. The below sub-query usage retrieves an error: “Column ‘Initial.DepartmentID’ is invalid in the select list […]

Categories
Mastering Development

Pivoting or gathering messy data from wide to long

I need to pivot or gather some wide time-series data that is varying with regard to width. The data comes in quarterly. I do however receive the data in both years-blocks (with with four quarters) and in six month blocks (with only two quarters), i.e. the data is varying with regard to width. My issue […]