Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
69 views

Reading an irregular column CSV file using Pandas causes errors

I have a csv file, "==CNAME==" "" "Tool Name","v2.1" "Name:","MATT B" "E-Mail:","[email protected]" "Phone Number:&...
Ξ R Λ Z Ξ R's user avatar
-2 votes
2 answers
101 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 ...
jonson's user avatar
  • 135
-1 votes
3 answers
59 views

I am not able to get print of desired string from this code......it works in pycharm but not in vs code. I dont't understand what is wrong here?

enter image description here I am getting this result in vs code but it is working in Pycharm and I have used the complete path of the file in both softwares... what should i do? is there some setting ...
Divyam Gaur's user avatar
0 votes
1 answer
145 views

Print data of csv file after specific string is found

I am quite new to Python and eager to learn. I want to open and use data from a csv file, but only use the data (four columns of values, seperated by ",") after a specific string (s,s,N,s). ...
JetskiS's user avatar
  • 133
0 votes
1 answer
340 views

Speeding up the code for downloading data from Telegram and saving it to a CSV file

I implemented the following function, which I would like to speed up as much as possible: async def async_update_database(self, source_id: str, source_hash: str, message_id_1: str, message_id_n: str, ...
I.S.M.'s user avatar
  • 131
1 vote
1 answer
433 views

Converting .dat files (inconsistent spacings and delimiters) to .csv files

I am trying to read the Computer and Internet Use data from this link. The datasets in 2019 and 2021 are provided as .csv, .dta, and .dat, which is very convenient. However, the datasets prior to 2019 ...
Thanh Nguyen's user avatar
2 votes
1 answer
95 views

Within extracting text from PDF to txt file the resulting txt file contains double quotes in some lines that I cannot get rid of

When I try to extract text from a PDF to txt file in some cases some lines are clutched with double quotes "" for a reason I do not understand. The problem lies most likely in the way I ...
Inhibitor_Aspirant's user avatar
1 vote
1 answer
136 views

Detect data in txt files, string parse and output as csv file

this is my code. I am working on use code detected a bunch of text files in a folder and then string parse the data output as csv files. Could you please give me some hint on how to do this? I am hard ...
mm mm's user avatar
  • 13
0 votes
0 answers
22 views

How can i read a csv file from a string while i compiled from info in an email? [duplicate]

Im looking to access a csv file from a string which i have compiled from contents in python from an outlook email and some pre defined things. Basically the file location gets defined below as ...
user21637863's user avatar
1 vote
1 answer
82 views

Why is my string being converted to a tuple when I append it to my list? [closed]

I am reading lines from a csv file and using that to initiate instances of a VM class, which is then appended to a list, called vm_list. I have two different ips being appended, "ip_address" ...
Rogelio Cordova's user avatar
1 vote
1 answer
319 views

Pandas string reassignment errors when read from csv but not xlsx

I'm using pandas to read in two datasets and reassign the value column of each. One dataset is a csv, loaded with pd.read_csv(), and the other is xlsx, loaded with Workbook.sheets() from the sxl ...
butterflyeffect's user avatar
3 votes
3 answers
136 views

How can I create a Dataframe based on an unstructured CSV file in Python?

I have a very messy csv file in Python and I need to extract some relevant information from it. Basically, there are 2-3 things that I need there: (1) two numbers separated from comma, positioned in ...
Aldla E Aoepql's user avatar
0 votes
0 answers
41 views

Unable to convert string to float in Python [duplicate]

I'm working with a csv file and one of the columns needs to be converted over to float. This row is giving me an error: 2020-10-26,B5,"1,315.89",,10.55,"1,618.87",,"1,911.11&...
Halloween Maker's user avatar
0 votes
0 answers
32 views

Using Pandas in Python: Splitting one column into three with possible blanks?

Right now, I'm working with a csv file in which there is one column with a string. This file is 'animals.csv'. Row,Animal 1,big green cat 2,small lizard 3,gigantic blue bunny The strings are either ...
Leia_Organa's user avatar
  • 2,064
1 vote
2 answers
90 views

read line and split line of csv file but has comma in a cell

I have a string line and tried split with the delimiter ',' tp = 'A,B,C,"6G,1A",1,2\r\n' tp.split(',') and get the results as with the length of 7 ['A', 'B', 'C', '"6G', '1A"', '1'...
agile's user avatar
  • 77
0 votes
1 answer
778 views

Edit CSV file with Python

I have a CSV that looks like this "String1","variablelengthstring1","No" "String2","variablelengthstring2","No" String1 and string2 does ...
investo me's user avatar
0 votes
1 answer
130 views

Making a dataframe where new row is created after every nth column using only semi colons as delimiters

I have the following string in a column within a row in a pandas dataframe. You could just treat it as a string. ;2;613;12;1;Ajc hw EEE;13;.387639;1;EXP;13;2;128;12;1;NNN XX Ajc;13;.208966;1;SGX;13;.. ...
anarchy's user avatar
  • 5,164
0 votes
1 answer
612 views

Column Type from Str to int or float pandas

I am using group by function of pandas, instead of adding numbers, pandas think it is a string and return like: 3,000,000,000.0092,315,000.00 instead of 3,092,315,000. i have tried several methods of ...
Ahmad's user avatar
  • 43
0 votes
1 answer
149 views

str object is not callable while importing the dataset on jupyter notebook. what to do?

I tried to import the dataset on jupyter notebook. But it indicates error as str object is not callable,even the pathway of the file are obsolutely okay. or Are there any problems with anaconda? help ...
Sudeep 002's user avatar
1 vote
1 answer
2k views

How to resolve TypeError: sequence item 1: expected str instance, int found (Python)?

Seeking for your assistance regarding this issue and I'm trying to resolve it, tried so many syntax but still getting the same error. I got multiple csv files to be converted and I'm pulling the same ...
QuickSilver42's user avatar
0 votes
0 answers
45 views

Python (on replit.com) only allowing one instance of one function to run at a time

Here is some code I'm working on requiring string and the opening and closing of files. #Importing required Packages--------------------------------------------- import string # Importing Datasets----...
BoyAcc's user avatar
  • 303
0 votes
1 answer
115 views

How to write string to csv that contain escape chars?

I am trying to write a list of strings to csv using csv.writer. writer = csv.writer(f) writer.writerow(some_text) However, some of the strings contain a random escape character, which seems to be ...
DOMINi04's user avatar
1 vote
1 answer
77 views

Code returning :.2f as invalid for a str, not sure where I'm missing the Float conversion

Working on a code for Python, where essentially I am taking a csv file and depending on user input, I can print/return the connected information within the csv file. Essentially I'm slowly but surely ...
Deo's user avatar
  • 11
1 vote
2 answers
273 views

Python - Use multiple str.startswith() in a for loop get their specific values

The below function parses multiple csv files in a directory and takes out values using str.startwith(). It works find using 'firstline.startswith('TrakPro')' and 'txt.startswith('Serial')'. However, ...
ksu1980's user avatar
  • 65
-1 votes
1 answer
40 views

Trying to delete a string in a list, but python wont detect it, using a csv file

I am trying to delete certain elements of the beginning of my list, but when I run my code python wont detect the elements. I am currently trying to delete/find a string. my_list = [time,open,high,...
Spencer Burgess's user avatar
0 votes
1 answer
25 views

Splitting a list into strings

I have a variable that contains multiple lists. I'm trying to split the lists into strings so that I can add them to a csv file but I'm not sure how. This is what I have been trying to do. For some ...
amb's user avatar
  • 1
0 votes
1 answer
2k views

Read multiple csv files with Pandas and assign different names [duplicate]

I am inside a directory with a series of .csv files that I would like to assign to their own variable. The idea is that I want to tidy up each dataframe on its own first within a loop, then ...
florence-y's user avatar
-1 votes
1 answer
43 views

String to pandas dataframe Name too long error

Having a comma separated string.When i export it in a CSV file,and then load the resultant CSV in pandas,i get my desired result. But when I try to load the string directly in pandas dataframe,i get ...
S. D. chowdhury 's user avatar
0 votes
0 answers
67 views

Need to convert pipe delimeted file to DataFrame

I have a file which has customer data stored in pipe delimited format: 'NS|0001||MMMMMES & MMMMMELL|||||||||29|08|11||||||||||||AD|01|999999999|2/342 P T MMMMMY 4TH STREET WEST|||MMMMMORIN||31|99|...
cRIsP's user avatar
  • 7
1 vote
1 answer
123 views

How to change from string to list when converting from CSV to JSON?

I found this code in order to convert a CSV file into JSON. What I need is to covert the Policy ID field to a list. Therefore, the PolicyID shouldn't be enclosed into the quote marks "" and ...
Tech Girl's user avatar
1 vote
1 answer
45 views

How to read string as dataframe separating by comma but with irregular quotation marks?

This is a small example of a big csv file. Imagine this csv file contais a text like this one below: import io import pandas as pd text="""A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P "2019,01/...
user026's user avatar
  • 702
0 votes
1 answer
36 views

Code not looping through the rest of my file or resetting the counter

Currently trying to loop through a file with addresses in python, but for some reason instead of looping through the entire file - it stops at the first line. I tried resetting the counter and making ...
Sabrina Sanchez's user avatar
-2 votes
2 answers
490 views

ValueError: could not convert string to float: '1.318.21''

i'm trying to convert data type from object to float, however when I try to convert it shows the error message: ValueError: could not convert string to float: '1.318.21' Here is the code: profkes_na=...
Daniella Ara's user avatar
0 votes
2 answers
91 views

How to explore features of strings PYTHON

I have a table with relative abundances of strings collected elsewhere. I also have a list of features that are associated with the strings. What is the best way to explore each string for each ...
BenWest's user avatar
  • 45
0 votes
1 answer
113 views

python find text in a string from a csv

I open a csv file that is an output form a windows CMD command. I read the csv and assigne a variable, but I can find any word even I'm seeing it. IT seems to be enconde... content of output.txt ( ...
Victor Rodriguez's user avatar
0 votes
2 answers
176 views

Converting comma separated string with key-value form into pandas Dataframe

I would like to convert the following string into a pandas dataframe: data = "key=iApFK, age=58, key=234das, age=64, key=89snkj, age=47" The dataframe would look like this: key ...
John Mantios's user avatar
1 vote
3 answers
648 views

Writing strings to CSV causing issue where the string in CSV is separated by commas (Python)

I am facing an issue that I was not able to resolve so far. I need to save a list of strings into the CSV file. I am able to do it however the strings from each element of the list are separated by ...
Samurajx's user avatar
0 votes
2 answers
839 views

Python Replace special characters in a CSV with specified string

I'm trying to replace multiple strings (with multiple language characters) in a csv file. The following code works assuming that I rename my csv files using the .txt extension and then rename back to ....
Naveed Abbas's user avatar
  • 1,187
0 votes
2 answers
886 views

How to remove double quotes in value reading from csv file

My csv file: Mp4,Mp3,"1234554" My code: csv=csv=b''.join(csv).split(b'\n') for index,row in enumerate(csv): row=re.split(b''',(?=(?:[^'"]|'[^']*'|"[^"]*")*$)''',row) ...
Stay cool's user avatar
2 votes
0 answers
36 views

How do I combine divided strings all on one line in a csv?

I am accessing the Twitter API using Python and the Tweets it is returning are formatted as follows: 'text': 'Sentence 1 of the tweet that needs ' 'to continue onto the second line.\n' ...
Gabe's user avatar
  • 33
0 votes
1 answer
296 views

Find string and print it and the column value beside it

I have many csv files. Each has a headline cell "Total" with a number in the column immediately to the right. Unfortunately, these cells are not always in the same place in the csv file. My ...
dandel1's user avatar
2 votes
1 answer
213 views

How to convert a Python String to a dict without eval

I have a string like this "{""netPrice"":251.6,""totalPrice"":299.4,""calculatedTaxes"":[{""tax"":47.8,""...
Erik's user avatar
  • 91
1 vote
1 answer
865 views

Python replace txt data with csv data

I have two files, one is text file and the other is a csv file. The text file has a string format like this To: {email} From: [email protected] Subject: Deals! Hi {first_name}, I want to ...
Mahmoud Faisal's user avatar
0 votes
1 answer
111 views

How to convert URLs imported from .csv to string - Python

I'm attempting to read URLs from a .csv file to begin a loop. My csv file only contains URLs. While trying to read the URL from the csv file, i'm receiving this error: Message: invalid argument: 'url'...
johns7843's user avatar
0 votes
2 answers
434 views

How to filter and sort specific csv using python

Please help me with the python script to filter the below CSV. Below is the example of the CSV dump for which I have done the initial filtration. Last_name Gender Name Phone city Ford Male Tom 123 ...
Jijin Shaji's user avatar
0 votes
1 answer
371 views

string indices must be integers in a defaultdict, CSV File

I have .csv file, about ramen and brands, varieties and ratings. I want to figure out, which Brand uses the Variety "Tom Yum" the most. I tried it with a defaultdict but i get the error code:...
Melo's user avatar
  • 5
-2 votes
1 answer
100 views

Map string with regular expressions using some delimeter [closed]

Below is my input and I want the output as shown. There are 6 parameters separated by $$$. Basically we have a csv file each line is having 6 different values as, Project Key, Jmp Issue, Summary, ...
user avatar
0 votes
2 answers
938 views

Pandas parse text column

I have a csv table with a column that contains the text from a chat log. Each text row follows the same format of the name of the person and time of the message (with an additional front and back ...
Mustard Tiger's user avatar
-1 votes
3 answers
103 views

how to parse a generated csv string in python

So I have this complex string that has been generated in python whilst parsing a csv file. here is the state of the string right now: [ {'id': 1463, 'name': 'culture clash'}, {'id': 2964, '...
itsMe's user avatar
  • 3
-1 votes
1 answer
114 views

Convert text file to CSV

I have a text file and I want to convert it to a CSV. Input: Tabular Editor 2.15.3 (build 2.15.7767.23827) -------------------------------- Loading model... Running Best Practice Analyzer... ==========...
Mohit Nayar's user avatar

1
2 3 4 5
9