I have a cod. I have a docker + python + pytest + selenium + Chrome + selenium host and prefs But it doesn’t work. I want save to file without dialog window. But test don`t save files. How can I understand the reason? And… Downloading files works on Windows, but not docker on linux. P.S I have thi…
Tag: python
Add trend line to datetime matplotlib line graph
I have a pandas dataframe df: And I can plot this easily using plt.plot: But now I want to add a trendline. I tried using some answers: How can I draw scatter trend line on matplot? Python-Pandas Which doesn’t work: Then I found the following question and answer: TypeError: ufunc subtract cannot use ope…
Pandas rolling up column values based upon max value in column when aggregating
I have a problem regarding my pandas data frame which contains row level for users, such as which group they belong to, their country, type, and total number of impressions from that user. An example slice of my df: As you can see, the info is 1 row per user, where users in a group can belong to different cou…
Converting a numpy array of zeros and ones into an array of binary numbers
I am looking for an efficient way of turning into or into The only thing I found so far is np.packbits but this only works with 8bit numbers. However my arrays have shape of around (20e6,20) I could of course do it by hand: But I assume that there is a faster way. Especially if the conversion directly to a
Jupyter notebook cannot find module
I’m trying to load a module called folium into my Jupyter Notebook environment. When I attempt to load this module, a ModuleNotFoundError is returned. When I run !pip list in the same Jupyter Notebook environment, folium is listed amongst my installed modules. How do I successfully load this module? Ans…
Configute tox.ini to ignore library during tests with py27
I have the following tox.ini configuration file: I have update my requirements.txt file in order to upgrade the version of Marshmallow from 3.0.0b14 to 3.10.0; like this: Now my problem is that, when I run tox -e py37 everything works fine, but when I run this command tox -e py27, it fails. I get that the iss…
Plotting barchart in Excel with Python, dynamic categories
I try to get a chart in Excel using Python. The code below works for now but next month a new line will be added. As you can see I now only select until line 64 (categories and values) so if I want to add the next month to the chart, I have to change 64 into 65. Is there
Python Widget with SizePolicy
Why the sizePolicy doesn’t affect on widgets that aren’t in layout? here is an example: But that doesn’t work, if you changed the main window size the red box still has the same size. So how can I make that red box resizeable when the parent (main window) is changing. NOTE: I don’t wan…
Fastest way to create a square nxn matrix from 1d array in numpy
Suppose the following numpy array: I want to know the fastest way to generate the following operation: (1) How to efficiently create matrix “result” (because n >> 0 can be very large) ? (2) Does this matrix have a particular name ? Answer This is a bit faster: cursory benchmarks, nothing sci…
Django Azure SQL ProgrammingError Invalid Object name
I am trying to use Azure SQL with Django by using mssql-django. I get this error during “makemigrations”: django.db.utils.ProgrammingError: (’42S02′, “[42S02] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Invalid object name ‘customer_group_customergroup’. (20…