content
stringlengths
85
101k
title
stringlengths
0
150
question
stringlengths
15
48k
answers
list
answers_scores
list
non_answers
list
non_answers_scores
list
tags
list
name
stringlengths
35
137
Q: Interactive plot of larger-than-memory binary data file I have larger-than-memory uniform (regularly gridded) 2d binary data which I am trying to interactively plot using any combination of Dask, Datashader and Holoviews. I am open to using other python-based tools, but the internet has led me to these ones for no...
Interactive plot of larger-than-memory binary data file
I have larger-than-memory uniform (regularly gridded) 2d binary data which I am trying to interactively plot using any combination of Dask, Datashader and Holoviews. I am open to using other python-based tools, but the internet has led me to these ones for now. The data files are ~11 GB and consist of a (600000, 4800) ...
[ "I'm not sure precisely what the ask is here, but the HoloViz way of approaching this problem would be to use dask without .persist() or .compute(). The np.memmap approach may also work.\nAnd then you'd use holoviews as described at https://examples.pyviz.org/census/census.html, or hvplot as described at https://hv...
[ 0 ]
[]
[]
[ "bokeh", "dask", "datashader", "holoviews", "python" ]
stackoverflow_0074424612_bokeh_dask_datashader_holoviews_python.txt
Q: How to create dataframe from txt file of column_name: value where rows are delimited by empty line I have a (2GB) txt file as follows column_name_1: value_1_1 column_name_2: value_1_2 column_name_3: value_1_3 column_name_1: value_2_1 column_name_2: value_2_2 column_name_3: value_2_3 Meaning that the rows are...
How to create dataframe from txt file of column_name: value where rows are delimited by empty line
I have a (2GB) txt file as follows column_name_1: value_1_1 column_name_2: value_1_2 column_name_3: value_1_3 column_name_1: value_2_1 column_name_2: value_2_2 column_name_3: value_2_3 Meaning that the rows are delimited by a blank line and in each row the value of a column follows the name of said column after ...
[ "here is one way to do it\n# read-in the csv with : as a delimiter\n# it ends up with a two columns DF\ndf=pd.read_csv('csv2.txt', delimiter=\":\", header=None, names=['col1', 'col2'])\n\n\n# groupby the col1, and aggregate columns2 as list\n# convert it to a dict and then create a dataframe from the dict\ndf2=pd.D...
[ 0 ]
[]
[]
[ "dataframe", "pandas", "python", "python_2.7", "python_3.x" ]
stackoverflow_0074425175_dataframe_pandas_python_python_2.7_python_3.x.txt
Q: Django PasswordResetView does not work for inactive users I have a simple django app where users can create and login to their accounts. When a user is registering for a new account, the user object is created and saved in the database with the is_active flag set to false. Once the user clicks the confirmation ema...
Django PasswordResetView does not work for inactive users
I have a simple django app where users can create and login to their accounts. When a user is registering for a new account, the user object is created and saved in the database with the is_active flag set to false. Once the user clicks the confirmation email, the user object has its is_active flag set to true. I have ...
[ "I was able to solve this by creating my own child of Django's PasswordResetForm and overriding the get_users method which checks if a user is_active.\nclass ResetPasswordForm(PasswordResetForm):\n \n # Override the get_users method and delete the requirement that a user is_active\n # This is to account fo...
[ 1, 0 ]
[]
[]
[ "authentication", "django", "python", "smtp" ]
stackoverflow_0074418171_authentication_django_python_smtp.txt
Q: Is there a short-hand for nth root of x in Python? In maths, if I wish to calculate 3 to the power of 2 then no symbol is required, but I write the 2 small: 3². In Python this operation seems to be represented by the ** syntax. >>> 3**2 9 If I want to go the other direction and calculate the 2nd root of 9 then in...
Is there a short-hand for nth root of x in Python?
In maths, if I wish to calculate 3 to the power of 2 then no symbol is required, but I write the 2 small: 3². In Python this operation seems to be represented by the ** syntax. >>> 3**2 9 If I want to go the other direction and calculate the 2nd root of 9 then in maths I need to use a symbol: 2√9 = 3 Is there a short-...
[ "nth root of x is x^(1/n), so you can do 9**(1/2) to find the 2nd root of 9, for example. In general, you can compute the nth root of x as:\nx**(1/n)\n\nNote: In Python 2, you had to do 1/float(n) or 1.0/n so that the result would be a float rather than an int. For more details, see Why does Python give the \"wrong...
[ 109, 11, 5, 5, 3, 2, 2, 2, 0 ]
[]
[]
[ "math", "operators", "python", "square_root" ]
stackoverflow_0019255120_math_operators_python_square_root.txt
Q: Error while loading a huggingface transformer model to perform text classification I'm training a transformer model by regular training as described in this notebook to classify the questions with their expected answer class. After training the model, I want to see the predictions for some questions, so I wrote th...
Error while loading a huggingface transformer model to perform text classification
I'm training a transformer model by regular training as described in this notebook to classify the questions with their expected answer class. After training the model, I want to see the predictions for some questions, so I wrote the following code: from transformers import pipeline,AutoModel, AutoModelForSequenceClass...
[ "The problem was in the space of Google Drive, it deleted the pytorch.bin file. So there is no error in the code related to the bin file.\n" ]
[ 1 ]
[]
[]
[ "arabic", "attributeerror", "huggingface_transformers", "python", "text_classification" ]
stackoverflow_0074414317_arabic_attributeerror_huggingface_transformers_python_text_classification.txt
Q: ImportError: /usr/lib/aarch64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found I install the kneed package in linux aarch64 architecture in miniconda3. When I import kneed inside python, I got the following error import kneed Traceback (most recent call last): File "<stdin>", line 1, in <module> F...
ImportError: /usr/lib/aarch64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found
I install the kneed package in linux aarch64 architecture in miniconda3. When I import kneed inside python, I got the following error import kneed Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/su/miniconda3/envs/myenv/lib/python3.10/site-packages/kneed/__init__.py", line 4, in ...
[ "Install gcc 12.1 via conda like this:\nconda install gcc=12.1.0\n\nEnsure that its libraries are in the library search path by setting the appropriate environment variable:\nexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/miniconda3/lib\n\n(using the lib of your specific conda environment may also work: $HOME/minico...
[ 0, 0, 0 ]
[]
[]
[ "numpy", "python", "tensorflow" ]
stackoverflow_0073317676_numpy_python_tensorflow.txt
Q: How to create for loop for monthly budget program? I am trying to create a for loop program that prompts the user to enter how many months they want to monitor their budget for, prompts for the amount they spent during the month, and their budget. It should tell the user how much they spent, their budget, and if t...
How to create for loop for monthly budget program?
I am trying to create a for loop program that prompts the user to enter how many months they want to monitor their budget for, prompts for the amount they spent during the month, and their budget. It should tell the user how much they spent, their budget, and if they were over or under the budget. this is what I have s...
[ "To iterate from 1 to the number of months inclusive, you can use range(1,numMonths+1). The number of months should be an integer or else you will probably get an error from range(). You can get the amount under or over budget by subtracting one amount from the other. The following script has these changes and does...
[ 0 ]
[]
[]
[ "for_loop", "loops", "python", "while_loop" ]
stackoverflow_0074425389_for_loop_loops_python_while_loop.txt
Q: How to fix my output of this code to return "correct"? i’m a beginner and i’m just starting to learn how to python code. I’m having trouble with this one. Whenever I type in the correct result, it shows that it is incorrect still. I'm wondering what i'm missing or what I did wrong. array1 = ([5, 10, 15, 20, 25]) ...
How to fix my output of this code to return "correct"?
i’m a beginner and i’m just starting to learn how to python code. I’m having trouble with this one. Whenever I type in the correct result, it shows that it is incorrect still. I'm wondering what i'm missing or what I did wrong. array1 = ([5, 10, 15, 20, 25]) print("Question 2: What is the reverse of the following arra...
[ "When you use input() the assigned variable will default to type string therefore, always returning false when compared to an array.\nHowever, if you plan to return a list in a string format, you should try using ast.literal_eval() to evaluate the string you passed as answer to the input function.\nConsider:\nimpor...
[ 1, 0, 0, 0 ]
[]
[]
[ "arrays", "computer_science", "python" ]
stackoverflow_0074425488_arrays_computer_science_python.txt
Q: While loop and if statements I have a string and k = number, which is the length of a substring that has the same letter repeated in a row. How can I have the wanted output only? The expected output: For length 3, found the substring ddd! my_string = 'aabadddefggg' k = 3 x = 1 c = 1 while x < len(my_string): ...
While loop and if statements
I have a string and k = number, which is the length of a substring that has the same letter repeated in a row. How can I have the wanted output only? The expected output: For length 3, found the substring ddd! my_string = 'aabadddefggg' k = 3 x = 1 c = 1 while x < len(my_string): if my_string\[x\] == my_string\[x...
[ "get rid of the break after didnt find the string. Your code means that once you evaluate c == k you will always break beacuse you have the break in both the if and the else meaning you can never reach x += 1\nmy_string = 'aabadddefggg'\nk = 3\nx = 1\nc = 1\nwhile x < len(my_string):\n if my_string[x] == my_stri...
[ 0, 0 ]
[]
[]
[ "if_statement", "python", "while_loop" ]
stackoverflow_0074425591_if_statement_python_while_loop.txt
Q: How to get the same number of frames from Librosa STFT? I'm trying to create a dataset that consists of Numpy arrays generated from WAV files. I'm able to get all of the individual WAV files into Numpy arrays, but I can't combine into a single Numpy array because they are all slightly different shapes. First dimen...
How to get the same number of frames from Librosa STFT?
I'm trying to create a dataset that consists of Numpy arrays generated from WAV files. I'm able to get all of the individual WAV files into Numpy arrays, but I can't combine into a single Numpy array because they are all slightly different shapes. First dimension is that same for all, but the second dimension(number of...
[ "Standardizing the size along the time-dimension is a common preprocessing step in audio machine learning. So the librosa library includes a handy function for it: librosa.util.fix_length.\n" ]
[ 0 ]
[]
[]
[ "librosa", "numpy", "python" ]
stackoverflow_0074409387_librosa_numpy_python.txt
Q: Building Flask server - installation error code 1 (MarkupSafe-python setup.py egg_info) First of all, I run on Python3.6 and trying to install Flask 1.1x. (I don't wanna upgrade Python) So, I'm into the active environment venv folder trying to install Flask 1.1x (apparently is the only one that can run on Python3....
Building Flask server - installation error code 1 (MarkupSafe-python setup.py egg_info)
First of all, I run on Python3.6 and trying to install Flask 1.1x. (I don't wanna upgrade Python) So, I'm into the active environment venv folder trying to install Flask 1.1x (apparently is the only one that can run on Python3.6). The error is always the same: Complete output from command python setup.py egg_info: ...
[]
[]
[ "upgrading pip sort out my problem python -m pip install --upgrade pip\n" ]
[ -1 ]
[ "pip", "python", "setuptools" ]
stackoverflow_0074425620_pip_python_setuptools.txt
Q: How to run a Python Azure Function with a private Azure Artifact dependancy I am trying to deploy a Python Azure Function into an Azure Function App. The function __init__.py script imports an SDK which is stored as an Azure Artifact Python Package. I can build and publish the function to Azure successfully using ...
How to run a Python Azure Function with a private Azure Artifact dependancy
I am trying to deploy a Python Azure Function into an Azure Function App. The function __init__.py script imports an SDK which is stored as an Azure Artifact Python Package. I can build and publish the function to Azure successfully using a pipeline from the DevOps repo, however the function fails at the import mySDK l...
[ "PIP_EXTRA_INDEX_URL wored for me.\nWhat was the issue you received when you tried it?\nBasically before you deploy your function, you should alter the application settings on your function app and add the PIP_EXTRA_INDEX_URL key-value pair. Then add the python package in your azure artifacts feed to the requiremen...
[ 1 ]
[]
[]
[ "azure", "azure_devops", "azure_functions", "python" ]
stackoverflow_0071145274_azure_azure_devops_azure_functions_python.txt
Q: Element showing on screen but only added to DOM after Inspection or clicking I'm trying to use selenium to download reports from Google Ads, the script is working fine until I try to click the Campaign-wide target button in the image, It's not showing in the DOM and selenium can't see it until I click/inspect it t...
Element showing on screen but only added to DOM after Inspection or clicking
I'm trying to use selenium to download reports from Google Ads, the script is working fine until I try to click the Campaign-wide target button in the image, It's not showing in the DOM and selenium can't see it until I click/inspect it that it's accessible. I tried to switch frames and search for it but to no avail,...
[ "The Solution was to simulate my interaction using ActionChains https://www.selenium.dev/documentation/webdriver/actions_api/,\nCode:\nselect_click = ActionChains(self.driver)\nselect_click.move_to_element(campaign_sim_target_dropdn)\nselect_click.send_keys(Keys.ARROW_DOWN)\nselect_click.send_keys(Keys.ENTER)\nsele...
[ 1 ]
[]
[]
[ "google_ads_api", "python", "selenium" ]
stackoverflow_0074423265_google_ads_api_python_selenium.txt
Q: Correlation Matrix in pandas showing only few columns I have a dataframe with the following columns. When I do correlation matrix, I see only the columns that are of int data types. I am new to ML, Can someone guide me what is the mistake I am doing here ? A: As you correctly observe and @Kraigolas states from ...
Correlation Matrix in pandas showing only few columns
I have a dataframe with the following columns. When I do correlation matrix, I see only the columns that are of int data types. I am new to ML, Can someone guide me what is the mistake I am doing here ?
[ "As you correctly observe and @Kraigolas states from the docs\n\nnumeric_onlybool, default True\nInclude only float, int or boolean data.\n\nMeaning that by default will only compute values from numerical columns. You can change this by using:\ndf.corr(numeric_only=False)\n\nHowever, this means pandas will try to c...
[ 2, 1, 1 ]
[]
[]
[ "pandas", "python", "sklearn_pandas" ]
stackoverflow_0074425579_pandas_python_sklearn_pandas.txt
Q: Why isn't my class program working? (python) I'm trying to make a class with function statement so I can learn how to make cleaner code. I keep getting 'userInput' is not defined when I defined it in my main program. Why? """ class ShippingCharges: def __init__(self, userInput=None): self.userInput = u...
Why isn't my class program working? (python)
I'm trying to make a class with function statement so I can learn how to make cleaner code. I keep getting 'userInput' is not defined when I defined it in my main program. Why? """ class ShippingCharges: def __init__(self, userInput=None): self.userInput = userInput def getPrice (self): if (us...
[ "Change userInput to self.userInput as it is a class variable\n" ]
[ 2 ]
[]
[]
[ "class", "function", "if_statement", "python" ]
stackoverflow_0074425700_class_function_if_statement_python.txt
Q: Why do we use __init__ in Python classes? I am having trouble understanding the Initialization of classes. What's the point of them and how do we know what to include in them? Does writing in classes require a different type of thinking versus creating functions (I figured I could just create functions and then ju...
Why do we use __init__ in Python classes?
I am having trouble understanding the Initialization of classes. What's the point of them and how do we know what to include in them? Does writing in classes require a different type of thinking versus creating functions (I figured I could just create functions and then just wrap them in a class so I can re-use them. W...
[ "By what you wrote, you are missing a critical piece of understanding: the difference between a class and an object. __init__ doesn't initialize a class, it initializes an instance of a class or an object. Each dog has colour, but dogs as a class don't. Each dog has four or fewer feet, but the class of dogs doesn't...
[ 316, 28, 6, 5, 4, 3, 3, 2, 0 ]
[]
[]
[ "class", "python" ]
stackoverflow_0008609153_class_python.txt
Q: How to Add Another Item in A List That's A Value for a Dictionary if the Key has already been used Okay, so to preface this this uses File Input and Output which I super have no idea what I'm doing with. So, basically, I have a data file that's like name, date, time name, date, time name, date, time etc. With each...
How to Add Another Item in A List That's A Value for a Dictionary if the Key has already been used
Okay, so to preface this this uses File Input and Output which I super have no idea what I'm doing with. So, basically, I have a data file that's like name, date, time name, date, time name, date, time etc. With each value being a string. And right now I have it transferring into a dictionary that's like {"name1": ["ti...
[ "The tricky structure of your data file is tripping you up. I suggest destructuring the 4 fields into 4 named variables to make it easier to keep them straight:\na = {}\nwith open(\"datafile.txt\") as f:\n for line in f:\n fname, lname, time, date = line.strip().split(\", \")\n a.setdefault(f\"{fn...
[ 1 ]
[]
[]
[ "dictionary", "python" ]
stackoverflow_0074425691_dictionary_python.txt
Q: How do I split audio in python [PYDUB] I am trying to split the audio of multiple audio files can you tell me where I am going wrong thanks :) from pydub import AudioSegment import os folder_number = 1 folder_number_str = str(folder_number) folder_type = 'short/' audio_file_dir = os.listdir('for_analysis/' + folde...
How do I split audio in python [PYDUB]
I am trying to split the audio of multiple audio files can you tell me where I am going wrong thanks :) from pydub import AudioSegment import os folder_number = 1 folder_number_str = str(folder_number) folder_type = 'short/' audio_file_dir = os.listdir('for_analysis/' + folder_type + folder_number_str)[0] audio_dir = '...
[ "To get this to work I reinstalled FFMPEG using suggestions from https://github.com/jiaaro/pydub/issues/450 and @NickODell below is the adapted code\nfrom pydub import AudioSegment\n import os\n\n folder_number = 1\n while folder_number <50:\n folder_number_str = str(folder_number)\n folder_t...
[ 0 ]
[]
[]
[ "pyaudio", "pydub", "python", "python_3.x" ]
stackoverflow_0074416219_pyaudio_pydub_python_python_3.x.txt
Q: Create a function in python that replaces "to be honest" in a sentence with "TBH" Create a function in python that replaces at least four different words or phrases with internet slang acronyms such as LOL, OMG, TBH. For example, if the user enters a sentence "Oh my god, I am scared to be honest." The output shoul...
Create a function in python that replaces "to be honest" in a sentence with "TBH"
Create a function in python that replaces at least four different words or phrases with internet slang acronyms such as LOL, OMG, TBH. For example, if the user enters a sentence "Oh my god, I am scared to be honest." The output should be "OMG I am scared TBH". The program must not use any built-in find, replace, encod...
[ "I cannot see any python errors that your code will actually produce, given the number of guard clauses, so I will assume what you mean by error is actually the program not working as you intended.\nWith that in mind, the main problem with your code is that you have nested for loops. This means that for any one cha...
[ 1, 0 ]
[]
[]
[ "indexing", "python" ]
stackoverflow_0074424708_indexing_python.txt
Q: how to divide this into class and object Loginform.py and Registrationform.py heres the starting code of the gui. from tkinter import * from PIL import ImageTk, Image # type "Pip install pillow" in your terminal to install ImageTk and Image module import sqlite3 from tkinter import messagebox, Tk window = Tk() ...
how to divide this into class and object Loginform.py and Registrationform.py
heres the starting code of the gui. from tkinter import * from PIL import ImageTk, Image # type "Pip install pillow" in your terminal to install ImageTk and Image module import sqlite3 from tkinter import messagebox, Tk window = Tk() window.rowconfigure(0, weight=1) window.columnconfigure(0, weight=1) window.state(...
[ "There's nothing unique to tkinter in this question. Just using the basic rules of python, put the class in a file, then import the class into another file.\nFor example, create a file named LoginForm.py. In it put a class that has the log in form. This class should inherit from tkinter's Frame class so it can be a...
[ 0 ]
[]
[]
[ "class", "object", "python", "tkinter" ]
stackoverflow_0074423937_class_object_python_tkinter.txt
Q: I have an error message with server_id = ctx.message.guild.id I have a problem and I can't find a solution. When I put server_id = ctx.message.guild.id in the following python source code, the terminal shows me: nextcord.errors.ApplicationInvokeError: Command raised an exception: AttributeError: 'NoneType' object ...
I have an error message with server_id = ctx.message.guild.id
I have a problem and I can't find a solution. When I put server_id = ctx.message.guild.id in the following python source code, the terminal shows me: nextcord.errors.ApplicationInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'guild' Just because I put my command in /command...
[ "You should decide on one library to use first off, I recommend discord.py, but it's up to you.\nAnyways, the problem is that there is no message attached to the context, but you can just do ctx.guild.id and it will work fine (Assuming you actually have a correct if statement).\n" ]
[ 0 ]
[]
[]
[ "discord.py", "nextcord", "python" ]
stackoverflow_0074424743_discord.py_nextcord_python.txt
Q: Control the order of the database columns before proceeding to makemigrations and migrate in Django Is there a way to control the database column ordering, directly within a Django model? I know I can manually edit the migration file after makemigrations to adapt it to my needs, but is there a way to do so, prior ...
Control the order of the database columns before proceeding to makemigrations and migrate in Django
Is there a way to control the database column ordering, directly within a Django model? I know I can manually edit the migration file after makemigrations to adapt it to my needs, but is there a way to do so, prior to the makemigrations call? This can be especially useful when initializing the database.
[ "There is still not a way, and this is by design. I wish there was a way!\n" ]
[ 0 ]
[]
[]
[ "django", "django_migrations", "django_models", "python" ]
stackoverflow_0074425545_django_django_migrations_django_models_python.txt
Q: Panda Query Error with Terminal Menu String This is a simple example from a more complex python script I'm writing, but this shows the essential problem I hope I can get help on. I have a list that I'm putting in a dataframe, like this: data={'Name':['Tom', 'Bob', 'Karen', 'Bill', 'Stefan', 'Jack', 'Bob', 'Debbie'...
Panda Query Error with Terminal Menu String
This is a simple example from a more complex python script I'm writing, but this shows the essential problem I hope I can get help on. I have a list that I'm putting in a dataframe, like this: data={'Name':['Tom', 'Bob', 'Karen', 'Bill', 'Stefan', 'Jack', 'Bob', 'Debbie'], 'Points':[20,23,41, 17, 24, 7, 52, 60]...
[ "It turns out the line:\nqueryStr= \"'{}'\".format(queryStr)\nwas causing the problem. Once this is deleted it works as expected\n" ]
[ 0 ]
[]
[]
[ "filtering", "pandas", "python" ]
stackoverflow_0074425525_filtering_pandas_python.txt
Q: How to use setUp from pytest as an async method? I have the following code: import asyncio import pytest from mymodule import myasyncfunction from unittest import TestCase class TestDummy(TestCase): def setUp(self): await myasyncfunction() @pytest.mark.asyncio async def test_dummy(self): ...
How to use setUp from pytest as an async method?
I have the following code: import asyncio import pytest from mymodule import myasyncfunction from unittest import TestCase class TestDummy(TestCase): def setUp(self): await myasyncfunction() @pytest.mark.asyncio async def test_dummy(self): assert False The test passes because it doesn't...
[ "The solution is to define a method as a fixture instead of using the traditional setUp() method. \nimport pytest\n\nclass TestClass:\n @pytest.fixture\n def setup(self):\n pass\n\n @pytest.mark.asyncio\n async def test_some_stuff(setup):\n pass\n\nAs you discovered, with pytest-asyncio th...
[ 2, 0 ]
[]
[]
[ "pytest", "pytest_asyncio", "python" ]
stackoverflow_0059353105_pytest_pytest_asyncio_python.txt
Q: How do I take the average (mean) of inputted numbers in Python? I would like to take create a code that takes an input of numbers, and then takes the average (mean) of these numbers. So far, I have this: from statistics import mean numbers=int(input("Enter some numbers. Seperate each number by a space: ") averag...
How do I take the average (mean) of inputted numbers in Python?
I would like to take create a code that takes an input of numbers, and then takes the average (mean) of these numbers. So far, I have this: from statistics import mean numbers=int(input("Enter some numbers. Seperate each number by a space: ") average=mean(grades) print(average) Running this code gives me an error st...
[ "Your'e trying to convert the whole input to one int. Get the input string then split it and convert to ints individually.\nfrom statistics import mean\n\nuser_input = input(\"Enter some numbers. Seperate each number by a space: \").strip()\n\nnumbers = [int(x) for x in user_input.split(' ')]\n\naverage = mean(numb...
[ 1, 0, 0, 0 ]
[]
[]
[ "input", "mean", "python", "spyder", "statistics" ]
stackoverflow_0074425899_input_mean_python_spyder_statistics.txt
Q: Inheriting from IntEnum: PyLance reports "Literal[...]" is incompatible with "property" Here is the code that cause the issue. This class has lots of other methods but only this one is at cause. from enum import IntEnum class Position(IntEnum): LOW = 0 HIGH = 1 ### String representation ### ...
Inheriting from IntEnum: PyLance reports "Literal[...]" is incompatible with "property"
Here is the code that cause the issue. This class has lots of other methods but only this one is at cause. from enum import IntEnum class Position(IntEnum): LOW = 0 HIGH = 1 ### String representation ### @property def string(self) -> str | None: """Return 'low' or 'high'""" i...
[ "As @chepner alluded to, enum members are constants. Position.HIGH will always be 1, and the enum machinery will block attempts to change its value.\nAs an aside, the anti-pattern of self.value == self.ENUM_MEMBER will no longer work in 3.14.\n" ]
[ 0 ]
[]
[]
[ "enums", "pylance", "python", "python_3.10", "python_typing" ]
stackoverflow_0074424658_enums_pylance_python_python_3.10_python_typing.txt
Q: Calculating CRC16 in Python I'm trying to evaluate appropriate checksum based on CRC-16 algorithm using crcmod Python module and 2.7 version of Python interpreter. The checksum parameters are: CRC order: 16 CRC polynomial: 0x8005 Inital value: 0xFFFF Final value: 0x0000 Direct: True Code: crc16 = crcmo...
Calculating CRC16 in Python
I'm trying to evaluate appropriate checksum based on CRC-16 algorithm using crcmod Python module and 2.7 version of Python interpreter. The checksum parameters are: CRC order: 16 CRC polynomial: 0x8005 Inital value: 0xFFFF Final value: 0x0000 Direct: True Code: crc16 = crcmod.mkCrcFun(0x18005, rev=False, in...
[ "crcmod is working fine. You are not giving it the three bytes you think you are giving it. Your str(int(0x5A0001)) is providing seven bytes, which are the ASCII characters 5898241 — the conversion of 0x5a0001 to decimal.\nTo feed it the bytes 0x5a 0x00 0x01, you would instead (as one approach):\nprint hex(crc16(\...
[ 5, 3, 1, 0 ]
[ "Here is a code you can use to generate a crc 16 for a data packet to send\ndef crc16_generator_hex(data: list[int]) -> str:\n\"\"\"CRC-16-MODBUS Hex Algorithm\nParameters\n----------\ndata : list[int]\n Data packets received.\nReturns\n-------\nstr\n CRC as hex string\n\nRaises\n----------\nValueError\n I...
[ -1 ]
[ "crc16", "python", "python_2.7" ]
stackoverflow_0035205702_crc16_python_python_2.7.txt
Q: How to drop row in pandas if column1 = certain value and column 2 = NaN? I'm trying to do the following: "# drop all rows where tag == train_loop and start is NaN". Here's my current attempt (thanks Copilot): # drop all rows where tag == train_loop and start is NaN # apply filter function to each row # return True...
How to drop row in pandas if column1 = certain value and column 2 = NaN?
I'm trying to do the following: "# drop all rows where tag == train_loop and start is NaN". Here's my current attempt (thanks Copilot): # drop all rows where tag == train_loop and start is NaN # apply filter function to each row # return True if row should be dropped def filter_fn(row): return row["tag"] == "train_...
[ "using apply is a really bad way to do this actually, since it loops over every row, calling the function you defined in python. Instead, use vectorized functions which you can call on the entire dataframe, which call optimized/vectorized versions written in C under the hood.\ndf = df[~((df[\"tag\"] == \"train_loop...
[ 2, 1 ]
[]
[]
[ "pandas", "python" ]
stackoverflow_0074425998_pandas_python.txt
Q: django deply support LANGUAGES (local vs host) I was programming my Django site normally .. and I set some data in the database in the Arabic language it was work find in my locl pc useing pycharm editer On my local pc its looks like this: photo 1 and then I buy sharing host on Namecheap and deploy my site after e...
django deply support LANGUAGES (local vs host)
I was programming my Django site normally .. and I set some data in the database in the Arabic language it was work find in my locl pc useing pycharm editer On my local pc its looks like this: photo 1 and then I buy sharing host on Namecheap and deploy my site after entering some data into my database in the Arabic lan...
[ "I fix this\nthe problem is not from the template or anything it comes from Mysql\nI go to PHPMyAdmin and change it :from \"latin1\" to :COLLATE utf8mb4_unicode_ci\n" ]
[ 0 ]
[]
[]
[ "character_encoding", "deployment", "django", "python" ]
stackoverflow_0074425718_character_encoding_deployment_django_python.txt
Q: Cannot replace substrings by using zip method To all, I have a dataframe with 104959 rows and 298 columns. To replace substrings in particular column I've tried: # 위에서 치환한 문자열들을 맞게 바꿔줍니다 df['EVENT_DTL'] = df['EVENT_DTL'].replace(dict(zip(['발견장소_1','발견장소_2','발견장소_3','발견장소_4','발견장소_5','발견장소_6','발견장소_7','발견장소_8','발견장...
Cannot replace substrings by using zip method
To all, I have a dataframe with 104959 rows and 298 columns. To replace substrings in particular column I've tried: # 위에서 치환한 문자열들을 맞게 바꿔줍니다 df['EVENT_DTL'] = df['EVENT_DTL'].replace(dict(zip(['발견장소_1','발견장소_2','발견장소_3','발견장소_4','발견장소_5','발견장소_6','발견장소_7','발견장소_8','발견장소_9'], ['자택','...
[ "Pass regex = True\nd = dict(zip(['발견장소_1','발견장소_2','발견장소_3','발견장소_4','발견장소_5','발견장소_6','발견장소_7','발견장소_8','발견장소_9'],\n ['자택','친척 집','지인 집','학교 혹은 직장','공공장소','숙박업소','교외 혹은 야산','병원','']))\ndf['EVENT_DTL'] = df['EVENT_DTL'].replace(d, regex = True)\n\n" ]
[ 0 ]
[]
[]
[ "pandas", "python" ]
stackoverflow_0074426046_pandas_python.txt
Q: How to iterate through inputs with a while loop? This problem has been posted before, but I'm having trouble translating what I've currently coded into a while loop as per professor instructions. The problem is: Write a program that first gets a list of integers from input. The input begins with an integer indicat...
How to iterate through inputs with a while loop?
This problem has been posted before, but I'm having trouble translating what I've currently coded into a while loop as per professor instructions. The problem is: Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the ...
[ "I just had the same problem. The answer is as follows...\ndef output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold):\n for value in user_values:\n if value <= upper_threshold:\n print(value, end=\",\" ) \ndef get_user_values():\n n = int(input())\n lst = []\n for i in ra...
[ 1, 0, 0, 0, 0 ]
[]
[]
[ "python" ]
stackoverflow_0069731990_python.txt
Q: Python - Call Pre-defined Function after Decorator I am building a straight-forward Flask API. After each decorator for the API endpoint, I have to define a function that simply calls another function I have in a separate file. This works fine, but seems redundant. I would rather just call that pre-defined functio...
Python - Call Pre-defined Function after Decorator
I am building a straight-forward Flask API. After each decorator for the API endpoint, I have to define a function that simply calls another function I have in a separate file. This works fine, but seems redundant. I would rather just call that pre-defined function directly, instead of having to wrap it within another ...
[ "The @syntax of decorators is just syntactic sugar for:\ndef LocationsRead():\n return Locations.read()\n\nLocationsRead = app.route('/locations', methods=['GET'])(LocationsRead)\n\nSo you could do something like:\nLocationsRead = app.route('/locations', methods=['GET'])(Locations.read)\n\nArguably, that takes a ...
[ 1, 0 ]
[]
[]
[ "flask", "python" ]
stackoverflow_0074425894_flask_python.txt
Q: How can I load tf js model? I want to load tf js model (convert from keras h5) but model is not opened I tried to train keras model and convert it to tfjs and use it my Keras model is as follows pre_model = keras.applications.mobilenet_v2.MobileNetV2(include_top=False, input_shape=[224, 224, 3], weigths="imagenet"...
How can I load tf js model?
I want to load tf js model (convert from keras h5) but model is not opened I tried to train keras model and convert it to tfjs and use it my Keras model is as follows pre_model = keras.applications.mobilenet_v2.MobileNetV2(include_top=False, input_shape=[224, 224, 3], weigths="imagenet") input1 = keras.layers.Input(sha...
[ "LoadModel uses fetch under the hood. And fetch cannot access the local files directly. It is meant to be used to get files served by a server. More on this here. To load a local file with the browser, there is two approaches, asking the user to upload the file with Or serving the file by a server.\n" ]
[ 0 ]
[]
[]
[ "javascript", "python", "tensorflow", "tensorflow.js" ]
stackoverflow_0074425880_javascript_python_tensorflow_tensorflow.js.txt
Q: How to access a ndjson file and find the oldest person, average age, youngest person in the country. Is it possible with python or javascript only Is it possible to open with python or javascript if so, how do I access the file and find the data I want. A: You just do it, line by line. import json data = [] for ...
How to access a ndjson file and find the oldest person, average age, youngest person in the country. Is it possible with python or javascript only
Is it possible to open with python or javascript if so, how do I access the file and find the data I want.
[ "You just do it, line by line.\nimport json\ndata = []\nfor line in open('ndjson.json'):\n data.append( json.loads(line) )\n\n" ]
[ 0 ]
[]
[]
[ "arrays", "javascript", "ndjson", "python" ]
stackoverflow_0074426030_arrays_javascript_ndjson_python.txt
Q: How to convert to timeseries based on column values as duration I have data with timestamps and duration of each operation. I want to convert the data into 1 minute time series and fill the rows based on the duration column and leave other rows NaN when it is not continuous. Data: datetime action durati...
How to convert to timeseries based on column values as duration
I have data with timestamps and duration of each operation. I want to convert the data into 1 minute time series and fill the rows based on the duration column and leave other rows NaN when it is not continuous. Data: datetime action duration 2022-01-01 00:00 3 40 2022-01-01 00:40 1 10 20...
[ "Try updating just the pandas dataframe index frequency by\ndf = df.asfreq('60S')\n\nThis should update the datetime index and bring NaNs automatically where no values are present. No fillna required.\n", "try this:\ntmp = df.copy()\ntmp['datetime'] = tmp.apply(lambda x: pd.date_range(\n x[0], periods=x[-1], f...
[ 2, 1 ]
[]
[]
[ "dataframe", "pandas", "python", "time_series" ]
stackoverflow_0074425749_dataframe_pandas_python_time_series.txt
Q: Azure Speech to text 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND) I've been trying to start a project involving azure speech to text and for testing purpose wanted to corroborate the workings with the demo code found in this site: https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/get-started-s...
Azure Speech to text 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND)
I've been trying to start a project involving azure speech to text and for testing purpose wanted to corroborate the workings with the demo code found in this site: https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/get-started-speech-to-text?tabs=windowsinstall%2Cterminal&pivots=programming-lang...
[ "Please check if my findings are helpful:\nAs you mentioned that you are using the Python 3.9.12 acquired from Microsoft store.\nThe same issue had been registered in the GitHub where people had fixed this issue by switching/using the Python interpreter from the Python.org website and copied over the azure site pac...
[ 1, 0 ]
[]
[]
[ "azure", "python", "speech_to_text" ]
stackoverflow_0072005067_azure_python_speech_to_text.txt
Q: Unable to load CIFAR-10 dataset: Invalid load key '\x1f' I'm currently playing around with some neural networks in TensorFlow - I decided to try working with the CIFAR-10 dataset. I downloaded the "CIFAR-10 python" dataset from the website: https://www.cs.toronto.edu/~kriz/cifar.html. In Python, I also tried direc...
Unable to load CIFAR-10 dataset: Invalid load key '\x1f'
I'm currently playing around with some neural networks in TensorFlow - I decided to try working with the CIFAR-10 dataset. I downloaded the "CIFAR-10 python" dataset from the website: https://www.cs.toronto.edu/~kriz/cifar.html. In Python, I also tried directly copying the code that is provided to load the data: def un...
[ "Extract your *.gz file and use this code\nfrom six.moves import cPickle\nf = open(\"path/data_batch_1\", 'rb')\ndatadict = cPickle.load(f,encoding='latin1')\nf.close()\nX = datadict[\"data\"]\nY = datadict['labels']\n\n", "Just extract your tar.gz file, you will get a folder of data_batch_1, data_batch_2, ...\nA...
[ 2, 1, 0, 0, 0, 0 ]
[]
[]
[ "dataset", "python", "python_3.x" ]
stackoverflow_0045121556_dataset_python_python_3.x.txt
Q: tensorflow variable constraints Can anyone help me implement a constraint on a tensorflow variable. def min_max(x): return tf.clip_by_value(x, 1.0, 3.0) a = tf.Variable(initial_value=[[1.0, 2.0, 10.0]], dtype=tf.float32, trainable=True, constraint=min_max) Now if I print a, this is the output: \<tf.Variable 'V...
tensorflow variable constraints
Can anyone help me implement a constraint on a tensorflow variable. def min_max(x): return tf.clip_by_value(x, 1.0, 3.0) a = tf.Variable(initial_value=[[1.0, 2.0, 10.0]], dtype=tf.float32, trainable=True, constraint=min_max) Now if I print a, this is the output: \<tf.Variable 'Variable:0' shape=(1, 3) dtype=float32...
[ "According to the doc, the constraint keyword specifies\n\nAn optional projection function to be applied to the variable after being updated by an Optimizer\n\nIt means the clipping effect should be applied once the variable a is updated by an optimizer. You can verify it using the snippet below.\na = tf.Variable(i...
[ 0 ]
[]
[]
[ "python", "tensorflow" ]
stackoverflow_0074424969_python_tensorflow.txt
Q: Convert EMF/WMF files to PNG/JPG I am receiving an form upload with a Word docx document. I got all the parsing done successfully. I have to then display that Word document on the web. The problem I am running into at this moment is that I have embedded EMF files (that the PIL library recognizes as WMF format), an...
Convert EMF/WMF files to PNG/JPG
I am receiving an form upload with a Word docx document. I got all the parsing done successfully. I have to then display that Word document on the web. The problem I am running into at this moment is that I have embedded EMF files (that the PIL library recognizes as WMF format), and I cannot figure how to convert them ...
[ "pip install Pillow\nfrom PIL import Image\nImage.open(\"xxx.wmf\").save(\"xxx.png\")\n", "I found it easier to use the Wand package for such conversion. I tried the previous suggestions without success. So here is what I did:\n(BTW, I wanted to convert all '.wmf' files into pdf)\nimport os\n\nfrom wand.image imp...
[ 7, 4, 2, 1, 0, 0, 0 ]
[]
[]
[ "python", "python_imaging_library" ]
stackoverflow_0014103891_python_python_imaging_library.txt
Q: t-SNE: Sklearn AttributeError: 'NoneType' object has no attribute 'split' Any help on the following error? I'm running both PCA and t-SNE and PCA seems to run well, but wherever I run t-SNE, I run into the following error.My code for t-SNE is below: def T_SNE(X,Label,Component=2,title=""): tsne = TSNE(n_compo...
t-SNE: Sklearn AttributeError: 'NoneType' object has no attribute 'split'
Any help on the following error? I'm running both PCA and t-SNE and PCA seems to run well, but wherever I run t-SNE, I run into the following error.My code for t-SNE is below: def T_SNE(X,Label,Component=2,title=""): tsne = TSNE(n_components=Component) tsne_result = tsne.fit_transform(X) tsne_result_d...
[ "I was facing the same issue, seems like something to do with the tSNE code not error handling it well. Set your perplexity value beforehand, for the data I was working on, perplexity values less than 120 worked fine, but beyond that I got this error. (I also set init='pca', not sure if that makes any difference. T...
[ 0 ]
[]
[]
[ "nonetype", "python", "scikit_learn" ]
stackoverflow_0073283082_nonetype_python_scikit_learn.txt
Q: Python class bug My remove and new quantity methods dont work and I have no idea why. Here is my code: # Type code for classes here class ItemToPurchase(): def __init__(self): self.item_description = 'none' self.item_name = 'none' self.item_price= 0 self.item_quantity = 0 d...
Python class bug
My remove and new quantity methods dont work and I have no idea why. Here is my code: # Type code for classes here class ItemToPurchase(): def __init__(self): self.item_description = 'none' self.item_name = 'none' self.item_price= 0 self.item_quantity = 0 def print_item_descript...
[ "You're not using del correctly. I think you've confused del with the .remove() method of a list.\ndel self.items[to_be_deleted] makes no sense. self.items is a list, and list indexes must be integers. But to_be_deleted is not an integer; it is an actual item in the list.\nIf you want to use del, you need the in...
[ 2 ]
[]
[]
[ "class", "python" ]
stackoverflow_0074426142_class_python.txt
Q: replace NaNs with 0 for df columns where column name contains specific string (pandas) I have a dataframe as a result of a pivot which has several thousand columns (representing time-boxed attributes). Below is a much shortened version for resemblance. d = {'incount - 14:00': [1,'NaN', 1,1,'NaN','NaN','NaN','NaN',...
replace NaNs with 0 for df columns where column name contains specific string (pandas)
I have a dataframe as a result of a pivot which has several thousand columns (representing time-boxed attributes). Below is a much shortened version for resemblance. d = {'incount - 14:00': [1,'NaN', 1,1,'NaN','NaN','NaN','NaN',1], 'incount - 15:00': [2,1,2,'NaN','NaN','NaN',1,4,'NaN'], 'outcount - 14:00':[2,...
[ "you can use:\nloop_cols = list(df.columns[df.columns.str.contains('incount',na=False)]) #get columns containing incount as a list\n\n#or\n#loop_cols = [col for col in df.columns if 'incount' in col]\nprint(loop_cols)\n'''\n['incount - 14:00', 'incount - 15:00']\n'''\nfor i in loop_cols:\n df[i]=df[i].fillna(0)\...
[ 0, 0 ]
[]
[]
[ "pandas", "python" ]
stackoverflow_0074424807_pandas_python.txt
Q: How to Concrete a 2D Python List to 1D A given 2d list say [['D', 'S'], ['A', 'M'], ['I', 'N'], ['C', 'F'], ['E', 'T']] is needed to concrete to all string like DAICE, DAICT, DAIFE, DAIFT, ..., SMNFT (1st list items + 2nd list items + 3rd list items + 4th list items + 5 list items) and store them to a new 1d list....
How to Concrete a 2D Python List to 1D
A given 2d list say [['D', 'S'], ['A', 'M'], ['I', 'N'], ['C', 'F'], ['E', 'T']] is needed to concrete to all string like DAICE, DAICT, DAIFE, DAIFT, ..., SMNFT (1st list items + 2nd list items + 3rd list items + 4th list items + 5 list items) and store them to a new 1d list. Anyone please help! Many thanks! I tried us...
[ "from itertools import product\n\nlst = [['D', 'S'], ['A', 'M'], ['I', 'N'], ['C', 'F'], ['E', 'T']]\n\nlst2 = list(map(''.join, product(*lst)))\n\nprint(lst2)\n\nTry the above snippet.\n" ]
[ 0 ]
[]
[]
[ "python", "python_3.x" ]
stackoverflow_0074426201_python_python_3.x.txt
Q: Why my code still slow after threading for 15k records only, how to fix this I have a script, taking links from a file, visiting it, getting re-directed links, storing it back. But it works too slow on a file with 15k records. How can I make it quick? already used threading Please do help to fix it out!, I've trie...
Why my code still slow after threading for 15k records only, how to fix this
I have a script, taking links from a file, visiting it, getting re-directed links, storing it back. But it works too slow on a file with 15k records. How can I make it quick? already used threading Please do help to fix it out!, I've tried multiple ways, threadings but I cannot make it quick. Is there any solution to m...
[ "Threads in Python do not run simultaneously due to the Global Interpreter Lock. You might want to use the multiprocessing module instead, or ProcessPoolExecutor() from concurrent.futures. If you decide to use ProcessPoolExecutors, pass the URLs to the callback and have the callback return the old and redirected UR...
[ 0 ]
[]
[]
[ "hyperlink", "multithreading", "python" ]
stackoverflow_0074425893_hyperlink_multithreading_python.txt
Q: Can't download PyQt5 on mac enter image description herewhen running the code, an error occurs, but I installed PyQt5, but an error occurs in the terminal when installing extensions reinstalled PyQt5 but nothing changed A: If multiple python versions exist on your machine, you should make sure you are running yo...
Can't download PyQt5 on mac
enter image description herewhen running the code, an error occurs, but I installed PyQt5, but an error occurs in the terminal when installing extensions reinstalled PyQt5 but nothing changed
[ "If multiple python versions exist on your machine, you should make sure you are running your code using an interpreter environment with PyQt5 installed.\n\nCtrl+Shift+P\n\nPython:Select Interpreter\n\nChoose the correct interpreter.\n\n\n" ]
[ 1 ]
[]
[]
[ "pyqt", "pyqt5", "python", "visual_studio_code" ]
stackoverflow_0074420512_pyqt_pyqt5_python_visual_studio_code.txt
Q: How can I create a code that charges a 'penny' for every second that my code is ran? (Python) I want to create a code that charges 'money' for every second that my program is ran. For example, if I am charging 1 cent for every second that the program is ran, and the program is ran for 10 seconds, I want a statemen...
How can I create a code that charges a 'penny' for every second that my code is ran? (Python)
I want to create a code that charges 'money' for every second that my program is ran. For example, if I am charging 1 cent for every second that the program is ran, and the program is ran for 10 seconds, I want a statement to be printed like "You have ran the program for 10 seconds, and will be charged 10 cents" at the...
[ "You're mostly there; just get the total_seconds() from the timedelta you got from subtracting the two datetimes.\nelapsed = (end_time-start_time).total_seconds()\nprint(f\"You have ran the program for {elapsed} seconds, and will be charged {elapsed} cents.\")\n\n" ]
[ 0 ]
[]
[]
[ "datetime", "python", "spyder" ]
stackoverflow_0074426283_datetime_python_spyder.txt
Q: Unable to access Pywhatkit api right now I'm a beginner in Python's study and this is the code what I trying to use: pip install pywhatkit import pywhatkit as kit texto = ''' XXXXXXX ''' kit.text_to_handwriting(texto, save_to='texto_a_mao.png') and shows this error: UnableToAccessApi Traceb...
Unable to access Pywhatkit api right now
I'm a beginner in Python's study and this is the code what I trying to use: pip install pywhatkit import pywhatkit as kit texto = ''' XXXXXXX ''' kit.text_to_handwriting(texto, save_to='texto_a_mao.png') and shows this error: UnableToAccessApi Traceback (most recent call last) e:\Meus Documentos...
[ "I checked and it seems to be working for now,\nThe problem is from our side, the part of this function is hosted on Heroku and is using the free dyno service, which is unfortunately going be discontinued by them soon, so unless we opt for the paid version or find any alternative to Heroku, this feature might be pr...
[ 0 ]
[]
[]
[ "python" ]
stackoverflow_0074049394_python.txt
Q: Merging two JSON responses in Python? I am trying to merge two json documents to one, where I need to look for the same "id". The first document looks like this and is named "mapping" [{'examine': 'things about 10344', 'id': 10344, 'name': 'name10344'}, {'examine': 'things about 20011', 'id': 20011, 'name...
Merging two JSON responses in Python?
I am trying to merge two json documents to one, where I need to look for the same "id". The first document looks like this and is named "mapping" [{'examine': 'things about 10344', 'id': 10344, 'name': 'name10344'}, {'examine': 'things about 20011', 'id': 20011, 'name': 'name20011'}, {'examine': 'things about...
[ "If you're sure that there is data for each id in mapping, you can do this:\nmerged = []\nfor m in mapping:\n merged.append({**data['data'][str(m['id'])], **m})\n\nIt loops through the mapping data to find the corresponding data entry and uses the dict-merge syntax to combine the two. For more on merging dicts, ...
[ 0 ]
[]
[]
[ "json", "mapping", "merge", "python" ]
stackoverflow_0074424460_json_mapping_merge_python.txt
Q: Can you help me to find out why it shows warning like that? And How to solve this problem? I have already intsall the pip packgae, but it doesn't work Can you give me the solution that how to fix this problem? A: Try using pip uninstall pandas and pip install pandas, replace pandas with serial for serial!
Can you help me to find out why it shows warning like that? And How to solve this problem?
I have already intsall the pip packgae, but it doesn't work Can you give me the solution that how to fix this problem?
[ "Try using pip uninstall pandas and pip install pandas, replace pandas with serial for serial!\n" ]
[ 1 ]
[]
[]
[ "python" ]
stackoverflow_0074426438_python.txt
Q: Python Panel How to force the update of the widget.Select I have this Panel widget defined: import panel as pn demo = pn.widgets.Select(name='Demo', options=datasource) How can i force the widget to update, when the datasource is also updated? I tried with this: demo.param.update() inside the function that also ...
Python Panel How to force the update of the widget.Select
I have this Panel widget defined: import panel as pn demo = pn.widgets.Select(name='Demo', options=datasource) How can i force the widget to update, when the datasource is also updated? I tried with this: demo.param.update() inside the function that also changes the datasource but it does not work. Any suggestions? T...
[ "If the datasource is also a panel object, you can do this:\ndef update_options(event):\n demo.options = event.new\n\ndatasource.param.watch(update_options, 'value')\n\n", "Just for others reference:\nimport panel as pn\ndemo = pn.widgets.Select(name='Demo', options=datasource)\n\n...\n# after changing the dat...
[ 1, 0 ]
[]
[]
[ "panel", "python", "select", "widget" ]
stackoverflow_0074306055_panel_python_select_widget.txt
Q: Django 2.0 - Reverse for 'password_change_done' not found. 'password_change_done' is not a valid view function or pattern name I'm having this error message after trying to change my app's password. Do you have any idea of what's causing this route to fail? Actually, it is changing the password but it isn't rend...
Django 2.0 - Reverse for 'password_change_done' not found. 'password_change_done' is not a valid view function or pattern name
I'm having this error message after trying to change my app's password. Do you have any idea of what's causing this route to fail? Actually, it is changing the password but it isn't rendering the success template "password_change_done.html". Thanks! app/urls.py from django.contrib.auth import views as auth_views from...
[ "I think the problem here is, as Tobit hints, is that your URLs are using an application namespace called account. That has been defined by the presence of app_name = 'account' in your urls.py.\nThe PasswordChangeView does not expect a namespace when looking up the password_change_done view. However, you can overri...
[ 12, 0 ]
[]
[]
[ "authentication", "django", "django_templates", "python" ]
stackoverflow_0049683018_authentication_django_django_templates_python.txt
Q: In python, how can I check if a filename ends in '.html' or '_files'? In python, how can I check if a filename ends in '.html' or '_files'? A: You probably want to know if a file name ends in these strings, not the file istelf: if file_name.endswith((".html", "_files")): # whatever To test whether a file en...
In python, how can I check if a filename ends in '.html' or '_files'?
In python, how can I check if a filename ends in '.html' or '_files'?
[ "You probably want to know if a file name ends in these strings, not the file istelf:\nif file_name.endswith((\".html\", \"_files\")):\n # whatever\n\nTo test whether a file ends in one of these strings, you can do this:\nwith open(file_name) as f:\n f.seek(-6, 2) # only read the last 6 characters o...
[ 17, 0 ]
[]
[]
[ "html", "python" ]
stackoverflow_0010873777_html_python.txt
Q: I want to make css_selector a repeat statement in python. How can I get that? This is python project. I want to make the code below into repeating using while or for. Because I have 45lists. I have to get all information from the code. I think I have to edit the code that 'li.dragons:nth-child(1)' to like 'li.drag...
I want to make css_selector a repeat statement in python. How can I get that?
This is python project. I want to make the code below into repeating using while or for. Because I have 45lists. I have to get all information from the code. I think I have to edit the code that 'li.dragons:nth-child(1)' to like 'li.dragons:nth-child(i)' what should I edit or add the codes to repeat? I need your help p...
[ "Use a format string! In other words, wrap this whole code block in a for-loop (for i in range(1, 46): since CSS indexes start at 1, not 0), then change browser.find_element_by_css_selector(\"ul.list_basis li.dragons:nth-child(1) .dragonchild a.link\").click() to browser.find_element_by_css_selector(f\"ul.list_bas...
[ 0 ]
[]
[]
[ "python", "selenium", "web_crawler", "web_scraping" ]
stackoverflow_0074426587_python_selenium_web_crawler_web_scraping.txt
Q: For loop monthly budget program creating error I am running this for loop code and it is creating an error, I cannot find out the problem with it print("""\ This program will prompt you to enter your budget, and amount spent for a certain month and calculate if your were under or over budget. You will have the opt...
For loop monthly budget program creating error
I am running this for loop code and it is creating an error, I cannot find out the problem with it print("""\ This program will prompt you to enter your budget, and amount spent for a certain month and calculate if your were under or over budget. You will have the option of choosing how many months you would like to mo...
[ "Your problem is that the for-loop variable month is an integer, so you can't concatenate it to a string without converting it first. The easiest way to fix that is to use a format-string instead.\nFor example, this line:\nAmountBudgeted = float(input(\"Enter amount budgeted for month \"+month+\":\"))\nShould be ch...
[ 0, 0 ]
[]
[]
[ "for_loop", "python", "while_loop" ]
stackoverflow_0074426552_for_loop_python_while_loop.txt
Q: Encoding error when trying to encode decode get request, exercise from PY4E course, in wsl the script will run correctly and print out the romeo.txt import socket mysock=socket.socket(socket.AF_INET,socket.SOCK_STREAM) mysock.connect(('data.pr4e.org',80)) cmd='GET http://data.pr4e.org/romeo.txt HTTP/1.0\n\n'.encod...
Encoding error when trying to encode decode get request, exercise from PY4E course, in wsl the script will run correctly and print out the romeo.txt
import socket mysock=socket.socket(socket.AF_INET,socket.SOCK_STREAM) mysock.connect(('data.pr4e.org',80)) cmd='GET http://data.pr4e.org/romeo.txt HTTP/1.0\n\n'.encode() mysock.send(cmd) while True: data=mysock.recv(512) if len(data)<1: break print(data.decode('utf-8'),end="") mysock.close This is...
[ "You need to follow the HTTP protocol and use \\r\\n for line endings.\nimport socket\n\nmysock=socket.socket()\nmysock.connect(('data.pr4e.org', 80))\nwith mysock:\n cmd = b'GET http://data.pr4e.org/romeo.txt HTTP/1.0\\r\\n\\r\\n'\n mysock.sendall(cmd)\n data=mysock.recv(4096)\n print(data.decode())\n\...
[ 0 ]
[]
[]
[ "python", "unicode", "utf_8" ]
stackoverflow_0074426470_python_unicode_utf_8.txt
Q: Django Celery: Clocked task is not running In a Django app, I have a form that schedules an email to be sent out. It has four fields: name, email, body, send_date. I want to dynamically create a Celery task (email) to run another Celery task at the designated time. I have been able to send out the email at regul...
Django Celery: Clocked task is not running
In a Django app, I have a form that schedules an email to be sent out. It has four fields: name, email, body, send_date. I want to dynamically create a Celery task (email) to run another Celery task at the designated time. I have been able to send out the email at regular intervals (every 30 seconds) based on the for...
[ "I guess it's the time zone.\nIf your configuration does not take effect.The celery database stores UTC time by default.\nYou can verify this by executing the following code.\nIn Django's shell environment\nimport datetime\nimport json\nfrom ProjectName.celerytest import test\n\nexecution_time = datetime.datetime.u...
[ 0 ]
[]
[]
[ "celery", "celerybeat", "django", "django_celery", "python" ]
stackoverflow_0070873663_celery_celerybeat_django_django_celery_python.txt
Q: finding columns with NAs in python using pandas I have a dataset and I need to use Python and Pandas to return a dictionary that has 2 values. The first one has the key value "Columns without nans" and the second one has the key "Columns with all nans" The value for the first should be a list of column names that ...
finding columns with NAs in python using pandas
I have a dataset and I need to use Python and Pandas to return a dictionary that has 2 values. The first one has the key value "Columns without nans" and the second one has the key "Columns with all nans" The value for the first should be a list of column names that have no nan values. The value for the second should b...
[ "You can check if a column in a dataframe contains any nulls using df[col].isnull().values.any() - this will return True if any of the values are null / nan / etc, or you can use ....all() to find if they all are nan. Wrap this in a loop over cols to append to lists for your dictionary.\nall_list = []\nnone_list = ...
[ 0 ]
[]
[]
[ "pandas", "python" ]
stackoverflow_0074426616_pandas_python.txt
Q: One-Hot Encoding Question - Concept and Solution to My Problem (Kaggle Dataset) I'm working on an exercise in Kaggle, it's on their module for categorical variables, specifically the one - hot encoding section: https://www.kaggle.com/alexisbcook/categorical-variables I'm through the entire workbook fine, and there...
One-Hot Encoding Question - Concept and Solution to My Problem (Kaggle Dataset)
I'm working on an exercise in Kaggle, it's on their module for categorical variables, specifically the one - hot encoding section: https://www.kaggle.com/alexisbcook/categorical-variables I'm through the entire workbook fine, and there's one last piece I'm trying to work out, it's the optional piece at the end to apply...
[ "\nSo my first question is, when it comes to one - hot encoding, shouldn't NAs just be treated like any other category within a particular column? \n\nNA's are just the absence of data, and so you can loosely think of rows with NA's as being incomplete. You may find yourself dealing with a dataset where NAs occur i...
[ 2, 0 ]
[]
[]
[ "data_science", "kaggle", "one_hot_encoding", "python" ]
stackoverflow_0060980972_data_science_kaggle_one_hot_encoding_python.txt
Q: How to sign an OKEx POST API request? The below is a result of this question How to sign an OKEx API request? and some of the answers: import hmac import base64 import requests import datetime import json from config import KEY, SECRET, PASS, ROOT_URL def get_time(): now = datetime.datetime.utcnow() t = ...
How to sign an OKEx POST API request?
The below is a result of this question How to sign an OKEx API request? and some of the answers: import hmac import base64 import requests import datetime import json from config import KEY, SECRET, PASS, ROOT_URL def get_time(): now = datetime.datetime.utcnow() t = now.isoformat("T", "milliseconds") ret...
[ "I ran into the same POST problem and figured it out. I used new domain name okex.com. Here is my code.\ndef set_userinfo(self):\n position_path = \"/api/v5/account/set-position-mode\"\n try:\n self.get_header(\"POST\", position_path, {\"posMode\":\"net_mode\"})\n resp = requests.post(url=self.b...
[ 0, 0, 0 ]
[]
[]
[ "authentication", "python", "python_requests", "sign" ]
stackoverflow_0070450871_authentication_python_python_requests_sign.txt
Q: Create an ordering dataframe depending on the ordering of items in a smaller dataframe I have a dataframe that looks something like this: i j 0 a b 1 a c 2 b c I would like to convert it to another dataframe that looks like this: a b c 0 1 -1 0 1 1 0 -1 2 0 1 -1 The idea is to look at each r...
Create an ordering dataframe depending on the ordering of items in a smaller dataframe
I have a dataframe that looks something like this: i j 0 a b 1 a c 2 b c I would like to convert it to another dataframe that looks like this: a b c 0 1 -1 0 1 1 0 -1 2 0 1 -1 The idea is to look at each row in the first dataframe and assign the value 1 to the item in the first column and the val...
[ "example\ndata = {'i': {0: 'a', 1: 'a', 2: 'b'}, 'j': {0: 'b', 1: 'c', 2: 'c'}}\ndf = pd.DataFrame(data)\n\ndf\n i j\n0 a b\n1 a c\n2 b c\n\n\nFirst make dummy\ndf1 = pd.get_dummies(df)\n\ndf1\n i_a i_b j_b j_c\n0 1 0 1 0\n1 1 0 0 1\n2 0 1 0 1\n\n\nSecond make df1 index to mul...
[ 0, 0 ]
[]
[]
[ "dataframe", "pandas", "python" ]
stackoverflow_0074426580_dataframe_pandas_python.txt
Q: Pyplot - '3D' scatter plot - zlabel? Minimum working example: #Python import matplotlib.pyplot as plt x = [0, 1, 2, 3, 4, 5] y = [0, 1, 2, 3, 4, 5] z = [0, 1, 2, 3, 4, 5] fig = plt.figure() ax = plt.axes(projection="3d") ax.scatter(x, y, z, c='g', s=20) plt.xlabel("X data") plt.ylabel("Y data") #plt.zlabel("Z da...
Pyplot - '3D' scatter plot - zlabel?
Minimum working example: #Python import matplotlib.pyplot as plt x = [0, 1, 2, 3, 4, 5] y = [0, 1, 2, 3, 4, 5] z = [0, 1, 2, 3, 4, 5] fig = plt.figure() ax = plt.axes(projection="3d") ax.scatter(x, y, z, c='g', s=20) plt.xlabel("X data") plt.ylabel("Y data") #plt.zlabel("Z data") DOES NOT WORK ax.view_init(60,35) plt...
[ "For 3D plots the labels need to be changed using the axes objects.\nTry something like this\nax.set_xlabel('X Label')\nax.set_ylabel('Y Label')\nax.set_zlabel('Z Label')\n\n" ]
[ 2 ]
[]
[]
[ "matplotlib", "python" ]
stackoverflow_0074426028_matplotlib_python.txt
Q: trying to simplify some boolean statements in python I'm "newish" to python programming. I'm trying my best to make my code look nice and function well. I'm using Pycharm as my IDE. I'm doing something for myself. I play tabletop RPG's and I'm attempting to create a character creator for a game I play. I have...
trying to simplify some boolean statements in python
I'm "newish" to python programming. I'm trying my best to make my code look nice and function well. I'm using Pycharm as my IDE. I'm doing something for myself. I play tabletop RPG's and I'm attempting to create a character creator for a game I play. I have everything working well, but Pycharm is telling me that "...
[ "Here's one way you could rewrite this code to make it easier to read, and more efficient:\n# Loop until the user provides a good input\nwhile True:\n # Set a temp variable, don't constantly reassign to the new_character.firstName attribute\n name = input('What would you like your first name to be?\\n').capit...
[ 1 ]
[]
[]
[ "python" ]
stackoverflow_0074426839_python.txt
Q: Link scraping errors url = "https://www.cnn.com/" response = requests.get(url) soup = BeautifulSoup(response.text, "html.parser") links = [] for link in soup(response).find_all("a", href=True): links.append(link["href"]) for link in links: print(links) AttributeError: ResultSet object has no attribut...
Link scraping errors
url = "https://www.cnn.com/" response = requests.get(url) soup = BeautifulSoup(response.text, "html.parser") links = [] for link in soup(response).find_all("a", href=True): links.append(link["href"]) for link in links: print(links) AttributeError: ResultSet object has no attribute 'find_all'. You're proba...
[ "You don't need to call soup(response), just call find_all directly on soup soup. Soup already has the response information from line 5, so it's redundant.\n# Replace this:\nfor link in soup(response).find_all(\"a\", href=True):\n\n# With this\nfor link in soup.find_all(\"a\", href=True):\n\n" ]
[ 2 ]
[]
[]
[ "beautifulsoup", "python", "web_scraping" ]
stackoverflow_0074426805_beautifulsoup_python_web_scraping.txt
Q: How to display the whole image on this canvas? The code provided here is: import tkinter as tk from PIL import Image, ImageTk from pathlib import Path class App(tk.Tk): def __init__(self): super().__init__() self.geometry('600x600') self.img_path = Path(r'D:\Python\Lena.jpg') self.img...
How to display the whole image on this canvas?
The code provided here is: import tkinter as tk from PIL import Image, ImageTk from pathlib import Path class App(tk.Tk): def __init__(self): super().__init__() self.geometry('600x600') self.img_path = Path(r'D:\Python\Lena.jpg') self.img = Image.open(self.img_path) self.img_rgb = sel...
[ "I can see two possible solutions:\n\nExpand image to fit window\nWrap window around image\n\nTo expand image to fit window\ndim_x, dim_y = 600, 600\nself.img_tk = ImageTk.PhotoImage(self.img_rgb.resize((dim_x, dim_y)))\n\nOR\nTo wrap window around image\ndim_x, dim_y = self.img_rgb.size\nself.img_tk = ImageTk.Phot...
[ 0 ]
[]
[]
[ "python", "tkinter", "tkinter_canvas" ]
stackoverflow_0074390233_python_tkinter_tkinter_canvas.txt
Q: How to connect list and if statement I am trying to make a trivia program that asks 10 questions to the user and displays if the user's input matches with correct answers or not. My code: class Question: def __init__(self): global qDictionary self.qDictionary = { # My questions ...
How to connect list and if statement
I am trying to make a trivia program that asks 10 questions to the user and displays if the user's input matches with correct answers or not. My code: class Question: def __init__(self): global qDictionary self.qDictionary = { # My questions '1': """ Q1. What does “www” stand f...
[ "In this condition check userAnswer == answer[userAnswer], you are fetching the answer using an incorrect variable, you should use count rather than the userAnswer which is actually user's input.\nuserAnswer == answer[int(count)] to be exact.\n" ]
[ 0 ]
[]
[]
[ "python", "python_3.x", "visual_studio" ]
stackoverflow_0074426915_python_python_3.x_visual_studio.txt
Q: Pandas add grouping to each column I have a dataset that has one line per user per week that records whether or not the user has registered along with values of certain metrics: cols = ["Worker ID", "Registered", "Week Ending", "Metric Value"] rows = [ ['A', True, '2022-08-06', 2], ['B', False, '2022-08-06...
Pandas add grouping to each column
I have a dataset that has one line per user per week that records whether or not the user has registered along with values of certain metrics: cols = ["Worker ID", "Registered", "Week Ending", "Metric Value"] rows = [ ['A', True, '2022-08-06', 2], ['B', False, '2022-08-06', 3], ['C', False, '2022-08-06', 4]...
[ "Use unstack so:\ndf.groupby([\"Week Ending\", \"Registered\"]).agg({'Worker ID': pd.Series.nunique, \"Metric Value\": sum}).unstack()\n\n" ]
[ 1 ]
[]
[]
[ "group_by", "pandas", "python" ]
stackoverflow_0074426727_group_by_pandas_python.txt
Q: ModuleNotFoundError when running pytest after moving the application directory for Docker Using Python 3.8, I made a functional project using FastAPI. With the structure I outline below, I placed all the elements of my project in an "app" folder so I could create a Docker image. ├── app/ | └── sdk/ | ...
ModuleNotFoundError when running pytest after moving the application directory for Docker
Using Python 3.8, I made a functional project using FastAPI. With the structure I outline below, I placed all the elements of my project in an "app" folder so I could create a Docker image. ├── app/ | └── sdk/ | └── __init__.py | └── sdk.py | └── schemas.py | └── exceptions.py |...
[ "Plase provide the contents of your Dockerfile and the Pipfile.\nUsually the standard for writing Dockerfiles for Python is that, you have a\nrequirements.txt\nFor your case it could be something like :\ncat requirements.txt \nuvicorn[standard]==0.18.3\nfastapi==0.45.0\nurllib3==1.22\ncx_freeze==6.0b1\npytest==3.2....
[ 0 ]
[]
[]
[ "docker", "fastapi", "python", "python_3.x" ]
stackoverflow_0074426973_docker_fastapi_python_python_3.x.txt
Q: Extracting Key Value pairs from a String using Regex I have a web scrapped string containing key value pairs i.e firstName:"Quaran", lastName:"McPherson" st = '{"accountId":405266,"firstName":"Quaran","lastName":"McPherson","accountIdentifier":"StudentAthlete","profilePicUrl":"https://pbs.twimg.com/profile_images/...
Extracting Key Value pairs from a String using Regex
I have a web scrapped string containing key value pairs i.e firstName:"Quaran", lastName:"McPherson" st = '{"accountId":405266,"firstName":"Quaran","lastName":"McPherson","accountIdentifier":"StudentAthlete","profilePicUrl":"https://pbs.twimg.com/profile_images/1331475329014181888/4z19KrCf.jpg","networkProfileCode":"qu...
[ "Try this regex (?<=\\\"firstName\\\":\\\").*?(?=\\\"). The ? in the middle makes it a lazy match, so that it stops matching as soon as it finds a \" character.\nI want to add that that with backtracking, there can be an exponential performance penalty. I can do something like this \"firstName\":\"(.*?)\" and extra...
[ 1, 1, 1 ]
[]
[]
[ "python", "regex", "string", "web_scraping" ]
stackoverflow_0074426885_python_regex_string_web_scraping.txt
Q: Unknown symbol and item that has baffled me from this code, import matplotlib.pyplot as plt import numpy as np def f(x): return x*x*np.sqrt(x+1) # prepare coordinate vectors x = np.linspace(-1, 1.5, 500) y = f(x) # create figure and axes fig, ax = plt.subplots(1,1) # format spines ax.spines['top'].set_vi...
Unknown symbol and item that has baffled me
from this code, import matplotlib.pyplot as plt import numpy as np def f(x): return x*x*np.sqrt(x+1) # prepare coordinate vectors x = np.linspace(-1, 1.5, 500) y = f(x) # create figure and axes fig, ax = plt.subplots(1,1) # format spines ax.spines['top'].set_visible(False) ax.spines['right'].set_visible(False...
[ "The $ doesn't mean anything in Python - it's just that character in a string. Matplotlib uses it for rendering LaTeX: https://matplotlib.org/stable/tutorials/text/usetex.html\n" ]
[ 1 ]
[]
[]
[ "python" ]
stackoverflow_0074427036_python.txt
Q: How to convert dictionary with multiple keys-values pairs to DataFrame I try to clean the data with this code empty = {} mess = lophoc_clean.query("lop_diemquatrinh.notnull()")[['lop_id', 'lop_diemquatrinh']] keys = [] values = [] for index, rows in mess.iterrows(): if len(rows['lop_diemqu...
How to convert dictionary with multiple keys-values pairs to DataFrame
I try to clean the data with this code empty = {} mess = lophoc_clean.query("lop_diemquatrinh.notnull()")[['lop_id', 'lop_diemquatrinh']] keys = [] values = [] for index, rows in mess.iterrows(): if len(rows['lop_diemquatrinh']) >4: values.append(rows['lop_diemquatrinh']) ...
[ "Here you go.\nfrom json import loads\nfrom pprint import pp\n\nimport pandas as pd\n\n\ndef get_example_data():\n return [\n dict(id=38, updated_at=\"2022-03-11\", diemquatrinh=6.25),\n dict(id=44, updated_at=\"2021-12-25\", diemquatrinh=6),\n dict(id=44, updated_at=\"2022-04-28\", diemquat...
[ 1 ]
[]
[]
[ "dataframe", "dictionary", "python" ]
stackoverflow_0074426788_dataframe_dictionary_python.txt
Q: create a dictionary from .txt file with each line as values and serial num as key i have a dataset which is a .txt file and each line has items separated by spaces. each line is a different transaction. the dataset looks like this: data.txt file 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 20 12 5 41 65 41 6 11 27 81 21 65...
create a dictionary from .txt file with each line as values and serial num as key
i have a dataset which is a .txt file and each line has items separated by spaces. each line is a different transaction. the dataset looks like this: data.txt file 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 20 12 5 41 65 41 6 11 27 81 21 65 15 27 8 31 65 20 19 44 29 41 i created a dictionary with keys as serial num. startin...
[ "Since you're really just counting numbers over the entire file, you can just:\nmy_dict = {}\n\nwith open('data.txt', 'r') as file:\n for number in file.read().split():\n my_dict[number] = my_dict.get(number, 0) + 1\n\nprint(my_dict)\n\nResult:\n{'1': 1, '2': 1, '3': 1, '4': 1, '5': 2, '6': 2, '7': 1, '8'...
[ 0, 0 ]
[]
[]
[ "data_mining", "dataformat", "fpgrowth", "frequency", "python" ]
stackoverflow_0074426513_data_mining_dataformat_fpgrowth_frequency_python.txt
Q: Ros2 publish to topic programatically I would like to create a stand alone ros2 Python node that, when ran, is equivelent to the command ros2 topic pub --once other_topic message How do I go about doing this? I do not want to create a new publisher/subscriber/topic, I am simply trying to publish a message to an e...
Ros2 publish to topic programatically
I would like to create a stand alone ros2 Python node that, when ran, is equivelent to the command ros2 topic pub --once other_topic message How do I go about doing this? I do not want to create a new publisher/subscriber/topic, I am simply trying to publish a message to an existing topic from a given node.
[ "A node that has the functionality that you describe is a publisher node. Check out the official tutorials by ROS2. You do not need to create a whole new message type or a topic to start publishing messages. You can publish messages over already existing topics. you just need to specify the topic name and type appr...
[ 0 ]
[]
[]
[ "python", "ros2" ]
stackoverflow_0074340393_python_ros2.txt
Q: Boto3 S3 client methods throw NoSuchBucket even it has I am trying to select one existing bucket then upload file into the bucket using Boto3. But all methods related with buckets aren't working correctly for me. The problems I'm confronting are like this: When I list up the buckets using boto3.Session.client('s3...
Boto3 S3 client methods throw NoSuchBucket even it has
I am trying to select one existing bucket then upload file into the bucket using Boto3. But all methods related with buckets aren't working correctly for me. The problems I'm confronting are like this: When I list up the buckets using boto3.Session.client('s3').list_buckets() method, it results an empty list of Bucket...
[ "Solved\nThe cause of my problem was the annotation on the test code, @mock_s3.\nActually, I cannot even call this as problem, but a mistake.\nAnyway, if anybody get in trouble with that annotation, I hope my stupid record help you.\n" ]
[ 1 ]
[]
[]
[ "amazon_s3", "amazon_web_services", "boto3", "python" ]
stackoverflow_0074425833_amazon_s3_amazon_web_services_boto3_python.txt
Q: Creating a temporary excel file using openpyxl python I made a program that extracts specific data from an existing excel file. Now I want that data to be shown in an excel file but I don't want to save it on the system This is the GUI of that application which I am making Now I want to remove that Select file sa...
Creating a temporary excel file using openpyxl python
I made a program that extracts specific data from an existing excel file. Now I want that data to be shown in an excel file but I don't want to save it on the system This is the GUI of that application which I am making Now I want to remove that Select file save destination Instead of that I want that when the user cl...
[ "Your requirement can be solved using xlwings module of python\nyou can try below code to open excel:\nimport xlwings as xw\nwb = xw.Book() # this will open a new workbook\n\nyou can find more about xlwings from documentation\n" ]
[ 0 ]
[]
[]
[ "excel", "openpyxl", "python", "temporary_files" ]
stackoverflow_0074419712_excel_openpyxl_python_temporary_files.txt
Q: PySimpleGUI not responding Im using PySimpleGui to make a simple file format conversion program, but the little window of my program keeps telling me (not responding) like if it was crushing while in reality it's working and its writing the new file. The issue is the cycle, if i remove it everything works but the ...
PySimpleGUI not responding
Im using PySimpleGui to make a simple file format conversion program, but the little window of my program keeps telling me (not responding) like if it was crushing while in reality it's working and its writing the new file. The issue is the cycle, if i remove it everything works but the user doesnt have any response on...
[ "Your code is working as expected. The window is unresponsive because you have a while loop that is blocking the main thread. The main thread is responsible for handling events and updating the window.\nThere are a few ways to fix this. One is to move the while loop into a separate thread. Another is to use PySimpl...
[ 0, 0 ]
[]
[]
[ "pysimplegui", "python", "user_interface" ]
stackoverflow_0074425822_pysimplegui_python_user_interface.txt
Q: Calculate column average row by row using pandas I have the following pandas DF: val 1 10 2 20 3 30 4 40 5 30 I want to get two output columns: avg and avg_sep avg should be the average calculated row by row. avg_sep should be the average calculated row by row until a certain condition (i.e. until r...
Calculate column average row by row using pandas
I have the following pandas DF: val 1 10 2 20 3 30 4 40 5 30 I want to get two output columns: avg and avg_sep avg should be the average calculated row by row. avg_sep should be the average calculated row by row until a certain condition (i.e. until row 3 I calculate one average, before row 3 I start cal...
[ "From the discussion in the comments:\nimport pandas as pd\nimport numpy as np\n\n# Building frame:\ndf = pd.DataFrame(\n data={\"val\": [10, 20, 30, 40, 30]},\n index=[1, 2, 3, 4, 5]\n)\n\n# Solution:\ndf[\"avg\"] = df[\"val\"].cumsum() / np.arange(1, 6) # or `/ df.index`\ndf.loc[:3, \"avg_sep\"] = df.loc[:3...
[ 1, 0 ]
[]
[]
[ "pandas", "python" ]
stackoverflow_0074354485_pandas_python.txt
Q: Comparing two DataFrames and retrieving modified values Two separate similar DataFrames with different lengths df2= pd.DataFrame([('James',25,'Male',155), ('John',27, 'Male',175), ('Patricia',23,'Female',135), ('Mary',22,'Female',125), ('Martin',30,'Male',185...
Comparing two DataFrames and retrieving modified values
Two separate similar DataFrames with different lengths df2= pd.DataFrame([('James',25,'Male',155), ('John',27, 'Male',175), ('Patricia',23,'Female',135), ('Mary',22,'Female',125), ('Martin',30,'Male',185), ('Margaret',29,'Female'141), ...
[ "use merge\ndf3 = df2.merge(df1, on=df2.columns[:3].tolist(), how='left')\n\ndf3\n First Name Age Gender Weight_x Weight_y Height\n0 James 25 Male 155 165.0 5'10\n1 John 27 Male 175 175.0 5'9\n2 Patricia 23 Female 135 135.0 5'3\n3 ...
[ 0 ]
[]
[]
[ "concatenation", "dataframe", "pandas", "python" ]
stackoverflow_0074427087_concatenation_dataframe_pandas_python.txt
Q: I Have A Question About While Loops and Writing One (In A Function) - Beginner I have run into a weird problem or maybe something I'm not understanding with this line of code that is kind of bugging me. I couldn't find what I needed online so thought I would ask here. When I was asked to put my while loop in a fun...
I Have A Question About While Loops and Writing One (In A Function) - Beginner
I have run into a weird problem or maybe something I'm not understanding with this line of code that is kind of bugging me. I couldn't find what I needed online so thought I would ask here. When I was asked to put my while loop in a function I didn't get the result I was after and I'm very confused. Here is the code I'...
[ "You have a function but do not call it so the code doesn't execute.\nYou need to call your function main().\ndef main():\n x = 0\n while(x < 5):\n print(x)\n x = x + 1\n\nmain()\n\n" ]
[ 0 ]
[]
[]
[ "function", "python", "while_loop" ]
stackoverflow_0074427163_function_python_while_loop.txt
Q: Python doesn't take my input but there is no error (code continues running) I continue learning the basics of Python by extending my TicTacToe game. It now lets the player choose difficulty. It seems that it works (finally), but sometimes I experience a strange issue. Note that I use Google Colab (in case that is ...
Python doesn't take my input but there is no error (code continues running)
I continue learning the basics of Python by extending my TicTacToe game. It now lets the player choose difficulty. It seems that it works (finally), but sometimes I experience a strange issue. Note that I use Google Colab (in case that is relevant). This is a turn-based game, meaning I play my turn, then computer plays...
[ "The error tells you what is wrong, you are trying to parse something that can't be interpreted as an integer, in this case an empty string ''. It is generally very dangerous to parse human input as an integer, without first checking that it can actually be converted to an integer. First you could check if it is nu...
[ 0 ]
[]
[]
[ "input", "python", "tic_tac_toe" ]
stackoverflow_0074424540_input_python_tic_tac_toe.txt
Q: What's means undefined symbol: cublasLtHSHMatmulAlgoInit, version libcublasLt.so.11 I am using SpaCy and SpaCy Stanza in Jupyter notebook with python 3, and I get the following error OSError: /opt/conda/lib/python3.7/site-packages/torch/lib/../../nvidia/cublas/lib/libcublas.so.11: undefined symbol: cublasLtHSHMatm...
What's means undefined symbol: cublasLtHSHMatmulAlgoInit, version libcublasLt.so.11
I am using SpaCy and SpaCy Stanza in Jupyter notebook with python 3, and I get the following error OSError: /opt/conda/lib/python3.7/site-packages/torch/lib/../../nvidia/cublas/lib/libcublas.so.11: undefined symbol: cublasLtHSHMatmulAlgoInit, version libcublasLt.so.11 can anybody help me? I tried update pip install --...
[ "I fix this error by adding the directory into LD_LIBRARY_PATH environment variable.\nLike this:\nexport LD_LIBRARY_PATH=/opt/conda/lib/python3.9/site-packages/nvidia/cublas/lib/:$LD_LIBRARY_PATH\n\n\nHope this helps.\n", "You can find your path by\npip show nvidia-cudnn\n\nthen\nName: nvidia-cudnn\nVersion: 8.2...
[ 4, 1 ]
[]
[]
[ "python", "spacy" ]
stackoverflow_0074294377_python_spacy.txt
Q: GraphQLTestCase self.query query() got an unexpected keyword argument 'op_name' I have the following GraphQLTestCase def test_create_foo(self): response = self.query( """ mutation createFoo($input: MutationInput!) { createFoo(input: $input) { foo { ...
GraphQLTestCase self.query query() got an unexpected keyword argument 'op_name'
I have the following GraphQLTestCase def test_create_foo(self): response = self.query( """ mutation createFoo($input: MutationInput!) { createFoo(input: $input) { foo { id title } } } """,...
[ "apparently op_name argument was renamed to operation_name in graphene-django 3.0.0, you can check other changes here https://github.com/graphql-python/graphene-django/releases/tag/v3.0.0\n" ]
[ 1 ]
[]
[]
[ "django", "graphene_python", "python" ]
stackoverflow_0074164177_django_graphene_python_python.txt
Q: How do I compile a Visual Studio project from the command-line? I'm scripting the checkout, build, distribution, test, and commit cycle for a large C++ solution that is using Monotone, CMake, Visual Studio Express 2008, and custom tests. All of the other parts seem pretty straight-forward, but I don't see how to...
How do I compile a Visual Studio project from the command-line?
I'm scripting the checkout, build, distribution, test, and commit cycle for a large C++ solution that is using Monotone, CMake, Visual Studio Express 2008, and custom tests. All of the other parts seem pretty straight-forward, but I don't see how to compile the Visual Studio solution without getting the GUI. The sc...
[ "I know of two ways to do it. \nMethod 1\nThe first method (which I prefer) is to use msbuild:\nmsbuild project.sln /Flags...\n\nMethod 2\nYou can also run:\nvcexpress project.sln /build /Flags...\n\nThe vcexpress option returns immediately and does not print any output. I suppose that might be what you want for a...
[ 145, 59, 30, 16, 5, 3, 1, 0, 0 ]
[]
[]
[ "c++", "command_line", "python", "visual_studio_2008" ]
stackoverflow_0000498106_c++_command_line_python_visual_studio_2008.txt
Q: How do you make VSCode Symbol Search find references in .virtualenv? I even opened the file directly and it still cannot find the symbol. Before anyone asks, no it's not file exclusion settings. I've allowed file searches under .virtualenv, and regular string search works fine, but particularly Symbol Search (usin...
How do you make VSCode Symbol Search find references in .virtualenv?
I even opened the file directly and it still cannot find the symbol. Before anyone asks, no it's not file exclusion settings. I've allowed file searches under .virtualenv, and regular string search works fine, but particularly Symbol Search (using the #) does not.
[ "You're now using a window to search for functions, methods, etc., and you're searching for strings in it. This of course doesn't exist because you don't have a method or variable named ConvReLU2d in your code.\n\nIf you need to search for strings, you can use Ctrl+F to search directly in the editor interface.\n\nO...
[ 0 ]
[]
[]
[ "python", "visual_studio_code" ]
stackoverflow_0074407065_python_visual_studio_code.txt
Q: different "python" and "python3" versions My python --version is Python 3.9.6 And my python3 --version is Python 3.10.8 I believe because of this I have a problem with running flask applications in VsCode. When I run one I receive ModuleNotFoundError: No module named 'flask error, however, I did install flask mod...
different "python" and "python3" versions
My python --version is Python 3.9.6 And my python3 --version is Python 3.10.8 I believe because of this I have a problem with running flask applications in VsCode. When I run one I receive ModuleNotFoundError: No module named 'flask error, however, I did install flask module Requirement already satisfied: flask in /Li...
[ "Use the following code to print out the currently used interpreter.\nimport sys\nprint(sys.executable)\n\nThen use the command to install flask for the current interpreter.\n<pythonpath> -m pip install flask\n\n\nReferencing this link will help.\n", "Try this either of this commands;\n---python3 -m venv venv\n--...
[ 1, 0 ]
[]
[]
[ "python", "visual_studio_code" ]
stackoverflow_0074424671_python_visual_studio_code.txt
Q: convert dictionary sentence and index into dataframe pandas { The word ‘Women Empowerment’ itself implies that women are not powerful enough - they need to be empowered.: 0, This painful truth has been in existence for a long long time.: 1, It is in recent years that noticeable work started beginning to lift women...
convert dictionary sentence and index into dataframe pandas
{ The word ‘Women Empowerment’ itself implies that women are not powerful enough - they need to be empowered.: 0, This painful truth has been in existence for a long long time.: 1, It is in recent years that noticeable work started beginning to lift women out of the abyss of insignificance and powerlessness.: 2, The pa...
[ "You can swap the key value pairs then feed it into pd.DataFrame(). Finally transpose().\ndata = {v: k for k, v in data.items()}\ndf = pd.DataFrame(data, index=[0]).transpose()\n\n" ]
[ 0 ]
[]
[]
[ "dataframe", "pandas", "python" ]
stackoverflow_0074427208_dataframe_pandas_python.txt
Q: Dynamically create nested for loops based on the number of variables I need to execute an expression like the following {(i, j, k): config[i][j][k] for i in config["content"].keys() for j in config["content"][i].keys() for k in config["content"][i][j].keys()} The expression is predicated on the depth on co...
Dynamically create nested for loops based on the number of variables
I need to execute an expression like the following {(i, j, k): config[i][j][k] for i in config["content"].keys() for j in config["content"][i].keys() for k in config["content"][i][j].keys()} The expression is predicated on the depth on config. Since this has 3 levels we get [i],[j],[k]. If we had 4 levels it wo...
[ "You can use a function that recursively flattens sub-dicts and merge the path of keys of the sub-dicts with the key of the current level:\ndef flatten(config):\n output = {}\n if isinstance(config, dict):\n for key, value in config.items():\n for path, leaf in flatten(value).items():\n ...
[ 1 ]
[]
[]
[ "dictionary", "dynamic", "for_loop", "python", "python_3.x" ]
stackoverflow_0074426971_dictionary_dynamic_for_loop_python_python_3.x.txt
Q: Reformat weird Dataframe Name place pers_data NaN NaN Nan Smith John NY sjohn@gmail.com NaN Nan 0987 4567 NaN NaN 0653 6734 Vic Stied SA 0986 5332 NaN NaN vickie@hotmail.com I would like to delete the NaN values and reformat the file like the following : Name Place pers_data other other_2 Smith John NY sj...
Reformat weird Dataframe
Name place pers_data NaN NaN Nan Smith John NY sjohn@gmail.com NaN Nan 0987 4567 NaN NaN 0653 6734 Vic Stied SA 0986 5332 NaN NaN vickie@hotmail.com I would like to delete the NaN values and reformat the file like the following : Name Place pers_data other other_2 Smith John NY sjohn@gmail...
[ "This is a variation on a pivot:\nidx = df['Name'].notna().cumsum()\nout = (df\n .assign(col=df.groupby(idx).cumcount(),\n Name=df['Name'].groupby(idx).ffill(),\n place=df['place'].groupby(idx).ffill()\n )\n .pivot(index=['Name', 'place'], columns='col', values='pers_data')\n .add...
[ 4, 0 ]
[]
[]
[ "pandas", "python" ]
stackoverflow_0073498869_pandas_python.txt
Q: When scaling, the start coordinates change I dynamically scale an image. It is working. In the example, I set the image center to (300,300). That doesn't work. the image will appear in the upper left corner. why? import pygame pygame.init() size = width,height = 600, 600 screen = pygame.display.set_mode(size) ...
When scaling, the start coordinates change
I dynamically scale an image. It is working. In the example, I set the image center to (300,300). That doesn't work. the image will appear in the upper left corner. why? import pygame pygame.init() size = width,height = 600, 600 screen = pygame.display.set_mode(size) clock = pygame.time.Clock() class Fireball(pyga...
[ "As the image resizes, you need to update the bounding rectangle and set the center of the bounding rectangle to the center of the original rectangle:\nclass Fireball(pygame.sprite.Sprite): \n # [...]\n\n def update(self):\n self.w += 2\n self.h += 2\n\n center = self.rect.center\n ...
[ 1 ]
[]
[]
[ "pygame", "python" ]
stackoverflow_0074427338_pygame_python.txt
Q: Replace job in Kubernetes via Python I have the following code: kubectl get job <JOB-NAME> -o json | jq 'del(.spec.selector)' | jq 'del(.spec.template.metadata.labels)' | kubectl replace --force -f - That replaces an existing Kubernetes job with itself. Is it possible to do this with the Python Kubernetes API? H...
Replace job in Kubernetes via Python
I have the following code: kubectl get job <JOB-NAME> -o json | jq 'del(.spec.selector)' | jq 'del(.spec.template.metadata.labels)' | kubectl replace --force -f - That replaces an existing Kubernetes job with itself. Is it possible to do this with the Python Kubernetes API? Here's what I am trying to do now: import k...
[ "The kubectl replace command has a --force option which actually does not use the replace, i.e., PUT, API endpoint. It forcibly deletes (DELETE) and then recreates, (POST) the resource using the provided spec.\nAccording to the kubernetes python client docs:\nUnder the class BatchV1Api(Api), there are 3 methods:\nr...
[ 1 ]
[]
[]
[ "kubernetes", "python" ]
stackoverflow_0074307365_kubernetes_python.txt
Q: python how to check if selenium webdriver is minimized the problem is i don't know how to check if browser has minimized, so how to check if browser is minimized on selenium (python)? i have tried this code: driver.get_window_size() but it will return browser size before minimized, and also i have read this questi...
python how to check if selenium webdriver is minimized
the problem is i don't know how to check if browser has minimized, so how to check if browser is minimized on selenium (python)? i have tried this code: driver.get_window_size() but it will return browser size before minimized, and also i have read this question but there is no driver.manage() attribute, you can help ...
[ "I've experimented with get_window_position(). And here is what I've got:\ndriver = webdriver.Chrome()\nprint('default:', driver.get_window_position())\ndriver.maximize_window()\nprint('maximized:', driver.get_window_position())\ndriver.minimize_window()\nprint('minimized:', driver.get_window_position())\n\nwith th...
[ 0 ]
[]
[]
[ "google_chrome", "minimize", "python", "selenium" ]
stackoverflow_0074427281_google_chrome_minimize_python_selenium.txt
Q: Pylance violating the Commutative Law with Union type ordering I have an interface specifying a position member. Because I want it to be agnostic to whether the member is implemented as a @property or a direct attribute, I annotate the type as a Union of the two class Moveable(Protocol): position: property or ...
Pylance violating the Commutative Law with Union type ordering
I have an interface specifying a position member. Because I want it to be agnostic to whether the member is implemented as a @property or a direct attribute, I annotate the type as a Union of the two class Moveable(Protocol): position: property or Tuple[int, int] entity: Moveable = Player() # Player implements `.p...
[ "Instead of or, use Union[] or |\nhttps://docs.python.org/3/library/typing.html#typing.Union\n" ]
[ 1 ]
[]
[]
[ "discrete_mathematics", "logic", "pylance", "python", "python_typing" ]
stackoverflow_0074427411_discrete_mathematics_logic_pylance_python_python_typing.txt
Q: Compute accuracy with tensorflow 1 Below you can see a code to build a network. With probs = tf.nn.softmax(logits), I am getting probabilities: def build_network_test(input_images, labels, num_classes): logits = embedding_model(input_images, train_phase=True) logits = fully_connected(logits, num_classes, a...
Compute accuracy with tensorflow 1
Below you can see a code to build a network. With probs = tf.nn.softmax(logits), I am getting probabilities: def build_network_test(input_images, labels, num_classes): logits = embedding_model(input_images, train_phase=True) logits = fully_connected(logits, num_classes, activation_fn=None, ...
[ "What you have done so far is good..., Hopefully, if I understood then you can find the mean accuracy easily..., by tf.compat.v1.keras.metrics.categorical_accuracy() So, I am putting a dummy code in your situation hope this will make some help...\nprobabilities_1 = tf.constant([[0.5 , 0.1]])\nprobabilities_2 = tf.c...
[ 2, 1 ]
[]
[]
[ "python", "tensorflow" ]
stackoverflow_0074304067_python_tensorflow.txt
Q: Python Paramiko Sudo Command     client paramiko.SSHClient()     client set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect() stdin stdout, stderr = client.exec_command("sudo passwd root") I've got a question!!!!! I have to change password for each of my VMs. Some of the accounts for l...
Python Paramiko Sudo Command
    client paramiko.SSHClient()     client set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect() stdin stdout, stderr = client.exec_command("sudo passwd root") I've got a question!!!!! I have to change password for each of my VMs. Some of the accounts for logging into Vms don't have to stdi...
[ "You're probably looking for something like paramiko-expect. Establish the SSH connection, then you can .expect the \"password for\" prompt.\nIf you receive a \"password for\" prompt, then send the sudo password. If you do not (and it appears that you will have to try-except a TimeoutError (or similar) to determine...
[ 0 ]
[]
[]
[ "paramiko", "python", "stdin", "stdout", "sudo" ]
stackoverflow_0074427251_paramiko_python_stdin_stdout_sudo.txt
Q: NameError: name 'playerNumber' is not defined - even though i defined it in another function Im coding a snake game for a project but for some reason it says that the variable playerNumber is not defined even though i very clearly defined it in the previous function. I dont really know whats wrong and i have tried...
NameError: name 'playerNumber' is not defined - even though i defined it in another function
Im coding a snake game for a project but for some reason it says that the variable playerNumber is not defined even though i very clearly defined it in the previous function. I dont really know whats wrong and i have tried various things and nothing has helped. import turtle gt = turtle.Turtle() t1 = turtle.Turtle() t2...
[ "Let's talk about scope.\nYou wrote this:\ndef start():\n playerNumber = ...\n\ndef playerColour():\n global playerNumber\n if playerNumber == ...\n\nThat is, start() makes an assignment,\nand playerColor() hopes to read that value.\nBut as written, it's making an\nassignment that is local to start.\nPut a...
[ 0, 0 ]
[]
[]
[ "python", "turtle_graphics" ]
stackoverflow_0074427336_python_turtle_graphics.txt
Q: Kernel not connecting in Jupyter Lab The kernel says connecting and then says No Kernel | Disconnected. I have clean-uninstalled anaconda and uninstalled all jupyter using python -m pip uninstall -y jupyter jupyter_core jupyter-client jupyter-console jupyterlab_pygments notebook qtconsole nbconvert nbformat Search...
Kernel not connecting in Jupyter Lab
The kernel says connecting and then says No Kernel | Disconnected. I have clean-uninstalled anaconda and uninstalled all jupyter using python -m pip uninstall -y jupyter jupyter_core jupyter-client jupyter-console jupyterlab_pygments notebook qtconsole nbconvert nbformat Searching anaconda or jupyter in Home directory ...
[ "It looks like you have a conflict in your PYTHONPATH. pdb attempts to import code, but instead of getting its module it sees your /home/username/Desktop/Projects/foldername/ms-p/peroo/code.py file which leads to the failure. Rename this file to something else, e.g. mycode.py. This can be a common problem, e.g. you...
[ 1, 1, 0 ]
[]
[]
[ "anaconda", "jupyter_kernel", "jupyter_lab", "jupyter_notebook", "python" ]
stackoverflow_0068612081_anaconda_jupyter_kernel_jupyter_lab_jupyter_notebook_python.txt
Q: Scraping "text" with BeautifulSoup I am working on scraping the data from a website using BeautifulSoup. For whatever reason, I cannot seem to find a way to get the text between span elements to print. Here is what I am running. import requests from bs4 import BeautifulSoup import pandas as pd headers = {"User...
Scraping "text" with BeautifulSoup
I am working on scraping the data from a website using BeautifulSoup. For whatever reason, I cannot seem to find a way to get the text between span elements to print. Here is what I am running. import requests from bs4 import BeautifulSoup import pandas as pd headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win...
[ "Referenced picture in your question is missing, but you can get rank by selecting your elements more specific:\nsoup.select_one('th:-soup-contains(\"Best Sellers Rank\") + td').text.split()[0]\n\nExample\nimport requests\nfrom bs4 import BeautifulSoup\n\nheaders = {\"User-Agent\":\"Mozilla/5.0 (Windows NT 10.0; Wi...
[ 0 ]
[]
[]
[ "beautifulsoup", "python" ]
stackoverflow_0074426872_beautifulsoup_python.txt
Q: Exclude right margin on bootstrap container I'm using dash (python lib to make dashboards) and i'm having a problem with bootstrap components. I can´t exclude the right margin from the container. I'm usign this: class_name='m-0' on the container class. Already tried using style={'margin': '0px'} too, but keeps thi...
Exclude right margin on bootstrap container
I'm using dash (python lib to make dashboards) and i'm having a problem with bootstrap components. I can´t exclude the right margin from the container. I'm usign this: class_name='m-0' on the container class. Already tried using style={'margin': '0px'} too, but keeps this same way. # Layout app.layout = dbc.Container(c...
[ "Your issue is hard to diagnose as you have not provided a minimal example that we can run to demonstrate the behaviour.\nFrom the snippet you have provided, the most likely explanation is that you are not using a fluid container, so your container will have a fixed width as set out in the bootstrap docs.\nYou can ...
[ 0, 0 ]
[]
[]
[ "bootstrap_5", "css", "plotly_dash", "python", "twitter_bootstrap" ]
stackoverflow_0074424684_bootstrap_5_css_plotly_dash_python_twitter_bootstrap.txt
Q: jupyter notebook keeps CONNECTING TO KERNEL The Jupyter notebook keeps saying Connecting to kernel, which never reaches finally popping an error, A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server confi...
jupyter notebook keeps CONNECTING TO KERNEL
The Jupyter notebook keeps saying Connecting to kernel, which never reaches finally popping an error, A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration. So the asterisk on the command line st...
[ "I had a similar issue. It was caused by the tornado-package and I had to downgrade it.\nsudo pip3 uninstall tornado\nsudo pip3 install tornado==5.1.1\n\nSee Jupyter notebook: No connection to server because websocket connection fails\n", "I have found this same issue, and identified it only happens with Chrome s...
[ 9, 0 ]
[]
[]
[ "jupyter_notebook", "python" ]
stackoverflow_0055014554_jupyter_notebook_python.txt
Q: Pandas - Drop rows where *not* totally duplicated I have a DataFrame that contains the following columns (along with others). I am trying to figure out how to remove all rows where: For each group number in ID_Dets if there exists more than 1 unique number in ID_Dets_2 then drop all rows. I have bolded the rows ...
Pandas - Drop rows where *not* totally duplicated
I have a DataFrame that contains the following columns (along with others). I am trying to figure out how to remove all rows where: For each group number in ID_Dets if there exists more than 1 unique number in ID_Dets_2 then drop all rows. I have bolded the rows that I would want removed. Thx! Index Other Column...
[ "You can count the number of unique values per group and set a threshold to have 1 unique value:\ndf[df.groupby('ID_Dets')['ID_Dets_2'].transform('nunique').eq(1)]\n\nor:\ndf.groupby('ID_Dets').filter(lambda g: len(g['ID_Dets_2'].unique())<=1)\n\noutput:\n Index Other Columns ID_Dets ID_Dets_2\n0 11 ...
[ 4, 1, 0 ]
[]
[]
[ "pandas", "python" ]
stackoverflow_0072888273_pandas_python.txt
Q: Search for particular data stored in variable Im trying to find percular process running on my system. For that pulling all the processes that are running on my system at the moment and storing it in a variable called 'name'. Now I want to parse through throught data stored in this 'name' variable and find a perti...
Search for particular data stored in variable
Im trying to find percular process running on my system. For that pulling all the processes that are running on my system at the moment and storing it in a variable called 'name'. Now I want to parse through throught data stored in this 'name' variable and find a perticular process that I need. import subprocess output...
[ "I think I didn't get your question, yet. If you loop through all of your processes, you could check in every loop through the name of the current process with the process you are looking for. Maybe not only a simple comparison, but with the use of regex.\nFor example with process WhatsApp.exe:\nimport subprocess\n...
[ 1 ]
[]
[]
[ "parsing", "python" ]
stackoverflow_0074427343_parsing_python.txt