Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: How to verify the give number is valid
Post: RE: How to verify the give number is valid
Regular expression you have matches all the three phone numbers
>>> mblNum =input("Please enter the mobile number to validate\n")
Please enter the mobile number to validate
9898989876
>&g... |
|
anbu23 |
General Coding Help |
3 |
2,412 |
May-16-2020, 02:40 PM |
|
|
Thread: question: finding multiple strings within string
Post: RE: question: finding multiple strings within stri...
>>> words=re.findall(r'<a href="/quote/([^?]+)\?',g2)
>>> words
['dog', 'cat', 'monkey', 'human']
>>> |
|
anbu23 |
General Coding Help |
4 |
3,001 |
May-16-2020, 12:30 PM |
|
|
Thread: HELP: collect path name
Post: RE: HELP: collect path name
show("Images/name.PNG", 100, 'title') |
|
anbu23 |
General Coding Help |
1 |
1,643 |
May-14-2020, 02:42 PM |
|
|
Thread: How to aling the printing statements
Post: RE: How to aling the printing statements
>>> import re
>>> pattern = re.compile('ab')
>>> matcher = pattern.finditer('zxaababaababa')
>>> for match in matcher:
... print("starting index ", str(match.... |
|
anbu23 |
General Coding Help |
4 |
2,326 |
May-14-2020, 02:39 PM |
|
|
Thread: Fixing a code error
Post: RE: Fixing a code error
Can you post code you tried? |
|
anbu23 |
General Coding Help |
5 |
2,777 |
May-14-2020, 07:54 AM |
|
|
Thread: Find index value in List
Post: RE: Find index value in List
>>> [item.index('cat') for item in test if 'cat' in item]
[1]
>>> [item.index('758') for item in test if '758' in item]
[0] |
|
anbu23 |
General Coding Help |
3 |
2,815 |
May-12-2020, 12:47 PM |
|
|
Thread: Sort on basis of (name,age,score)
Post: RE: Sort on basis of (name,age,score)
Try sorted(List of tuples) |
|
anbu23 |
Homework |
9 |
9,566 |
May-12-2020, 09:54 AM |
|
|
Thread: 'numpy.ndarray' object is not callable
Post: RE: 'numpy.ndarray' object is not callable
The error TypeError: 'numpy.ndarray' object is not callable means that you tried to call a numpy array as a function.
distances[i] = distances[p, points[i]] |
|
anbu23 |
Data Science |
1 |
15,273 |
May-12-2020, 08:12 AM |
|
|
Thread: Fixing a code error
Post: RE: Fixing a code error
Dictionary has keys. Check https://www.w3schools.com/python/python_...naries.asp
def rps():
print("This is a rock, paper, scissor game")
time.sleep(3)
move_list = ['Rock', 'Paper', 'Sciss... |
|
anbu23 |
General Coding Help |
5 |
2,777 |
May-12-2020, 07:26 AM |
|
|
Thread: Split string with multiple delimiters and keep the string in "groups"
Post: RE: Split string with multiple delimiters and keep...
>>> import re
>>> regex = re.compile(r'((.)\2*)')
>>>
>>> matches = regex.finditer(".nnddd9999999999ddnn.")
>>> s = []
>>> for match in matches:
.... |
|
anbu23 |
General Coding Help |
4 |
6,542 |
May-11-2020, 02:51 PM |
|
|
Thread: Adding loop results as rows in dataframe
Post: RE: Adding loop results as rows in dataframe
Are you expecting this output?
list2=[(('ATM',), ('ROA',)), (('ATM',), ('ROE',)), (('ATM',), ('NIM',)), (('ATM',), ('ROA', 'ROE'))]
tm_final = {0: 3, 1: 6, 2: 4, 3: 2, 4: 0}
totalrows=sum(tm_final[i]... |
|
anbu23 |
General Coding Help |
2 |
2,200 |
May-09-2020, 10:25 AM |
|
|
Thread: a function to look for dates in a string
Post: RE: a function to look for dates in a string
Check this http://theautomatic.net/2018/12/18/2-pac...in-python/ |
|
anbu23 |
News and Discussions |
6 |
4,045 |
May-09-2020, 10:05 AM |
|
|
Thread: Finding Max and Min Values Associated with Unique Identifiers in Python
Post: RE: Finding Max and Min Values Associated with Uni...
df['ID_Max']= df.groupby(['ID'])['N1'].transform(max)
df['ID_Min']= df.groupby(['ID'])['N1'].transform(min) |
|
anbu23 |
General Coding Help |
1 |
2,065 |
May-08-2020, 12:04 PM |
|
|
Thread: Web scraping read particular section
Post: RE: Web scraping read particular section
>>> import bs4
>>> html_string='''<div class="bhgxx2 col-12-12">
... <div class="MocXoX">
... <div class="_2GiuhO">Specifications</div>
... <div>
... &l... |
|
anbu23 |
Web Scraping & Web Development |
4 |
3,086 |
May-07-2020, 10:48 AM |
|
|
Thread: BeautifulSoup : how to have a html5 attribut searched for in a regular expression ?
Post: RE: BeautifulSoup : how to have a html5 attribut s...
can you post sample html file? |
|
anbu23 |
Web Scraping & Web Development |
2 |
2,638 |
May-07-2020, 08:00 AM |
|
|
Thread: How do I merge df1 and df2 by two columns?
Post: RE: How do I merge df1 and df2 by two columns?
>>> import pandas as pd
>>> df1 = pd.DataFrame({'ID1': [1,2,3],'ID2': ['aa','bb','cc'],'Desc1':['d1','d2','d3']})
>>> df2 = pd.DataFrame({'ID1': [1,2],'ID2': ['aa','bb'],'De... |
|
anbu23 |
Data Science |
1 |
1,699 |
May-07-2020, 07:57 AM |
|
|
Thread: reformatting text with comma separated numbers
Post: RE: reformatting text with comma separated numbers
>>> import re
>>> pat_obj=re.compile('[0-9,]+')
>>> str='foo 4,566 bar 1,234'
>>>
>>> text=pat_obj.findall(str)
>>> for num in text:
... str=str... |
|
anbu23 |
News and Discussions |
4 |
2,655 |
May-07-2020, 06:14 AM |
|
|
Thread: Multiline comments
Post: RE: Multiline comments
Python does not have a separate syntax for multi line comments. You could use # for each line to be commented |
|
anbu23 |
General Coding Help |
6 |
2,777 |
May-06-2020, 04:18 PM |
|
|
Thread: Web scraping read particular section
Post: RE: Web scraping read particular section
Can you post sample html and expected output? |
|
anbu23 |
Web Scraping & Web Development |
4 |
3,086 |
May-06-2020, 11:40 AM |
|
|
Thread: How to calculate column mean and row skip non numeric and na
Post: RE: How to calculate column mean and row skip non ...
>>> import numpy as np
>>> df2
0 2.0
1 5.0
2 NaN
3 2.0
Name: s2, dtype: float64
>>> for i, num in df2.iteritems():
... if not np.isnan(num):
... print(num)... |
|
anbu23 |
General Coding Help |
5 |
4,964 |
May-06-2020, 10:52 AM |