text

How to create a table/dataframe/list from part of a text file in Python?

How to create a table/dataframe/list from part of a text file in Python? Question: I have a text file with the following structure: I want to create a table of only the ‘StructName’ and the ‘Volume_mm3’ header in Python, but I am not sure how to do this. The information in the rows with # …

Total answers: 1

split dataframe text column with given strings – NLP

split dataframe text column with given strings – NLP Question: I have a dataframe with a text column in this form: column_description "this section includes: animals: cats and dogs and vegetables but doesn’t include: plants and fruits: coco" "this section includes the following: axis: x and y but doesn’t include: z, k and c" "this …

Total answers: 2

How to turn TXT ASCII to PNG Python

How to turn TXT ASCII to PNG Python Question: I have been trying to solve this problem I have right now. I have tried many many ways to convert txt files to pngs but none has worked for me. I have been wanting to convert the text file below (the content of this file is …

Total answers: 1

Remove space between string after comma in python dataframe column

Remove space between string after comma in python dataframe column Question: df1 ID Col 1 new york, london school of economics, america 2 california & washington, harvard university, america Expected output is : df1 ID Col 1 new york,london school of economics,america 2 california & washington,harvard university,america My try is : df1[Col].apply(lambda x : x.str.replace(", …

Total answers: 4

Removing inverted commas and brackets from python dataframe column items

Removing inverted commas and brackets from python dataframe column items Question: df1 Place Actor [‘new york’,’washington’] [‘chris evans’,’John’] [‘new york’,’los angeles’] [‘kate’,’lopez’] I want to remove brackets and inverted commas from each column items: Expected output: df1 Place Actor new york,washington chris evans,John new york,los angeles kate,lopez My try: cols = [Place,Actor] df1[cols].apply(lambda x : …

Total answers: 1

Python tkinter text widget delete function doesn't work correctly

Python tkinter text widget delete function doesn't work correctly Question: I am creating a calculator app and i added this backslash button to it and here is the function for the number buttons : it works correctly and when i press a number it just adds it to the end of the current number . …

Total answers: 2

Concatenate text file lines with condition in python

Concatenate text file lines with condition in python Question: I have a text file in this format: 0.jpg 12,13,14,15,16 0.jpg 13,14,15,16,17 1.jpg 1,2,3,4,5 1.jpg 2,3,4,5,6 I want to check if the image name is the same and then concatenate those lines into one line with the following format: 0.jpg 12,13,14,15,16 13,14,15,16,17 1.jpg 1,2,3,4,5 2,3,4,5,6 I …

Total answers: 1

How to remove lines that does not end with numbers?

How to remove lines that does not end with numbers? Question: I have a text file Mytext.txt that looks like this, 0 1 A 1 2 T 2 3 A 3 4 B 4 5 A 5 6 6 7 A 7 8 D 8 9 C 9 10 10 11 M 11 12 Z …

Total answers: 1