I am trying to convert one of the dataframes I have to year-week format to use it in my time series modeling, but I am not sure how would I be able to do this? Here is my code: Output- Desired O/p in week column should be in date time format. The datatype was an int in the 1st dataframe,
Tag: python
python-vlc running out of memory after playing multiple songs
I am writing a python program, running on a raspberry pi (PI 3 A+), that plays a song every 10 minutes. I am using python-vlc to play the song through the pi’s headphone jack. PlaySong() is a function that gets called (successfully) every 10 minutes. This works as expected the first 6 times. After 6 tim…
Encountering Fatal Python error when I try to use pip in command prompt
I am a new programmer who is trying to follow this tutorial about pip. In the tutorial, you are asked to go into command prompt and type ‘pip’. You are supposed to get a list of general options and commands. However, when I type pip in my command prompt, I get this instead: (I am using Windows 10 …
How can I make a commmand that goes through a txt file and sends the text that i need?
Im trying to make an api key thingy in discord but i don’t know how to go through txt files one by one for ex test test2 test3 test4 If the first user sends !key it would send test if the 2nd user sends !key it would send test2.And so on. this is what i’ve made so far: But im
Python tkinter How can I created all these Checkbuttons by using a loop?
Is there any way to create all these Checkbuttons “grp_material_1”, “grp_material_2″,”grp_material_…” by using a loop ? I try but got an error that the name (“grp_material_1”, “grp_material_2″…) can not be a variable. I would like to redu…
Animating two circles Python
I have a text file, with the coordinates of two circles on it. I want to produce a live animation of both particles. For some reason the following code crashes The text file that the data is taken from has the columns of X1, Y1, X2 and Y2 where X1 represents the x coordinate of the 1st particle etc. If
python in Rmarkdown using reticulate cannot read packages
I am using R on a MacBook. I have an Rmarkdown document and I’m trying to use reticulate in order to use python within R. First I download the libraries: Next I look at an R chunk and figure out my working directory. Then I write mtcars to my desktop. Then I try to use python instead to read in
Getting all row indices in numpy 2d array where elements in each row exists more than 2 times in entire array
I am working with graph data defined as 2d array of edges. I.e. Defines a graph, all elements define a node id, there are no self loops, it is directed, and no value in a column exists in the other column. Now to the question, I need to select all edges where both ‘nodes’ occur more than once in t…
Reading in file names from a tensor in Tensorflow
Context: I am trying to make a GAN to generate images from a large dataset, and have been running into OOM issues when loading in the training data. In an effort to solve this, I am trying to pass in a list of file directories and read them in as images only when needed. Issue: I do not know how
Constrained Multi-Linear Regression using Gekko
I have a multilinear regression problem where I have the prior information about the range of the output (dependent variable y) – The prediction must always lie in that range. I want to find the coefficients (upper and lower bound) of each feature (independent variables) in order to make the linear regr…