I have a dataframe ‘df’ with 36 columns, these columns are plotted onto a single plotly chart and displayed in html format using the code below. I want to iterate through each column and create a subplot for each one. I have tried; I created 6 rows and columns as that would give 36 plots and tried…
Failure to install Sybase package on Windows 10 / Python 3.6
I’m looking to connect to a Sybase db in PyCharm. I’m getting the following errors when installing from available packages and the terminal: Has anyone succesfully installed on Win10? Peter Answer I had the same challenge. I resolved it by using a trial version of the Devart ODBC Driver for ASE av…
Remove timezone (+01:00) from DateTime
I would like to delete the timezone from my dateTime object. Currently i have: 2019-02-21 15:31:37+01:00 Expected output: 2019-02-21 15:31:37 The code I have converts it to: 2019-02-21 14:31:37. Answer In the first line, the parameter utc=True is not necessary as it converts the input to UTC (subtracting one …
How I can upgrade my Ubuntu python3.7 to python3.8 latest version?
I am tried by this command but still, it did not work. Answer pip is not capable of upgrading python – it is for python packages. Use, On Ubuntu. You may also want -dev and -venv: To ensure you have 3.8 pip, virtualenv, and such.
Why is this tkinter program freezing?
I’m having an issue with my GUI freezing, and I don’t know why. The run method is not releasing the lock. Demo program Problem Spam-clicking the progress bar freezes the program. Attempts at debugging I used mttkinter by adding import mttkinter to the import statements and the problem persists. Th…
Black formatter – Ignore specific multi-line code
I would like to ignore a specific multi-line code by black python formatter. Particularly, this is used for np.array or matrix construction which turned ugly when formatted. Below is the example. I found this issue in black github, but that only works for inline command, which is not what I have here. Is ther…
PyTorch embedding layer raises “expected…cuda…but got…cpu” error
I’m working on translating a PyTorch model from CPU (where it works) to GPU (where it so far doesn’t). The error message (clipped to the important bits) is as follows: Here is the full model definition: This type of error typically occurs when there is a tensor in the model that should be on GPU b…
Pandas rolling sum with groupby and conditions
I have a dataframe with a timeseries of sales of different items with customer analytics. For each item and a given day I want to compute: a share of my best customer in last 2 days total sales a share of my top customers (from a list) in last 2 days total sales I’ve tried solutions provided here: for r…
How to remove quote (‘) from the my scraped output
How can i get rid of the quotes in the output. I have tried to used .strip(”) but the output does not seem to change. The current output looks like this: [‘ADANIPORTS.NSn’, ‘ASIANPAINT.NS’, ‘AXISBANK.NS’, ‘BAJAJ-AUTO.NS’, ‘BAJFINANCE.NS’, ̵…
Subprocess call with exit status 128
Essentially, I am trying to use a subprocess call to checkout a git commit at a specific sha hash. However, I keep getting the error subprocess.CalledProcessError: Command ‘[‘git’, ‘checkout’, ’62bbce43e’]’ returned non-zero exit status 128. This is my code belo…