stats.ttest_ind() vs. “manual” computation of Student’s independent t-test: different results

I am comparing stats.ttest_ind() vs “manual” computation of the same test, and get different results. import numpy as np import pandas as pd import scipy.stats as stats import math stats….

How to put initial condition of ODE at a specific time point using odeint in Python?

How to put initial condition of ODE at a specific time point using odeint in Python? So I have y(0) = 5 as initial condition, following code works:: import numpy as np from scipy.integrate import …

fitting closed curve to a set of noisy points

This is my set of data, where I would like to fit a closed curve to, just like this post array([[ 0.3 , -0.05], [ 0.35, -0.05], [ 0.4 , -0.05], [ 0.45, -0.05], [ 0.5 , -0….

How to use np.unique on big arrays?

I work with geospatial images in tif format. Thanks to the rasterio lib I can exploit these images as numpy arrays of dimension (nb_bands, x, y). Here I manipulate an image that contains patches of …

Scipy minimze with constrains that have no simple expression

I am trying to find the values that minimize a least squares function. The issue is that a solution may be valid or not in a way that cannot be given as a simple expression of the values. Instead, we …

Problem in linear constraints of scipy. All the elements of population is getting rejected

I am using scipy differential evolution. I have to set the following linear constraints. 0

Interpolation of points along the spline using scipy.interpolate.splrep

I’m working on the task of interpolating the points along the lanes in the images. A sample image with annotated points(image not from the actual dataset and spacing between the point is also not …

For loops to iterate through columns of a csv

I’m very new to python and programming in general (This is my first programming language, I started about a month ago). I have a CSV file with data ordered like this (CSV file data at the bottom). …

Extrapolating using Pandas and Curve_fit error func() takes 3 positional arguments but 4 were given

def func(x,a,b): return a*x + b guess = (0.5,0.5,0.5) fit_df = df.dropna() col_params = {} for col in fit_df.columns: x = fit_df.index.astype(float).values y = fit_df[col].values …

Initialize high dimensional sparse matrix

I want to initialize 300,000 x 300,0000 sparse matrix using sklearn, but it requires memory as if it was not sparse: >>> from scipy import sparse >>> sparse.rand(300000,300000,.1) …