Category "numpy"

Can't calculate g(x) as Derivative(f(x))

Hello! Problem: I can calculate xp(t) and xh(t) for any given t value, but not for ġ(t). Context: I'm calculating a general solution for a vibration system

How to make boundaries with numpy at mathplot lib

I am trying to generate random numbers from -0.005 to 0.005 and want to give position from 0 to box size enter code here import Numpy as np a= [] velocities=

The Jupyter do not show border lines and grey blocks

everybody. I learn NumPy and pandas with the Jupyter. When printing, it does not show borderlines and grey blocks. Example: Should be: How to solve it? Thank

A faster way than "for loop" - Indexing 3d numpy array by 2d array

I have a 3d (3, 2, 3) array and first dimension(3) is flexible it can be any size. arr = np.array( [[[56, 24, 32], [56, 24, 32]], [[51, 27, 72], [51, 27, 7

ML on apache logs

I am trying to visualize and predict application logs (I am using category model), my label category is on response time, my sample log is on below format 172.1

Deep neural network gives a constant value as output

I have implemented a neural network from scratch. I have taken random values as both input and output. When I use a single layer( with sigmoid activation) the n

mypy fails for numpy sum

This code snippet works: py -c "import numpy; print(numpy.array([[1,2,3],[4,5,6]]).sum(axis=0) % 2)" [1 1 1] But mypy gives an error: py -m mypy -c "import num

How to convert a numpy array with dtype=object to a numpy array of int?

Now I have a numpy array: In [1]: import numpy as np In [2]: a = np.ones(10) * (1 << 64) In [3]: a Out[3]: array([1.8446744073709552e+19, 1.84467440737

Given a matrix, return a list (or generator) of all it's pairwise-neighbors

Let's say i have this matrix: (doesn't have to be squared) a b c d e f g h i I want to return a list, or a generator, of all it's pairwise-neighbors. Meaning:

Saving data in the table

How I can save this: a=1b=2c=3d=4 into the table like this (I do not need header): 1 2 3 4 Thanks.

Exception has occurred: ModuleNotFoundError No module named 'tensorflow.python'

im working on Simple RNN code with python, i want to use keras but when i run the code it show to me ( tensorflow error ), i uninstall tensorflow then i install

Python Script cannot run using Batch File

hihi, I just installed Anaconda3, and my script was able to run smoothly using Spyder. But when I call it using batch file, the below error is show: C:\Users\De

Tensorflow data pipeline stops working during training

I made a Tensorflow pipeline for loading numpy arrays (video data shape (40,160,160,3)). However, it stops working after loading the first x batches. The proble

TypeError: int() argument must be a string, a bytes-like object or a number, not 'Image'

I have a folder with images, I read all the images and resize them from 300x300 to 96x96 with this code: from PIL import Image import os size = (96,96) list_of

How to sort 3d numpy masked array on time axis at each grid i.e at specific latitude and longitude for climate dataset

I have a NetCDF file of Climate dataset having 3D structure with a shape of 20 * 445 * 445 as (time, latitude, longitude) I have read it as numpy.ma.core.Masked

How to combine winter months that span 2 years?

I have a dataframe p90results that contains daily counts of temperature exceedances from 12/01/1952-12/31/2021. I want to create a plot that sums the daily exc

How to write a method to check independence which returns a dictionary of length 3

I having some difficulty to try to understand the question and I am not very sure how to get a method to returns a dictionary of length 3. This is the sample ta

Expand 2-D Numpy integer Array as binary but in parallel

I want to convert arrays of integers to 0 or 1s, padding with 0s if the other array possesses the larger value. Examples: ex1 = np.array([[0],[3]]) => array(

Using numpy.where function with multiple conditions but getting valueError

So I have a dataframe with multiple columns with numbers in them. It looks like this: H C T P R 300 200 500 0.3 500 400 300 0.2 I'm trying to perform operat

np.max() error: TypeError: only integer scalar arrays can be converted to a scalar index

I'm trying to get the np.max() function to work like a relu() function but keep getting this error: >>>np.max(0, np.arange(-5, 5)) -------------------