I have two files for eg input.txt and output.txt. input.txt output.txt i have to compare these two files such a way that if first column between two files matches then i have to check for 2nd column and if both matches then it’s okay and if second column doesn’t match then i have to write that dat…
Tag: python
How can I create Pulsar stream from Python?
How can I create a Kafka stream directly from Python? I know that I need to use GQLAlchemy but I don’t know the exact commands. Answer GQLAlchemy is a fully open-source Python library and Object Graph Mapper (OGM) – a link between graph database objects and Python objects. An Object Graph Mapper o…
How can I create Kafka stream from Python?
How can I create a Kafka stream directly from Python? I know that I need to use GQLAlchemy but I don’t know the exact commands. Answer GQLAlchemy is a fully open-source Python library and Object Graph Mapper (OGM) – a link between graph database objects and Python objects. An Object Graph Mapper o…
locate an a element and click on it in selenium pyhton
I have this page and I want to click on the a element that sends an email(the one that is highlighted in the screenshot below and I have tried to find this element using By.XPATH email = driver.find_element(By.XPATH, “//a[contains(@class, ’email-old-32′)]”).click() and By.CLASS_NAME em…
convert data to 1NF
I have a dataset like this name date singer language phase 1 Yes or No 02.01.20 Benjamin Smith en 1 2 Parabens 01.06.21 Rafael Galvao;Simon Murphy pt;en 2 3 Love 12.11.20 Michaela Condell en 1 4 Paz 11.07.19 Ana Perez; Eduarda Pinto es;pt 3 5 Stop 12.01.21 Michael Conway;Gabriel Lee en;en 1 6 Shalom 18.06.21 …
How to search graph database using Python?
I want to search graphs inside Python without the burden of having to learn a new query language. I extensively use pydantic library and I wonder if the two can work together. Answer You can use GQLAlchemy. It is an open source object graph mapper, and it is created using the pydantic library. You can check t…
How do I find countries where the name has between 4 and 5 letters with regex in python list?
How can I generate a list with regex in python for countries with 4 or 5 letters? I was trying to do this but it returns an empty list: It is an exercise that’s why I can only do it with the module re. Any help will be appreciate. Answer You can use len(w). But if you want to solve
Serialize ‘csv’ file as binary and append to file
How is it possible to achieve the following at the same time in python 3: Serialize column names and numerical data as a binary file Reopen the file and append additional numerical data For example with the following data: My approach with numpy This approach allows to save data and append additional data. Ho…
How do I select the first item in a column after grouping for another column in pandas?
I have the following data frame: Note that the df is grouped by name / name_ID. names can have n scores, e.g. A has 2 scores, whereas B has 3 scores. I want an additional column, that indicates the first score per name / name_ID. The reference_score for the first scores of a name should be NaN. Like this: I
sort string arrays of texts by length python
I have an array that containts elements out of words. I want to have a sorted list at the end. How do I do this in python? Thanks Eg: => Answer You can use a lambda that will sort first by reverse length then by length of the first element: