parsing

Unable to parse CSV files using pandas

Unable to parse CSV files using pandas Question: What I am trying to do is parse a lot of csv files using a for loop and append it into a single sheet. But the error related to pandas package keeps coming up after it parses a few files. for file in files: data = pd.read_csv(file,encoding=’iso-8859-1′) …

Total answers: 1

How to get a text of certain elements BeautifulSoup Python

How to get a text of certain elements BeautifulSoup Python Question: I have this kind of html code <tr> <td class="a">…</td> <td class="a">…</td> <td class="a"> <p> <sup> Name Name Name </sup> </p> </td> <td class="a">…</td> <td class="a">…</td> <td class="a"> <p> <sup>25.01.1980</sup> </p> </td> <td class="a">…</td> <td class="a">…</td> </tr> <tr>…</tr> <tr>…</tr> I need to get the …

Total answers: 1

Python parsing numbers out of strings

Python parsing numbers out of strings Question: I have a variety of strings that contain numbers: examples: >=5.0% or <=-6.25% >=6.25% or <=-7.813% <2.5% and >-3.125 >=2.5% or <=-3.125% >=5.0% or <=-6.25% <5.0% or >-6.25% <3.125 and >-3.906% I am trying to figure out if there is a way that I can write a section …

Total answers: 1

Read specific folder's name from folder's path Python

Read specific folder's name from folder's path Python Question: I’m trying to read the folder name at the specific place from the file path. My current code: import os # search for and input multiple files def get_files(source): matches = [] for root, dirnames, filenames in os.walk(source): for filename in filenames: matches.append(os.path.join(root, filename)) return matches …

Total answers: 1

Date search and date output from the same class name when parsing

Date search and date output from the same class name when parsing Question: I’m trying to parse a site. It has the same named classes, while the number of such classes varies from page to page. I’m interested in the class that contains the date, which is written in the following pattern: 24 January 2020. …

Total answers: 2

Regex: getting the follow data into groups

Regex: getting the follow data into groups Question: I’ve got the following 2 records: Input Marvel Comics Presents12 (1982) #125 Marvel Comics Presents #1427 (1988) I want to parse it into the following format using RegEx: Title Year Serial Number Marvel Comics Presents12 (1982) #125 Marvel Comics Presents (1988) #1427 I do know basic RegEx …

Total answers: 1

Parsing Data using Regex. Split it into columns via groups

Parsing Data using Regex. Split it into columns via groups Question: I want to use REGEX to parse my data into 3 columns Film data: Marvel Comics Presents (1988) #125 Spider-Man Legends Vol. II: Todd Mcfarlane Book I (Trade Paperback) Spider-Man Legends Vol. II: Todd Mcfarlane Book I Spider-Man Legends Vol. II: Todd Mcfarlane Book …

Total answers: 1

Using BeautifulSoup to parse html, I am getting unwanted prints. Why is that?

Using BeautifulSoup to parse html, I am getting unwanted prints. Why is that? Question: I am using beautiful soup to parse an HTML document on Jupyter Notebook. This is a sample from the file. Please note that this same HTML sample is repeated multiple times. The below table tags are siblings and are surrounded by …

Total answers: 1

Facing an error while modifying XML file with python

Facing an error while modifying XML file with python Question: I am parsing an XML file and trying to delete a empty node but I am receiving the following error: ValueError: list.remove(x): x not in lis The XML file is as follows: <toc> <topic filename="GUID-5B8DE7B7-879F-45A4-88E0-732155904029.xml" docid="GUID-5B8DE7B7-879F-45A4-88E0-732155904029" TopicTitle="Notes, cautions, and warnings" /> <topic filename="GUID-89943A8D-00D3-4263-9306-CDC944609F2B.xml" docid="GUID-89943A8D-00D3-4263-9306-CDC944609F2B" TopicTitle="HCI …

Total answers: 1