Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: please help
Post: RE: please help

Pandas is the tool best that can deal with a lot of configurations; nonetheless in some cases, other "light" tools can be used (Numpy for instance). Do you have the same number of columns in all rows...
paul18fr General Coding Help 6 419 Apr-10-2024, 09:22 AM
    Thread: Minimize function with SciPy
Post: RE: Minimize function with SciPy

here is the well known Rosembrock test case: 2 variables, unconstraint problem, single (global) minimum. Keep in mind that:several evaluations/iterations are necessary; in your case, 1 iteration = 1 ...
paul18fr General Coding Help 3 336 Apr-05-2024, 07:51 AM
    Thread: Minimize function with SciPy
Post: RE: Minimize function with SciPy

I guess you're using python to:retrieve results from your FEA solver to calculate the cost function value to start the optmization process (with constraints?) Nontheless here I would suggest yo...
paul18fr General Coding Help 3 336 Apr-03-2024, 10:03 AM
    Thread: Variable Explorer in spyder
Post: RE: Variable Explorer in spyder

Because all your variables are local ones (which are removed outside the function). Use debug mode + breakpoints to verify it (ctrl + f5)
paul18fr General Coding Help 1 235 Apr-02-2024, 06:50 AM
    Thread: ndim array
Post: RE: ndim array

Dim=2 because you're using a 2D array; in the following examples, 3 type of arrays have been defined: a vector = 1D array (dim=1) a 3x3 matrix = 2D array (dim=2) a 3D matrix (equivalent to n "layers...
paul18fr Data Science 2 284 Apr-01-2024, 05:42 PM
    Thread: [Numpy] How to store different data type in one numpy array?
Post: RE: [Numpy] How to store different data type in on...

agree with @deanhystad For instance, if the goal is to recover data per type, I would imagine the following if you can use 2 arrays (possible?): import numpy as np Array1 = np.array([['2024-03-22',...
paul18fr Data Science 7 631 Mar-26-2024, 08:39 AM
    Thread: File is not being created with 'w' argument
Post: RE: File is not being created with 'w' argument

With the text file, I would have test something like : import datetime now = datetime.datetime.now() readFileName = now.strftime("%d-%m-%y.txt") dirName = "dataLogging" readFileFullPath = ('E:/...
paul18fr General Coding Help 3 446 Mar-13-2024, 08:50 AM
    Thread: [closed] "checked" variable (attribute?) origin?
Post: RE: [closed] "checked" variable (attribute?) origi...

Ok I think I finally figured out: if I want something to be printed (or checked) when the signal is sent, one need to define a variable that "sets" the boolean. import sys from PySide6.QtWidgets imp...
paul18fr GUI 4 554 Mar-04-2024, 10:32 AM
    Thread: [closed] "checked" variable (attribute?) origin?
Post: RE: "checked" variable (attribute?) origin?

I can understand what the second argument checked in the slot is doing, but from where it comes from? no return, nor variable, nor attribute, etc. I had a quick look at the QmainWindows and QPushButto...
paul18fr GUI 4 554 Feb-28-2024, 04:43 PM
    Thread: [closed] "checked" variable (attribute?) origin?
Post: [closed] "checked" variable (attribute?) origin?

Hi I've found this small snippet, and in the the_button_was_toggled method, i do not understand from where the checked variable (attribute?) come from? Is it an inheritance? Thanks import sys fro...
paul18fr GUI 4 554 Feb-28-2024, 01:08 PM
    Thread: Help!!
Post: RE: Help!!

In addition to what it has previously said, that's the return content which is returned using print (None by default if not specified) def hint_username(username): if len(username) < 3: ...
paul18fr General Coding Help 2 360 Feb-22-2024, 01:43 PM
    Thread: recording textbox data into a variable
Post: RE: recording textbox data into a variable

None of the 2 solutions work for me when line 44 is uncommented; I'm missing something for sure.
paul18fr GUI 4 462 Feb-19-2024, 08:13 PM
    Thread: recording textbox data into a variable
Post: recording textbox data into a variable

Hi This is my very (very) first test to code a GUI and I know it'll be a very (very) long way **wink** . In the following example, printing textbox content works, but I do not figured out how to re...
paul18fr GUI 4 462 Feb-19-2024, 06:13 PM
    Thread: Python3 string slicing
Post: RE: Python3 string slicing

The following code should help you (do additional tests by yourself): Alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X'...
paul18fr General Coding Help 4 629 Feb-16-2024, 08:52 AM
    Thread: Need help with coding project
Post: RE: Need help with coding project

I'm not a specialist myself, but I would have add an additional method (see def getPlant here after) to get the plant name and to check if it is the same as the input string. class Plant: def __i...
paul18fr General Coding Help 4 494 Feb-14-2024, 10:04 AM
    Thread: Convert numpy array to image without loading it into RAM.
Post: RE: Convert numpy array to image without loading i...

Some time ago, I used h5py to record pictures into a h5 file (very usefull and powerfull); in the following example: a basic image is created using matplotlib the image is saved into the h5 file as a...
paul18fr General Coding Help 7 5,914 Feb-08-2024, 09:38 AM
    Thread: Spyder console zoom in not working?
Post: RE: Spyder console zoom in not working?

I've been using Spyder under Windows 10 and Anaconda; I can notice some specific directories exist when using Spyder => if I were you, I would remove all of them prior to open Spyder, in order to "...
paul18fr General Coding Help 2 464 Feb-06-2024, 03:31 PM
    Thread: Python Classes
Post: RE: Python Classes

Two possibilities (not necessary the best ones) class Resister: # variables (dictionaries) outside the constructor bands = { "black": 0, "brown": 1, "red": 2, ...
paul18fr General Coding Help 4 540 Feb-05-2024, 05:01 PM
    Thread: problem usage of static method
Post: RE: problem usage of static method

You're doing the same when using classically "math.factorial" => "class.method" Here you're creating your "OwnMath" class With your own "factorial" method (récursive use) => "OwnMath.factoria...
paul18fr General Coding Help 5 552 Feb-03-2024, 07:43 AM
    Thread: problem usage of static method
Post: RE: problem usage of static method

maybe the following snippet gives you some answers: import math class OwnMath: @staticmethod def factorial(number): if number == 0: return 1 else: return...
paul18fr General Coding Help 5 552 Feb-02-2024, 09:37 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020