Following image showing Memory Usage: Memory error occurs. I am using Numpy and Python3. I have two numpy arrays of shape (36000,256,256,3) each as X and Y and memory error occurs when I do following code. They are code to prepare training data. Is there another way to do it which uses lesser memory? This is …
resample/interpolate time series with datetimeindex
I have two dataframes each containing one or more time series from the same time frame but sampled at different timestamps. I’d like to merge them into a single one resampled and interpolated with the index of the first. Here’s a sample of the first dataframe: And the second one: In this case the …
How to get a user input for a column in pandas by creating a GUI using tkinter?
I have a dataframe with 3 columns: Date, attribute_one, attribute_two. The date column is blank but the other two columns are filled with some data. how can I use tkinter package to build a GUI which would prompt the user to enter date which will then be eventually stored in the dataframe. Answer Using the tk…
Creating pandas series from array and list
I’m trying to map array data to a list of column names but keep getting this error message This is a sample of the data in a and the list of rows in cols: The endgoal is to create a series showing the coefficients of each feature (represented by the cols list) Answer You array is having an array inside
User needs to move mouse to fire bullet
When the user hits q to fire a bullet, there is no smooth motion. They need to move the mouse around the screen in order for the bullet to travel. I’ve tried looking around StackOverflow, youtube, reorganizing the code. I want the user to hit q and the bullet should fire with a parabola shape smoothly. …
simple comment code won’t collaborate with notification app
my code for comment works fine but as soon as I add notification feature it doesn’t work, while notification kinda works. I’m using django-notification-hq 3rd party app. from here: https://github.com/django-notifications/django-notifications here’s my code views.py urls.py I added this singl…
Mute DEBUG alerts from ‘import pandas’ statement
I’m importing pandas and it continues to throw 7 DEBUG messages. It’s happening in JupyterLab and pythonanywhere. It does not appear when I comment out the pandas import I tried to mute them using: warnings.filterwarnings(“ignore”), to no avail. Tried “from pandas import pandas a…
Creating custom web scraping tool to count unique words in python
I’m trying to create a function that has 2 arguments, a web URL, and a search word. The function should print out the number of times the word is seen on the page. I am currently unsure of what I’m doing wrong, as my output isn’t giving me neither an error nor an output… So if a user t…
How do I get the sum of values under a diagonal in numpy?
Given a 2D rectangular numpy array: I would like to take the sum of all values under the lower left to upper right diagonal , I.E. 8, 9 and 6. What is the best way to accomplish this? The method should work for large arrays too. Answer You can rotate, sum the upper triangle, and subtract the diagonal.
How to use existing login token for telegram web using selenium webdriver
I’m trying to read telegram messages from https://web.telegram.org with selenium. When i open https://web.telegram.org in firefox i’m already logged in, but when opening the same page from selenium webdriver(firefox) i get the login page. I saw that telegram web is not using cookies for the auth b…