Skip to content
Advertisement

list in dictionary get empty out when coming out of the loop

This is the code I wrote for web scraping purposes. I want to save all data in the dictionary and then save that data into a dataframe. Up to the last iteration, it saves the dictionary, but when coming out of the loop all lists (that are the values of my dictionary) are empty. How can one fix that? This

Selenium – Wait for the ScrollIntoView to finish

I need to scroll to an element and take a screenshot of the page but the driver takes the screenshot before the page is completely scrolled to the element. I’ve used a time sleep in this way but I really don’t want to use sleeps since they are not test-oriented. I’ve tried to wait for the element to be visible

Getting column mean by summing values of another column

I have a Dataframe with three columns Customer, Purchase amount and Purchase date. I need to get sum of Purchase amount of customer purchases for each day, then get mean of purchases for each customer for one month. I’ve tried to use df.pivot_table() but it takes mean of purchases for one day and then mean of purchases for one month.

removing URL from string using python’s re

Using this to try to remove URLs from a string: Unfortunately it works for simple URLs but not for complex ones. So something like http://www.example.com/somestuff.html will be removed but something like http://www.example.com/somestuff.html?query=python etc. will just leave trailing bits behind. I think I’m at the limits of my re knowledge so any help will be much appreciated. Thx. Answer Try: r”https?:[^s]+”

odoo PyCharm configuration / no module named ‘odoo’

I’m newbee in programming and I need some help. I have to work with PyCharm and Odoo, so my point is to configure PyCharm for Odoo debugging. First of all I made a module and a model, it perfectly work with database(i can see and check it). I want PyCharm not to highlight word ‘odoo’, ‘models’ and ‘fields’ by red

How to downcast numeric columns in Pandas?

How to optimize the data frame memory footprint and find the most optimal (minimal) data types dtypes for numeric columns. For example: Expected result: Answer You can use parameter downcast in to_numeric with selectig integers and floats columns by DataFrame.select_dtypes, it working from pandas 0.19+ like mentioned @anurag, thank you:

Advertisement