Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Can property getters and setters have additional arguments?
Post: RE: Can property getters and setters have addition...
Not sure what are you trying to achieve, but please execute the following code:
import numpy as np
class Matrix:
def __init__(self, msize):
self.msize = msize
self.mvalues = np.f... |
|
Askic |
General Coding Help |
2 |
3,049 |
Oct-29-2020, 12:06 PM |
|
|
Thread: change dataframe header with 2 rows
Post: RE: change dataframe header with 2 rows
(Oct-28-2020, 10:22 AM)tonycat Wrote: Hello, I am new to programming, have some questions , thanks ! **biggrin**
I download stock quote from yahoo and return two dataframes, by 2 methods
data1 = ... |
|
Askic |
Data Science |
2 |
2,002 |
Oct-28-2020, 05:32 PM |
|
|
Thread: Dealing with duplicates to an Excel sheet
Post: RE: Dealing with duplicates to an Excel sheet
Quote:So, for example, when the program takes the address and puts them into an Excel sheet two of the addresses are "Main-1303 Yonge St". I'm trying to figure out how to get the code to remove a dupl... |
|
Askic |
Homework |
6 |
3,272 |
Oct-28-2020, 05:16 PM |
|
|
Thread: class homework
Post: RE: class homework
(Oct-28-2020, 12:40 AM)mohan10216 Wrote: Hi I wanted to get some help on how I could solve this python problem as I am just a beginner in python.
allow the user to enter their school code and last n... |
|
Askic |
Homework |
2 |
1,743 |
Oct-28-2020, 05:09 PM |
|
|
Thread: So simple yet not working....
Post: RE: So simple yet not working....
(Oct-27-2020, 12:13 PM)jps2020 Wrote: I'm sorry to say it doesn't work for me, and I'm not sure why.
This is my code, where I've replaced Line 5 with your suggestion, bowlofred:
temperature = (i... |
|
Askic |
General Coding Help |
13 |
4,223 |
Oct-27-2020, 04:59 PM |
|
|
Thread: So simple yet not working....
Post: RE: So simple yet not working....
I'd do something like this:
temperature = input("Insert temperature: ")
print(temperature.translate({ord(i): None for i in 'FCfc'})) |
|
Askic |
General Coding Help |
13 |
4,223 |
Oct-26-2020, 10:44 PM |
|
|
Thread: So simple yet not working....
Post: RE: So simple yet not working....
When execute your code, I get this:
Insert temperature: 35C
35
Insert temperature: 25f
25
So it appears it works, but the general approach is not that good.
What if user enters 27B? |
|
Askic |
General Coding Help |
13 |
4,223 |
Oct-26-2020, 10:37 PM |
|
|
Thread: Solve system of equations
Post: RE: Solve system of equations
Hello Sancho,
please double check your equations. I'm looking your last code. Is it Ar = 1 - omega**2*Cs*Cl or
Ar = 1 - omega**2*Cl*L??? |
|
Askic |
General Coding Help |
19 |
8,949 |
Oct-26-2020, 05:28 PM |
|
|
Thread: Solve system of equations
Post: RE: Solve system of equations
I see,
this looks like as if the constrained optimization would probably do better (since L,C and R cannot be negative)
import math
from scipy.optimize import least_squares
def f(LCR):
# variabl... |
|
Askic |
General Coding Help |
19 |
8,949 |
Oct-26-2020, 10:35 AM |
|
|
Thread: Solve system of equations
Post: RE: Solve system of equations
Sancho_Pansa,
can you please elaborate more about the problem itself. You said you have 3 equations with 3 unknowns. The unknown variables that need to be found are: Cs, L, Rs
So the first equation i... |
|
Askic |
General Coding Help |
19 |
8,949 |
Oct-26-2020, 10:05 AM |
|
|
Thread: Counting the values in the dictionary
Post: RE: Counting the values in the dictionary
I'd do something like this:
dict1 = {
"key1": ["a", "b", "c"],
"key2": ["x", "y", "z"]
}
count = 0
for j in dict1.values():
count += len(j)
print(count)Or the way you started:
count = 0
fo... |
|
Askic |
General Coding Help |
7 |
3,655 |
Oct-26-2020, 09:38 AM |
|
|
Thread: Cannot open url link using urllib.request
Post: RE: Cannot open url link using urllib.request
I'd like just to add that this program works without any exception:
import urllib.request
sp_link = r'https://www.kernel.org/doc/readme/drivers-staging-lustre-README.txt'
count = 0
try:
with url... |
|
Askic |
General Coding Help |
5 |
6,689 |
Oct-25-2020, 04:56 PM |
|
|
Thread: Cannot open url link using urllib.request
Post: RE: Cannot open url link using urllib.request
(Oct-25-2020, 04:22 PM)snippsat Wrote: Use always Requests and not urllib,then avoid error like this.
It also better to downloads the whole file in binary,than doing line be line in requests from a... |
|
Askic |
General Coding Help |
5 |
6,689 |
Oct-25-2020, 04:27 PM |
|
|
Thread: Cannot open url link using urllib.request
Post: RE: Cannot open url link using urllib.request
Yes, I did try that with the following code:
import urllib.request
scarlet_pimpernel_link = r'https://gutenberg.org/cache/epub/60/pg60.txt'
count = 0
try:
with urllib.request.urlopen(scarlet_pimp... |
|
Askic |
General Coding Help |
5 |
6,689 |
Oct-25-2020, 04:03 PM |
|
|
Thread: Cannot open url link using urllib.request
Post: Cannot open url link using urllib.request
Hello Python experts,
when trying to execute this little code snippet
import urllib.request
scarlet_pimpernel_link = r'https://gutenberg.org/cache/epub/60/pg60.txt'
count = 0
with urllib.request.url... |
|
Askic |
General Coding Help |
5 |
6,689 |
Oct-25-2020, 03:46 PM |
|
|
Thread: capture pytest results to a file
Post: RE: capture pytest results to a file
(Oct-16-2020, 12:44 PM)maiya Wrote: Hi,
my_test.py::test_001_mytest PASSED [ 50%]
my_test.py::test_002_mytest PASSED ... |
|
Askic |
General Coding Help |
2 |
5,843 |
Oct-16-2020, 02:21 PM |
|
|
Thread: invalid syntax (BEGINNER)
Post: RE: invalid syntax (BEGINNER)
In addition to what GOTO10 said about (over)write vs append, there is also one more thing you need to read and understand. Please read here!
Especially this part: The main advantage of using a with s... |
|
Askic |
General Coding Help |
21 |
5,516 |
Oct-16-2020, 01:45 PM |
|
|
Thread: Strange syntax error with f-strings
Post: RE: Strange syntax error with f-strings
|
Askic |
General Coding Help |
6 |
4,210 |
Oct-16-2020, 10:40 AM |
|
|
Thread: Strange syntax error with f-strings
Post: RE: Strange syntax error with f-strings
Thank you guys, I know what is the cause of the syntax error. I tried to use escape character '\' just like I would used in f'Sarah\'s... but it didn't work inside the bracket.
Since I prefer to use ... |
|
Askic |
General Coding Help |
6 |
4,210 |
Oct-16-2020, 10:18 AM |
|
|
Thread: Strange syntax error with f-strings
Post: Strange syntax error with f-strings
Hello Python experts,
can someone please explain me why this code produces a syntax error:
favorite_languages = {
'jen': 'python',
'sarah': 'c',
'edward': 'ruby',
'phil': 'python',
}
... |
|
Askic |
General Coding Help |
6 |
4,210 |
Oct-16-2020, 08:55 AM |