Categories
Mastering Development

Filling NaN values in pandas after grouping

This question is slightly different from usual filling of NaN values. Suppose I have a dataframe, where in I group by some category. Now I want to fill the NaN values of a column by using the mean value of that group but from different column. Let me take an example: a = pd.DataFrame({ ‘Occupation’: […]

Categories
Mastering Development System & Network

SMART test failures on harddrive

i have probably problem on my system with SMART failures on my harddrive. There is used OS: SLES 11.2 i586. Problem is, that recently there appeared some errors in SMART print of status of my device (smartctl -a /dev/sda) i am attaching. I am interested what mean errors mentioned in last half of print with […]

Categories
Mastering Development

How can I keep track of total transaction amount received by an account each last 6 month?

This is my transaction data. It shows the transactions made from the accounts in from column to the accounts in to column with the date and the amount information data id from to date amount <int> <fctr> <fctr> <date> <dbl> 19521 6644 6934 2005-01-01 700.0 19524 6753 8456 2005-01-01 600.0 19523 9242 9333 2005-01-01 1000.0 […]

Categories
Mastering Development

Pytorch crossentropy loss with 3d input

I have a network which outputs a 3D tensor of size (batch_size, max_len, num_classes). My groud truth is in the shape (batch_size, max_len). If I do perform one-hot encoding on the labels, it’ll be of shape (batch_size, max_len, num_classes) i.e the values in max_len are integers in the range [0, num_classes]. Since the original code […]

Categories
Mastering Development

when we reshape numpy array, how is the stride size inferred?

I have an 1×1024 1-d array (flattened image). To see the image, I want to reshape its size as 32×32. I can easily achieve this by doing x.reshape(-1,32) and it works as I intended. It doesn’t screw the image. It reads the 1d array with 32-width stride each time. Say this time, there are 4 […]

Categories
Mastering Development

Adjust Google Column Chart Data in small chunks

I have plotted google charts as belowenter image description here is there any way by which I can show 5-year charts at a one time and adjust the remaining chart in a slider. <html> <head> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load(‘current’, {‘packages’:[‘bar’]}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ [‘Year’, ‘Sales’, ‘Expenses’, ‘Profit’], [‘2001’, […]

Categories
Mastering Development

find exception number from a list with python [closed]

Example: temp_list = [12, 175, 204, 232, 262, 291, 322, 350, 380, 409, 437, 464, 489, 517, 933] I want remove 12, 933 i dont know how func to do this, please tell me.

Categories
Mastering Development

Pandas: dynamically append dataframe column into a running total dataframe within a loop

I am writing a simulation and I am trying to append the result of EACH ITERATION INTO a dataframe that keep track of all the iterations. While everything works fine with collecting the results, I cannot find a way to append the results into a new column each time. I have been banging my head […]

Categories
Mastering Development

Making A Game in Javascript, Wondering why my object speeds up every-time I press the left or right arrow button

It is just the beginning process of the game, but I am wondering why my rectangle speeds up every time I press the left or right arrow button. I just want to make is move a little and stop when the buttons are released and have the same speed every-time. <body> <canvas height="400" width="400" id="myCanvas"></canvas> […]

Categories
Mastering Development

Need help to display JSON data

I am requesting a JSON data feed and getting a successful return of data. I am trying to create the PHP code to display the results on my website and I’m a bit stuck on part of it. I have spent days trying to figure it out and have done numerous searches. I have shown […]