Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Saving variables in memory
Post: RE: Saving variables in memory
(Mar-08-2021, 06:37 PM)snippsat Wrote: (Mar-08-2021, 03:48 PM)pprod Wrote: I understand Python saves variables in memory, right? As it does so, does it create any logs or files with a reference to... |
|
pprod |
General Coding Help |
8 |
3,576 |
Mar-08-2021, 08:24 PM |
|
|
Thread: Saving variables in memory
Post: RE: Saving variables in memory
(Mar-08-2021, 04:36 PM)deanhystad Wrote: What is you question?
Are you wondering how Python makes a connection between a variable name and a value?
Are you asking what kind of structures Python has... |
|
pprod |
General Coding Help |
8 |
3,576 |
Mar-08-2021, 04:44 PM |
|
|
Thread: Saving variables in memory
Post: Saving variables in memory
Hi,
I understand Python saves variables in memory, right? As it does so, does it create any logs or files with a reference to the content of the variables? I am a beginner and I don't understand very ... |
|
pprod |
General Coding Help |
8 |
3,576 |
Mar-08-2021, 03:48 PM |
|
|
Thread: Not rounding to desired decimal places?
Post: RE: Not rounding to desired decimal places?
(Mar-05-2021, 11:04 AM)Gribouillis Wrote: Floating numbers are stored in binary format by the computer. Real numbers such as 0.1 that have a finite number of decimal digits may have an infinite numb... |
|
pprod |
General Coding Help |
2 |
2,572 |
Mar-05-2021, 11:11 AM |
|
|
Thread: Not rounding to desired decimal places?
Post: Not rounding to desired decimal places?
Hi,
I'm trying to get my head round this: I've rounded all items in a list (List A) to 5 decimal places and created a variable (List B) that takes the rounded numbers from List A and adds a constant. ... |
|
pprod |
General Coding Help |
2 |
2,572 |
Mar-05-2021, 10:29 AM |
|
|
Thread: <class 'str'> ?
Post: <class 'str'> ?
Why is that '\d' in a regular expression finds digits but then if those digits are stored in a variable, print(type(variable)) returns <class 'str'>?
import re
string = '''
10.00 22.34 31.23
'... |
|
pprod |
General Coding Help |
2 |
1,737 |
Feb-27-2021, 07:12 PM |
|
|
Thread: For loops & DataFrames
Post: RE: For loops & DataFrames
Thanks, nilamo. You're right, since I only need the big dataframe your suggestion is a more elegant way of doing it. Cheers. |
|
pprod |
General Coding Help |
5 |
2,387 |
Feb-25-2021, 08:23 AM |
|
|
Thread: For loops & DataFrames
Post: RE: For loops & DataFrames
Thanks, maurom82. I generated the df inside the for loop and it worked. However, I read that df.append() copies all the data with every append and so, it makes the process inefficient when looping thr... |
|
pprod |
General Coding Help |
5 |
2,387 |
Feb-22-2021, 04:58 PM |
|
|
Thread: '|' character within Regex returns a tuple?
Post: RE: '|' character within Regex returns a tuple?
(Feb-19-2021, 05:15 PM)bowlofred Wrote: Oops. double posted.
Thanks, bowlofred. That worked fine. I don't think I'd figure that out any time soon.
Thanks guys! |
|
pprod |
General Coding Help |
10 |
5,606 |
Feb-19-2021, 05:22 PM |
|
|
Thread: '|' character within Regex returns a tuple?
Post: RE: '|' character within Regex returns a tuple?
Still no luck. I keep getting the error:
Output:AttributeError: 'tuple' object has no attribute 'strip'Output:AttributeError: 'tuple' object has no attribute 'replace'I suspect it has to do with the c... |
|
pprod |
General Coding Help |
10 |
5,606 |
Feb-19-2021, 05:12 PM |
|
|
Thread: '|' character within Regex returns a tuple?
Post: RE: '|' character within Regex returns a tuple?
(Feb-19-2021, 04:33 PM)eddywinch82 Wrote: Hi pprod,
You might be getting that error, due to the spacing between the quotes for the comma, after item.strip try :-
pattern = [item.strip(',') for ite... |
|
pprod |
General Coding Help |
10 |
5,606 |
Feb-19-2021, 04:41 PM |
|
|
Thread: '|' character within Regex returns a tuple?
Post: '|' character within Regex returns a tuple?
Hi,
Using the '|' character within a Regex is giving me an undesirable result that I have been unable to avoid. For example, consider a 2-page file with the following text in each page:
Page 1:
111A1... |
|
pprod |
General Coding Help |
10 |
5,606 |
Feb-19-2021, 04:17 PM |
|
|
Thread: Conditional RegEx
Post: RE: Conditional RegEx
(Feb-18-2021, 05:49 PM)bowlofred Wrote: flight1_re = re.compile(r'E *\d{3}\s')
for match in flight1_re.findall(text):
flight1 = match(text)
else:
flight = 'NULL'
pri... |
|
pprod |
General Coding Help |
2 |
2,302 |
Feb-19-2021, 09:19 AM |
|
|
Thread: Conditional RegEx
Post: Conditional RegEx
Hi,
I'd like the RegExs below to output 'NULL' when they don't find a match but I haven't figured out how to do this. I'd like to do this so that when I can display flight1 and flight2 in a DataFrame.... |
|
pprod |
General Coding Help |
2 |
2,302 |
Feb-18-2021, 02:10 PM |
|
|
Thread: For loops & DataFrames
Post: For loops & DataFrames
I'm running RegExs on a 13-page PDF file in a Jyputer notebook and I want to display the result in a DataFrame. However, when I execute the code below the DataFrame shows only the result for the last ... |
|
pprod |
General Coding Help |
5 |
2,387 |
Feb-17-2021, 10:54 AM |
|
|
Thread: strip()
Post: RE: strip()
(Feb-16-2021, 12:29 PM)buran Wrote: (Feb-16-2021, 12:18 PM)pprod Wrote: print(repr(Var1)) I get Var1 again:['1234 :A'], ['1234 :B'], ['1234 :C'].not possible, in the best case - you get "['1234 :A... |
|
pprod |
General Coding Help |
8 |
3,472 |
Feb-16-2021, 12:51 PM |
|
|
Thread: strip()
Post: RE: strip()
(Feb-16-2021, 11:58 AM)buran Wrote: (Feb-16-2021, 11:13 AM)pprod Wrote: Var1 is the same as the output: ['1234 :A'], ['1234 :B'], ['1234 :C']
If this is really the case, then you have tuple of lis... |
|
pprod |
General Coding Help |
8 |
3,472 |
Feb-16-2021, 12:18 PM |
|
|
Thread: strip()
Post: RE: strip()
(Feb-16-2021, 10:50 AM)buran Wrote: post sample of Var1, also note the inconsistency in your code - you use Var2 and var2
the output suggest you have nested list of lists.
Thanks, buran. Var1 is the... |
|
pprod |
General Coding Help |
8 |
3,472 |
Feb-16-2021, 11:13 AM |
|
|
Thread: strip()
Post: strip()
Hi,
Var1 is a list and I'd like to strip characters from each item in the list and save the result as a new list called Var2. I can't find a way to do it. The code below seemed to be the logical solut... |
|
pprod |
General Coding Help |
8 |
3,472 |
Feb-16-2021, 10:43 AM |
|
|
Thread: Sorting data
Post: RE: Sorting data
(Jan-21-2021, 01:56 PM)paul18fr Wrote: H
I've found this way
import numpy as np
MyList = ['A', 'D', 'B', 'C']
MyArray = np.array(MyList)
MyArraySorted = MyArray[MyArray[:].argsort()]
MyArraySorte... |
|
pprod |
General Coding Help |
4 |
2,685 |
Jan-31-2021, 06:17 PM |