I need your help. I had 40k of mobile numbers and i need to do few things: Check if this numbers have tg account Add this account to contact list. Can anybody helps me, how i can do it. Or with examples of codes. Thanks Answer if you are using pyrogram, To check if the entity has a telegram account
Tag: python
Using Environment Variables as Credentials on Heroku
I need to make the “google-credentials.json” file works on heroku it’s working locally by putting the local path on my laptop but in heroku I don’t know how to do it. I search a lot, I found this solutions How to use Google API credentials json on Heroku? but I couldn’t make it w…
Query by computed property in python mongoengine
I wondered if it is possible to query documents in MongoDB by computed properties using mongoengine in python. Currently, my model looks like this: When I do for example SnapshotIndicatorKeyValue .objects().first().snapshot, I can access the snapshotproperty. But when I try to query it, it doesn’t work.…
Accessing Json object values with the Help of a dictionary
I’ve a huge json file which has a lot of nested key value pairs. So I thought I should save the keys as dictionary values and use that dictionary values as keys to access the values from the json file. Say for example: so I thought to access the key morning value, instead of writing I should keep a dict…
Extracting features from dataframe
I have pandas dataframe like this For example if “ex” start to 533,535,545 new variable should be : Sample output : How can i do that ? Answer You can use np.where: Update You can also use your Phone column directly: Note: If Phone column contains strings you can safely remove .astype(str).
Group values of a chosen column into a list when creating a dictionary from a pandas data frame with a non-unique index
I have a dataframe that looks like his I want to get a dictionary structure that looks as follows I have seen this answer. But it seems like overkill for what I want to do as it converts every value of the key inside the nested dictionary into a list. I would only like to convert col1 into a list
Identifying common elements in a list of words
I have list of words in a column where I need to find common elements. For example, list contains words such as, sinazz31 sinazz12 45sinazz sinazz_84 As you can see, the common element is “sinazz”. Is there a way to develop an algorithm in Python to identify such common elements? If the length of the words ar…
Create new dataframe that contain the average value from some of the columns in the old dataframe
I have a dataframe extracted from a csv file. I want to iterate a data process where only some of the columns’s data is the mean of n rows, while the rest of the columns is the first row for each iteration. For example, the data extracted from the csv consisted of 100 rows and 6 columns. I have a
Using a while loop to output a list after user input
I’m new to python and im attempting for my program to output a the variable “movie genre” vertically once a user enters their name. I plan to use a while loop but keep hitting the error “movie_genre”. And perplexed as to how to proceed. Answer You didn’t show error message …
python regex: capture different strings line by line from .txt file
I need to extract names/strings from a .txt file line by line. I am trying to use regex to do this. Eg. In this below line I want to extract the name “Victor Lau”, “Siti Zuan” and the string “TELEGRAPHIC TRANSFER” in three different lists then output them into an excel file…