Categories
Mastering Development

How can we Sort a dictionary

As a part of key I am storing a List and in Value I want to store max and min values of that list. Later there will be many lists like that. I need to sort for the dictionary having minimum possible maximum element value and minimum possible minimum element value Something like var map= […]

Categories
Mastering Development

Java GUI, graphics not moving automatically and also makes copies instead of moving when pressing arrow keys

Ok so I am working on a snake game, right now I am trying to simply make the snake move to the right. But the issue here is the snake isn’t actually moving it just seems to copy itself to the right and also it’s not going to the right automatically you have to keep […]

Categories
Mastering Development

How to convert multidimensional Arraylist to single Arraylist in Java?

[[4, 17, 28, 38, 43, 58, 69, 77, 83], [4, 12, 24, 35, 48, 55, 62, 73, 87], [11, 15, 22, 36, 46, 60, 67, 80, 84]] (which is Arraylist<Arraylist>) how to convert that to this: [4, 17, 28, 38, 43, 58, 69, 77, 83, 4, 12, 24, 35, 48, 55, 62, 73, 87, 11, […]

Categories
Mastering Development

Syntax Error: ‘return’ outside function: my indentations seem to be correct

So first of all im writing a program that will total up all of the values in a list / array and heres what i got so far def go( ann ): total = 0 for i in range(0,len(ann)): total = total+ann[i] return total print ( go( [-99,1,2,3,4,5,6,7,8,9,10,12345] ) ) print ( go( [10,9,8,7,6,5,4,3,2,1,-99] ) […]

Categories
Mastering Development

Numpy.NET Getting Values

I’m trying to "convert" the Keras notebooks made by F. Chollet to C# / .NET applications. You can find them here. I am specifically working on "3.5 – Movie Reviews" as of right now. The problem is, I can’t convert my NDarrays to C# arrays to use the values. I tried this method (in README […]

Categories
Mastering Development

How to get key from the value of dictionary

I have the following set of rules for grading system if 25 < score <= 30, grade = A. if 20 < score <= 25, grade = B. if 15 < score <= 20, grade = C. if 10 < score <= 15, grade = D. if 5 < score <= 10, grade = E. […]

Categories
Mastering Development

Arrange data frame columns by class

Good afternoon , Assume we have the following dataset : dput(head(cylinder)) structure(list(X19910108 = c("19910109", "19910104", "19910104", "19910111", "19910104", "19910111"), X126 = c("X266", "B7", "T133", "J34", "T218", "X249"), TVGUIDE = c("TVGUIDE", "MODMAT", "MASSEY", "KMART", "MASSEY", "ROSES"), X25503 = c(25503L, 47201L, 39039L, 37351L, 38039L, 35751L), YES = c("YES", "YES", "YES", "NO", "YES", "NO"), KEY = c("KEY", "KEY", […]

Categories
Mastering Development

Get all row values from single column

This code is working and retrieving the exact data i need. I just need to output all the row values into a single value; HERE IS THE bit of CODE dfs = pd.read_html(str(tables)) df = dfs[0].iloc[[1,3,5,7,9,11,13,15,17,19],[1]] s = df[‘score’].str.split(‘-‘,expand=True).astype(int) df[‘team_win’] = np.where(s[0] == s[1], 0,s.idxmax(1) + 1) df = df[‘team_win’].drop([9, 11]) HERE IS THE OUTPUT […]

Categories
Mastering Development

Compare two lists in Pandas Dataframe with different length

I have two dataframes with lists which I need to compare in order to know if one row is the same than the other and then add it. The two datasets are: Dataset 1 sex age zip_code 0 F 46 08204 [6, 40, 9, 44, 30] 1 F 40 08205 [33, 41, 48, 50, 30] […]

Categories
Database Development

How do I merge three update query into one single update query

I am trying to update a promotion table with a single update code in sql but i can’t just figure it out. though the three lines of update code can do it but i want to merge the three codes into one. please can someone help me out. thanks "UPDATE promos SET next_promotion = (last_promotion […]