All Questions
326 questions
-2
votes
2
answers
103
views
Specific section of string comma separated [closed]
I have a csv file with some numbers and words. Example,
Header
1 This is the first line.
This is the second line.
3 4 This is the third line.
5 6 7 This is a special line.
Trying to separate these ...
-1
votes
1
answer
49
views
Extract multi-level bullet point contents from a tab delimited text file
I have a text file containing two level bullet points in the format below. I have splilted them in lines.
What I would like to do is to extract all contents that belong to the first level bullet ...
0
votes
1
answer
78
views
How to get cleaned data from a noisy tsv file using regex?
I've to clean the data which is stored in a tsv to a dataframe using regex , for reference the data looks like this
ps8trw17rlo16s dh7r1wjixjse72 Theoretical movements expensive. In rural areas, ...
1
vote
3
answers
80
views
can not separate csv file with thousands and comma [duplicate]
I need to read csv file with comma and also string and numbers but number contains comma in it like 1,260. Also csv file is seperated by comma so i can not read file in right way. How could i ...
1
vote
2
answers
60
views
pdfplumber and regex - but regex not extracting data and writing to CSV
Using the following code I am able to obtain the list of transactions in the desired format
import re
import pdfplumber
import csv
line_re = re.compile(r"(\d{2}/\d{2}/\d{4}\s+\d{2}/\d{2}/\d{4}.+)$...
0
votes
0
answers
46
views
Is there a way to slice a dataframe when the characteristic variable has non-printable characters?
I imported multiple CSV files from census data. I was able to successfully bring in the files and append the three files (axis 0) one on top of the other. I was able to put the data into a dataframe ...
-2
votes
4
answers
78
views
how to add a find a year in path file name using re.findall
Using re.findall to find a digits in multiple path files using a loop. However some the files contain other digits or doesn't contain a '20' infant of them. wondering how to just get the files ...
0
votes
3
answers
161
views
Select n columns, with the rest of line added to the end of the last column, using read_csv()
I am using Pandas to read with read_csv() a file with fields separated by spaces. There is a fixed number of columns, but a few lines do not follow the pattern.
The solution I used so far is to add ...
-1
votes
3
answers
101
views
Replacing line breaks within quotes [closed]
I have a TSV file that contain multiple columns, but it doesn't seem to be aligned properly. There are linebreaks between quotes in one column (the column "Examples" in the example). I want ...
1
vote
1
answer
220
views
Python: Regex file search with shutil using an excel file
I have a program I am writing for an internal employee that takes a CSV file and searches a file server for the files listed in the CSV then copys each file to a folder in the desktop. The issue I am ...
1
vote
2
answers
68
views
pandas.read_csv seperator with Regex
I'm struggling how to parse a text file into a pandas dataframe.
I think to use pandas.read_csv(sep='') but I can not figure out the right configuration since the file uses blanks as seperator, but ...
-1
votes
1
answer
48
views
Python Regex String Extraction when the string is a number ranging from 0 to 9,999,999.99 and has either no commas or multiple commas
Im looking for a way to extract this string our of this CSV list. Im thinking i need to change the , as they are giving me a issue but im not sure. the number at the end can rang from 0 to 9,999,999....
0
votes
2
answers
458
views
I want to get the first string before comma on a csv file but also get the string for rows that have no commas (only one tag)
This is my original CSV file
enter image description here
I want to make the genre column only the first tag. when I use
dataframe['genre'] = dataframe['genre'].str.extract('^(.+?),')
it gets the ...
0
votes
2
answers
54
views
How do I use regex within a certain cell in a csv to edit?
I have a CSV with a structure as:
Test CSV:
Column A
Column B
abc-dfcv
rebtgsergbsedrfgesrg
water rdfe egreg
oluiuilegregreg
def fefd
rtjtyujdtgfhndgfhjfh
water edgregerg
Result needed:
Column A
...
0
votes
1
answer
75
views
Extracting data from txt file and importing into a CSV
I have data in a txt file in a format that looks like this.
ScanHeader # 1
position = 1, start_mass= 2.000000, end_mass = 535.010058
start_time = 0.034048, end_time = 0.000000, packet_type = 24
...