Text1,Text2,Class,Text1_length,Text2_length makeing my first discord bot while learning python bot wont post the picture i want it to ok so im still learing and discord is the first api i decided to work with so far after a few teaks and adjustments ive gotten a good bit to work then i thought a welcome message would be great to make so heres the code and the error error that shows,selenium and auto closing browser i have script on selenium and it works fine now i reworked it for selenium but now browser closing on its own when code ends i want to keep browser open,0,69,38 pandas merge with left option is losing rows in left data frame i have dataframes the first left dataframe has rows second has only rows when i try to merge these dataframes with left option i get only rows here i get raws reopen the first dataframe here i get raws with marks how can i avoid reloading the first dataframe or fix this problem,signing payload in js frontend using ec and validating in python i have a python backend that generates public private keys generates a payload then needs to get that payload signed by the client reactjs or pure js which is later verified the implementation in python looks like this imports generate keys sign verify what i need now is to load or even generate the pem keys on the client side then upon request sign a json payload that can later be verified from the python backend i tried looking into the usage of web cryptography and cryptojs but had no luck i m okay using another algorithm that is more compatible but at the very least i need the signing functionality fully working i also tried compiling python to js using brython and pyodide but both could not support all the required packages in simple terms i am looking for the following generate payload python sign payload js verify signature python any help advice would be greatly appreciated,0,71,167 python define function to get the weighted median i have the following dataframe i have defined the following function however when i call the function wmedian df i get an error keyerror close the outcome i am trying to get is what is missing in my function i don t understand why i m getting that error,django turn settings debug to true for testing swagger endpint i have this test for checking if i can ping the swagger endpoint so this test fails because i only have swagger added to url when settings debug true i thought override settings debug true would fix that but it doesn t my test passes when i manually set settings debug true under my settings py file otherwise it throws an error because it can t find the endpoint i ve tried decorating both the class and the function with override settings and in both cases it threw the error because it couldn t find the endpoint i m not particularly attached to this way of testing to see if swagger is working this test is just to check if swagger isn t returning an error regarding annotation if anyone knows a better way to test this i m open to that i ve also tried but that also gives django urls exceptions noreversematch reverse for swagger not found swagger is not a valid view function or pattern name it only works when i set test init py,0,54,166 python freeopcua server how to know number of connected clients i have successfully set up a freeopcua server and it communicates well with clients but now i would like to know how many clients are connected to my server is there a method or workaround to know how many clients are connected to a freeopcua server,how insert image that is located in my documents folder in a mail i m trying to send an email within the body an image that i located in this folder users experiment documents opera terza gestionale opera iii foto concerto jpg i m using python and pycharm and this is the code all works fine but the image is not loaded it every time looks like this in the body of my mail it doesn t work also if i put the image in the same directory of my main py file obviously calling opera iii foto concerto jpg and not the previous path here is my code,0,55,93 jupyter console runtimewarning coroutine zmqsocketchannel msg ready was never awaited by running jupyter console any press of enter button show this error i have tried different computers with different linux distributions ubuntu mint manjaro kde manjaro xfce i tried different python versions different ipython verions and even with docker interesting that jupyter qtconsole jupyter notebook and ipython are working fine all answers i searched were about ipython or jupyter notebook but i need jupyter console,convert docx to pdf using python within google app engine i am trying to convert a docx file i have in my tmp directory to pdf using python within google app engine i have used docx pdf before but google app engine or linux doesnt support this module i have seen people use libreoffice to convert the file but i dont know how to install libreoffice within google app engine i could really use some help,0,68,75 extract the first dimention of numpy array based on condtion on the rd dimention suppose that i have numpy array with dimension x y z and i would like to extract the x and y dimension on a condition on the z dimension for example if z how could i do that,how made cross validation with python hi i made a neural network and i need to do a cross validation i don t know how made that specifically how train or made that if someone knows made that please write or give me some indications here is my code some recomendation for training or validation would be helpful,0,52,56 how to import install dependencies packages from a global system environment to a virtual environment i have installed my needed packages dependencies in the global system environment instead of my virtual environment virtualenv because i have used the command pip install package name outside of the virtual environment so i want to know how can i make a list out of them and install them in any of my virtualenvs,positively identifying python variable type trying to figure out how to positively identify the variable types generates the following output the type command generates a class structure which makes it hard to positively identify the variable type in question is there a way to get to the variable in the each class,0,69,52 how to check if xgboost uses the gpu i m writing a pytest file to check if my machine learning libraries use the gpu for tensorflow i can check this with tf config list physical devices for xgboost i ve so far checked it by looking at gpu utilization nvdidia smi while running my software but how can i check this in a simple test something similar to the test i have for tensorflow would do,how to add path to deal with this warning warning the script pygmentize is installed in home maulik local bin which is not on path consider adding this directory to path or if you prefer to suppress this warning use no warn script location,0,69,38 error when adding scrapy to flatpak project i m building a flatpak builded gnome builder project now i want to add scrapy to my project i use flatpak pip generator to generate scrapy package and add it in my manifest like but when i run i get the following error and if i add python setuptools rust it leads to this error any idea to solve this problem tks in advance,countvectorizer does not process my text data it keep giving me attributeerror list object has no attribute lower i have created process textdata function that takes in a pandas dataframe column of text then performs the following convert text to lower case and remove all punctuation optionally apply stemming apply ngram tokenisation returns the tokenised text as a list after that i implement the function into sklearn countvectorizer and it give me this error what am i doing wrong can somebody help with this,0,65,87 bitnami review board the python module subvertpy is not installed when adding repository bitnami review board the python module subvertpy is not installed when adding repository the python module subvertpy is not installed you may need to restart the server after installing it,d surface in pyvista is not generating correctly i am trying to avoid closing the center opening but can t figure out how to do so issue with pyvista filling opening that shouldn t be filled i am trying to create a d surface using pyvista have also tried mayavi whenever i perform a delaunay d mesh to create the surface it closes the mouth opening of this surface that should still be open i have included an image showing what part needs to be fixed and also a copy of my code that generates the data and reproduces the current issue i would really appreciate anyone s help regarding this issue,0,43,108 python misinterpret keyboardinterrupt exception when using lingoes i want to write a python program run py that always runs and only stops running when ctr c is pressed this is how i implement it wrapper py run py however when i hold left mouse and select text in the terminal that is running wrapper py this event is understood incorrectly as ctr c then the wrapper py stop running run py my question is how to prevent reading mouse events as keyboardinterrupt in python unix thanks terminal,performance changing the data depending on the options while iterating i was writing a personal project and i found myself at a tight spot to make things easier code is basically iterating and printing the names of the users while iterating i check if getlastname option is enabled if its true then add it to the final name string for better understanding check the code below now the problem is my actual code is pretty complex and checks for many factors middlename coloredname so checking each time while iterating is reducing the performance since it checks for many factors and changes the final data what would be the best approach while keeping the code optimised and good if you are confused about what i am trying to achieve take this code for instance this code obviously is pretty bad because it checks every time for each user for options thanks,0,78,152 list comprehension over tuple of tuple i have the following string conf x x o o x x o which is a tuple of tuple i want to iterate over each element and find the which means the empty space and return a tuple with the coordinate of the what i have tried so far which does not work can someone help with this one,is there a way to copy subfolder without copying recursively am trying to copy subdirectories from directory but i realize the first subfolder copied is copied recursively i would not like that i would like to copy the sub folder intactly when i run the code i have sub dir a sub dir b and dir b copied in new dir i however want dir a and dir b in new dir,0,68,63 csv reader reports values out of range i am attempting to convert a csv file into a python data dictionary here my code here are what initial rows of the csv file look like this works but when i include rows and it give me this error tried to troubleshoot but unclear why there is an error,problem with condition if a predefined text exists in the database field then the if condition is satisfied my idea is to insert a condition in the if if in the specified field in the database it says smartphone i have a problem inserting this condition in the if i would like to obtain that if in the device field of the database it says smartphone then the if condition is true i m not getting errors but hello doesn t print the database is the row for example is id street chelsea smartphone,0,58,93 new entry in dataframe is deleting the previous entry in pandas in this code i m trying to generate water level data for a for every minute for a whole day then storing that data to pandas data frame but when i try to do so the new data in data frame deletes the previous one and at last in the data frame there is only one value left,extracting latest values in a dask dataframe with non unique index column dates i m quite familiar with pandas dataframes but i m very new to dask so i m still trying to wrap my head around parallelizing my code i ve obtained my desired results using pandas and pandarallel already so what i m trying to figure out is if i can scale up the task or speed it up somehow using dask let s say my dataframe has datetimes as non unique indices a values column and an id column what i want to extract is the latest value for every second e g if the price right before is the row with the index of the latest value is in my case sometimes index values are not unique so as a tie breaker i d like to use the id column the value with the largest id number will be considered the latest value for the case of the three values tied at the time the value would be chosen since the largest id for that date would be also note that id is not consistent throughout the dataset and i cannot only rely on it for ordering my data in pandas i simply do this by obtaining the last index and then if the value of last values index is unique is false i finally perform last values sort values id iloc i ve been having a hard time translating this code to dask encountering issues regarding my delayed function resulting to them to need computing before i can reindex my dataframe again i d like to know if there are any best practices to dealing with this sort of problem,0,68,273 tkinter attributeerror button object has no attribute get when trying to access file from filedialog askopenfilename so i have something like this what i m trying to do is to store the dataframe created in open file to use it in get info i m getting attributeerror button object has no attribute get how could i access the dataframe created in open button,translator on python not working coming with error saying baseblob translate got an unexpected keyword argument the code basically asks user to input a number and converts it into the spelling for the number i need to make a translator for the output on the gui it has a combo dropdown box and the user can select what language it needs to be translated to however the code does not work what should i do whenever i change the language an error saying baseblob translate got an unexpected keyword argument comes up i made it so a message box shows an error,0,57,99 capture elements with selenium which are loaded lazy in python trying to click a button with selenium but i keep getting an error nosuchelementexception message no such element unable to locate element method link text selector agree here s the button i am trying to click i assume the popup is loaded lazy i found some sources but could not make it work here s my code i also tried and the popup is definitively there but still get the same error,counting number of a value in a dictionary when values are a list of lists i have a dictionary where the values are a list of lists and i want to count the number of times a certain value shows up in the dictionary i ve tried something like this this but when i try that i get zero back,0,77,59 unexpected requests exceptions connectionerror i was trying to run this code but a big error has raised i tried to ping this host but failed and google didn t give useful advice could you please tell me why and how to deal with it thanks a lot i have also asked this question on github at,python vlc switching playback media between launches i m trying to set up a system where my start screen video loops until of buttons is pressed gpio buttons then the playback changes to either a video with subtitles or no subtitles once that has finished its play through it reverts back to the splash screen video i have additional tickers in here just to count the number of play throughs per day for analytics my test device also only has button hooked up which is why gpio is never used implementation will be identical to gpio s so once one is working the other won t be hard to match up when i launch the script the media played is not always splash the script also closes the window at the end of playback and opens a new one to play the media i believe this may be due to not establishing an xwindow for raspberry pi any advice,0,54,156 how to check if xgboost uses the gpu i m writing a pytest file to check if my machine learning libraries use the gpu for tensorflow i can check this with tf config list physical devices for xgboost i ve so far checked it by looking at gpu utilization nvdidia smi while running my software but how can i check this in a simple test something similar to the test i have for tensorflow would do,how to stream data to an output blob binding with azure function i m trying to retrieve a big file from an api and save it on an azure storage account so i am designing an azure function i don t want my code to download all the data and then write all the data i can have a data input stream from this api and i would like to stream data to an output blob here is a small example here is my function json and when i open the file container hello txt from my storage it contains only the last character r and weighs only byte i think that outputblob set data overwrites the data to the output blob how can i stream data and append it to my output blob i d rather use output blob bindings but i can use containerclient objects edit in the docs they specify that we can use streams as func out func inputstream,0,69,154 how to validate json with help of jsonschema i want to validate my json input my json i expected exception because job is not job how to validate this json,printing out features used in feature selection with xgboost feature importance scores i m using xgboost feature importance scores to perform feature selection in my knn model using the following code taken from this article the output that i m getting is showing me for each iteration the number of featues used select x train shape the threshhold that is used everytime a feature is removed thresh the classification report and the confusion matrix this output will keep on going until the number of features used reaches n what i want to do is that i want to also include the names of the features used or removed in each iteration but i can t figure it out is there a way to get it done,0,30,121 list of all us zip codes using uszipcode i ve been trying to fetch all us zipcodes for a web scraping project for my company i m trying to use uszipcode library for doing it automatically rather than manually from the website im intersted in but cant figure it out this is my manual attempt this takes alot of time and would like to know how to do the same in more efficient way using uszipcodes,performance changing the data depending on the options while iterating i was writing a personal project and i found myself at a tight spot to make things easier code is basically iterating and printing the names of the users while iterating i check if getlastname option is enabled if its true then add it to the final name string for better understanding check the code below now the problem is my actual code is pretty complex and checks for many factors middlename coloredname so checking each time while iterating is reducing the performance since it checks for many factors and changes the final data what would be the best approach while keeping the code optimised and good if you are confused about what i am trying to achieve take this code for instance this code obviously is pretty bad because it checks every time for each user for options thanks,0,74,152 is it correct in scrapy to have multiple parse methods in one spider is it correct in scrapy to have multiple parse methods in one spider something looking like,import json with missing keys into postgres with flask sqlalchemy i have a question you guys might be able to answer i have a json file that looks something like this the point is that not every entry has all keys i have a flask sqlalchemy model that looks like this and i have a python script to add the json entries into my postgresql database that looks like this i don t know why but somehow every cell is null except the official id field how so and how can i fix that i m at the end of my wits right now every pointer or help is much appreciated edit what i found out so far is that entry key is not interpreted as entry state for example but actually creates a reference entry key bw for example why is that,0,30,136 trying to get a member s status right now i am doing it on ready just to try and figure it out the status is returning offline when i am online ultimately i am looking to do this within a looped task where i check whether they are afk every so often is my settings in the discord dev portal anyway any ideas where i messed up,create a new variable based on other variables i have a dataframe in python called df where i have dichotomous variables called ordering ordering ordering ordering with true false values i need to create a variable called clean which is based on the other variables meaning when ordering true then clean ordering when ordering true then clean ordering then clean would be a combination of all the true values from ordering ordering ordering ordering here is an example of how i would like the variable clean to be i have tried the below code but it does not work df clean df ordering df ordering df ordering df ordering would anyone please be able to help me how to do this in python,0,66,126 problem with slowing down ball in pong game i ve been making pong with pygame and i got the ball to bounce around the screen and on the paddles however the speed is too high and i want to decrease it this is what the code looks like for the ball object if i try to set the velocity as a float it stops the ball completely can someone help me,determining time complexity of a function i have a computer science project in which i am tasked to assess the time complexity of this specific function and also figure out a way to optimize it by using hash function data structures like sets and dictionaries for clarification group is supposed to be an empty list at first network is supposed to be a nested list in which the elements inside the inner lists are ints and current user is supposed to be an int edit typo,0,70,86 how to convert lmd file to csv flow cytometry data lmd file extension is often used for generating flow cytometry data but this couldn t be directly used for processing either in r or python is there a way to somehow convert it to csv or some renowned format,create multiple boolean columns in pandas dataframe based on multiple conditions i have a dataset where authors are ranked by the order of authorship etc i want to create three more boolean columns if first if second if last the purpose of this i want to show if the author is ranked or last in the article the last means the maximum number in rank column the maximum number for this authorid in the column rank i can do if first and if second that is pretty easy but not sure how to resolve if last two rules here expected output,0,48,101 how can i close the visual studio code window with a python command i was writing a python script and i got the idea of making a line of code that closes the visual studio code window is there a way to do this with just python commands or do you need an other language for this,viewing attrib s slots from parent classes in derived classes how can i view access the parent class slots from the derived class when using attr,0,58,24 accessing a variable within a nested function of the same class i am trying to access variable within function how should i go about doing this,merging two dataframes and updating count and date i have this dataframe and this dataframe how can i merge them by the number so that the total complaint count getts added to the one in the first dataframe and last complaint on date is updated with the later date like this i tried this approach but don t know how to proceed further if the number is not present in the first dataframe it s simply added to the rows dict of the first table for reproduction second table,0,27,83 python misinterpret keyboardinterrupt exception when using lingoes i want to write a python program run py that always runs and only stops running when ctr c is pressed this is how i implement it wrapper py run py however when i hold left mouse and select text in the terminal that is running wrapper py this event is understood incorrectly as ctr c then the wrapper py stop running run py my question is how to prevent reading mouse events as keyboardinterrupt in python unix thanks terminal,cannot import name workspace extension from jupyterlab server after updating to the most recent jupyter server when i enter i get how do i correct this do i have incompatabe package versions installed,0,78,31 python unable to understand how async works not able to run the python script i am using python i wanted to check what happens when i call sync function inside async i have test py when i try to run i get so then i tried putting await before main when i run i get so what is the correct way to make this script working,list comprehension and str split returns lists in list instead of individual strings assume i need all items from that list sometimes separated by sometimes not the below function works but i d like to know how to do this with list comprehension list comprehension i tried i d like to avoid adding named functions to my code if it can be avoided i m also interested in solving this with lambda functions although i m learning basic stuff at the moment,0,66,78 python get env from finished subprocess python so i have a subprocess like so now the subprocess itself is modifying the env and i wanna know how can i get this modified env from the process the example is using export however i run a script which may change or add other env variables so i d like to get the whole env,attributeerror tuple object has no attribute lower when returning specific values from an array i have an array like this i want to return only the values into a new array group by the values in final outcome i use this code however as index is a tuple i get back any ideas on how to fix it,0,62,61 how can i concatenate pytorch tensors or lists in a distributed multi node setup i am trying to implement something like this for nodes each node with gpus i tried to get a sum of these but what i want is a concatenated version like this or is also ok with me is it possible to achieve this from torch distributed,tickval does not assign correct position to ticktext i am plotting an annotated heatmap with a colour bar using the code below inspired in part by this very helpful tutorial its part of a larger bit of code which i ll put at the end final df is a dataframe whose columns are protein ids and index is features of interest only one in this example m a non int in a heatmap cell means the protein associated with the cell is part of the feature associated with the row index and each non int between and maps to a protein grouping that i d like to use to color my cells i m plotting the heatmap with the code block below unfortunately my colorbar ticktexts dont match up with tickvals and i have no idea why it should be one label biosynthetic etc per colored block in the colorbar on the right of the image any pointers cheers tim full code,0,62,161 token authentication failed utf codec can t decode byte xe in position invalid continuation byte i m trying to send the json data from azure ml to eventhub this is the screenshot of output of the variable data output and getting following error anyone could help debug the error thanks,pdfplumber memory hogging crash with large pdf files using pdfplumber to extract text from large pdf files crashes it,0,48,19 get home directory path in python on linux as root i have a script where i need the path string of the current user i am using os path expanduser my problem is that if i execute the script as root the path is root where i wanted to have something like home user name how can i achieve this in python this snippet when called as root sudo python test py returns,take a screen shot of a specif area and save as variable i want to make a program taking a cropped screenshot like windows shift s and save it as variable not as a file how do i programmatically open this win shift s window how to directly get the output without saving this as a picture i m using python,0,68,56 how do i determine if a given p x y point is located within the boundaries of an array below was my attempt i couldn t print out the accurate key if the point is within a part boundary the algorithm should return the part number otherwise the algorithm should return,log message not displaying on console below is the code i am trying to run but the log message is not getting displayed on the console i am running code on pycharm with python,0,49,34 using alias to rename pyspark columns i m trying to import a parquet file in databricks pyspark and keep getting the error i tried the suggestions in this post using withcolumnrenamed like in this post and also using alias like but always get the same error how do i go through each column to replace any invalid characters with underscore or even just delete all invalid characters,timestamp ecact time calculate this this timestamp from one of website but this timestamp always have few members extra if someone can tell me what is this and why this timestamp example mentioned by real order if someone can tell me what is the relations between those numbers,0,67,48 other than max value replace all value to in each column pandas python i have a df which i want to replace values that are not the max value for each column to code sample df result trying to get kindly advise many thanks,how do i split up a user input so that it takes up two index places in an array python i am looking to be able to take a user input of a few different words separated by commas and then add them to an array so that each word they ve put in takes up a different index value this is the function i am using for this currently this works by taking one user input changing it to lowercase adding it to the array and printing it out i want to have it so the user can input mouse horse mountain and the program will add those three items to the array all separately at the moment it adds them all together as it should i ve tried the split command however all that seems to do is add them as one thing and just put square brackets around them any help would be great cheers,0,46,157 python discord bot multiple on message i am very new to python and i am trying to make a discord bot that sends messages whenever it finds food related words here is what i came up with and it s giving me an indentation error on line why is that and what do i do edit i ve copy pasted the code from repl it to here thank you for your help enter image description here,how to count the number divisible by n in given range a to b for multiple cases c in python so basically there are multiple cases that need to be solve by counting the number that divisible by n in given range a to b for example there are cases case has a b n case has a b n but on one condition that the input must be like this the output will be like i have this function for reference my explanation is bad but i just don t know how to make it more clearer i hope someone will understand and enlightened me about this problem thank you,0,71,113 how to find neighbors of element in matrix in python i need help with a function that s supposed to return all neighbors of element in a matrix i can t use numpy because it s a project for school for example for given matrix i need get neigbors x y function that returns all of elements around the element m x y for example get neighbors is supposed to return and please no one liners thanks,copying a list of numpy arrays i am working with lists of lists of numpy arrays as a bare bones example consider this piece of code here i copy a list of one array from a to b however the array itself is not copied so both give array if i want to make a copy of the array as well i could do something like and a would remain unchanged this works well for a simple list but it becomes more complicated when working with nested lists of arrays where the number of arrays in each list is not always the same is there a simple way to copy a multi level list and every object that it contains without keeping references to the objects in the original list basically i would like to avoid nested loops as well as dealing with the size of each individual sub list,0,71,152 convert million to integer in pandas i m trying to change the scraped results in a column called outstanding currently the numbers being scraped are coming out like m and i want them to be i m not sure quite how to do it but i know that if you put e instead of m it would come out as i tried this below but no luck any ideas how to get what i m looking for thanks edit,plotly subplots issue with specs value error i am trying to plot subplots with secondary y axis with plotly subplots but no matter what i am trying still getting this type of error valueerror the specs argument to make subplots must be a d list of dictionaries with dimensions x received value of type class list secondary y true secondary y true secondary y true thank you for help,0,78,68 issue with tensorflow tensorflow transform beam on windows running the below code on my local win machine and facing errors imported the below packages python windows tensorflow transform snapshot of error can anyone help with this,can returned attributes be forced into lowercase changes on our ldap server have changed the case of the attributes returned from search for example mailroutingaddress is now mailroutingaddress the searches themselves are case insensitive but the python code processing the returned ldap object is attempting to reference attributes in all lower case and failing is there a simple way to specify that the ldap module should lowercase all returned attributes or is there a straightforward way to change them to lowercase as soon as the results are returned we re trying to avoid extensive rewrites to handle this change in our ldap software this code returns an error key not found when the last line was change to this it worked i was hoping there was something i could do when the ldap object was first bound or i could iterate over all of the attributes passed back by the search function,0,36,151 how to get the timeslots from the start time and end time in the pandas dataframe i have a pandas dataframe where it has start time end time and booking duration please find below example dataframe i am trying to get the timeslots from the above dataframe expected output what i have tried till now i can get the slots from start time and end time but i am missing the expected output can anyone give some hints please,getting a empty dataframe using pandas i m using pandas to create a dataframe in python but i get only the columns when i try this this is my code,0,75,29 drf from django conf urls import url in django i ve a project in django and i ve updated pip install r requirements txt to version new release and i ve currently the below error when i run the server in a virtual environment i use drf can t import from rest framework import routers in urls py from django conf urls import url importerror cannot import name url from django conf urls,web scraping requests python good morning everyone i m trying to access the html code of a web page i ve got the login working through python but only that once i print the page the html code is not as complete as if i opened it in a browser a this is the answer,0,65,53 how do i convert a composite class into a dictionary i have a class called large which contains an instance of small when i call the class and try to look at its dictionary it looks broken how do i force the small attribute to a dictionary also,how to identify bad records during read csv using python pandas i have a data stored as a csv file with plus columns and k records i am encountering the parse error during read option my objective is not resolve it but to debug identify those error causing records i already referred the posts here here here so it s not a duplicate when i try the code below i get the parse error as given below parsererror error tokenizing data c error expected fields in line saw based on this post i followed the below suggestion and it works fine however this results in loss of records therefore i tried another suggestion but this doesn t display the output in tabular format due to tab delimiter i would like to view the offending bad records obtained by subtracting records in a neat tabular format because more than half of the dataset is lost due to this issue so am seeking your help to know what is causing this issue if i can identify those error causing records and store it in a table format it would be helpful for me to review,0,48,194 connect to mysql database over ssh in python script i am in a situation where i need to access a mysql database running on another computer computer b unfortunately the computers aren t on the same local network the only way i found that i can access the sql database on computer b from my laptop computer a is via ssh my question is can i access the sql database over ssh from python,how can i iterate through a list of songs and play them one after eachother i am looking to iterate through a list of songs such as songs song mp song mp song mp and i want to play each song one after each other i have tried various methods the most suggested seemed to use pygame however i have not been able to debug the tremendous amount of errors that come with using it my main source code and attempt at this is as shown below upon running this i receive error pygame error modplug load failed i am running this concurrently inside of a slideshow program i have i want this code to run as background music and i plan on checking for the end of the song in a function i already have set,0,73,133 pyspark crosstab with percentages i have a dataframe after applying crosstab in the pyspark example below instead of s i want to get the percentages of the rows i can be easily get that with the pandas using the crosstab function how can i get this in pyspark,converting an xlsx file to a dictionary in python pandas i am trying to import a dataframe from an xlsx file to python and then convert this dataframe to a dictionary this is how my excel file looks like where a and b are names of columns and and are names of rows i want to convert the data frame to a dictionary in python using pandas my code is pretty simple what i want to get is but what i get is what might be the issue,0,48,90 how to get yesterday s date in epoch time python i can easily get the yesterday date like this how can i do the same for unix epoch time i tried this i could go now to some crazy conversions to convert str to int and so on but that really seems like complete overkill recon there s gotta be a simpler way to do this thanks,how can we create object in desire database in rest framework i m creating project but that project is saving in the default database i want to create that project in other database i m using creatapiview i don t get it how can i use that using otherdataname in get serializer,0,65,47 how to add two values from the same columns so i am looking to add values from a dataframe column and write the result in a second column column is given column will be my result what i want to do is column column column column column column,change the element in a list of lists differently alternating every nth time i have a list of lists containing information about days in a month e g i would like to iterate through the list of lists setting the element id to a for the first five then b for the second five and continuing that alternation for as long as the list of lists might be i am struggling to get the syntax right using a for loop,0,54,79 extended unpacking not creating separate items in list i am executing the below code i am getting output as tho please help me understand why the output is not t h o as we are using the operator on lhs so the output should be t h o and not tho,can a function and local variable have the same name here s an example of what i mean the code doesn t produce any errors and runs perfectly this contradicts the idea that variables and functions shouldn t have the same name unless you overwrite them why does it work and when applied to real code should i use different function local variable names or is this perfectly fine,0,53,65 how to fix can t find main module in error i am calling my python file from windows service the code is working fine by itself and the service works fine too but when i call the python code from the windows service i get this error my python code is this and he is my windows service in c and the error i get is this how to fix that,some records are duplicated when writing bigquery query result rows to csv file i m using the following script to select from a bigquery table then loop over the query job result rows and write to a csv file one row at a time my problem is that for some query jobs the total number of rows written matches the expected but with some of the rows duplicated and others missing for example the query itself may return k rows and no duplicates but of the k rows written there are records duplicated and records missing when compared with the query result one file in question is over gb before compressing but for other queries selecting the same columns but a different visitstarttime range the file will be even larger yet have no duplicate issue is there a reason why for some query jobs some of the records would be written in duplicate and others not written at all,0,71,160 why is my python script printing none after using a function and using input print this is my code which prints this how can i stop it from printing none i ve read that i should use return but i m not really sure what i should do also this is the whole videosourcedeclaration function,numba why guvectorize is so slow i am learning numba to try to optimize my code first i calculated a exp b x where a and b are two parameters and x a large numpy array i used the jit decorator the output is d array with len x elements this the code the output is so everything worked well i have a large time decrease with numba optimization the machine where this code runs has cores after i decided to use an array of a and b parameters par np array i i for i in range x is unchanged this is the beginning of my problems first as the output is a d array of shape len x elements it seems that i could not use jit decorator but i must use guvectorize decorator i have written this code very similar to the one above that works but the benchmarks are not good the code with numba optimization is slower than the code written only with numpy functions as it is the first time i used numba i suppose there is something that i have not understood any help would be appreciated,0,52,191 need to apply rule based algorithm for large corpus to find similar relevant keywords present in array of elements currently am working in nlp workspace respective to text data i want to find out actual given keywords based domain dictionary with column through search based the output should predict which category position will fall into a particular row based on high probability keywords in each category,how to determine the negative index of an element in a list how can i see the negative index of an element in a list in python list index will only return the positive index how do i get the negative index of it,0,65,43 how can i deal with context var in asyncio while it is in a while cycle contextvar value doest change as it goes through while cycle the output is i want to set a new value to this context var but i cant find any similiar cases for the first time here so i dunno if all images are shown correct and dunno gow to paste a code here so pls help,joint accumulation of addition and multiplication i have an array and i want to do the following calculation with out as the output for the given example is there a nice way to vectorize this i think einsum can be used but i couldn t figure how to write it,0,76,50 how to set time zone for historical price quotes retrieved using ccxt the python example below from ccxt will fetch historical price quotes the code does not show how to set the time zone how can i set the fetched price quote timestamp to asian hk singapore time zone i am using python,replace all occurances of a number in a matrix python the input is a multi line string containing the matrix i have to replace all the occurrences of let s say with so the output array would be,0,54,38 how to update replace a file in a django filefield i have a django model that holds a file like so i know want to access this file with an updated version of the file if this was a int foat or json field etc i could use something like but for some reason as it is of type filedfield there is no update operation how can i replace the old file with a new file,asyncronous threading python ocpp i m trying to implement the ocpp libary in python there are two functions which run in a while loop continously cp start for logging and cp heartbeat as a protocol intern heartbeat when i want to implement them normally into my routine the while loops will block the event loop so i want them as threads but the libary seems to have a problem with it the errors even when i set the thread as a daemon the heartbeat will work but i can t close the program anymore the final goal is to let cp start and the heartbeat run in a thread so that i can control the charging proces of an electric vehicle in another logic,0,77,119 adding to set if part of tuple not exists i would like to use something similar to the add function to add tuples to a set however i want them not to be added if a part of that tuple already exists in the set for example this gives me a result as but i would like the a b combination to only appear once the first time it is added so that my result is,valueerror at admin services blog add blog objects need to have a primary key value before you can access their tags i m trying to create a blog by the admin panell but i m not able to save can you please help model py for some reason when i m trying to save the tags and the data i m getting this error,0,74,55 converting python dataframe to a particular json structute hi i want to convert my dataframe to a specific json structure my dataframe look something like this and the json structure in which i want to convert my datafram is below i tried implementing this with below code with different orient variables but i didn t get what i wanted so if any can help in achiveing this thanks,how to build unique random couple from a single list i want to find random couples on a single list with different members here is my code i am sure there is a better way and more elegant way to do this with itertools combinations do you have a piece of advice,0,69,52 pytest pass cmd line options to test scripts but not to test function my test sample py is like my question is how can i pass cmdopts to the test script not to the test c function,building a d boolean matrix from a d matrix with indices in numpy i have a d matrix of shape with indices ranging from to currently i use a for loop to build a d boolean array of shape that stores true at the position of each index for each row between and is there a way to achieve the same result without iteration perhaps using numpy functions,0,34,77 weight which is but so code should take weight but it does weight i am currently working on my python course and i have some code here however when i print the result i am getting ground shipping why is this is greater than and less than so it should be multiplying by not,difference between function and function i see my question is why use len function without parenthesis in but use it with parenthesis in what is the difference between the two i see this kind of occasion a lot where using a function with and without parenthesis can someone explain to me what exactly is going on thanks,0,74,59 how to print following pattern getting issue with spaces i am trying to write the code but not getting how to achieve expected output causing issue with space and not able to make proper judgement how to get exact spaces after every iteration my code output of above code is not as expected output expected output,conceptual understanding of variable scope in higher order functions i have a function score which gives me a score for every turn for n turns in a loop this score is incremented by a random integer from to every turn i now have to design another higher order function which should print the highest score jump of a player out of all the score jumps yet and should be called inside the score function i name it highest gain naturally this should print the first score value as it s the first turn hence it is the biggest jump python tutor link the problem is that calling highest gain doesn t update the values of previous value and highest point why aren t these variables getting updated in the score function body and how should highest gain be called be called so that these variables are updated on each iteration of the loop,0,58,147 append items in front to every list inside list of lists not to the back i have the following list of lists i would like to append item name to the front of the list such that it looks like this here is the python code i wrote to do this the code appends the items to the back of the list what i want is append to the front of the list i am using python,how to retrieve aws s objects url using python i need to write a lambda function that retrieves s object url for object preview i came across this solution but i have a question about it in my case i would like to retrieve url of any object in my s bucket hence there is no keyname how can i retriece url of any future objects stored in my s bucket,0,77,70 how to speed up this python loop any suggestions please threading or something like that outputs here downloadtime downloadtime downloadtime,how do i make a function to change every appearance of a letter to a different letter i have a name let s say john i want to create a function that changes the o to an a this is what i came up with this works fine and returns jahn but what if i want to change a name like johonas for example it returns jahonas so i tried to make an if statement like so however this return none and i quite honestly don t know how to fix this any help is appreciable,0,24,94 how to calculate the difference b w each element in an numpy array with a shape please feel free to let me know whether it is a duplicate question from in arr np array how can i get diffinelements i tried np diff in arr axis but it does not generate what i want is there a numpy function i can use cheers,fileexistserror errno file exists usr bin python home had virtualenvs cv bin python when i have python and python on ubuntu i entered some alternate commands to use python only when i type python v and python v the same output is and then i install virtualenv and virtualenvwrapper these packages allow me to create and manage python virtual environments sudo pip install virtualenv virtualenvwrapper sudo rm rf get pip py cache pip to finish the install of these tools i updated our bashrc file i added the following lines to your bashrc export workon home home virtualenvs export virtualenvwrapper python usr bin python source usr local bin virtualenvwrapper sh next source the bashrc file source bashrc and final i created your opencv python virtual environment mkvirtualenv cv p python i have created the virtual environment but had some problems in the back end and i guess it was due to the presence of python in the end i decided to uninstall python and rerun the steps above from scratch and had a problem at the last step that i mentioned above when i enter command mkvirtualenv cv p python i get an error fileexistserror errno file exists usr bin python home had virtualenvs cv bin python at the same time when i enter the command update alternatives config python python is no longer there but i get a warning update alternatives warning alternative usr bin python part of link group python doesn t exist removing from list of alternatives there is choice for the alternative python providing usr bin python looking forward to your help thank you,0,64,249 adding legends to axes d plot i m trying to add a legend to a d plot and i ended up getting this the legend is incorrectly displaying one color and in a list rather than separate legends for each label what am i doing wrong,pandas create csv with row wise instead columnar i have the below code where dict hh is instead it come like below it is comming like below how can i make it,0,45,32 pyautogui click won t register click on window of application on my desktop my code will locate the window with a picture and then move the mouse to the correct position but the click doesn t actually register on that window the window does register when i click on it manually like normal,efficient way to find if a matrix is sub matrix of another one given two matrices a and b is there efficient or more pythonic way to find if b is a sub matrix of a the code below is worked but i got a time limit exceeded when the matrix is so big note the matrix data structure is represented as an array of strings input code expected output,0,51,68 how to make a face recognition identification and verification program so i made a face detection program for webcam in python using opencv but this just detects the face it doesn t recognise identify who it is so how to i train my program to recognise if it is me my code so far i also wanted to know if there was a way for the program to tell how many faces it is detecting,affine transformation of with python translating my code from matlab i am trying to apply an affine transformation to georeference a terra aster satellite image using python using a tranformation matrix from pairs of coordinates src dst of the four scene corners using functions from the skimage package the tform is the same as in matlab but transposed but the warping creates a plane green image not the one expected as in matlab see wetransfer link below any ideas the numerical values indicate a low contrast or no image depending whether i use tform or tform inverse with tf warp according to solutions i googled download of images from wetransfer mb including input image naivasha tif and output images naivasha georef python png and naivasha georef matlab jpg,0,72,118 how to group data returned from sql and convert in json i have the following data coming from sql result and i have to make a json structure like i know there are multiple ways to do it like involving dicts and list or itertools but unable to figure out a cleaner way to do it because data is variable and it d keep coming from the db,python not creating new file headers when it does not exist i want to write a new csv file with headers if it does not exist and append row data to it not sure why the following code doesn t add the file headers append works fine,0,67,46 question regarding negative indices in tuples and lists in python in this program why is the output and not this is the case with lists also i noticed print t doesn t give the output as but instead gives what is going on here why can t we go backwards please help me i ve just started python i have no background in programming,subtract one from last nonzero value in row multiple column i have created a dataframe with dates and the amount of days each month from a dataframe of arrival and departure dates this dataframe can be n columns long what i want to do is select the last column with a value that is nonzero and subtract basically looking like this afterwards i have tried using numpy with but this does not seem to work correctly with pandas,0,64,79 how do i move both files and folders to the specified directory there is a code that moves files from one directory to another but it doesn t move folders how to make it move both files and folders to the specified directory,program won t end i have tried to make a program which can play random chess moves against stockfish when running the program it will play the entire game and give the result but the program won t stop running after doing this does anybody know what is wrong and how to fix it,0,42,52 python pandas in person class i have a person class that have method admin sign in and log in but in csv file every object i make saved with header and index do you have any suggestion to manage it,how to use htmlunitdriver using selenium in python i m using selenium and i m searching for the lightest webdriver possible for speed purpose i heard about htmlunitdriver but when using python i need to run a selenium server before trying to use the driver i was careful to take the version corresponding to my selenium version available here and i followed exactly the steps to make it work but it didn t after running java jar selenium server jar standalone running on localhost i tried and i got the following error so i changed my code to and it worked i got the screenshot but then i was no longer using htmlunit does anyone know what s wrong and or what i could do to make it work,0,42,123 how to make a single image using several images i have these images and there is a shadow in all images i target is making a single image of a car without shadow by using these three images finally how can i get this kind of image as shown below any kind of help or suggestions are appreciated edited according to the comments i used np maximum and achieved easily to my target,pip fails to find brew installed libs with m chip folks with new m chip brew stores its libraries in the different location opt homebrew instead of usr local and now when pip needs some packages installed by brew in my case leveldb for plyvel it s not able to find it until i use rosetta brew version to put in the old directory usr local i ve added eval opt homebrew bin brew shellenv in my zshrc to import brew related vars and i thought it should do the thing but no lack do you have any tips on how to handle this issue,0,72,94 how to write an iterative function in a recursive manner i need to sum the variables in a list if they are integers and ignore if they are strings i have written one for the iterative function i need to write the same as a recursive function how can i do this,print text with delay in python by using signal how can i print text with delay of second with using signal i don t want using sleep,0,52,27 cannot resize array using np resize i am trying to resize an array to x my code is as below when i go to reshape later on in my code i get the following you can see from the error that the array hasnt changed size and is still i believe im missing something simple but i cant seem to find it thanks,bar plot with plotly grouped and stacked as is my input let me explain what i want one column will be label color and second column will be label quality where x axis is df index and correlated position columns with order of index also y axis is just name of label and colors is values from df columns label colors label quality here solution that provide r beginners but ion real data its looks some strange seems like that column borders overlapped i find solution fig update traces marker line color rgb marker line width so hope it will be helpful anyone who want visualization data,0,63,92 getting a image data source from a span with beautifulsoup i am attempting to extract the data img url value from the span in the a class but i am not succeeding my source code is as follows my error is as follows typeerror nonetype object is not subscriptable it is obviously not finding the span that i am looking for but i have no idea why,vscode python debugging doesn t have same path as interpreter essentially using the debugger doesn t seem to be loading my zshrc while the integrated terminal does i e this simple test outputs different code when i debug vs when i just call pytest in the terminal this is a problem for me as i use shutil which to find executables i know it s finding the correct python since sys version yields the same results in both the debugger repl and through terminal i even added the following block to my settings json which i never had before to explicitly point to the correct shell this has never been problem till recently and i ve had lots of debugging related issues since vscode i ve downgraded twice and even set update mode none but bill seemingly keeps hacking in and forcing me to upgrade any insight is appreciated thanks,0,65,142 scrap link from balise a inside div using python beautifulsoup this my code enter image description here any solution possible,how to debug the identation levels in a python program i ve just started learning python i m using mu editor and i can t get past the first if statement i click run then enter joe and it keeps asking me who are you am i correct in entering this input in the run section or should it go in the repl or text editor section,0,22,64 im trying to copy array but both of them has the same link im using python my code is both of the variables are now but i dont want to apply changes to variable a what should i do ive tried to use the c b statement but it didnt help,amazon pay sdk python createbuttonsignature i m integrating amazon pay sdk python for the web i have done reading all documentation of amazon pay but i didn t get any idea about how to give or create a button signature in frontend backend code here is my code of frontend to create a button of amazon pay one time checkout if anyone implemented this give your valuable answer,0,54,55 get youtube video link in python i need to make sure that i enter a word in the console and a link to the video should be displayed for me for example if i mean the word linkin park in the console it should give me a link to the first video for this request in my example the first link is numb official music video linkin park how can i do this,django typeerror int argument must be a string a bytes like object or a number not driver when creating vehicle in driver id i must pass an instance of an object drive so when i pass a number i find an object with this id in the serializer and pass it because otherwise it would give an error that an instance needs to be passed but when i want to display information on some object vehicle it will give an error if this object has a driver id field of an object instance but when it is null then everything is fine vehicle model urls driver model driver views driver serializer request error message,0,74,112 python reading file not working through tkinter file chooser when i run the code and select a file it doesn t output anything putting the file location manually in the code still outputs nothing and the txt file definitely has content,multiprocessing hanging at join before anyone marks it as a duplicate question i have been looking at stackoverflow posts for days i haven t really found a good or satisfying answer i have a program that at some point will take individual strings also many other arguments and objects do some complicated processes on them and spit or more strings back because each string is processed separately using multiprocessing seems natural here especially since i work on machines with over cores the following is a minimal example which works with up to to cores if i try to give it more cores it hangs at p join i know it s hanging at join because i tried to add some debug prints before and after join and it would stop at some point between the two print commands minimal example the suspect is that the queue is getting full but also it s not that many strings when i give it cores it s hanging but that s about strings if the choice was always but is that many strings for the queue to get full assuming the queue is getting full i am not sure at which point i should check and empty it doing it inside return string seems to be a bad idea as some other processes will also have the queue and might be emptying it filling it at the same time do i use lock acquire and lock release then these strings will be added to a file so i can avoid using a queue and output the strings to a file however because starting a process means copying objects i cannot pass a io textiowrapper object which is an open file to append to but i need to open and close the file inside return string while syncing using lock acquire and lock release but this seems wasteful to keep opening and closing the output file to write to it some of the suggested solutions out there de queuing the queue before joining is one of the answers i found however i cannot anticipate how long each process will take and adding a sleep command after p start loop and before p join is bad at least for my code because if they finish fast and i end up waiting that s just a lot of time wasted and the whole idea is to have speed here add some kind of sentinal character e g none to know if one worker finished but didn t get this part if i run the target function times for cores i will have sentinels but the problems is that it s hanging and can t get to the queue to empty and check for sentinal any suggestions or ideas on what to do here,0,40,457 python inspect member variable comments how do i inspect the comments of a python instance variable i ve tried any thoughts,passing requests with scrapy i m trying to pass a request with scrapy based on the brand number in the url and then extract id s from the webpage which provide information on the next page then iterate over the next pages to grab the product id s i can pass the request and parse the data for products and send this into requests however i m unsure on defining the function to let me grab the cursors for the next page here s my code i get the following error attributeerror int object has no attribute json expected output,0,20,95 how to fix indexerror string index out of range python i am trying to make a parser for my text adventure i used a text file called test txt i keep getting indexerror string index out of range how can i fix this parser py test txt,how to solve python error typeerror init takes exactly arguments given i am new to python can someone please help me to solve this error my code is as following i am getting this error i am using python in linux,0,45,44 connect to mysql database over ssh in python script i am in a situation where i need to access a mysql database running on another computer computer b unfortunately the computers aren t on the same local network the only way i found that i can access the sql database on computer b from my laptop computer a is via ssh my question is can i access the sql database over ssh from python,no module named yfinance in vscode when trying to import the yfinance module in vs code i receive the problem exception has occurred modulenotfounderror no module named yfinance file c users user downloads yf py line in module import yfinance as yf what s troubling is i have it installed under my python site packages so i do not understand this issue,0,73,56 how to assign foreign key inside loop django i want to assign a foreign key to each color in a loop product model color model views,bfs on wikipedia pages is taking very long can someone help me analyze my code s runtime i am trying to perform bfs on wikipedia pages i believe i am implementing this correctly and in the best possible way run time wise keeping it to one thread but it is taking quite a long time to find a connection between two articles here is my implementation it takes sometimes a few minutes before finding a match is this expected due to how big wikipedia is or am i messing something up here and am performing it in a non optimal way or could it be beautiful soup is running too slow,0,26,110 apscheduler id not found can date scheduled jobs have ids i don t know what i am doing wrong but whenever i run this code i get the error apscheduler jobstores base joblookuperror no job by the id of item last run was found,extract a specific url field from json output using jq i have json output as follows i want to extract the value for the example io creatorid field currently the following code returns all of the values under annotations however when i tried the below script appending example io creatorid it fails error can anyone tell me how to achieve this using jq fyi i am running this as a python script,0,38,68 django unboundlocalerror local variable image link referenced before assignment i have written a function for parsing news articles feeds but upon running the code i get i don t understand where the error is coming from seeing as i had defined image link in the image for loop statement above i have checked similar answers on so but i don t seem to find a suitable answer please help me debug this,selenium webdriver unexpectedalertpresentexception new question another question about same topic previous question about closing the alert selenium webdriver unexpectedalertpresentexception i tried closing the alert but now it gives an error saying no such alert error script,0,69,36 im trying to make a whitelist checker with python im new to python and i have an excel sheet with names in the first column and i want to make a python code where a user will input a name and the script will check if the name is in the column i am able to print out the rows in the column but i am not sure how to check it one by one in a loop,spotify web scraping beautifulsoup shows attributeerror nonetype object has no attribute findall the code i have is too long to post here what general scenarios would cause this attributeerror what is nonetype supposed to mean and how can i fix this error i posted the code image for conviniences the part of the code before error enter image description here the next part where error occurs this code returns error attributeerror nonetype object has no attribute findall error codes sorry i m new to all this i run this code just to get the dataset for my project i have zero experience in web scraping,0,78,104 enclosing every csv field that having commas in between with double quotes in python i am trying to enclose the each field value in double quotes using csv module but here the trick is we do have commas in between the values which needs to be skipped this is the snippet i am using to enclose the values in quotes data code snippet output expected output,why does my lightgbm model fail with an oserror i am working with a large dataset rows columns i wanted to run a base lightgbm model to test what sort of predictions it makes it is my first time participating in a kaggle competition and i was unsure of where to proceed from here so i decided to just fit one model to see what happens this is the command i ran and this is the error that i get i am honestly clueless and would appreciate some help i apologise if this is a repeat question i did my best to search around and could not find anything that addressed my issue thank you,0,66,117 question regarding negative indices in tuples and lists in python in this program why is the output and not this is the case with lists also i noticed print t doesn t give the output as but instead gives what is going on here why can t we go backwards please help me i ve just started python i have no background in programming,nuitka error main py can t open file gen py i currently have an error with nuitka which i am starting to use i want to compile my script including a folder and its contents here is the command i use python m nuitka follow imports enable plugin tk inter onefile show progress include data dir c users user desktop myprogram datas datas myscript py but every time i ended up with this error and i don t have it when i remove include data dir am i ordering incorrectly or is this another problem thanks edit you must delete the temp gen py folder it will be re generated and problem fixed,0,64,89 how could i plot circular histogram like this in matplotlib i need plotting the circular histogram in matplotlib they should look like,replace na in dataframe for multiple columns with mean per country i want to replace na values with the mean of other column with the same year note to replace na values for canada data i want to use only the mean of canada not the mean from the whole dataset of course here s a sample dataframe filled with random numbers and some na how i find them in my dataframe what s the easiest way with pandas to replace those na with the mean values of the other years and is it possible to write a code for which it is possible to go through every na and replace them inhabitants area cats dogs at once,0,23,116 keyerror after re running the same code a keyerror is returned when i try to run the below code my dataframe has the following columns i know that there are many questions on the keyerror name but what was weird is that without changing anything this error appeared while running the code but previously i could run the code with no errors nothing has changed any help on this would be great traceback,finding previous group s name in pandas dataframe i want to add a column to my dataframe with repetitive values which contains the name of previous group float and sortable any idea before after,0,72,33 getting extra numbers while handling big numbers in python i tried why i am not getting how do i obtain the real result,how do i stop my program from reading the second while loop when not needed i have some homework which i m not sure how to finish the task given was to make a script which would ask the user to enter his name after entering it the script would check if the name entered matches with any of the names on a pre existing list if the name matches the script would ask the user if they would like to delete the name off the list or keep it if the name doesn t match with any names on the list it asks if the user if they d like to add it on it the script should write the list of names in the end i wrote it like this issue is that i have no idea how to stop it once the user chooses to delete their name off the list it always reads the next while because the deleted name is no longer on the list also i am very sorry if this looks like poo poo i m new to coding,0,23,181 attributeerror partially initialized module not same file name i am making a program python with the module pyautogui when i try to use a function i get this error the file name is code py and the only other file in the folder is called tester py full error message,add the remaining quarterly columns that do not have any values i have monthly time series data as follows i needed to convert this monthly data into quarterly data as a sum of three months so i adapted the code from here to do just that the resulting df is as follows however i wanted to have all quarters listed in between not just the ones that have a value larger than so my desired output is as follows so in this output there is an additional column q because it is between the first and the last quarter periods even though it has no positive values does anybody know how to do that,0,48,115 typeerror send login mail got multiple values for argument email i am learning celery reddis and trying to send email through celery i have created a task in which i have encapsulated my send email logic i am calling the send login mail function and passing the keyword arguments using delay am i using delay wrong i have tried using apply async but still couldn t make it work p,how do skimage morphology remove small holes and skimage morphology remove small objects differ both of these methods are included in the scikit image library for python i m trying to extract certain objects from images and ran into these two methods in a senior dev s code written for the same purpose i have read the documentation for both skimage morphology remove small holes and skimage morphology remove small objects but i can t understand what difference these two methods pose when they are run on a ndarray containing an image,0,62,72 forloop over rows python dataframe i have a forloop that is changing the address format of over rows it works but it s taking a long time to run is there a way to make it run more efficiently,makemigrations can t detect change in django i know there are a lot of similar questions but i will describe my problem as simply as i can this is the app i want to migrate this is my setting py this is what happens when i type in makemigrations after i add a field in my model this is what happens when i type in showmigrations after i add a field in my model i have reinstall django using pip i have created new app i have created new project new venv i even have reinstall python itself all same story i suspect my django source code has been corrupted but when i install django using pip it use file that is downloaded before instead of download new file trust me i have tried all the way a newbie could possibly tried could someone tell me how to redownload django itself or someone who is way smarter than me know what s going on right now thx,0,40,161 how can i store results from a loop in a dataframe i have the following loop creating kpi values for each of my subsets is there a way to store this in a nice table something like this with the sku value and sku scaled in the columns edit code used to create kpi function,aws s object filter to not match prefix in python script when iterating over s objects using python boto i see that there s a filter method but can you apply a not condition i want to just get the top level objects not objects in folders they have a prefix i am currently doing this and it works i see support for a filter like this i m asking is there a way to say prefix folder name,0,56,76 how to access items from ndarray with dtype object how can i access data inside a numpy array with dtype object the following raises an indexerror,how to repeat numpy array at specific index changing every loop i want to repeat first four indices time then the next indices but want this dynamic as index number might be changed expected output should be y i am trying to repeat array at specific index as shown in the following code,0,24,55 i want to find the difference between two fraction numbers i want to find the difference between two fraction numbers i created a port of code but somehow it doesn t give right output and i don t know where is the problem,detecting near horizontal lines using image processing is there any way to use opencv to detect lines that are nearly horizontal i ve muddled my way through some of the concepts mentioned in how to detect lines in opencv i can get edge detection with canny but i m kind of lost on how to use hough transforms and constrain them to horizontal lines i have a bunch of example images here including in particular each image has a pair of horizontal edges that are approximately pixels long and within degrees of horizontal these are formed by corners of photographs i scanned in any suggestions on what algorithm to use,0,41,111 plotting table in python matplotlib alternatives are there any alternatives to matplotlib as it comes to plotting tables i find it very inconvenient to plot tables in matplotlib it s hard to make small change of one parameter table size scale font size cells contents column widths heights etc often requires fine tuning all other parameters,how to make my message count command count messages for each server not all in once how do i make my message count command count messages for each server but not all at once because i want to have it like when i type messages on the server it count form only this when i use this on the other server it count from other server only here is code of my coommand,0,54,73 why is islice permutations times faster if i keep a reference to the underlying iterator iterating through islice permutations a n is somehow times faster if i just keep an extra reference to the permutations iterator alternating between with and without the extra reference what s going on full code try it online,join rows with same index and keep other rows unchanged i have this data frame i want to get this merge the column text with the same index in column join and reindex id and paraindex rest without change i used this command it only merges the row with the numerical index in column join and exclude row with non index so i changed to this here it merges all rows based on index join but it considers row with index nan as one group therefore join them also to be group however i do not want to join them any idea many thanks i also used this it looks better as it has all columns but no changes,0,51,119 requests exceptions missingschema invalid url no schema supplied full code is stated above full output is stated below i have never ever seen an image link like only with backslashes not this and bs recommends me to use that and i dont know how to solve this error typically followed automate the boring stuff with python book same code as from that book but shoots this error when i try to scrape the site thanks for any help,how to format variable in template as currency i am trying to format a string in a template to display as a currency object cost would i be able to do something like f format object cost in the template,0,79,40 i am getting typeerror postitional argument typeerror str missing required positional argument acc,python getattr get multiple value get python class module getattr use funation obj val val error python program for error expert value,0,15,20 how do i copy an error line from logfile to another file using python i m developing a script that should scan a night run log file this script should print the whole lines that the word error is shown there into another log file named analyzer which will going to create during the script running the output is an empty new log file without the willing lines the code is developed on python and i linked it to here,how to see the celery messages in redis i have a celery worker running redis as a broker starting the worker processes gives me this this is what i can see in redis right after starting the celery workers even if i set a long timer on my tasks sleep the tasks will take seconds to run but i still don t see anything in my redis container mget key returns nil for all keys above i was expecting to see messages incoming in form of id or something into redis i can see messages if i use sqs as broker but not for redis,0,79,105 concatenation of the elements in two list in python for instance the message save our soul would be encrypted as sv u oliaeorsu and then i want to decrypt sv u oliaeorsu to its original ones i had performed the encryption but the decryption looks difficult and at the end i want to concatenate items of both list into a new one for example lst a c e g lst b d f the list i want is lst a b c d e f g output,volttron bacnet grab multiple configs py i am trying to auto discover bacnet devices in volttron on a lan with grab multiple configs this message below is from the linux terminal when i am trying run proxy grab bacnet config py where my args or something is incorrect usage grab multiple configs py h use proxy proxy id proxy id out directory out directory ini ini csv file this is my bacnet proxy id d cd b a f b bb b d when i run this from terminal python grab multiple configs py out directory desktop volttron scripts bacnet configs use proxy proxy id d cd b a f b bb b d multie csv i get the usage error is it because my args aren t in the correct order edit snip of vctl status,0,73,93 i need an array where user introduce values and print changing the elements position without functions i m in my first steps in python i need an array where user introduce values and print changing the elements position without functions input output i don t know how following after,inserting geography type into sql server database i want to write multi polygons into a ssms database via python if i print instance of f geography stgeomfromtext geovlak i get this seems good to me but then the following error occurs,0,71,40 using python to split text string into two variables i need to split a text string like this hello everyone bye everyone into two different variables so hello everyone is one variable and the other variable is bye everyone what is the easiest way of doing this i have been experimenting with maxsplit within the split function but no luck i put an example of what im trying below any help or insight would be appreciated thank you,calling one python script as a module within another python script and both scripts should work independently from command line as well i have two scripts a py and b py both work independently from command line by providing relevant args both scripts run on linux box both scripts have numerous methods and main method how can i call a py into b py as a module should i just import a at the top of b py and then call the relevant methods inside the main method of b py or is there a way to directly call the main method of a py inside b py note i don t want to create multiple supporting files like setup py or init py if that is possible thanks,0,78,121 what is the equivalent of side effect for a property mock in unit test i want to mock a property to return different values in order like when you use side effect on a magic mock right now i m doing this any idea how to mock it properly,comparing columns of current row and previous row in the same csv file so if someone has asked this question before i am sorry ahead of time but i could not find an answer i have a data frame that looks like this it is the output of a previous part of the code that writes to a file i have been trying to find a way to write a script to check to see if a resid goes from bottom to top or the opposite and if it does to create a dictionary counting how many times it switches from bottom to top its important to only check the iterations of that particular resid to see if it goes from bottom to top as that next resid corresponds to a different ion which may not switch at all each frame here corresponds to a different time frame of the same atom resid and i am wanting to check if this atom goes from top to bottom over time i will eventually plot the dictionary values but am struggling to get the dictonary i have tried just indexing off of the reader but that did not work so then i tried to use iloc to index the file but this also did not work how would i go about comparing the location between a current row and a previous row if the resid is the same thanks in advance,0,47,239 assign a value from dictionary to the list and convert the list to a dictionary i have a dictionary and a list i want the output as a dictionary with the values of k a assigned to first list k ato the second and so on in the list a like below i tried a lot but couldn t figure out a possible solution to this can anyone please help,how to identify a qgraphicsitem i want to know if there s a way of getting a qgraphicsitem s id nothing complicated lets say i have a qgraphicsscene and i created a lot of rectangles of the same size and color in it even if not with ids than how can i identify them update here s some of my code thanks in advance,0,67,61 django display a list of post s categories with a number of post hi i am trying to make a template in django that displays a post categories table and has a number of posts with it i can t seem to make it right using annotate when making queries on my model like this views py im receiving list of posts instead and has a posts count key with value of models py where did i miss thanks,how can i write a rule in spacy with pattern inside a pattern nested pattern i would like to write a pattern in spacy that matches a text and then optionally all the parenthesis at the right of the text if there is any for example for the following texts i give as input the left part of the arrow and expect as an output the right part of the arrow however we found that this example te as explained above other stuff this example te as explained above other stuff here is another example this example te some text here this example te some text here some random text and then this example te this example te then a final example this example this example these texts are not fixed and work as an example i would like to get as many starting parenthesis as ending possibly even no parenthesis pattern i tried the following but it does not work it matches only the first parenthesis since i operate on long texts i would also like to match a short phrase and not the entire document if there is a right parenthesis at the end i would like something like the following but it does not work thank you for your help,0,75,219 how to check the result of a function i have three functions i want to check if the port is open and if it is open perform function number two otherwise perform function number three i wrote the following code but it doesn t work,add value to column data of dataframe in pandas i have a dataframe like this i want to add to the value just before so the new dataframe will be like this i know we can for loop the column section then split the string by then add to the former value then reformat the string and assign to the cell assuming it might have hundred thousand rows i am wondering if there is more efficient method to do it,0,44,84 how to define folder name when saving json file in python how to define folder name when saving json file i tried to add myfoldername inside open but did not work also tried to myfoldername myfilename in filename definition error code,how do i receive interactions via outgoing webhook i m trying to make my discord bot receive an interaction via outgoing webhook it says in the docs that my endpoint needs to be ready to ack a ping message and that my endpoint must be set up to handle signature headers i ve completed both of these steps but it won t work here is my code when i run the bot there is no error message but when i try to save the endpoint url it won t save can someone please help,0,40,90 django database error while connecting sqllite,adding to set if part of tuple not exists i would like to use something similar to the add function to add tuples to a set however i want them not to be added if a part of that tuple already exists in the set for example this gives me a result as but i would like the a b combination to only appear once the first time it is added so that my result is,0,6,74 crop image borders dynamically how can i crop images that looks like this and save as different images the issue is that images are different in size and non proportional so i want to make a code that dynamically cuts black borders but not the black part which is inside the picture here is the desired outcome below is the sample code i ve made which works only for one specific image,facing issue with dataproccreateclusteroperator airflow i m trying to migrate from airflow to airflow which has a change of name for some operators which includes dataprocclustercreateoperator here is an extract of the code i am ruuning into below error on debugging i see this issue is due to the param metadata does anyone has idea what is wrong with this param or a way to fix it,0,71,70 what is the difference between rdkit s molecule fingerprints fingerprints fingerprintmols and chem rdkfingerprint can anyone tell me when i should use fingerprintmols fingerprintmol instead of chem rdkfingerprintwhen making molecule fingerprints these are the two options is fingerprintmols fingerprintmol more efficient,weird at top of csv file while using pandas with dictionary i want to print a dictionary into a csv file dictionary is containing a subject code as a key and a mark that one student got as a value here is my py code code prints the dict here is csv file i don t know what is causing the at the top any help update printing the data frame brings this,0,35,74 convert buffer repesents list of int little indian python class i m trying to get data from buffer represents as string example got except explain length since the numbers repesnts an hex number in little indian and the rest the same idea a any idea i have some solution but it s too messy and isn t easy to support,how can i manually color each point in my scatter plot in plotly i have a list of rgb values for each point in my plot that is not based on a single discrete value nor category thus built in methods in plotly express are not working i tried using go figure and adding a new trace for each point however that is extremely slow is there another way of doing this it seems extremely simple i m surprised there s no way to pass color values array to the plotting function,0,68,87 how to implement string in python class i m working on a problem called employee class and mostly thru it but it s not printing what i want this is my program and this is the file with my class in it i know i need to implement a string but i m stuck,rsync how to copy files from source to destination in loop sequentially linux i have been using rsync and it is working fine but we keep deleting files in the destination folder and rsync keeps syncing files from the source folder what s the solution for this i need to delete files from the destination and rsync should not keep syncs files again from source how to solve this problem for handle this programmatically using python,0,51,76 installing http module in python not able to install http module in python warning discarding from command errored out with exit status python setup py egg info check the logs for full command output,python read a line from a file then remove it with threading i have this program that uses python threading to read different lines in a file if it reads a duplicate line then reads another one and once it has read it removes the line from the file the problem is that whenever it reads the file it doesn t update the file or i m not quite sure what s happening it can sometimes read the same line as before therefore breaking it i m not sure if my code is the most effective way to do this,0,37,96 randomly select layer in tensorflow model i want to use different layers with specific probabilities in my network layers are the following classes and the network is like below each time i run the code below i get the same output but i expected different ones is there any way to implement this,how to invoke methods on the same singleton object in python i want to use a singleton database connection object in my project to avoid creating a connection more than one in this example oracle connection method returns the instance of the parent class which is cx oracle connection my question is how can i return connection instance which is the class i created instead of cx oracle connection class because i want to invoke some methods on my singleton object like only my connection class will have execute method not the parent class,0,53,88 flask plotly dash integration i am starting my first experience with flask and plotly dash to create a web based dashboard i would like to know if i can embed dash components in the flask app,implement division as a series of subtraction python i m trying to implement division as a series of substractions for example minus five times with a remainder of i have done this with a while loop which seems appropiate for the task however i also tried to implement with a for loop the following is my while loop i m experiencing some issues with my for loop i had to use a list comprehension to rule out any negative numbers within range denominator numerator using so it can take the full value of the numerator it seems that the operation numerator int numerator int denominator keeps going into the negatives if you print the below you will get if you uncomment the list comprehension you will get which is what i want i would like to understand why this range keeps going into negatives thank you all,0,35,176 how to get yesterday s date in epoch time python i can easily get the yesterday date like this how can i do the same for unix epoch time i tried this i could go now to some crazy conversions to convert str to int and so on but that really seems like complete overkill recon there s gotta be a simpler way to do this thanks,scrape text with playwright is slow on part of the code using page locator i have made a script in playwright to scrape some text this is the part i have problems here i scrape a series name using locator and it works when the series are not present is skipped but it takes seconds to the code move on the log is below what is the problem can i improve it i think its because of the try statement but why as i have the same code for per example author and it is fast i know it is not good to use playwright best are other modules,0,65,109 issues adding a student to a specific class in microsoft teams graph api in python my code i am having issues with the format for my request body based on microsoft docs my request body is supposed to supply a json representation of an educationuser object i have shown my code and the example given by microsoft and i do not know what is wrong with my request body since it is the same format please help microsoft example,firefoxprofile not working if firefoxbinary is set as webdriver firefox firefox profile profile firefox binary binary i noticed if i use firefox binary within webdriver the firefox profile is not working im getting my standard useragent but if use driver webdriver firefox firefox profile profile i see the updated useragent but then normal firefox is opening with my standard ip what am i doing wrong my os is on windows and python i also see when im using the webdriver with firefox binary right of address bar not connected but the website for example is showing another ip always is that a problem if i use webdriver without firefox binary is see nothing right of the address bar,0,79,107 python requests why is requestscookiejar object sometimes empty i ve seen a couple of answers on this subject but i still don t quite understand why is the requestscookiejar object sometimes empty in the example below for instance it returns empty output,applying multiple filter on pandas pivot table how can we apply multiple filter on piviot table i have a dataframe as df i m able to apply one filter on it by the above code is working correct with one filter brand but how do apply one or more filter to this in the below code if you see i have tried to add but i was getting an error which didn t work maybe i m not giving the second filter correctly does anyone know how do i do this,0,41,87 extract tables in webpages from python r or other software i would like to extract name address of school tel fax head of school from the website is it possible to do so,trying to convert string of letters and square brackets into a list of letters and lists im super new to coding and solving an assignment the problem at hand is to convert an input string of letters and square brackets into a list of letters and lists for example the string abc should return a b c i have the code running for a few test cases but it fails for the following string a b c which should return a b c but instead my code returns a b c c can someone please tell me what im missing in my logic please help here s my logic so far that i ve been able to research,0,33,117 how to access linux s downloads folder using python in ubuntu the downloads folder is located in home ubuntu downloads but i don t know if different distros have the same style eg home arch downloads is there a universal path for all distros for anyone wondering i need to make a new directory in downloads,check if any devices on windows are playing sound python i m trying to detect system sounds on windows and i figured i could use the pyaudio module since winrt didn t work for me i ve got this code that lists all the devices and i know i can open streams with pyaudio but how can i tell whether any of these devices are currently outputting sound do i open a stream for each one and take the mean square root of the bytes if this is an xy problem and i d be better off using another module please let me know,0,50,100 how can i avoid nested loops when working with spreadsheet data i am working with a spreadsheet where i have to combine all possible combinations of comma separated values into their own lines below is the main logic for the current implementation is there any way i could re write this to be more re usable and dynamic what if i need to add a new column to also combine that d mean that i would need to create a new for loop,getting average of selected rows for each column pandas i want to be able to get the average of the last rows that are in stage for each column sample data currently i am using av df loc df stage vout mean but this gives me the average for the entire column so for the column vout i am getting the entire columns average value when i just want the columns average value to be the average of the last rows that are in stage,0,78,88 cluster values within two columns in groups in pandas i have a dataframe like this and i would like to cluster into groups the val and val values for instance and i should then get here is the dataframe if it can help,generate random binary strings of length i want to generate random binary strings of length i e from to where each string is length i m wondering how i could do this efficiently or pythonically right now i randomly choose between and times and then append the results into a string this seems pretty inefficient and not pythonic is there some library functions i could use for this,0,44,75 cannot delete or update a parent row a foreign key constraint fails sql error i m trying to delete the product row using the delete button on y frontend frontend is in reactjs but it throws this error message on the python sql server ysql connector errors integrityerror cannot delete or update a parent row a foreign key constraint fails grocery store order details constraint fk product id foreign key product id references products product id on update restrict delete route code product dao py file code postman request,compare several dataframe columns to list i have a dataframe like this the columns are not side by side and a list like list i now want to compare if a value from the list is present in the dataframe and mark it with else with so that the output is i only found out how to do this with a single column how can you make this to consider all columns thanks in advance,0,77,79 how to generate test samples with hypothesis directly from dataclasses i have lets say two dataclasses where one is used inside the other like this how can i use hypothesis to generate sample for my testing from this i have found in the docs that hypothesis strategies support dataclasses natively hypothesis but no examples anywhere about how to do it in a simple case like the one described,building a dynamic regex string in python x i m attempting to dynamically build a regex string for a match check it will use part of users input the problem i m facing is when i build the string which uses numerical digits d for example it ends up with an additional backslash to escape the initial one so the re match never works i initially thought this was a simple problem to solve but after lots of googling and failed attempts at arr what if i must be missing something any pointers or insight would be appreciated,0,69,95 i don t know how to express summation in python gurobipy i have a variable like this xitb i nc np time number when i is belong to nc i want to express like this x x x x x x x x x i made code like this is it right code,i need to replace digits in list alphabet starting from index key m in alphabet of digits in list m b by index in list c i need to replace digits in list alphabet starting from index key m in alphabet of digits in list m b by index in list c expected result is alphabet a b c d e f g h i j p g t u a p q r s t u w v x y z but the actual result is alphabet a o c d e f g h i j a l m n o p q y s t u b x y z,0,48,110 python reading file not working through tkinter file chooser when i run the code and select a file it doesn t output anything putting the file location manually in the code still outputs nothing and the txt file definitely has content,pytorch says that optimizer got an empty parameter list here i make model forward step here is my output here i train my model but i got error however when i try to put the parameters in a optimizer class i get this error,0,40,44 is there a way to find the value for the last day of each month in a dataframe i have a dataframe which gives me the daily quantity levels of various articles i want to get a dataframe which gives me the quantity levels on the last day of every month of each article original df target df is there any way to obtain it i tried group by item and date with tail but it didn t work,how can i implement multithreading in this for loop consider this code snippet i m using minimax algorithm in main game with branching factor now since the third for loop has a time consuming function up to o in time complexity is there any way i can make it run faster i m thinking of parallelizing multithreading for example any suggestion,0,78,58 pandas for vs itertuples i ve dataframe with a lot of columns for example a xx a x b xx c yy etc all coulmns are integer dataframe df i need change value for all columns a i ve but it s not work for one variable example it is ok could you help me how do this for many variables,parametric pdf estimation histogram vs likelihood given a sample from a distribution and assuming it is gaussian normal distribution with unknown mu sigma the task is to find the parameters mean and standard deviation that describe it best what is the mathematical difference and why does it yield different results and if it is different why and when to use which method i think both are parametric and can be used in the same cases,0,57,75 how to check file arrived in javascript and httpresponse object in django my code is working fine but i can t figure out how to catch a file arrives message in javascript i m working with django template views,importerror cannot import name process from multiprocessing pool when i don t have any file named multiprocessing pool i know that this questions seems repeated but the existing questions didn t apply to my case i don t have any file named multiprocess pool in my directory and i still get this error when trying to run the traffic generator this is the part of the code where it uses process i believe this parts needs to be updated by i have no idea how any help with this issue is appreciated thanks in advance edit i followed the first answer and now the error changed to this edit i followed this question to solve the second issue and now it works,0,38,117 add test case with robot api how to add a test to a robot file from the api i tried this see code below but it does not work does anyone have an example of adding test cases on a robot test via the api i m probably not using the api features correctly robot test,how to convert list of lists into a dataframe pandas i want to convert these lists into a dataframe expected dataframe note first row is empty since all the first elements are empty,0,55,32 how to add x amount number from user input then add all of number in python for take number in how many number print sum,tkinter pack method not working for one label the variable lb could not be shown on the tkinter window even though i have used pack method i would like to put the lb widget below lb and i had tried using anchor sw still not showing so any possible methods to have that widget be shown properly,0,21,56 how to calculate the time difference between two string formatted datetimes i m trying to subtract two columns on a dataset which have string times in order to get a time value for statistical analysis basically toc is start time and ia is end time something is slightly wrong,issue azure test chat bot error while finding module specification for aiohttp web modulenotfounderror no module named aiohttp i have some issues while trying to use azure test chat bot i deployed my bot on azure web app with github actions everything is going great but when i m trying to test my chatbot nothing happens it throws me an error i tried to use differents python versions and also differents requirement version i have configured port app id and password id in my config py file my web app has his general parameters configured with this command it seems that azure can t find aiohttp it works perfectly on local host thank you for your help error app py requirement txt,0,47,119 how do i select element in a list present in an un ordered list using selenium python this the website i am dealing with here i am able to send the code for the security name but in order to submit it i need to click the dropdown element that comes after giving the security name how do i achieve this with selenium i used the code below and its not working staleelementreferenceexception,how to change part of numpy array without reshaping i have the the following array i would like to change the attribute for part of the array filled with my custom class for example i would like to change elements starting from element then from row to row ideally i would do something comparable to the result would be something like the following unchanged x changed the problem with my array is that i first need to flatten it before i could do something like this or i should calculate how many columns and rows i before i can index the array itself is there a numpy function such that i can just iteratre over the array element by element row by row i hope my explanation is clear,0,71,131 cell output to pdf jupyter is that possible i m wondering if is it possible to generate a pdf file from the output in jupyter notebook basically i would like to generate a pdf file based on the cell output,pytorch binary classification rnn model not learning i m working on a binary classification task with pytorch and my model is failing to learn i can t figure out if it is a problem with the model or with the data here is my model the model consists in two rnn layers with a batchnorm in between then a dropout and the last layer i use softmax function with two classes instead of sigmoid for evaluation purposes then i create and train the model this is the output when training the model and this is the loss per epoch for the data each of the features in the input data have a dimension of and the targets have dimension either or then i add the sequence length dimension to the input data for the rnn layers distribution of the target classes i can t figure out why my model is not learning the classes are balanced and i haven t notified anything wrong with the data any suggestions,0,40,170 how can i repeat an input in order to get a proper answer i m making a little game this is what i ve done so far in short i really like to know how i can repeat the input when it is not x or y i really appreciate any kind of help,how can i remove three dots at the end of usage line in argparse python argparse keep putting space and three dots at the end of usage line example usage program sh h command options would it be possible to remove them example code output,0,52,45 updating numbers pandas python but also keep all the data i got two dataframes df df i am using the update function to update the two dataframes result is it possible to get the other numbers too something like this,how can i create a merged cell with a word in it in python i would like to create a merged cell in an excel document with a word in it the function would ideally take as an input arguments start row start col finish row finish col and word this function would edit the document such that i have a merged cell in the range given to the function an example usage in this example i would get a tralala word from column c to column e from row to row,0,40,90 having issue while printing specific value from df in the above code i want to extract only the price which is for today but the value i am getting is n n is there any way to get the specific value while web scrapping,failed to change one value in numpy matrix when using matrix in numpy i want to change the value of one element in a matrix using the index but the result i got is strange how can i change one value in indexing method,0,47,44 what s the difference between np array int and np array int what s the difference between np array and np array i understand that the latter is a d array containing a single value but what is the former called,npm install don t install file node mdule node gyp error i have been trying to solve this error for days i check a lot of solutions inside internet and stackoverflow and i m desperate looking for help so inside my project when i write i had errer i have installed nodejs v npm python visual studio,0,34,57 how do i copy an error line from logfile to another file using python i m developing a script that should scan a night run log file this script should print the whole lines that the word error is shown there into another log file named analyzer which will going to create during the script running the output is an empty new log file without the willing lines the code is developed on python and i linked it to here,how to improve language model ex bert on unseen text in training so i am using pre trained language model for binary classification i fine tune the model by training on data my downstream task the results are good almost f measure however when i remove a specific similar sentence from the training data and add it to my test data the classifier fails to predict the class of that sentence for example sentiment analysis task i love the movie more specifically the acting was great i removed from training all sentences containing the words more specifically and surprisingly in the test set they were all misclassified so the precision decreased by a huge amount any ideas on how can i further fine tune improve my model to work better on unseen text in training to avoid the problem i described above of course without feeding the model on sentences containing the words more specifically note i observed the same performance regardless of the language model in use bert roberta etc,0,79,168 pandas how can i replace rows in a dataframe i am new in python and try to replace rows i have a dataframe such as i have two question how can i replace nd row with th such as how can i put th row above rd row such as,hyperparameter tuning keras a neural network regression we have developed an artificial neural network in python and in that regard we would like tune the hyperparameters with gridsearchcv to find the best possible hyperparameters the goal of our ann is to predict temperature based on other relevant features and so far this is the evaluation of the performance of the neural network as of now we have no clue on how to utilize gridsearchcv correctly and we therefore seek help to move us towards a solution that would satisfy our goal we have a function that might work but are not able to apply it correctly to our code this is the hyperparameter tuning function gridsearchcv our main function our function to split data into training and testing data our function to fit the model and to utilize the artificial neural network ann our function to make the model of the ann our function to evaluate the performance of the ann,0,51,161 get all possible combinations from a list of lists by picking one item from each list i have a list of lists and i would like to get all possible combinations by picking one item from each list for example the following list the output should be the number of lists and their items is random,list resets after for loop a list is defined at the beginning of a function then appended to in a for loop and printed at the end of the function which returns an empty list the code the commented out print statement under the append returns the following which is what is expected the print and return statements at the end of the for loop both return an empty list how can i fix this,0,56,75 mysql connector errors operationalerror mysql connection not available i get this error message on pythonanywhere when i reload the app a couple of times i need to reload the app from pythonanywhere to make it work error message file home sideproject virtualenvs myvirtualenv lib python site packages mysql connector connection cext py line in cursor raise errors operationalerror mysql connection not available mysql connector errors operationalerror mysql connection not available anyone please help me with this server js file code sql connection py file code,how to compare two lists in python with the if loc condition i have two lists and i need to compare those two lists in below manner output getting expected output,0,63,31 how to schedule code to run at a specific time every day need help to run code that automatically starts at pm every day on python visual studio code i don t want to print anything i just want to execute my commands like pg keyup enter for example only works with printing text,pythonic way to loop through dataframe for a non decreasing id there are debit and credit transactions in the dataframe df the transactions are random but ensure that at any point account is not in net debit i e at any row cumulative debit amount cumulative credit amount what is the most efficient algo to deduct each debit entry from credit entries such that credit entries with lowest id get exhausted to zero before debiting from subsequent credit entries for example desired output for this is,0,51,85 pandas split column of unequal length list into multiple columns in python i have a list of codes in one column his name course code that i would like to put each code is a new column can you guys please give me some guidance how to do that thanks,is there an easy way to use asserts in python to check for results printed on screen whereas assert in python is ideal to verify wether certain function calls return an expected output for a given input could it also be used to check for results printed on screen i e in procedures that return no results but only have side efffects like printing stuff on screen the context of this question is how to write such automated tests that i would like to include in an automated grader tool since expect the answer to this question to be assert does not serve this purpose what other trick could i use then to check the screen output produced by a procedure,0,50,120 getting google returned a response with code error in pytrend i want to get yesterday or todays data from pytrend but every time i use this code i keep getting the request failed google returned a response with code with the data and sometimes timeout or rate limit exceed error my code,why is same url scraped twice instead of two different start urls i have the following spider when i run it then the print output states that the first url of start urls has been scraped twice why is this happening as key bits of the pages load via javascript then it might be useful for me to include the selenium middleware i m using,0,54,62 how to append data in to the dataframe the code is working fine and give me the image link but i want give name image image and so on to get output like these as you seen in picture,how to convert x to quotes in javascript i am trying to pass a python list with string values from views py to the template where a javascript uses the same for labels of a pie chart plotly the issue is when the list is received at the front end the list is getting the hexcode of the quote which is instead of the quotes how to convert it to quote here is the snippet var trace x labels y values marker color rgba rgba rgba type bar now i am getting the values for labels as instead of just wanted to know are there any methods to avoid this easily instead of using string replace methods,0,38,120 explanation for this no flux boundary code needed im completely incompetent in programming can anyone help me understand what this code does exactly according to the notes it should impose a no flux boundary condition but im completely baffled at what the terms indicate can anyone explain this to me,iterate through list of dictionaries that don t contain the same keys i am struggling when trying to iterate through a large list of dictionaries for the most part they contain the same keys but there are a few that are missing some keys obviously this causes error and i m unable to successfully run below is a sample of the list we are missing away in the second dictionary so when i run the following code i obviously get the error keyerror away since away is nowhere to be found in the second dictionary is there a way to ignore the missing keys and just put a null in place of the variables for the dictionaries where away is missing thank you in advance finally if this has already been asked i apologize as i cannot seem to find it anywhere i see multiple questions regarding iterating through dictionaries but none regarding different keys,0,49,153 detecting whether build ext is building a python extension with debug information i have a python package that has a cython extension in my setup py file how can i tell whether build ext or bdist wheel were supplied with the debug flag i want to link against different libraries based on the debug flag,what is the simplest way to access a deep list of lists in python i have a big list that its elements are also lists and their elements also lists for example so if i have only the grandfather list and i want to access the leaves elements which are the elements inside each child i will have to write you can notice the complexity of accessing the leaves elements actually the real list i have is much deeper than that so my question here is is there a simpler way to access the leaves directly,0,51,96 i accidentally deleted my python venv folder on vs code what should i do i accidentally deleted my python venv folder on vs code i had tried some tutorials i could find on the internet but none of them works anyone know how to restore or redownload the venv file thanks,how does the one hot encoding work in keras image data generator so i have classes for images cat cow and dog when i do i get this and when i do this i get this which i correct as i have cat dog and cow pictures however i don t understand why is for cat shown as or for dog shown as and for cow shown as can anyone please help with the logic,0,51,86 can not make detailview render data hello guys i m new with django class based views i m learning what am i doing wrong it suppose to render ids but it does not url py views py html,python error not enough values to unpack and main py not specified so i was doing some python exercise and been stuck on one which teaches parameters unpacking and variables so the code goes like this but the error i get running this directly on compiler is now if i run the code with terminal using command python main py first second third as the book says i get the error help would be appreciate,0,35,73 google colaboratory os mkdir filenotfounderror errno no such file or directory i am trying to run autoencoder train ipynb on google colaboratory however i am getting this error what is going wrong here here is a link to my file,how to deal with different arguments that may have similarly named dest let s say you want to use subcommands and at its core the subcommands want the same object data points to be stored in namespace but perhaps grouped by subcommands how can one extend argparse but not lose any of its standard behavior while achieving this for example the above example just tries to explain my point but the main issue is that what happens is that when the above code executes parse args returns a namespace that just has rawr n but what if my code distinguishes behavior based on the subcommand so its important that there be an object that has an attribute rawr within the namespace object for example if args only has args rawr then you cannot discriminate action or action they both are legal actions without the additional nested layer,0,38,145 typeerror get members takes positional arguments but were given i actually gave i am making a bot and it has a method in it called get members which takes args self and client i am supplying both arguments and still it says i am providing args also the client parameter shows a warning unexpected argument the stacktrace,incremental duplicates i ve list of integers which the list is circular i want to find consecutive duplicates instead of them place duplicate number to the start position also need to do this until there are no consecutive duplicates in the list or list is empty i tried while loops with different forms but couldn t reach my goal tried cycling with itertools cycle cause and are also consecutive but couldn t remove or insert also finding out when to stop is problem tried int list list set int list but there might some non consecutive duplicates so that create a infinite loop here is an example edit the original problems is in this codewars kata,0,60,112 pandas column fill n as with rolling mean i have a pandas dataframe i d like to replace nans in rate column with rolling mean of previous values expected output,why isn t my else in flask python not working when i press the start button it directs me to error html even if i choose my skin type,0,29,27 how to install python on ubuntu since python is no longer supported in ubuntu and the usual deadsnakes method also doesnt work it gives following error,how to run requirement txt file using pip i try to run an python project so i created python virtual environment after this i activate environment after this i try to install requirement from requirement txt file using but it show an error consider using the user option or check the permissions,0,30,50 extract an element from the class with beautiful soup how would you extract the from data dat,pyqtgraph stacked bar graph i have this set of data i want to draw a stacked bar chart in pyqtgraph similar to this one drawn in matplolib i have checked pyqtgraph bargraphitem documentation but i didn t find any information regarding stacking bar,0,17,41 how to simplify slightly different if statements to one in python i would like to simplify this code and not repeat the if not statement and the print only one condition is being added in the first case curaccession data and the print is exactly the same is there any way to achieve this with a flag or something excuse my naive question i m not familiar with python,having trouble encoding dataset array dataset i ve been trying to deploy the ensemble method from sklearn to a small dataset i have linked above for some reason i keep receiving this error this is the code any help and or suggestions on getting encoder to work so i can use the ensemble method,0,69,53 issue with django json response i have issue with json response messages values gives me user id instead of username how to get username here is my code,maya setting frame range programmatically with the render setup api i am trying to set the start frame with the rendersetup python api in maya like this for some reason the value gets translated in how to set it to the proper value,0,26,47 does it matter in which order you use prefetch related and filter in django the title says it all let s take a look at this code for example when using prefetch related first does django fetch all the manytoone manytomany relations without taking into consideration filter and after everything is fetched the filter is applied imo that doesn t matter since there s still one query executed at the end thanks in advance,python data transformation i have a dataset with two columns how to convert into the format given below using python,0,68,20 how to use queue with threading properly i am new to queue threads kindly help with the below code here i am trying to execute the function hd i need to run the function multiple times but only after a single run has been completed current output expected output,why is this float conversion made i have this dataframe an integer value from an integer column is converted to a float in the example but i do not see the reason for this conversion in both cases i assume i pick the value from the selected column from the first row what is going on,0,50,56 how can i test aws cognito protected apis in python i m trying to test out some aws apis that are protected by cognito i found the first part on how to get the json token but i can t figure out how to use the token correctly so i can authenticate on the api here s my code i m getting the following error message,getting days difference from dates in same column in a groupby in pandas i have a pandas dataframe like this in the code columns the values are always form a specified list here n n n etc i want a dataframe that displays the days it takes to progress from code n x to the next one in sequence for each user i am thinking something like this your help will be much appreciated,0,64,71 how to access execution date in airflow for operators other than python or bash i am using bigquery to gcs operator in airflow i want to save the tables in folder with execution start date as name of folder since the tasks run overnight datetime today sometimes gives next day as execution start date how can i access dag execution start date in place of datetime today so that all tables get stored in folder with execution start date as folder name,event loop is closed called after closing the discord bot after completion shutdown the bot gives an error error my code the bot issues such an error after the program is completed how to fix it solutions like these solutions didn t help me the only thing i have improved all the libraries that were discord itself aiohttp and asyncio but they did not lead to a result what can such a problem be related to bot code example,0,78,77 extract and rename zip file from specific folder using python i am using python to unzip a file i have a zip file in folder wowo if i select folder using path and use only file name the code doesn t work but when full path filename given it works i don t want go give full path and file name together i want to define path saperately,how to get the missing record row number and column names using python using python and pandas i would like to achieve the output below whenever there are null or nan values present in the file then it needs to print the both row number and column name expected output,0,65,50 how to loop dataframe by year in pandas i want to loop dataframe by year for example my df is to length and columns a h columns index is datatime in this time df a like that df a is one of the answer i want but df a df a df a is all of them but i don t know how to loop by year by year because we cannot write df a i so please rent me your knowledge,best way to respond quickly to a variable that is changed by another thread i have written a program to consume data that i am sending to it via udp packets every milliseconds i am using separate threads because it can take a variable amount of time to run the logic to process the data and if more than ms have elapsed i just want it to process the most recently received datagram i am currently running a while loop and checking every millisecond for a new quote via time sleep i just learned that this time sleep is actually taking up to milliseconds to process on a windows server operating system and it is delaying everything i could just put pass instead of time sleep but this ends up using too much cpu i am running multiple instances of the program is there a way i can have the program pause and just wait for maindata newquote true before proceeding the trick is i would like it to respond very quickly in less than a millisecond rather than waiting for the next windows timer interrupt,0,74,186 access vault credentials using api i am trying to access vault credentials using python api i am doing something wrong as i always get access denied i have used the following code,no output when executing the script python vscode i m developing a simple reactive programming script example to download images from a web but when i execute the script in vscode i do not get any type of output i already tried creating a virtualenv in the terminal i get this output ps c users ernes desktop paradigmas c users ernes appdata local programs python python python exe c users ernes desktop paradigmas jose py ps c users ernes desktop paradigmas,0,32,59 how to get id from created object in django i have models group and members groups have many members but when a group is created currentuser automatically becomes a member i m doing everything in single request and i have problem with getting id createdgroup my models form view how can i get the newly created group s id i ve tried something like this when i console log request post i m getting only name description,highchart to display percent on each and every column of column chart how to set different colors to different datalabels of all columns in this bar chart in this code i just set with orange color for all data labels in this chart how can apply different colors to all datalabels on top of columns,0,70,55 building is diagonalizable with numpy i m practicing about numpy library beginner and i want to create a function that decide if a given square matrix is diagonalizable it seems that the next function returns true for every matrix and i m wondering why is that happening any help will be appreciated,showing gps points on altair world map i m building for learning purposes a python program that extracts gps data from jpg files in a directory and display the gps coordinates from the photo s on a world map i managed to extract the latitude and longitude values in a panda s dataframe and display it on a altair world map but my problem is that the points don t show up in the right gps position also when i pan the map the points move around the map and the map selve doesn t move how can i manage to get the points fixed on a world map and in the right gps position this is my code for the altair map this is a part of my dataframe thnx in advanced,0,52,122 generate random binary strings of length i want to generate random binary strings of length i e from to where each string is length i m wondering how i could do this efficiently or pythonically right now i randomly choose between and times and then append the results into a string this seems pretty inefficient and not pythonic is there some library functions i could use for this,reading a text document with special formatting in to a numpy array i have a text file with the following format x value y value z value id i would like to read this into an array and i have been partly able to do with positions np genfromtxt file skip header n header lines usecols however i run into a problem when the x value is negative this results in the following x value y value z value id the problem being that numpy now reads x value as one column and does not separate the the string from the float i hope i was able to convey my problem clearly does someone know how to solve this problem,0,75,110 discord py client get user returns none with user id i keep getting a attributeerror nonetype object has no attribute send exception when i run this code i have tried the similar questions and they did not work,pandas create session number from log data i have a log data with timestamp userid action i would like to create a session id based on the following rule if no action was done for minutes by the user it should start a new session id for next action so for the following data frame to the following for user a new sessionid is created because when the action was taken it has been more than minutes since last record but for user there is no such gap thank in advance,0,35,96 can anyone here describe me this higher order function written in python specifically fn fn arg,detecting state mutation in python is there any way to detect state mutation in python i m working on some software where all mutated state must be saved to an external database and i d like to write an automated test to detect state which has not been persisted more background on the problem my software has a set of worker processes and these processes can be restarted at any time so it is necessary for a worker process to recover its state from the database if it is restarted my concern is that there may be state mutation which is not persisted to the database and therefore not recovered when the worker is restarted i m wondering if there is any way to automatically defect this i d be happy to detect all state mutation and exclude that which i know is persisted to the database,0,15,143 the price from get ticker is different from the market i m trying to improuve my python script on the binance api now i have seen that if i get the price of a symbol with the api get ticker and then try to buy or sell at market price the prices are very different the difference is about is there another api to get the market price,different query results for local server and production server without changing the code and updating the display order of pictures on my production server django postgresql bootstrap nginx uwsgi has changed see the picture before now i can t reproduce this problem on my local server with same backup code in django orm i have this result reboot nginx postgresql didn t help what could have happened and how to fix it,0,66,61 moving pandas dataframe columns to the start i ve got a pandas dataframe with almost a thousand columnds the column titles are like how would i re arrange the columns to move a b c d e to the start,convert multiindex to datetimeindex in grouped dataframe i have a pandas dataframegroupby df groups that i have created by grouping another dataframe df pub containing a list of publications by their day month year index i then want to check how many unique publications exist in each group so i use this is a pandas series with a mutiindex that looks like the following i would like to convert this multiindex into a datetimeindex so that it would look like is there a simple way to do it so far i ve tried several approaches but nothing has worked for example if i do pd to datetime n unique pub index i have an error typeerror class tuple is not convertible to datetime,0,35,112 why is this code throwing an error in pandas i m trying to solve this problem on stepik the dataframe with the name my stat contains columns session value group time n users in the variables n users we replaced all negative values with the median value of n users excluding negative values of course here s what i wrote but i get this error how can i fix it,is there any way to rotate dcc dropdown at an angle as shown drop down button is in the image is rotated is there any way to do it i looked into but didn t find anything,0,64,36 selectively sum elements of list in python editediteditediteditediteditedit,folder seems to exist in os but fails silently upon sudo rm rf dirname i am trying to delete a folder but failing to do so i am sudo and have all permissions cd path to parent ls i want to delete which is the problematic folder other folders behave normally observations what may be causing this how to debug this i want the folder removed and i need this to not happen again edit to answer comments edit with the information that a race condition is the problem relevant code chunk that creates the folder,0,8,94 iterating over queryset of dictionary i have a queryset dict which i want to access in template i have following queryset i have tried some options but can t seem to get what i want can anyone please help me how can i do it,how to iterate over two lists in a specific order i have two lists i would like to create these new names and append them to an empty list the structure is the st item in list with st item in list and so on i only want these names this is what i ve done so far the problem with this it creates every possible combination of names between list list how do i limit my loop to only produce names i want,0,44,85 django app incorrect datetime during deployment i have a django model with a datetime field like this locally on my machine this control is created with the local date and time when the application is deployed the field is not created with local time i tried to do this it does not work how to solve this problem i am in central africa,keyerror after re running the same code a keyerror is returned when i try to run the below code my dataframe has the following columns i know that there are many questions on the keyerror name but what was weird is that without changing anything this error appeared while running the code but previously i could run the code with no errors nothing has changed any help on this would be great traceback,0,64,72 pandas shift values from one column to other and drop duplicates using python suppose i am getting a dataframe like this how do get a dataframe such that i will be left with this output this is how i am getting my dataframe how do i shift the numbers from name column to value column please help,how to dynamically set the output name for a blob in azure functions for python i created an azure function in python that gets triggered after a blob upload happens i would like to copy and rename the blob to another storage this is what i have right now this works fine but it only copies the file how can i rename the file dynamically during runtime thx,0,57,68 volume created on lambda boto does not show up in console code output problem after running the code vol xxx does not show up in console and was never created details i m creating a volume using boto from a snapshot id and the output returns a newly created volume id however when i check the console this volume id does not exist was never created your input would be appreciated thank you,how to build dynamic python class with a stub file and method validation i have a python class where the implementation of every function in the class is the exact same this is because the main purpose of the class is to build out strings based on function calls for example so with the above code you should be able to do something like this print stringbuilder hello world and the output would be hello world hopefully that makes sense so far here is my question is it possible that i could define all the valid function calls in a stub file so that auto complete can pick them up including any arguments they might support and then for the implementation of stringbuilder i can do something like this where there is a validation to make sure they are calling an accepted function from the stub file and then execute the string builder logic any thoughts,0,70,152 how to get the missing record row number and column names using python using python and pandas i would like to achieve the output below whenever there are null or nan values present in the file then it needs to print the both row number and column name expected output,discord py editing private message for user edits it for everyone issue i have a discord bot that you can private message one of the commands makes the bot send you a message and then uses bot wait for to wait for the user to answer the message and once they do it will edit the initial message it sent you and change the text to something else this works but if users message the bot and both are waiting on the bot wait for and person replies to the message the bot edits the message for both peoples private message even if the other user never replied to it how do i get it to only edit the message for the user who replied to the bot here is some of my code thanks,0,50,133 output not right on descending selection sort i am working on an assignment and i am really struggling to figure out what i am doing wrong i am new to python and honestly i barely understand the code i have cobbled together so far what i have currently is with the input of i get what i need is,typeerror nonetype object is not iterable while inserting tmdb data into the database i have a simple code that takes data from tmdb api and saves it into the database but while doing this sometimes it throws typeerror is there any way to solve this i am using the links csv file which is provided by the movielens dataset here is the link,0,59,63 communication between top level python code and operator variable in airflow i am writing airflow code where i am running one python operator to read user input given from cli and want to use result return by that operator in top level python code for dynamic task generation using xcom we can perform inter task communication but how can we communicate between task and main code,replace na in dataframe for multiple columns with mean per country i want to replace na values with the mean of other column with the same year note to replace na values for canada data i want to use only the mean of canada not the mean from the whole dataset of course here s a sample dataframe filled with random numbers and some na how i find them in my dataframe what s the easiest way with pandas to replace those na with the mean values of the other years and is it possible to write a code for which it is possible to go through every na and replace them inhabitants area cats dogs at once,0,67,116 how to fix this issue typeerror object has no attribute value in connectivity i can t able to insert values in ssms geting error,couple of questions about how objects work in python when i say x node what exactly is x as in is it a pointer to where node is stored or does it create a separate identical copy of the linked list or is it neither i ask because if i were to add node is not altered but if i added instead node would be altered in that the first value in the linked list would now be also if i were to add i d get something like main node object at x fd is the x fd part the memory address of the object,0,24,104 loop to split a large dataframe to small dataframes df is a dataframe with columns a b c a b c a b c i want to split that df data frame into small dataframes df df df df to have a b c as columns df to have a b c as columns df to have a b c as columns the number in the name of the dataframe df should match with its columns a b c i tried getting the error is it possible to do this in a single loop,how to read or write an uploaded file from filefield model in django i m new in python and programming in general i have this project to create a simple library to add new authors and upload books i must also display the uploaded book details total words most common words different words etc when i open the book now to do this i know that i first must open the uploaded book in readmode but i don t know how to access the file that i uploaded this is my models this is my forms my views my details html i want it to be shown in details html thanks in advance,0,76,109 python how to link a filename to a memory file the memory file will be an input of another program not python so a file name is needed,how to add hoverdata to the argument of fig add scatter in plotly how to add hover data to the argument of fig add scatter in plotly it belongs to fig px scatter but i used this for a point to provide name argument thank you here is the data here is the code,0,28,50 elif statement unreached in python script in the following code the if statement is reached and runs fine the elif statement however seems to have no effect when the script is run when the conditions for the elif statement are met nothing happens and when i press return button twice the script just keeps going skipping the elif statement altogether my code,wondering about pixel perfect mousepointer collision in the case of a button i ve got a pretty simple code up right now that just moves between two menu screens once the button for each is pressed i know that you can mask images in pygame to get pixel perfect collision but not sure how i d go about doing it for the buttons in this code it s just pretty annoying that you can click slightly off and have it still transfer you to the other menu a follow up question i had was on how i could do fade transitions between the screens i ve seen some tutorials but they ve all seemed overcomplicated,0,62,110 select first image of image foreign key in django template i want to select first image of an object property set i created a property model with a foreign key to an propertyimages model how do i access the first image of the property object set all in the template i don t want to do it in the view function since this should be in the base html file the code,django orm data based on max date group model ex data output desire i need only record for max date of every stock currently doing quote objects values stock symbol annotate max date max valid till but still not able to think about proper solution,0,68,35 how to parse all the gitlab ci yml files from all the repositories that i have access to how to parse all the gitlab ci yml files from all the repositories that i have access to i was searching documentation to do it using a python script but no luck any suggestions are highly appreciated thanks in advance guys,is it possible to pass array containing userids to add to telegram group in single request i don t want to make many request so was wondering if it s possible to create an array of users i intend to push to my telegram group and make a single request,0,55,48 create a histogram in python i m trying to create a histogram in python my fuction is the next one it is supposed to look like this but with my function it looks like this besides anyone who knows to represent it in that way too,python function about logistic equation the original logistic function that represents the change in population size per year is delta n r n k n i m trying to write a new function that takes in r k n the initial value of n which stands for initial population size and t the number of years and return the population n after t years below is my code it does work but when i plug in t which is supposed to mean there is no change in time it stills return some n that is different from n which means my code is likely wrong do people have any idea as to how i can fix my code,0,46,112 how to add values to url on python request i wanna get data from an api and i use this requests get i want woeid to be a variable and i be an integer,passing list to adf i have a python function that returns a list of items as a string as part of an adf pipeline using when adf picks this up it is littered with escape characters how can i get this list out,0,33,43 python result from console error string format i have a problem with my console program a total of four initial results are expected from me the interesting thing is that two of them work correctly the other two make the following mistake also since i m a beginner i want to ask how to create a variable that can read both text and number,how to copy every repository folder from one jfrog artifactory to another jfrog artifactory using python there is a package called dohq artifactory in python which copies file from one to another artifactory but not folders repositories i have tried to copy folder with same package but it didn t work please let me know how to accomplish this with python or suggest if there is any better way to accomplish this,0,62,68 difference between values and iloc on a pandas series i am currently refactoring some code where i see both these lines being used from my current understanding both lines do the same thing retrieving the first value of the pandas series are they really the same if yes is one way more recommended than the other due to internals subtleties speed behavior when setting value instead of getting value etc,why does a change in nested list doesn t affect the first layers and only the subsequent layers i just wanted to know how do we get the following output the given below is a python code output is why x didn t make any changes in the list y but why x changed the element in list y can you give a detailed and simple explanation to this why,0,71,68 typeerror can t round symbolic expression i wrote a function that computes the value of the derivative when passing arguments but when passing a function with abs the results are symbols instead of floats however the result i need to round to decimal places and i can t figure out how to fix it,combine multiple data frames with while loop screenshot of results from updated code from suggestion dlist is a list of provider id that is in a dataframe i tried to use a while loop for dlist but it only returns the value of the last provider id in the array in this case it is i used the append function but it didn t do anything the additional rows from provider id are not showing how do i combine everything so it shows the values of both numbers from dlist to equal rows missing values result of the current code,0,53,103 no module requests found visual studio code i cannot run a code in visual studio code with import requests i installed requests with pip install requests and it still doesn t work i tried uninstalling it and installing it again but this didn t work either tried doing it via the terminal which didn t work either,str object has no attribute paste i m working on code that takes different images and overlays them i got this code online and i m trying to change it to work what i wanna do but when i run it i get this exception has occurred attributeerror str object has no attribute paste i m new to python so i m struggling to figure out what s wrong with this any help would be greatly appreciated background variable code jacket variable code i m only pasting part of the code that i need help with out of concern for security all variables in the code above work perfectly fine when i run the program without the code above it runs flawlessly,0,55,116 how to check if xgboost uses the gpu i m writing a pytest file to check if my machine learning libraries use the gpu for tensorflow i can check this with tf config list physical devices for xgboost i ve so far checked it by looking at gpu utilization nvdidia smi while running my software but how can i check this in a simple test something similar to the test i have for tensorflow would do,dataframe pairs of columns division i have a dataframe and want to get divisions of pairs of columns like below i want to combine the last three lines into one like but i only get an error of valueerror columns must be same length as key if i just simply print df a b c df a b c i will only get a dataframe with nans of shape edit now i know why my original one line code doesn t work actually the arithmetic operations of two dataframes will be conducted between the columns with same labels while those columns without same label in another dataframe will generate nans the result dataframe will have the union of the columns of the two operating dataframes that s why my original solution will give an valueerror and the div will generate nans following example will be helpful to explain,0,69,146 problems scraping a dynamic website with beautiful soup i would like to scrape crime news articles from the website but the soup object does not return the required div tag could anyone give me reasons for that,google colaboratory os mkdir filenotfounderror errno no such file or directory i am trying to run autoencoder train ipynb on google colaboratory however i am getting this error what is going wrong here here is a link to my file,0,37,38 expected str bytes or os pathlike object not dataframe i tried to load embedding file for parts of speech analysis with nlp but it shows what s should i do,pyqt figure canvas doesnt stretch problem is my figurecanvas isnt taking all possible height it is only reisizing its width the problem occurs after resizing main window i would like to let canvas take maximum available height this is how it looks now this is minimal reproducible example,0,27,48 way to slice a string using variable i m new to programming and came across a question if i have a string where i have variables indexed and need the value from the middle for example my string is heyeveryoneimtryingtolearnpythonandihavequestion where i have variables what can i do to get the learnpython substring or is it not valid,how to import python files from within a notebook when the files are in another directory i have a folder structure that looks like and in my notebooks i want to run but of course that results in the error so far i found i could do this by first running but that is breaking some functionality in vs code what is the right way to do this update i m finding that running this in my notebooks and then importing my code as is working much better but still happy to learn of any better approaches,0,60,96 how to skip some symbol characters when this character is used as a split column symbol in pandas split function i have a dataframe like below original data i want to be to be data,getting an error for pyspark when i try to run take i am new to learning py spark so forgive the very basic not detailed question i am trying to sc to read a tsv file and then parse that file however after reading the file when i try to do take on it it gives me the following error which i cannot understand i am running it on windows below is the code and here is the error i am getting any help will be appreciated thank you,0,35,89 fast way to access elements of a matrix or pandas dataframe from a list of coordinates i would like to select non consecutive elements from a matrix or pandas dataframe where the row and column of each element is given in a list of coordinates output this code works but i asume there are more efficient ways avoiding for loops to solve this any suggestion,adding text in loop python only once adding a string to a column in a loop i would like to add a red abcd on the left as it is on the top i have a big problem with it because everything is done in a loop as i have now as i want to have,0,65,57 pyttsx not working process finished with exit code i am making an artificial intelligence ai assistant and i wrote this to make it speak it does not speak and shows how to fix it,parse a text in a text file with python i use the special character to split each word in the text file the code output is as follows i m aiming to separate every word in the file the code i developed to solve this problem is available below,0,35,49 i need to make my scatter plot legend dots bigger but w o overlap them i m having issues with a scatter plot legend i need the size of the legend dots to be bigger but i don t know how to do it i tried to multiply sizes but then in the legend the dots overlap thanks for your help here s my code,taking user input and using it in another script i m developing a python script to enter some corporative websites and extract the data that i need so i have two kinds of scripts the first one is to do the automation process and the second type is the parent script in which i use runpy to run the first kind of scripts and tkinter simpledialog askstring to ask the user their login and password the problem that i m facing is that i need to store the user s input that i gather in my parent script and use it in my automation script this is my parent script as you can see it just stores the user s input and run another script below is the another type of script that is located on path to my automation script i m trying to import my parent script variables login and password but as a user i have to fill the tkinter dialogs two times i think that the first fill occurs because i run the parent script and the second one it s when the parent script runs the automation script and thus it re run the parent script to do the variable import is there a better or right way to make it work effectively,0,63,210 plot confidence interval of a duration series i measured the duration of requests i got now an array of elements each element represents the duration of a connection request in milliseconds i want to plot the confidence interval in python and in a clearly arranged manner do you have any idea how i should plot them,how to add multiple dictionary to a json file in python how can i add multiple dictionary in a json file i want to add or dictionaries once and after a while to add or or dictionaries in same json file exemple i want to add it to a test json file and after a while i want to add the dictionary and after a while i want to add this for example edit this is first output than i append dict to list and this is the output it create a second list and put dict in it how can i change the code to put dict in my first list,0,59,121 kivy numeric keyboard on text of the text field i am trying to add numeric keyboard in ui which will be display as clicked on the text on filed but some how numeric keyboard not show in the ui i use numeric json file to open the numeric keyboard as per the kivy documentation json file and link is here is my code below,string alignment inspired by global dna sequence allignment i would like to do something similar to this but with strings like this x x etc instead of dna alphabet characters is anyone aware of a package to achieve this in r or even python thanks,0,64,45 what is the difference between rdkit s molecule fingerprints fingerprints fingerprintmols and chem rdkfingerprint can anyone tell me when i should use fingerprintmols fingerprintmol instead of chem rdkfingerprintwhen making molecule fingerprints these are the two options is fingerprintmols fingerprintmol more efficient,add few variable based on the existing csv and append to the existing json in python we do have one csv and one json based on the values inside the csv we need to modify the json for instance input csv input json now here i need to update add the extra govalues which we get that from the csv inside the govalues id and status are generated later all we need is to do is to append the values of name goid myid name should be the same as the goid without subnet goid is goid myid is myid convert this to json as below and append to the input json,0,35,111 sns set style command is not working on my code please assist i tried using seaborn package in my code to scatter plot complex numbers but i am not getting any output even after calling sns set style please help,googletrans error with dictionary translate trying to use googletrans in my project using version rc python on windows local machine the script is simple it must translate an array of the phrases into english from russian when trying to translate one phrase it s ok but when trying to translate a dictionary the error occurs part of the script where this error occurs where should i dig or maybe someone had such a problem,0,35,77 find all combinations with set characters i m new and i promise you i ve tried google for the past few hours but i must be using the wrong words and for that why i m here i m trying to find all combinations with some set fixed prefixed characters at in certain positions for example dt fg zr l m n q p characters to choose from,plotting a heatmap based on a scatterplot in seaborn is there any way that i can plot a heatmap in seaborn based on a scatter plot for instance i have the following scatter plot and want to plot the corresponding heatmap in such a way that darker spots in the heatmap shows more crowded areas in the scatter plot,0,63,59 its necessary to start an app in django to load javascript files i m making a portfolio on django python and i have successfully loaded all the assets templates from my project such as css jpg png files but the javascript files js are not working i saw several questions about this issue with javascript and i tried all of the solutions that i saw anyone could help me thanks a lot,can t input data to custom loss inputs to eager execution function cannot be keras symbolic tensors when i m testing my tensorflow keras custom loss using additional input data to calculate loss which is as follow i got a error massage i follow the answer in custom loss problem inputs to eager execution function cannot be keras symbolic tensors but found but without considering the correctness of the input data when i change the mse loss to my own loss function i still got this error i dont know which step made my function error what can i do to add this loss function to my model,0,71,105 how do i resolve list index out of range error i have a code that scrapes data into a dataframe however i get partial output at while i checked for the argument when i explore further i get cases i am getting an indexerror at how can i resolve this lorem ipsum dolor sit amet consectetur adipiscing elit quisque pellentesque ipsum vel tempor suscipit turpis mauris venenatis leo nec vestibulum arcu urna et quam,i d like the browser to display data from to in white python from selenium import webdriver from webdriver manager chrome import chromedrivermanager from selenium webdriver common by import by from selenium webdriver chrome service import service from selenium webdriver common keys import keys from selenium common exceptions import nosuchelementexception from selenium common exceptions import i think something is missing,0,75,46 how to get column names sql in python i want get a db into pandas df in python i use a following code this code works but i want to get column names as well i tried this question mysql get column name or alias from query but this did not work how can i get column names from db into df thanks,how to loop through lists more efficiently i have two lists at hand each consisting of tuples in form lemma pos token list a is generated by a lemmatizer from input text list b is from a preexisting database the objective is to check if a token from list a is found in list b then if found return corresponding lemmas from both lists and check if they are the same write yes if so no if not if not found return corresponding lemma from list a ideally the output should be something like so i tried doing that with for loops cause we didn t really learn much else you see whilst list a is quite short tuples from the text i am testing on list b is pre existing and has m elements for looping through it for each item on list a is not going to be efficient i guess apparently my laptop can t complete executing this code anyway so i can t even test it what could i do i have a feeling a fundamentally different approach is needed here upd i have after about an hour of trial and error come up with this solution where lemtok is list a binlistfinal is list b,0,63,206 why is there a difference in how the in operator behaves this works perfectly but when i apply the in operator to an array like this it fails,handle files in media group using aiogram i need a sustainable method to handle files wrapped in media group my function handle files is waiting for media files when user uploads media file it goes through the series of different checks if it passes all tests size restriction formats restriction the media file is downloaded and processed it looks like this working with separate files looks fine after downloading files user gets a list of added files one by one but the problem is that when user uploads files in media group one file overrides another it looks like that so only one file is appending to the list list of files that prevents me from processing both files i tried to solve the problem by initializing user data dictionary one more time it solved one part of my problem but this solution is not elegant and supposedly not quite sustainable the message is duplicated i need that after uploading media group user gets one message containing the list of all files from this media group i suppose that the problem here is linked with asyncio but i ve spent already a lot of time but the solution haven t been found looking for you help,0,28,200 i want to check if there are any identical rows in a matrix i need to check if there are any identical rows in a matrix that contains integers values for example this must return true but in other example this must return false,django unit test not executed i m still struggling with tests in django now i ve rewrite a test but it s not executed so i see no results when i run the test command is it because of the wrong test or i m missing something thank you once again models test,0,48,50 pandas calendar issue this code for custombusinessday works fine output however when adding an optional calendar as in date functionality it produces the next business day even though today s date dec is not a holiday according to a specified calendar below output,shap dependence plot doesn t work with an error which is related deep inside the function i have this code and my data is when i run this code i am getting this error the error is deep inside of this function and i am not sure how my data can change it how can i fix this issue,0,45,57 writing to config py file from another python script i ve created a python script that reads from a config py file using import config to inform it s output config py script py i need current brightness to be permanently incremented in config py after running the script so that subsequent script runs will import the newly updated value instead of it always being in other words how do i write to a config py file like i would any other standard config format like config ini,plotly putting y axis two plots in the same range in python i have two box plots side by side but i want to have them to have the same y axis range in this case currently the plot on the right side does not have the same y axis range as the left one i have tried it using fig update layout yaxis range but i am not having any success here here s the plot here s the code,0,79,73 python create file from list add empty line to the end i have to create the cvs file from the list here is the code i can understand n breaks the line but when i open the file i see last line is empty this is how content looks like is there any way i can remove last empty line found the way to fix this but wanted to check if this is the right way,how to use canny correctly i have an image with a resolution of x i am applying the canny operator to it but the result i am getting doesnt suit me i want all the edges to stand out however when i apply this algorithm to images of lower resolution everything works correctly how can i solve the problem original image result,0,76,62 how can we create object in desire database in rest framework i m creating project but that project is saving in the default database i want to create that project in other database i m using creatapiview i don t get it how can i use that using otherdataname in get serializer,gensim package installation word vec not recognised from gensim models import word vec results in the following error importerror cannot import name word vec from gensim models unknown location from gensim models word vec import word vec results in the same error after deleting all conda installations of this package pip uninstalling gensim pip installing gensim and pip install upgrade gensim i can finally do import gensim but when i try to use gensim models word vec it results in the error attributeerror module gensim models has no attribute word vec edit updated numpy and scipy as well note i am using a jupyter notebook that i run from my local machine i have not had this problem using pycharm where i was running gensim from a conda env but i m working on a group project in notebook so it would be nice if i didn t constantly have to copy paste between these workspaces any help would be appreciated,0,47,145 plotly express ho to plot a stacked bar chart of single variable i have a dataframe like this i d like to plot a simple stacked bar chart like the one below whit plotly express how can a i do that i ve seen on documentation several examples but none of them solved my problem thank you,cannot install libpulse dev in ubuntu i like to use pocketsphinx speech recognition engine for that libpulse dev is one of the dependencies however i cannot install libpulse dev in my system i used the following command to install the package sudo apt get install libpulse dev and i get the following output what should i do thank you in advance,0,55,56 numpy arrays addition i have different numpy arrays with values in each and i want to add all the elements at position of arrays together and store in another array at loc all the elements at location and store in location and same for all elements of arrays how should i do in python,why is same url scraped twice instead of two different start urls i have the following spider when i run it then the print output states that the first url of start urls has been scraped twice why is this happening as key bits of the pages load via javascript then it might be useful for me to include the selenium middleware i m using,0,64,62 read shp file from sftp using pysftp i am trying to use pysftp s getfo to read a shapefile without downloading it however the output i get does not seem workable and i m not sure if its possible do this with a shapefile ideally i would like to read in the file and convert it to a geopandas geodataframe from here i can t decode the value and am unsure of how to proceed,polyalphabetic cipher in python decode method doesn t work i am trying to implement some basic ciphers in python the one i m stuck on is a polyalphabetic cipher i ve seen other posts on here that use the same term for what appears to be a different cipher so i ll specify i m trying to implement what this textbook calls a polyalphabetic cipher in chapter section this involves digitizing the message breaking it up into vectors of equal length multiplying each one by a set matrix that is invertible mod adding a shift vector and reversing the digitization to get the encoded message out using the example in the textbook i m trying to encode help with matrix and shift vector and it is encoding to rrgr as the book says it should however when i apply my decode method to rrgr to helo in case more data is helpful i ll add that when i encode and then decode the whole alphabet with the same matrix and shift vector i get abcdefgghjklmnopqrstuvwwyz my code is below apologies for the lack of comments this code isn t for anything important so i didn t bother,0,72,197 bracket validation python syntax question after watching a youtube tutorial on a bracket validation algorithm i understand everything besides this line of code going through the loop until i hit a closing bracket c turns into so i m guessing the code would statically be here is where i get confused because i don t see why stack which is is equal to closetoopen is it because closetoopen returns the value of which is,numpy array of dimensions indexing and sum i have a doubt there is an efficient way to sum all neighbors of a numpy matrix without using several conditions this is an example when i run m it returns me and not an error so if i want to add to all neighbors of a value i need to use a lot of conditions because i can t just use m because in this case and in the other cases of the corners it returns me just a false neighbor,0,76,92 multiple values to single variable python i am tryin to create some really basic list using python only for practice but i am struggling to find answer for how to add multiple values to a single variable program should read one or another depending upon a users input i wish to enter multiple values to a single variable so that i can use just that variable later on,count subquery in sqlalchemy i m having some trouble translating a subquery into sqlalchemy i have two tables that both have a store id column that is a foreign key but it isn t a direct many to many relationship and i need to return the id store id and name from table along with the number of records from table that also have the same store id i know the sql that i would use to return those records i m just now sure how to do it using sqlalchemy,0,68,85 get name of installation directory for pip installed package i need to get the installation directory of a python package installed using pip i got a package let s say mkdocs mermaid plugin if i use this package within python i can do so import mermaid i need a script which outputs for a given python package name mkdocs mermaid plugin the name of the installation directory,parametric pdf estimation histogram vs likelihood given a sample from a distribution and assuming it is gaussian normal distribution with unknown mu sigma the task is to find the parameters mean and standard deviation that describe it best what is the mathematical difference and why does it yield different results and if it is different why and when to use which method i think both are parametric and can be used in the same cases,0,62,75 discord python music bot bad operand type for unary dict error hi im having a problem with my discord music bot s play command this the code and this is the error,python type hint enum member value i m trying to constrain an enum to have all member values of only one type for example i want to be an enum with only ints in its members values therefore when i write mytypedenum member x value into my ide it recognizes that the type is indeed int edit this is obviously a simple example with int but i d like to use any type in its place,0,34,71 nameerror name yt is not defined i wrote this code to make a python video downloader from pytube import after i run it it asks me to enter the link i want it to download as i want it to do and after i enter the link it shows me this error how do i fix it,how to stop the sound in pgzrun pygame zero when my game ends the sound plays right now for eternity and i only want it to play once when the game ends i ve looked it up everywhere but i really cannot find any good and helpful solution to this problem i use pygame zero here is my code for my game,0,59,61 use namedtuple instead of tuple with typing optional how can i use namedtuple with typing optional instead of this tuple i want to to call the function in the format of result final power stats min max none thank you i tried with stats namedtuple stats optional int optional int,when are linked lists preferred over lists i m learning data structures and algorithms using python i ve learnt that the advantage of linked list is that it does not have a maximum number of nodes unlike arrays in other languages since python automatically resizes our lists for us the advantage has been abstracted away for us therefore i ve always thought that the only advantage linked lists have was that adding a node at the front or back of the linked list was o whereas adding an element to a list could end up being o n from python having to resize the array and copying every element over however i ve just learnt that amortized time complexity is a thing today and that appending to a list takes amortized o so adding an element to a list is actually quicker than adding a node to a linked list since adding a node at anywhere other than the front back of a linked list takes o n time complexity so then what is the point of using linked lists over arrays lists,0,42,175 how can i concatenate pytorch tensors or lists in a distributed multi node setup i am trying to implement something like this for nodes each node with gpus i tried to get a sum of these but what i want is a concatenated version like this or is also ok with me is it possible to achieve this from torch distributed,lights out with branch and bound i m implementing an algorithm using branch and bound to find a solution for the game lights out i can t find the way to relax the restrictions of the game in order to find the bounds how can i relax the problem,0,62,47 typeerror bad operand type for abs vpython cyvector vector i m trying to implement the gravitational force between two objects using this code then i got this error,no module requests found visual studio code i cannot run a code in visual studio code with import requests i installed requests with pip install requests and it still doesn t work i tried uninstalling it and installing it again but this didn t work either tried doing it via the terminal which didn t work either,0,25,55 response when i use requests to make a post request my core code is as follows the variable url is my own website which is based on django i know i can use csrf exempt to disable csrf but i don t want to do that however it return response when i use requests to make a post request i wish someone could tell me what was wrong with my approach,how to make individual index html file for each category in pelican i m new to pelican and i recently made my personal blogs website website is hosted on gh pages branch with the help of ghp import here i want to generate custom category welcome homepage for each category i don t want to display all the articles of that specific category i tried this by creating index html file in the each specific folder of category but it didn t worked also searched on so and found some related answers but i cannot figure out what to do in my case here are those questions mentioning it cos maybe they are helpful how to achieve this thanks in advance,0,71,115 i need one coroutine wait until next friday for the execution of sub coroutine i am completely new to python and asyncio so i need some help basically i need to make the coroutine to sleep until friday pm doing this every week schedule friday night send friday night,python asyncio result not set in task error i am trying to create an asyncio task perform some db query and then a for loop process and get the result back in the task however in the code sample below it seems like my result is not being put to total result result but rather just to total result not sure if there is any misunderstanding that i m having regarding my implementation of asyncio below i have a feeling that it is because of total result being a list object but not sure how to resolve this,0,46,93 attributeerror message object has no attribute mentioned user i m trying to make something similar to the afk command code error,django not showing images in editor error i m try create post and add to this post images and i m use for this django summernote in django picture upload to folder on hard disk but not showing in editor console show error please give me advice how to fix it thank you settings py urls py models py screenshot from console,0,19,59 how can i randomly assign powers to my heroes i m creating a hero game i ve created a dictionary containing magic powers my problem is how can i create a method that will randomly assign magic powers to of my heroes each hero get s powers without one magic power being assigned multiple times here s my code,how to change part of numpy array without reshaping i have the the following array i would like to change the attribute for part of the array filled with my custom class for example i would like to change elements starting from element then from row to row ideally i would do something comparable to the result would be something like the following unchanged x changed the problem with my array is that i first need to flatten it before i could do something like this or i should calculate how many columns and rows i before i can index the array itself is there a numpy function such that i can just iteratre over the array element by element row by row i hope my explanation is clear,0,58,131 how to get the canvas create text text value in tkinter python,python project euler question if statement won t execute if index is greater than i have been attempting problem from project euler in python and have come across an error that confuses me basically the x grid of numbers is a list that contains sublists of every line or every number the problem asks me to find the greatest product of four adjacent numbers in the same direction up down left right or diagonally meaning i have to loop through every number and find those combinations to loop through each number i create nested for loops to first loop through the multiple lists and then to loop through the numbers in those lists my for loops look like this i also make pre set combinations in the form of a list based on the variables list and num the hard part of this problem the way i see it is that i can t have all combinations listed above for every number for example for numbers that are less than spaces away from the left side and less than spaces below the first list cannot have a horizontally left diagonally down left diagonally up left and vertically up combination of number as there simply isn t enough space this is expressed with the if statement looking like this piece of code works with the output in my console being the numbers such as are from me printing which list it is and which number place it is so means the first number of the first list and would be the nd number of the nd list however a problem occurs when the code loops to the top right part of the grid the code i implement is yet this doesn t seem to register in fact the full console log looks like this i m confused because list value is under and the number index is above i ve done some troubleshooting and the if statement works without the and num for some reason but i still need that part my full code looks like this if there appear to be any errors in the structuring and such,0,10,371 row and column wise data insertion using two dataframes below are the two input dataframe df and df values of a a a from df should be filled by looking non zero values of b b b of df the intended output is,how to convert kivy project into apk for android i have a project that contains a py file and kv file and txt file and i want to convert all that to a apk file is it possible to do that using google colab,0,39,44 set the number of minor ticks in matplotlib colorbar i am able to set the number of major ticks of the colorbar using the following code borrowed from here is there a similar way of setting the minor ticks of the colorbar,attributeerror clients object has no attribute is authenticated in django restframework i want to implement a custom two layer of global authentication i e first every request must have a client id and bla bla after that request must have user authentication services like access token and refresh token when i want to implement the first layer it rais following error i m using i m getting the client id from the client request header and validating it as like my setting py config file is like this my client model as follow data in database table,0,42,92 choosing a column which has a certain value i have an numpy array as the following i am trying to only show the array which has third value in this case when i execute my code i get the following output i do not know why i get those arrays my code is below,can t parse selenium python flashscore i m sorry guys my brain is buffering in this problem since a lot of time i m trying to get all match summary deatails results and date i m parsing it filtering the score now what i want is to get the match if in the last match team last match team and h h btw them there is minimum goal if there is one result match i don t get anything for now i m stacked here how to put the if condition inside the for i tried everything but nothing worked for now thank yuou a lot guys i mean i want to get first matches with results of team team and h h btw them and if there is a in the score i won t get it this is example page of flashscore overall enter image description here enter image description here,0,59,155 typeerror bad operand type for abs vpython cyvector vector i m trying to implement the gravitational force between two objects using this code then i got this error,how to handle subprocess run error exception how do i handle a subprocess run error in python for example i want to run cd userinput with subprocess run what if the user types in a directory name which does not exist how do i handle this type of error,0,25,46 adding comma to bar labels i have been using the ax bar label method to add data values to the bar graphs the numbers are huge such as how can i add commas to the data values using the ax bar label method i do know how to add commas using the annotate method but if it is possible using bar label i am not sure is it possible using the fmt keyword argument that is available,fix snowballstemmer error attributeerror english object has no attribute default hello there i am using the package snowballstemmer and i am getting an error i am very glad for any kind of help code error here,0,73,37 selenium python framework import issue when i run my selenium python tests via right click run in pycharm all is good however when i try to run with command line pytest i get error here is my folder structure driver py file looks like this testname py looks like this and when i run pytest v s tests testfolder testname py i get following errors in my console thank you for your help,why the the total number in confusion matrix not same as the data input why the total confusion matrix does not have the same number os samples as the dataset the dataset contains but the total at confusion matrix not exceed here is the code,0,68,47 how to copy build artifacts from azure devops to azure virtual machine i want to copy build artifacts to azure virtual machine what steps should i perform or check to solve these errors is there any other way to copy artifacts on virtual machine from devops,replacing a column in a dataframe with another dataframe column using partial string match i have the large csvs with following sample dataframes i would like to replace the names in df to replace the names in df to create the following dataframe what would be a generic way to do this thank you,0,46,54 can t connect dockerized mysql container from flask app i m trying to make an dockerized app with flask and mysql but i m getting an error with exec db create all on flask sqlalchemy i have confirmed that the following can be connected can you tell me if there are any other settings that are wrong i m using mysqlclient so i also tried the following with the same results,find size of rotated rectangle that covers orginal rectangle hi everyone i have a bounding box of faces from the face detection system in the format x y x y i want to crop out and align the face my current approach is as follows calculate the angle from the eye position then rotate and crop using cv warpaffine function the problem is the new rotated bounding box is not completely covering the old bounding box how i can calculate the size of the new bounding box so it completely contains the old one,0,64,94 parser error when trying to read csv file with pandas on jupyter hey community im new to coding and as a job task they asked me to read a csv file i used the commands and after that second command i get the parser error i would be very thankful for any help i am really hoping on landing this job,increase the value as soon as the condition is met i think this problem is quite easy but i can not find the correct function of pandas to achieve it or link in stackoverflow i tried it with cumsum but did not succeeded my dataframe looks as follows now i want to have a new column and here it should always be increased after every rd time id the output table should look like this,0,61,75 loop in pandas dataframe i have this problem looping through this dataframe its printing the same column for each value thanks,sh api access token so i have a code here written in python to generate an access token from the api using the secret key and consumer key provided by stubhub when executing in command prompt i keep getting an error in line saying traceback most recent call last file c users desktop python py line in access token token respoonse access token keyerror access token any suggestions thanks,0,21,63 python dataframe if a particular row is bad then drop previous n rows i have a data frame i check if a row is good or bad if a row is bad i want to drop this and the previous two rows n in my actual problem n i have a working solution is there a better way checking if my solution is the pythonic way of doing it my code expected answer my solution,i can t get image url scraped from website i am using this python code to extract cars details however i managed to extract them except the image source url which am facing trouble with you can at my code below in terms of error am getting the following output anyone have idea what am missing out here,0,75,57 modify pandas dataframes inside a loop i want to modify some pandas dataframes inside a for loop the problem is that after the loop runs the dataframes are not updated with the modifications what is happening my code,iterating over a pandas dataframe super fast i am trying to create labels for my dataset which is just a csv file with lines of text i ve used the following method but it takes about minutes to create all the results the desired outcome is this was a really crappy product generated label with confidence score,0,38,55 python passing a number as a parameter to filename for example i have two files txt first file has lines second file has lines is there any easy way to pass a number as a parameter to the result currently in result i get but i would like to have as a result code anyone can help me,shamir s secret sharing doesn t work with large ints i am to use a python example of shamir s secret sharing from wikipedia when i give it number a larger than it gives completely different output why doesn t it work after that number and is there a way to get around this,0,61,51 how can i efficiently decode vectors to numpy operations i am trying to generate an encoding that maps vectors to operations between numpy arrays and do so efficiently for example if i have two operations np add np foo and i encode np add as and np foo as what is the fastest way to go from a vector np array to np add essentially a more efficient way to do,python distutils keyerror i had a working code of disutils in setup py file like the following but today i got the following error while trying to run ci in github action i have not got enough resource to figure out the solution yes distutils is deprecated but as the code was working until today morning can anyone please point me to the right fix,0,68,64 how to check if xgboost uses the gpu i m writing a pytest file to check if my machine learning libraries use the gpu for tensorflow i can check this with tf config list physical devices for xgboost i ve so far checked it by looking at gpu utilization nvdidia smi while running my software but how can i check this in a simple test something similar to the test i have for tensorflow would do,how come this sum syntax right in python i found this simple code snippet from somewhere but i don t understand how come this sum syntax works for in is nothing but the looping five times so the code snippet loops five times and add for each loop so becomes i guess i m not sure about while looping five times in for in what s happening then with according to the syntax of sum iterable start the first argument should be iterable but is int how come this works based on the sum syntax how this code internally works i m confused,0,69,106 python round to remove trailing zeros the code below is used to find the x using gradient descent and the problem here is that the final result of req is and when i round it it results in how can i round to get or instead without using any other module,apache kafka setup consumer error json decoder error extra data line column char the consumer bin kafka console consumer sh bootstrap server kafka topic my topic works and i can see the logs as t z ts uid ciaup fxwzqyssoh id orig h fe f eff fef a id orig p id resp h ff fb id resp p proto udp service dns duration orig bytes resp bytes conn state s missed bytes history d orig pkts orig ip bytes resp pkts resp ip bytes however with the consumer code listed below i am getting json decoder error extra data line column char which seems to be an easy error related to parsing the data which has each log starting with the date time as shown above meaning the consumer gets the first log but cannot parse it easy enough yet it seems i cannot get around it as this is part of the kafkaconsumer object if anyone can give a hint or show how to do it it would be great thanks and regards m,0,55,126 append string to empty pandas column in a for loop the code uses an ocr to read text from urls in the list url list i am trying to append the output in the form of a string txt into an empty pandas column url text however the code does not append anything to the column url text when,how to check exception cause using pytest raises i d like to test that an exception is raised from another exception type i m surprised not to see a way to inspect the exception chain in the pytest raises docs is there a clean way to do this using ptyest raises,0,56,50 replacing all but one type of character in a string python the desired output of this code would have been l ll but it was l ll an l ll an lilli n lillia sorry about this i m not the best at code but i d appreciate a solution thanks,what does a mean in python array what is the meaning of in a python array the code below is what it was written like please help me,0,43,31 replacing all but one type of character in a string python the desired output of this code would have been l ll but it was l ll an l ll an lilli n lillia sorry about this i m not the best at code but i d appreciate a solution thanks,subtract one column by itself based on a condition set by another column i have the following data frame where time stamp is already sorted in the ascending order i want to create a new column in the above data frame that shows the time difference between each row s time stamp value and the first time stamp value above that row where indicator is not nan immediately above row where indicator is not nan below is how the output should look like time diff is a timedelta value but i ll just show subtraction by indices to better illustrate for example df time stamp df time stamp we can use a for loop that keeps track of the last nan entry but i m looking for a solution that does not use a for loop,0,43,133 how do i make this piece of python code work i am making a project on replit that makes money not in real life i want the wheat seads melon seeds pumpkin seeds wheat melon pumpkin to be available in and out of functions and be changed in different functions i tried to put these variables in and out of the farm command to remove the syntax error but it doesn t work if you can also improve this piece of code,iterating through tree datastructure using treelib python i created some nodes by a node class and added them to a tree using treelib by calling tree show i got a great overview of the tree now i want to iterate through the tree and get the data of each node defined earlier not only a single property by tree show data property do you got any ideas of how to work with the defined data my final goal is to calculate the tree structure like a decision tree and i dont find a good way using treelib so far,0,77,94 how to send a message in an async def on raw reaction add discord py i want to send a message in the discord channel but i am not able to in an async def on raw reaction add does anyone know how to,have text appear under picture in smaller mobile view i have a site that works great on the desktop mode but when i shrink the page the font stays over the picture and makes it so i cant see the picture and words how would i adjust the html or css or both to make it so that the font goes below the picture when the site is viewed on a smaller device here s my html and css code here s the css,0,37,82 append string to empty pandas column in a for loop the code uses an ocr to read text from urls in the list url list i am trying to append the output in the form of a string txt into an empty pandas column url text however the code does not append anything to the column url text when,https data over socket using https proxy i am looking to send https data over https proxy connected via sockets i can send data over port in the connect through the proxy fine however when i send data over port in the connect i usually get http errors heres an example i fixed this by adding host in the headers rather than host however now i receive no matter what i do i can t seem to get the server to respond correctly am i missing a header i was reading some other stackoverflow posts and some people mention that i need to double wrap the socket however i am not too sure where to start any information would be delightful i appreciate your help thank you,0,56,130 plot confidence interval of a duration series i measured the duration of requests i got now an array of elements each element represents the duration of a connection request in milliseconds i want to plot the confidence interval in python and in a clearly arranged manner do you have any idea how i should plot them,how to find the reverse of power mod a b c when using power mod a b c we get a b c returning x i have a c and x but am having a difficult time reversing the c is there a function that already exists to reverse this or would i need to implement euclidean algorithm to find what b is and return that,0,59,57 how do you add more than one command how do you add more than one command function to python py this is my code,not able to select any of the options from select using selenium and python according to this tutorial i should use this but i get this error i think its not working since the elements show up after the usr clicks the box but i have no idea how to get around that to select the element with selenium ultimately i am trying to target this box i don t know if its because of the old selenium syntax getting deprecated or not any help would be greatly appreciated,0,23,87 viewing the source code behind python modules such as pandas and random i would like to see how to view the code behind these modules such as how randint from random works etc for example,how do i restart the function i m trying to print random integers each time the button is clicked and the function is executed however i only get the same result unless i restart the program here s my code so how do i do this,0,35,44 docplex error model has non convex objective i would like to solve a mix integer nonlinear programming problem in phyton i use the codes you see in below i m taking this error error model has non convex objective x distanceofclusters how can i fix this my model is using quadratic programming as i see if the problem is caused by this how can i changed my optimization model s method,no module named rest framework on pythonanywhere com i m trying to host my django app on i m am getting the following error i tried but its is still showing error i also tried pip freeze and found djangorestframework in the list also works fine i ran my project locally and also it in a new virtual env it worked fine installed same requirements txt on pythonanywhere but still the same error this is bugging me for a long time please help here is my error log file,0,69,86 function within function to change a variable value why doesn t the variable url change test and yes it needs to be a function within a function that way the rest of my code is more simple thanks for your help,grc throttle block inclusion causes error the top embedded python block in this grc application is the stock block the bottom one is a lpf the code for which is below without the throttle block the application works with the throttle block the error gr log error thread body wrapper error thread thread per block block embedded python block valueerror could not broadcast input array from shape into shape is generated there is no such problem when the throttle block is in the path of the stock block i learning grc and would like to understand why the introduction of the throttle block is causing the problem,0,40,105 groupby and get the values in one dataframe i have a dataframe which i need to do groupby by multiple columns and get the items within every group as a row i need to output a below table after group i have been looking for the answer but i was not able to find any i appreciate if you can help we with the code,calculating hamming distance in a given year i have a following dataframe i would like to calculate pairwise hamming distance for each pair in a given year and save it into a new dataframe example note i made up the numbers for the hamming distance and i don t actually need to pair column i tried something like,0,65,57 how to pcolormesh rgba array with d x and y i have a rgba array img with d x and y like this according to this question we can pass any array to plot and set the color using img however it just changed the edgecolors i want to show it like axs imshow img,how to solve this error install cryptography for dirsearch tool i don t know why this error i want to solve this error so that i can run the dirsearch tool properly note pip install cryptography not helpful click to see screenshot,0,53,41 how to fill matplotlib polygon regardless of point order i am trying to make the area shown below all green so far i use this but not the whole four sided figure is coloured it would be possible to fix the rotation of x and y in this specific example but in other times it would not work is there a way to fill everything between the area between given points regardless of any order of the points,can i run unittest pytest with python optimization on i just added a few assert statements to the constructor of a class this has had the immediate effect of making about tests fail rather than fiddle with those tests i d just like pytest to run the application code not the test code obviously with python s optimization switched on o switch which means the asserts are all ignored but looking at the docs and searching i can t find a way to do this i m slightly wondering whether this might be bad practice as arguably the time to see whether asserts fail may be during testing on the other hand another thought is that you might have certain tests integration tests etc which should be run without optimisation so that the asserts take effect and other tests where you are being less scrupulous about the objects you are creating where it might be justifiable to ignore the asserts asserts obviously qualify as part of testing i d like to add more to some of my constructors and other methods typically to check parameters but without making hundreds of tests fail or have to become much more complicated,0,76,196 nameerror for pyspark model in this code i am getting nameerror name agg is not defined,building a simple to do list app i would like to save the lists to a specific directory why won t these save to these specified file location this is a simple to do list application i would like to save lists entered by the user to a directory how do i save the files to a specified location the code below creates a file but does not save it to the directory function newlist,0,16,75 scrapy image pipeline object has no attribute spiderinfo error i just met an issue with scrupy image pipeline the background is i just want to download some pics for testing purpose with scrupy image pipeline but after the code composed i met an error when i run the script error message command to run the script scrapy crawl picspider scrupy version scrapy here s the code below,dealing a multidimensional array and trying to concatenate as desired efficiently what we have what we want code to perform task as required note the solution is correct and gets the output as desired but is there any other way to do it which is more efficient faster question i am performing a machine learning task and training a model needs to go through these loops a lot many times making the training process very slow is there any way we can have a more efficient solution to this problem,0,67,90 read the elements of a text in python i have a text file like this there is no separation mark when i use these lines of code it returns nothing how can i save its elements in a python list or array,sampling from static data set to create dataframe ignore index in python i am trying to create some random samples of a given size from a static dataframe the goal is to create multiple columns for each sample and each sample drawn is the same size i m expecting to see multiple columns of the same length i e sample size in the fully sampled dataframe but maybe append isn t the right way to go here is the code the output of this is shown in the pic below the red line shows the index i want remove the desired output is shown below that how do i make this happen thanks,0,42,111 push rejected failed to compile python project django heroku it is my first deployment i am trying to push my django project into heroku but it is saying push rejected failed to compile python project i have tried changing the python lower versions but no luck any help would be much appreciated thanks here is my cmd output my pipfile py source url verify ssl true name pypi my pipfile lock my procfile,instead of printing each element in tuple python prints letters i try to create a validator by getting data from mysql after getting data from mysql i have a list containing tuples but when i tried to printing elements in tuples instead of printing elements from the tuple my code printed the letter of each of them here is my code here is the output i have account admin password and account admin password thank all of you so much edit when i use only for loop i get tuples,0,74,95 why can t i deploy the streamlit online i can run the code locally but it didn t work when i deployed it online i guess it was probably caused by reading the data file i m not sure where i should put the datasets csv for loading,how to get python to scrape web page generated by javascript files i have a website i want to automate some actions on but the page is generated by javascript files and is defined like this in the html runtime js is about lines and app js is about k lines i have no idea how to read the code as i don t know any javascript and my pyton knowledge is a mere atom more i d share the particular site but the page is behind a login so i ve managed to get to the page using different methods but can t find a way to press buttons within this next page generated by the js method requests beautifulsoup but got stuck on the js bit so switched to method method selenium chromedriver so i thought method would make things easier but pretty much stuck at the same point the page generated that i want contains buttons i d need to press in order to access downstream pages read a lot about accessing elements but can t see anything within this k worth of js jibberish where is a good place to start,0,44,198 helium s api selection list options not able to select learning helium for automation i could not able to select list options either using click or hover and click is it any solutions for an example in the page have an colors option and would be select silver or any other option i could not be selected,attributeerror for imported class with flask i am importing a class termindex the class works fine on its own but i am getting a attributeerror function object has no attribute search when i call the class s search function from within another function i ve tried throwing in global index at the start of the data function but that didn t help edit like so i get no error and like so i get no error which is why i ve tagged flask,0,59,79 printing youtube video title in selenium i m trying to print the title of a youtube video in selenium i tried it different ways and only one way worked so i just want to know why the other ways didn t work my first try this didn t work and the error is my second try this also didn t work and i got the same error,how should i parse this json from the api using python python returns json decoder jsondecodeerror expecting value line column char i am trying to parse json from this api but when i do it returns as json decoder jsondecodeerror expecting value line column char my code is here,0,64,52 trouble finding least common multiple of numbers i am currently trying to solve euler problem which wants to find the lcm of numbers the code above is brute force but for some reason it doesn t work can someone point me in the right direction,facing issue in passing metadata field with dataproccreateclusteroperator airflow i am facing some issues while installing packages in the dataproc cluster using dataproccreateclusteroperator i am trying to upgrade to airflow error message on further dig down came across a github link where this issue of valueerror metadata was invalid is discussed in community forum i followed the link and used cluster config way to generate the cluster config for dataproccreateclusteroperator but now running into another new issue as below i do not see much information around here is the code,0,47,92 pil image save convert does nt maintain rgb color i am trying to save a numpy array as rgb image using pil image save but it the saved image is not rgb how do i save the image as rgb i am receiving the image as numpy array the link to original image the link to image saved by image save,extract white regions from binary images i am trying to select only the eyes that were segmented from some face images here is one example of one binary image the problem is that i want to get each eye of the image putting them centered in a fixed size squared image in this case there will be two images with the eye centered on a fixed nxn squared image i tried to check the following post how to extract white region in an image but it seems to work only in one big part of a binary image how to do that in my case,0,56,105 access sharepoint via python using service principal the goal is to access files on sharepoint via python i registered an app in aad and granted the sharepoint sites readwrite all permission i tried using the following script to access the files on a specific sharepoint site i was not able to find out where i would have to set additional permissions to be able to access the requestes site anyone any suggestion,change the element in a list of lists differently alternating every nth time i have a list of lists containing information about days in a month e g i would like to iterate through the list of lists setting the element id to a for the first five then b for the second five and continuing that alternation for as long as the list of lists might be i am struggling to get the syntax right using a for loop,0,69,79 for loop in python why does this return not does anyone know why does this return and not but when i do not indent the return statement it gives me this is my code,svg commands to an array of points in python for plotting i have svg commands printed out in this style how do i convert this into an image and also be able to generate intermediate points an array of points so i can create a d plot in python thanks for helping,0,39,51 extract an element from the class with beautiful soup how would you extract the from data dat,python read datatype linestring from csv i am trying to read the linestring datatype into python from a csv file could someone help me parse it efficiently this is what i have so far i am trying to avoid using geopandas for now as my anaconda install is borked,0,17,49 fast way to generate large scale random ndarray i want to generate a random matrix of shape e but i find numpy random rand becomes very slow at this scale is there a quicker way,using numpy fromregex to read data from a file i need to read some data from several text files that have random number lines of text at the beginning typically the files look like file dat the lines containing the data could may have spaces tabs at the start of each line i have tried the following code but when i run it i get your help is very much appreciated,0,33,69 how to print all rows data from csv file with pandas in python i have a csv file which has rows i want to print them all with pandas module but it only printing rows how can i print all of them,integrityerror at authentication addprofilepic unique constraint failed authentication userprofile user id i am working with a blog project where i am trying to add profile picture of the user whenever i submit the picture it gives me unique constraint failed authentication userprofile user id views py models py forms py here comes profilepic html but the server shows me this unique constraint failed authentication userprofile user id where is the problem thanks in advance,0,43,59 i have a syntax error in python while trying to load the file here is the error i get,how can i add qradiobutton widget to qtableview in pyqt i am creating a tool that that will have a search option after searching i am creating a dataframe and displaying it in qtableview i need to show a radio button against each row in table view radio button will be the first column in table view i have found table view method setindexwidget but not sure how to implement it i have columns in tableview membernumber firstname lastname once i will select radio button against my st row and click on show data button it should show member number in msg box below is the code which i have written till now,0,19,114 how to fix exception has occurred sslerror httpsconnectionpool in vs code environment i try to use python requests library but i got this error i use psiphon vpn most of time in windows and got this below error after calling requests get api url,django says too many values to unpack expected i m using django in the upload book function i generate a digit code for each book and i identify and distinguish two books from one another by their code rather than their primary key however i get an error in the generate code function here is the generate code function with required imports i did the extra bit over there to prevent two books being of the same code however low the probability of that might be with possible combinations and here s my upload book function and my book model in models py the error is at this line of the upload book function which leads to this line in the generate code function here s the error with its traceback i don t know why this is happening in another question the accepted answer mentioned that this happens when split is used and that returns more than two elements i m joining the elements of the list which is generated by random choices string ascii letters string digits k max length into a string when i print join random choices string ascii letters string digits k max length in the python idle shell it returns a string all right so what s the issue here,0,43,192 how do i append an array a value of if it s a power of or otherwise in python given an array of integers determine whether each is a power of where powers of are how do i append an array a value of if it s a power of or otherwise,numpy pandas nested condition in two columns introduction i have a pandas dataframe columns df opendate high low open close volume is eligible in which problem statement i want to add one more column end date which will be calculated based on below if is eligible is true then its end time will be that closestopendate which row has high value that of the is eligible true example let say row no has is eligible true high low open close then we have to find out next immediate row which has the high value my approach i tried the following solution vectorised approach but not working,0,59,106 for loop is only storing the last value in colum i am trying to pull the week number given a date and then add that week number to the corresponding row in a pandas python dataframe when i run a for loop it is only storing the last calculated value instead of recording each value i ve tried append but haven t been able to get anything to work,loop through functions in a class in python i have the following simplified code i want to loop through every function in the class states of course will return name state is not defined but i hope it gives an idea what i try to achieve,0,66,46 how do i append an array a value of if it s a power of or otherwise in python given an array of integers determine whether each is a power of where powers of are how do i append an array a value of if it s a power of or otherwise,counting number of a value in a dictionary when values are a list of lists i have a dictionary where the values are a list of lists and i want to count the number of times a certain value shows up in the dictionary i ve tried something like this this but when i try that i get zero back,0,59,59 how to merge rows inside a dataframe in python i want to merge this dataframe so that the rows gets merged with the highest value from each of the columns and there are more similar inputs like this where each four of them has the same session name the output i want the blank space in row indicates empty string i don t know what code to write to get my desired output,jupyternotebook filenotfounderror winerror the system cannot find the path specified i ve created folder structures with code on my desktop and filled them with images using the cap cv videocapture with no problem to create folder structures and make directories i wrote this code and it works fine folderstructures on desktop but when i want to list images in a file i get this error error filenotfounderror winerror the system cannot find the path specified positive can you help me,0,75,77 how to schedule code to run at a specific time every day need help to run code that automatically starts at pm every day on python visual studio code i don t want to print anything i just want to execute my commands like pg keyup enter for example only works with printing text,is there any way to make this filter query smaller these are my tables this query seems very long to me i thought select related should help with this but it follows foreign keys and return all results not the result that is related to this instance of salary follow up on willem van onsem s answer i added a couple more rows to my tables and i m using this query in the save function and suddenly i m getting this error get returned more than one which is a popular error i made the query a tad smaller too i checked to see what sql query django is running behind the scenes and i found the culprit i think where blog salary id is null is the culprit and i don t understand why and i don t know how to fix this searched a lot and went through docs a lot as well,0,51,148 generate a specific designed pdf from basic html input i want to generate a pdf with a specific background from three simple input fields a title a message and a signature as shown in the picture below example of desired result i have some experience with creating web sites with python flask but i struggle with how to tackle this challenge,how to run my script that opens a web browser script from server i m automating a few things where i work regarding communication using whatsapp i have implemented a few scripts using python pywhatkit and mysqldb that acess my work s database and sends out a few text messages the thing is we currently have a local centos server up and running and i don t know how to make my script run on that like i was told that the server had no graphical interface and my script basically opens firefox and sends texts every once in a while how can i make this work from this server is there another alternative this will be used to send a couple of texts every day so it won t be cpu intensive best use scenario would be to run this script every day at a scheduled time and that s it,0,59,147 how can i find the last non empty column number of an excel file using openpyxl how can i find the last non empty column number of an excel file using openpyxl so if the last column with data is column n how do i get that letter and then convert it to a number,dataframe merge for on specific columns i have a basic question on dataframe merge after i merge two dataframe is there a way to pick only few columns in the result for example result pd merge left right on key key result is there a way i can chose only column c from right dataframe and a column from left dataframe for example i would like my result to be like,0,53,70 calculate average the letter length of a phrase with one function i did this programming to calculate the average letters of a phrase do you think this program is responsible for all texts and do you have a better offer thanks,click event not work in pyqt with qlabels i want to define a click event for this class but no error is given and the code does not work properly in this class i want to design a button that the user can click to call a function and perform a specific operation i want to run a method by clicking i am not fluent in english and i can not ask my question well thank you answer this question,0,41,80 how to remove backslash from decoded json string i have records that have a list of maps dict in which i have encoded data in it when we decode the data we get a json string with extra backslashes now i need to remove the backslashes from the json string json output rawdata after decoded data my python program but this is able to remove double backslashes and newline n but it leaves single backslashes output,how to load a dataframe in pyspark to snowflake i am trying to load a dataframe df into snowflake the table is created in snowflake and i am trying exactly what s written in the documentation i am doing the below where appropriate values were kept in the variables i got this error i added the snowflake spark connector and the snowflake jdbc connector to path in environment variables and used that while creating the spark session as well still the issue persists i tried multiple routes but no luck any lead will be appreciated,0,76,93 implementing introspection validation from okta using authlib in python flask app i am trying to implement introspection on client side suing okta as my authorization server but continuously getting error error missing authorization error description missing authorization in headers my implementation i have been trying to resolve this for a while but could not succeed,pandas read csv fails on na values from my point of view in the code below i explicit declared as a na value or missing for an int column while reading a csv file but i got the error message so it looks like that pandas recognize the as a na value but treat it like an error but it should just interpret it as a na value because i defined it that why why doesn t it a workaround could be to tread the columns all as strings and convert them after read csv but that is not the kind of solution i am looking here for i assume i missunderstand the options of read csv,0,53,111 implementing asyncio with pysimplegui i am trying to implement asyncio with pysimplegui in python in this gui example two buttons button and button emulate a long task to accomplish goal expected result current result i thought that i applied async wait according to the rules did i miss something,how to verify collision between two sprites in the same pygame sprite group i have been trying to create an enemy moving system for my top down pygame d game but my two enemies always end up by getting over one another this is why i decided to create a method that will stop the enemies from overlaping one and other but i don t know how to check for a collision between an enemy in the group and the rest of the group because when i do so the enemy is always thinking he has collided with another enemy but he just collided with himself is there an easy way to fix this see the comment in the code below for more explanation,0,48,121 facing issue with dataproccreateclusteroperator airflow i m trying to migrate from airflow to airflow which has a change of name for some operators which includes dataprocclustercreateoperator here is an extract of the code i am ruuning into below error on debugging i see this issue is due to the param metadata does anyone has idea what is wrong with this param or a way to fix it,filtering a list of nested dictionary i am receiving the following response in a list of nested dictionaries format however i don t need all of the records for a specific action for that i am trying to filter all records which note fields starts with the word ticket unfortunately i am running into the following error and i have no clue how to get around it attributeerror nonetype object has no attribute startswith,0,70,73 how do i convert this json to dataframe i have a json that i am struggling to convert into a python dataframe the json takes the following form ultimately i want to achieve the following table i have tried pd read json but i always get an error mixing dicts with non series may lead to ambiguous ordering,issue when trying to apply format to date column pandas i am trying to set date format to a pandas dataframe column however i get this error why i cannot format this date column to day month year format,0,55,37 how to fix connection refuse error using mail sent function in django hello i am new to django i am making a blog project i want to add sharing feature in my project via email i am facing an error called connection refuse error error look like that connectionrefusederror at url win error no connection could be made because the target machine actively refused it setting py where i defined my views function my views file look like that views py,dataiku job failed error in python process at line class nameerror i work on dataiku and i have a jupyter notebook which is work and now i want to include this on python recipe the objective is to write dataframe pandas in a dataset data f is the name of my dataframe and output gen python is the name of my dataset in dataiku i have this error job failed error in python process at line class nameerror name data df is not defined here is my code,0,79,89 how can i convert instance to dictionary with model method and relationship below is the implementation of model class customer i want to convert the django model class instance to a dictionary somewhat like thanks,get the value of a powershell variables to a python wxglade gui we have here a powershell script collenting some user and windows infos storing them to a txt file it would be nice if i could choose which information has to be collected with a wxglade gui i have already a solution how to execute powershell scripts the question is how i receive the values from the powershell variables to the python application we are interested in such powershell infos this is the tkinter code i use for testing purposes running powershell script from python i will upgrade it with some advanced wxglade widgets does it make sense to make it on this way or is it easier to collect all these infos with a native python code thank you for your support i edit i think this is a good solution to find e g office version description,0,36,146 integer solution constraint for scipy optimize differential evolution i am trying to use the scipy optimize differential evolution optimizer in my program but i need the solution to be of only integers right now the solution the attribute x of scipy optimize optimizeresult always looks something like this but i need all the elements in the solution to be integers e g is there any way to enforce this or is there any other better suited package i could use for this,find cosine similarity between two columns of type array double in pyspark i am trying to find the cosine similarity between two columns of type array in a pyspark dataframe and add the cosine similarity as a third column as shown below the current implementation i have is but i guess the above code only for works for columns with integer values is there anyway i would be able to extend the above function to achieve a similar behavior for array columns,0,72,81 string with backslashes to dictionary i have the following string when i print it i see the below output in my console i want to make a dictionary of the string by using ast literal eval this yields the following error valueerror malformed node or string ast name object at x fb b ab fa please explain what s going wrong how can i make a dictionary from the string thanks,rsync how to copy files from source to destination in loop sequentially linux i have been using rsync and it is working fine but we keep deleting files in the destination folder and rsync keeps syncing files from the source folder what s the solution for this i need to delete files from the destination and rsync should not keep syncs files again from source how to solve this problem for handle this programmatically using python,0,62,76 value error when calculating standard deviation on dataframe i need the standard deviation of column distance for each row in my dataframe dataframe df stats trying to do it this way but i get this error why is it not working,can someone explain to me how to resolve the argument error below with the use of my code the error here is on positional argument error where the code can not execute because of the position argument error on this line of code customer cars customer requestcar i got an error of typeerror rentcaronhourlybasis missing required positional argument n which i am not sure if it has been resolved i need an explicit explanation on how to resolve all the errors listed above the error my code,0,40,88 find all possible paths using networkx how can i find all possible path between two nodes in a graph using networks this is the result but i want all possible path so for e g start b a c a end,how do i update powerpoint with my dataframe would really love to get some help here i have the below data i wish to update my slides with this slide contains data for country in industry and another part of the slide includes a chart to include the values for data x y and z instead of looping as follows for country industry x y z in df country name industry group name x y z values tolist is there a way to capture all the individual row data in a list to update without having to mention each column names for eg x y z hope this isnt too confusing,0,35,103 tkinter nameerror when getting input from entry so the issue is when i click the calc button which calls the calculate tip method i get a nameerror saying subtotal entry is not defined i have tried a bunch of different things to get this working but nothing has worked so far i am trying to get the users input from the entry i created called subtotal entry here is my code,python converting binary data to bit floating point error unpack requires a buffer of bytes i am trying to convert a binary file with the hex representation d this has a bit floating point value big endian of however when i try to unpack the structure using i get the following error,0,67,54 convert json dict and list i have pulled json data from a url the result is a dictionary how can i transform this dictionary to a dataframe so adractcnt and adrbal in kcnt are columns and the time is the index for each value thanks in advance,calculating standard error does not give expected result i want calculate standard error of vector and i don t understand why it doesn t work let s consider vector calculating standard error of mean is just to calculate standard deviation and divide it by square root of length of vector however when i calculate this by function i obtain completely something different could you please explain to me why i don t unsterstand why this difference occurs,0,45,73 python pandas add tuple list to cell i m struggling with setting a cell value to a tuple or list with pandas using replace here is my dictionary here is my dataframe and here is my attempt to add a new column color with each tuple above the output i d like is,i have a syntax error in python while trying to load the file here is the error i get,0,50,19 how to remove specific strings from a list in pyspark dataframe column i have the below python list lst name age country spark dataframe is below i have to compare the list with spark dataframe string column and remove the values from list from the column expected output is,add data to request in the route handler using python quart we are working on developing an api using python quart we have multiple routes set up and a global error handling method we need a way to tag each request by adding a random hash to the request object so it can be accessed anywhere by tapping into the request object for instance the error handler should be able to access the random hash that s tagged with each request what is the cleanest way to achieve this using the quart api framework we wish to achieve this without any unexpected side effects,0,46,102 telebot how to take a massage in input here i don t know how to take a message in input here,array resetting back to empty python for some reason when i run this code the data array always has something in it even the line before if data index numbercheck but for some reason on the exact line it says list index out of range and the vs code debugger shows that the array data is empty i am unsure of why this is happening appreciate any help,0,20,65 how to implement kmeans clustering as a feature for classification techniques in svm ive already created a clustering and saved the model but im confused what should i do with this model and how to use it as a feature for classification this clustering is based on the coordinate of a crime place after the data has been clustered i want to use the clustered model as features in svm,python web scraping how to combine selenium and pandas for gathering data on html i am gathering sports fixtures and results on the webpage first of all i am going to use pandas to scrape however there is an option for selecting timezone on the page so i add slenium for the auto choosing timezone therefore i do not know how to scrape with pandas after i use slenium would everybody please do me a favour thank you very much here is my work,0,70,83 what s the difference between priority queue heap and sorting queue reconstruction by height the best answer to the above problem is this the above method is a priority queue method on the other hand the method using sorting is this big o is similar but i don t know why we should use a more complex priority queue what are the advantages of priority queue over sorting,how can i plot d list onto existing plot without knowing x locations i am plotting a graph with datetime and power which can be seen in the big blue line on the attached image after plotting the image i am trying to insert the d list only unusual in the same plot actually df power includes the values of the d list only unusual but without including y axis alongside with only unusual i can t plot the graph how can i plot the only unusual list in the same plot so that it will be visible on the main blue line with a different color my code my data,0,65,105 sqlite return true if duplicate values are found in table i want to know how you can find duplicate values in a table and make it return true i have seen alot of questions about this but none of them helped thanks here s my example to those wondering no this will not be used in a production environment it is unsafe and can be easily exploited haven t even salted the hashes,is cssselector the only way i can use for shadowroot selenium common exceptions invalidargumentexception message invalid argument invalid locator is css selector the only way i can use to find element inside a shadowroot element i am using python selenium chrome below is my code and the error i got as below if i don t use by css selector,0,73,55 list divide based on element from another list i have two lists as follows so basically i want to break list a into smaller chunks based on start stop values from list b e g something like this can someone please help me figure this out,filenotfounderror errno no such file or directory after copying pathname i copy pasted the pathname from the folder i want to extract images from this same exact code was working before but now i get the error message i held down the option key whilst in the folder and clicked copypathname on mac so it cannot possibly be a non existent path folder,0,45,61 timestamp binning mechanics when resampling i m not quite clear on how bin membership in dataframe resample is determined example actual output expected output reasoning i expected pandas to create the two bins and the timestamp to fall into the first bin while and the remaining timestamps should fall into the second bin edit i just realized that using hours instead of days yields the expected result why i m using pandas,discod py json user not defined issue i would like to make a bot with bank accounts but it says that user is not defined i watched a lot of tutorials and searched around but i could not find a solution o i am new and really not good at python i would appreciate every help,0,74,56 when i am fetching the data of students by city in tkinter it s only show last value as i mention i want to print data of student who s belong from city but in label it only shows one data and terminal shows all the data i am using for loop to print data here is text file expected outcome if selected surat then,month format in humanfriendly i m making a discord bot and for my tempmute command i ll use the new timeout feature since the time of the tempmute is variable i use the library humanfrinedly to convert it the usage of the library is s for seconds m for minutes h for hours d for days y for years what is the one for months i ve tried with uppercase m but it takes as minutes,0,63,73 how can i break line in this type of string here is the code of python i am trying to return the p variable to web page but on web page whole string is showing in one line here is the html code,using class variable for type hinting in init in python i have a list of allowed types in my class and in the constructor i would like to pass an argument that has to be in that list of allowed types so conceptually this is what i would like i m not sure how to tackle this how would you set something like this up maybe there s a better set up for this but i m not sure how thanks,0,43,77 why does my class schema looks broken in fastapi and swagger i have fastapi application using python i have the following module and my endpoint looks like when i look at my schema in the docs page the schema looks broken what am i doing incorrectly,regex expression to split sql create statements i have a schema file with all the create statements of my database and i d like to split them to get each individual statement i could work by splitting the text on when all i had were create table statements but now that i also have create trigger with begin and end commands which also get a semicolon i d need a more intelligent way to extract the full statements since each statement begins with create and ends with n before the following create i though i could compile create ncreate using the dotall flag so the newlines are considered by the dot but python s re findall only returns a single extraction containing everything but the last statement i though it could be something relating to the subgroup but create n returns only empty strings and create n will return the whole original text i could use python to simply prepend the create sequences with something else and split but that seems rather primitive i m sure this is simple as hell in regex but i can t wrap my head around it can someone lend me a hand,0,47,190 how to retrieve data from mysql database in django and display it in html page i am trying to retrieve data from mysql database and display it in a html page using python here is my view py models py html but i didnot retrieve anything any help will be highly appreciated,how to prefill input box with future date in django template i am trying to prefill an input field with a future date in a django template how could i set it so object table expiration date default is prefilled with datetime now plus days,0,50,41 python combinactions via list comprehension with variable input array let s say i have a list array abc def ghi and i want to compute all the different combinations i e comb adg adh adi bdg without using itertools combinations this is possible e g via result x y z for x in pos for y in pos for z in pos how to rewrite the list comprehension with variable length array list e g result a b c for a in pos for for z in pos,how can i iterate through a list of images and display them in tkinter so my goal is to create a sort of slideshow within tkinter i have a list of images like images png png i want to be able to iterate through the list and display each image in a tkinter window the concept is simple and as follows i have managed to iterate the images using a button press however i do not want to have to click a button as it is meant to imitate a slideshow i also attempted looping a function but the time sleep function does not delay in the correct way because of how tkinter behaves i managed to achieve the above using mostly source code from here and i would appreciate a little hand achieving the above my code i also attempted to use after however it did not display each image it skipped from the first image to the last straight away with the compounded delay,0,74,167 avoid type casting when selecting a row i ve got a dataframe with enforced data types which are quite important to my application correctly yields however when i pick one row using iloc pandas suddently casts everything into float presumably because it turns it into a series which wants a data type yields that causes downstream problems as i need the data in the correct types how can i pull out a single row while maintaining the correct types,extracting deleting rows from time series without using index information i have a simple problem i want to get a subset of time series with a certain condition that is not dependent on time index i have a very huge dataset i am just giving a small example to make my problem understandable i want a dataset that should not contain row num and output should be but my problem is when i try to drop it always drops by index and delete all index of and i can not manually extract such a subset because data size is very huge and there are so many duplicate indices how to solve this problem,0,79,115 python gtk new tab i m just playing with gtk currently but was wondering if someone has an example code of a window that has a notebook in it and with a click of a button or event it opens a new tab with a gtk for example entry in it and is accessible from further code i can t find any working code like that on the web or on this website,python requests response forbidden so i am trying to scrape this website i was able to scrape data from it without any problems but today it gives me response i tried using proxies passing more information to headers but unfortunately nothing seems to work i could not find any solution on the internet i tried different methods the code that worked before without any problems,0,71,68 iterate over files in databricks repos i would like to iterate over some files in a folder that has its path in databricks repos how would one do this i don t seem to be able to access the files in repos i have added a picture that shows what folders i would like to access the dbrks sql folders thanks image of the repo folder hierarchy,statsmodels api tsa seasonal decompose plot figsize i am using statsmodels api tsa seasonal decompose to do some seasonal analysis of a time series i set it up using and then try and visualise it using the output was tiny so i tried to use the standard matplotlib command of however this got the warning the documentation says that a matplotlib figure figure is returned from decomposeresult plot so i am unsure as to why this error is happening my version of statsmodels is and i am aware that the documentation is for but conda says that that version does not exist and that i cannot update to it any thoughts would be appreciated,0,68,105 why i need to add a square bracket when i pass an instance as a parameter to class below is my code when i try to run the program with below code the error will pop up the error i receive is typeerror argument of type employee is not iterable however when i put the square bracket around frank the error is gone can you help me to understand the reason,type hinting for class defined in a function we are adding type hints to our code base and there s one specific case where i don t know how to do proper type hinting we have a function that will create an instance of a specific class if it didn t yet exist the class of which it creates an object is defined in the function itself to make it a singleton an example of such a function is given in the following piece of code i was now wondering how we can add a type hint for the return type of the get greeter function can i just use get greeter greeter or should i do something different note that there are indeed cleaner ways to define singletons since python but refactoring that is something on the backlog,0,71,136 how to get the length of a value from user input i m working on an assignment my input is supposed to be a name it could be anything the output is supposed to be the length of the name e g currently i have but the second half isn t correct,how can i convert this multiple json files into one csv file hey i have a dataset with multiple json files and i want to convert them into one csv file to do some preprocessing and than put the csv into an database but i have some problems to convert the the json structure the json files have the following pattern i tried this code in python but i keep getting this error typeerror list indices must be integers or slices not str any help is very appreciated thanks,0,49,89 how to use numpy vstack to append row to empty array i want to append some rows of ndarray as values of dictionary however i receive an error for unequal dimensions using np vstack please guide me in this regard desired output dic below is the code i tried error,what is this scrapy error reactornotrestartable i do not understand why my spider wont run i tested the css selector separately so i do not think it is the parsing method traceback message reactornotrestartable,0,53,34 convert pandas core series series data from nan to none django i have a pandas core series series class when the field is empty i get nan as a value and like that it stores in database i want to convert that empty value to none so i can manipulate with none value what i tried is here but this isn t working can someone help me please,trying to do telemetrics on openstack using ceilometer in python as a project i need to do some telemetrics with ceilometer on openstack i was given an old piece of code as a reference how the newer version should look like using what little knowledge of python and openstack i have and spending hours on openstack documentation i wrote the following code for some reason when i try to run this code my virtual machine running it says that projects is an unknown attribute what is a newer way of showing all projects in openstack is there anything else wrong with the code,0,61,103 python inspect member variable comments how do i inspect the comments of a python instance variable i ve tried any thoughts,replace child attribute to parent attibute i am able to create xml with duplicate key and follow suggested answer python dicttoxml same key multiple times but it hit badly performance issue when i user custom class fore more than million record i have tried to update node class above but did not get efficient time improvement later i move to follow link which suggest to use default which is really faster and data process in less than min why is dictionary lookup in python always slower when using user defined objects as keys but i am looking xml following way is there anyway to get following xml node class dict,0,20,111 python printing longest length of string in a list my question is to write a function which returns the longest string and ignores any non strings and if there are no strings in the input list then it should return none my answer i m a beginner so i have no idea where to start apologies if this is quite simple,wondering about pixel perfect mousepointer collision in the case of a button i ve got a pretty simple code up right now that just moves between two menu screens once the button for each is pressed i know that you can mask images in pygame to get pixel perfect collision but not sure how i d go about doing it for the buttons in this code it s just pretty annoying that you can click slightly off and have it still transfer you to the other menu a follow up question i had was on how i could do fade transitions between the screens i ve seen some tutorials but they ve all seemed overcomplicated,0,59,110 empty requests in seleniumwire python i m using selenium wire to scrape requests headers in ubuntu and using firefox driver but driver requests is empty what s the problem with me and result is is there something wrong with ubuntu settings or firefox settings or my code,method object is not subscriptable i don t know which is wrong can someone help me where i got it wrong,0,44,20 set the range for colorbar of a d surface plot created using plotly how to manually set the range of the colorbar of d surface plot created using plotly,need to issue card for the bank account using random and datetime module in python i am working on a project where i have to issue card to each and every account that has been created below are the methods that i have to create within the class to have the card issued and with an expiry date as mentioned in the below criteria we are not allowed to import anything beyond random or datetime method we can use loops for same cardnumber the card number which should be a string containing a digit number should be importing and use the random module for this cardexperience a tuple where the first element is an integer corresponding to the month and the second element is digit year eg represents march should be importing and use the datetime module for this issuenewcard self creates a new card number with the expiry date being years to the month from now e g if today is then the expiry date would be,0,29,174 we have findbys and findall in selenium java how to use same code to find locators in python we have findbys and findall in selenium java how to use same code to find locators in python please guide me someone,appending one list to another in recursion so the question was to find all paths from source to target the only change in the above two code snippets is line i ve added the print statement in line to show what validpath is holding my question is why appending just validpath results in a different output than when i append validpath copy in line,0,40,66 how to create an animated line plot with ploty express i m trying to create an animated line plot to illustrate the price increase of different asset classes over time year but it doesn t work and i don t know why what i ve done so far output,how to do a d circle in matplotlib around a rotation axis i m trying to plot circles using matplotlib that were i can give a rotation axis i already found this post here on stack overflow where someone provided a code for rotating tangential to the z axes how can i move this to rotate around the origin at the moment my code is looking like this by calling circ d z i get this picture can someone help me to understand where the shift is coming from and how to avoid it i updated the code and get now the following so the remaining question is given a circle in the x y plane degree how can i tilt the next circle over degree x y plane to z axes such that the center of the circle is still and it does not evolve to an ellipse thanks in advance,0,46,149 python pandas how do i subset time intervals into smaller ones let s imagine i have a timeseries dataframe of temperature sensor data that goes by min intervals how do i basically subset each min interval into smaller min intervals while accounting for the difference of temperature drops between each interval i imagine that doing something like this could work min intervals min intervals,function binding in python i m trying to understand and keep track of all the changes in the binding of functions but cannot seem to grasp why the y parameter in the lambda function gets binded to h on being called the transition from step in this python tutor link to be precise,0,68,53 i want to find the difference between two fraction numbers i want to find the difference between two fraction numbers i created a port of code but somehow it doesn t give right output and i don t know where is the problem,forbidden error code missing access discord py i m getting this error whenever i try to run my program i tried giving it all the permissions possible except admin but it still doesn t run it only runs when i give it admin permission the error occurs on on ready event here is my code here is the error edit all these permissions are given already,0,41,64 image not moving pygame when i try to fire my knife in my game it doesn t work i am not very experienced in pygame this is my first game that i m making it worked the first time but now i try to call a new knife in a function and it doesn t work i have tried a lot but it won t work here s my is my code,extract email and phone numbers from website using python and scrapy i have a list of thousands of websites and i would like to extract phone numbers and emails if available possibly using python scrapy i found this one but it looks like the package is not available anymore any suggestions thanks,0,67,54 how to create a comparision matrix using python i have list in python how can i generate a matrix by subtracting the list element by each othe and create a comaprision matrix and save it into csv,retrieve indices of certain value in a matrix and put it in a nested list i have this matrix let s say there are hundreds of x value and thousands of y lists inside this matrix how will i be able to retrieve the index of value and put it in a nested list here is the sample output,0,37,60 how to write a text parser logic which identifies keywords from a dictionary how to make a simple text parser that finds keywords and categorizes them accordingly example i have two dictionaries now i want to pick out if the keywords from a are present in b and the result should be something like this i m a beginner and the logic to get this is very confusing,selenium how to find a div that hiding in a i want to use selenium to find a div my code is but i got the error what should i do to find this div,0,67,36 python how to link a filename to a memory file the memory file will be an input of another program not python so a file name is needed,convert multiindex to datetimeindex in grouped dataframe i have a pandas dataframegroupby df groups that i have created by grouping another dataframe df pub containing a list of publications by their day month year index i then want to check how many unique publications exist in each group so i use this is a pandas series with a mutiindex that looks like the following i would like to convert this multiindex into a datetimeindex so that it would look like is there a simple way to do it so far i ve tried several approaches but nothing has worked for example if i do pd to datetime n unique pub index i have an error typeerror class tuple is not convertible to datetime,0,28,112 issue with pip instalation of pyqt i m trying to install pyqt using pip i did it but in code it still doesn t recognise pyqt it is the ouput of terminal but the error still exist import pyqt cannot be resolved,how to slice an image with different dimensions in python i have a x image and i want to slice it with boxes which are different sizes and will be selected randomly for example pieces x pieces x etc box positions is not important and i want to use every pixel only one time below is my code but when i run it a lot of pictures are created and same regions are being used how can i make that each pixel will be used only time below picture represents which i want that is what i want,0,39,101 converting a list of strings to dictionary i got the following list i need to convert it to a dictionary like i have tried ast library and json loads but in vain,average of one wrt another or averageifs in python i have a pandas df as displayed i would like to calculate avg rate by dc by brand column which is a similar to averageif in excel i have tried methods like groupby mean but that does not give correct results,0,30,50 method object is not subscriptable i don t know which is wrong can someone help me where i got it wrong,finding the row of a pandas dataframe when searching with a variable in a column problem i have a csv file that i imported to pandas df lets say it is something like this when i use foo to search there is no problem and the statement below works as expected but when i use a variable x i e instead of foo to search in the column a it doesn t return anything how can i solve this problem thanks a lot for your help,0,20,84 python change time format i m trying to change the time format of my data that s now in form of or hh mm ss msmsmsms to seconds i browsed through some of the pandas documentation but can t seem to find this format anywhere would it be possible to simply calculate the seconds from that time format row by row,read newline enter key in python i want to write a code to read a input from user that include newline enter key something like and when i press enter do something for example how can i do it,0,56,39 how can i random choice a question without the answer for a discord robot quiz game i just started learning how to code in python and i was wondering how can i randomly ask questions for a quiz without the answer that follows for example i d want the robot to ask what s the capital of france but without it saying paris questions what s the capital of france paris who painted the mona lisa da vinci ty,append from a string list until a semi colon in python how do i append from multiple string lists i don t know what are but i ll need to separate into new different lists using the semi colon as a separator in python for example if i m given the following string list i need to get the following results and append with the same logic and order when given a new string p s since there are no patterns in the list i ll be given i can t just use for the task which is what i ve tried,0,79,94 how would i find the current decibel level and set it as a variable i m looking to find the current decibel level in a room using a microphone and setting it as a variable i haven t been able to find any python code on this so i m very stuck it would be good if the variable could refresh every of a second but it doesn t have to thanks for your help,microsoft graph delete access package assignment i m using microsoft graph api beta version to delete an access package however for deleting an access package i need first to remove all its assignments for doing this i found on the official doc the accesspackageassignment object when i perform a get request on the assignment the response is successful odata context accesspackageid xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx assignmentpolicyid xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx assignmentstate delivered assignmentstatus delivered catalogid xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx expireddatetime none id ad eb baa b a bfef d aef isextended false schedule expiration duration none enddatetime t z type afterdatetime recurrence none startdatetime t z targetid xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx however when i perform a delete request i get the following error error code innererror client request id xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx date t request id xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx message no http resource was found that matches the request uri i suppose this error is due to fact that in doc no delete method is mentioned for the accesspackageassignment object so how can i delete an access package assignment via microsoft graph,0,72,158 recursively add nested dictionary json to tkinter s treeview i would like to recursively add nested dictionary data made of dom nodes into tkinter s treeview items i was expecting to have a tree structure like unfortunately i noticed quite repeated fields here is the following code i was expecting to have a single html root with corresponding added children unfortunately this is the result below how can i readjust my code to have a perfect tree,how to get last wednesday for current month in python my code as follows my current output as follows in the above case i am getting previous month last wednesday but i need current month last wednesday my expected output is as follows,0,76,43 what is the usual approach for things like this python multithreading i have the following code do task is basically a method which process some i o operations and i want to to execute it in parallel for each obj in self objs list i want self do final task to be executed only once all the threads finished their job my code works however it is very ugly and immature it seems is there a more elegant way of doing so,detailview in django keyword slug i recently started learning django i want to display one news item but when i open on the link i get an error message views py urls py models py what am i doing wrong,0,75,37 creating website with button that executes python script my python program uses an input variable a number each day preferably i want to create a simple website with only input field number and a button which then executes the python script is there any easy way to do so i don t have any experience with making websites,keras lstm dimension value errors i have a problem about dimensions of lstm i have a matrix as input i want to get an output matrix sized but i got this error what is the problem or how can i solve it i tried also different input shapes but i couldn t solve this problem,0,59,59 affect value to dataframe respecting conditions i have two dataframes df and df df have columns id date val val date and df contains columns id date date i want to affect date of df to date of df and date of df to date of df for all the rows of df content of df df the result should be,unable to run vscode s debugger with dockerized django project every time when i run a debugger there happen many things but not what i expect i m running a project with docker compose up checking the localhost if backend backend is okay it s down what s funny the container is running because i m attached to this with vscode s remote containers the debugpy library is installed the first approach to run a debugger end with such info in debug console and it s down backend is also down second try and it s down but backend is up i m able to login etc the third try ends with such an error connect econnrefused any tips code manage py the local docker compose yml and the launch json,0,63,119 this error where add frappe erpnext new site,docplex error docplex mp utils docplexlimitsexceeded promotional version problem size limits vars consts exceeded i want to use docplex module in python and i have installed cplex version and installed python when i tried to run the code i got the error docplex mp utils docplexlimitsexceeded promotional version problem size limits vars consts exceeded cplex code how do i solve this problem thanks,0,7,64 unsingning a signed value django rest i am using web personal sign nonce web eth coinbase callback to sign nonce at the front end but i am trying to build the backend in django rest using this to unsign the signed nonce but getting an error error does anyone have any ideas about how to unsign this nonce,creating class object inside same class in python i m trying to create a class object inside the class itself something like this this works and runs correctly but if i use inheritance to create another class as a daughter of this one e g car motor the car function doesn t work properly because it s creating an object of type motor not car is there any other way i could do this thanks,0,53,69 python exponentiaiton with def and for loop input expected output result with my code code i m trying to find the square root of the numbers in a list without pow and functions i ve found the square root of each number but i m wondering how to put them in a list,python selenium can t find element by xpath within shadow root open using selenium and python i was browsing on this website i tried to click the button alle bestatigen with the following script but that didn t work and it received the error how can i solve that problem so it finds the element,0,50,53 pandas vectorization speed up dataframe function i have this python code of the supertrend implementation i am using pandas dataframe the code works fine but the supertrend function runs slower and slower as the dataframe increases in length i was wondering how i could convert the for loop in the supertrend function to a pandas vectorization or using the apply method vector version,how should i correctly handle an api timeout in python background i am writing a py script that calls an api saves the response as a json file and performs various other tasks before saving the response to a xlsx file issue the api i am calling is very unreliable especially as it s a get response with c rows of data as demonstrated by the following intermittent timeout errors in the empty json file which should contain the response function that calls the api objective proposed solution i would like my script to continue to call the api until successful successful no errors the only real solution i can think of is to implement a while loop in my script s function which makes the api call where i am stuck is how i would define the condition to be met in order that the script ends and doesn t get stuck in a infinite loop,0,63,157 trying to convert a string to list and then identify if there are int elements in the list python i have a string that i have converted to a list but i am unable to coerce some of the list values to int,how do i make a function to change every appearance of a letter to a different letter i have a name let s say john i want to create a function that changes the o to an a this is what i came up with this works fine and returns jahn but what if i want to change a name like johonas for example it returns jahonas so i tried to make an if statement like so however this return none and i quite honestly don t know how to fix this any help is appreciable,0,43,94 numpy matrix red dot path visualization i have a numpy matrix fill of on each iteration a go along the principal diagonal putting instead of see just i want to display a numpy matrix with red dot square in the principal diagonal i want also see the same matrix updated in each position at runtime instead of display n different matrix,database data is not updating on my apache website unless i restart apache service edit i have django installed and am using apache to host the website using wsgi i have checkboxes on my website and when i click a checkbox and then click submit it saves the change to the sqlite database and refreshes my website if i log out of my website and then back in the checkbox is no longer clicked but the related database item is showing true in the django admin site if i restart apache using sudo service apache restart and refresh the website it then has the proper boxes checked i am brand new to django apache so i apologize if this is a stupid mistake but restarting apache every time i make a change seems wrong edit i have changed my code to use a modelform i think i did it properly as recommended by the first commenter but i am having the same problem my views py my main site html my models py my forms py,0,63,171 pytorch tensors using all ram i have a list of tensors which is too heavy for my ram i would like to save them in filesystem and load them when needed if i want to use batches while training is there an automatic way to load tensors when needed i was thinking about using tensordataset and dataloader but since now i don t have tensors in a list but in filesystem how should i build them,does not search for the same values in table i have the following problem i am trying to sample a given signal and when i loop through the points of the signal every so often the values take even though there are such values in the array with other functions there is the same loop and it works fine generates samples from a specified interval results and data from signal chart i would like to eliminate those dots at the value,0,75,83 how to select columns from multiindex pandas table in a custom order how to select columns from multiindex pandas table in a custom order in this case how can i have quantity to come before price without the use of ascending false as well as the size to be in the order medium large small desired output creation of dataframe i have tried to use dataframe loc however i have realized loc does not maintain the specific order,building a multidigraph in networkx i am trying to create a multidigraph in networkx that can be automatically adjusted through other entries for gates depots connecting points or parking spots my problem is that the nodes and edges are created but i always get this runtime warning and i do not know how to fix it and what it is with this two expected doubles another problem is the when i add the bd node because it is manually inserted and i wish to do it with i but then it just creates one more bd node for this example than needed maybe you also have first ideas how to build automatic connections between the created points i am open to any suggestions how to fix this points thank you very much,0,78,133 svgwrite only works in idle inexperienced in programming svgwrite scripts only work in idle for me let s say you have this what would you need to add to make it run normally thanks for any help,convert float to int not loosing information of original values i would need to transform float to int however i would like to not loose any information while converting it the values from a dataframe column used a y in modeling build that i am taking into account are as follows if i convert them into int directly i might get as or so i will loose some information i need to convert the values above to int because i need to pass them to fit a model model fit x y any format that could allow me to pass these values in the fit function the above column is meant y column code data the error that i am getting running the above code is,0,36,127 how to stop visual studio from referencing netframework version because latest version of vs doesn t support net earlier than i am making a simple python command line application i also tried to change from the application tab of project but the problem is the application tab doesnt exist shown in screenshot below i just want it to reference to the latest version of net how do i fix it error no application tab,how to access class variable inside methods of that class in python i have below code i want to use pad token class variable inside init method but i got below error question,0,73,32 import information to classes from a txt file my issue is that information in the txt file is has columns and the space between columns is not the same here is the sample i need to somehow import info into the class i created here is the class i tried strip split didnt work if anyone has sugesstions i would be extremely grateful,jsondecodererror expected value line column error in jupyter notebook i m putting a predictive model into production when i run requests post in the code below i get an error jsondecodererror expected value line column error if i remove json from the end it runs fine so i m thinking it s saying the customer is not json but i ve looked over customer and it appears to be correct would anything else cause this error,0,65,75 guessing game does not stop it does not stop when you guess the number still asks for new guess i couldn t find the problem i just started learning python,what is the way to add a text after user input while user adding it in the input in python i would like to make ask the user for any data and put a text after the user input in the execution like below number of persons input how many persons console the screen to be in same step user adding the answer and how many persons persons,0,29,69 sum two columns if other columns are equal i m trying to use pandas to add columns amount and amount only if account is in account input expected output my code,combine dataframes when the dataframes have different size i have df one is i want the result as follows the column of the new df is the same as the column of the df depending on the value of the df,0,30,45 fast way to generate large scale random ndarray i want to generate a random matrix of shape e but i find numpy random rand becomes very slow at this scale is there a quicker way,using numpy fromregex to read data from a file i need to read some data from several text files that have random number lines of text at the beginning typically the files look like file dat the lines containing the data could may have spaces tabs at the start of each line i have tried the following code but when i run it i get your help is very much appreciated,0,33,69 how to check if a property exists in a foreign key model i have a model named product in both foreignkey s i have the same property named number i want to check if that property exists in product model or in its foreignkey s models what i am trying to do is,python selecting days in between with input date by user i am trying to take some values from a covid database and i wrote the following code which works as i want see below but i have a question for you after the code now i want to add this part of the code to ask the user what is the starting date and the finish date but in the line df df df date start date df date end date there is an error because he cannot compare date to string i actually tried importing datetime but i actually had the same result because there is still a problem because for some reason it only consider a day per month or something similar but anyway the result is not as wanted how to solve the problem selecting the days in between,0,51,140 pandas merge with left option is losing rows in left data frame i have dataframes the first left dataframe has rows second has only rows when i try to merge these dataframes with left option i get only rows here i get raws reopen the first dataframe here i get raws with marks how can i avoid reloading the first dataframe or fix this problem,data streaming on grpc python with iterator request but get exception iterating requests i tried to use grpc python to make a bidirectional streaming communication but there is some issue on client side request here is my proto here is my client code for generating a iterator request and call the datatransmission function but got the error why this error and is this the right way to use bidirectional grpc communication on python then there are some posts mentioning the following way also the same error,0,71,86 pandas group by cumsum with a flag condition assuming i have the following data frame i want to create a cumulative sum of the nums grouped by user only if flag so i will get this so far i was able to cumsum by flag disregarding the group by user or cumsum by user disregarding the flag i need help making them work together,scraping data from a container i m new to scraping and would like to scrape this the historical data table from this url i have tried to use bs but nothing seems to work for me as it just returns an empty list as far as i understand what i need to do is to find all tr in the container or what i don t have that much code but i think it make sense to show it to you so there is something to work with my code,0,66,90 weird vector movement in pygame for some reason the movement of my sprite is only diagonally up and left when pressing a diagonally down and right when pressing d and w s just don t work despite the correct vectors being given to move in any direction here s where the inputs are handled and here is the relevant sprite code i can provide the whole program but it s a little over lines so let me know if it s needed,plotting several runs of the same function on one plot using matplotlib i have a function that gives me outputs t a and b i am attempting to plot several runs of the function on the same plot i am getting a new plot for each run i have put the code below please see if you know a fix,0,78,62 pandas merge with left option is losing rows in left data frame i have dataframes the first left dataframe has rows second has only rows when i try to merge these dataframes with left option i get only rows here i get raws reopen the first dataframe here i get raws with marks how can i avoid reloading the first dataframe or fix this problem,signing payload in js frontend using ec and validating in python i have a python backend that generates public private keys generates a payload then needs to get that payload signed by the client reactjs or pure js which is later verified the implementation in python looks like this imports generate keys sign verify what i need now is to load or even generate the pem keys on the client side then upon request sign a json payload that can later be verified from the python backend i tried looking into the usage of web cryptography and cryptojs but had no luck i m okay using another algorithm that is more compatible but at the very least i need the signing functionality fully working i also tried compiling python to js using brython and pyodide but both could not support all the required packages in simple terms i am looking for the following generate payload python sign payload js verify signature python any help advice would be greatly appreciated,0,71,167 django change last login from datetimefield to integerfield i have a litte probleme i have a legacy database that have a users table and in the table of users the last login field is an integerfield when i have extend an absractbaseuser and put the last login in integerfield it give a me an error when trying to connect to django dashboard it say that the last login field expected a number but got date time value any help please,how can i get the last name in a path next to the right of a character using re on python i have been trying to make a good regular expression that catches the last name of a file or folder for a given path meaning that for instance the following path c users resetstorex pictures can be reduced to pictures what i have achieved so far is the following re which reduces the previous path to x pictures any ideas,0,77,79 is not a valid xpath expression i am trying to dowload a image in my web page with the xpath expression part of code part of page source i m trying to dowload error,when importing into google collab typeerror str object is not callable using pandas in google colaboratory i am attempting to import a csv file named gifted csv using the following code df pd read csv content gifted csv i have ran the pandas library as pd but whenever i run the code it does not function and the following error appears enter code heretypeerror str object is not callable,0,33,62 how do i run a python script in powerbi i am new to python i am trying to create a bar chart in power bi using python but the script does not seem to work the code is below please find attached the file enter image description here,how to check for new discounts and send to telegram if changes detected i like to scrape new discounts from website and text me on telegram with a change on the website this is working but i got to much messages and i want to change the script to check a specific class on the website so on the website i want to check the span class space ml size all l size fromw xl cept discount span i want a message if the value is between and is this possible the script to check changes is below here maybe there is also a problem with cookies in this script or it is not defined,0,49,109 plotly parallel category linked brushing cross filter with dash in python i want to create a parallel category in plotly that have linked brushing as the documentation from plotly however inside it only show how to do it without plotly dash how to combine go pract and dash can someone help me with this,tuples to dictionary with two occurances my question is how to turn two tuples in a dictionary and have it so that if there are two strings that are the same in the first tuple it returns the first element from the second tuple e g however this outputs however i would like it to be apologies if this is too simple a question to be stuck on i know i have to add more to my code which is why its returning the wrong output i want i ve had a look at other resources however it doesnt answer my specific question i ve thought about putting an if statement and do x count k however i didnt know where to go from there,0,52,120 pycharm complaining about parentheses in a python function call running jetbrain pycharm on windows with python bit installed the code is simple homedir os path expanduser here is a picure in the ide line have anyone seen this type of parsing error is this unique to windows python version installed or jetbrain issue any clue will be helpful,django how to add multiple objects to a database dyanmically via a api endpoint use rest framework django supports a method to allow you to query your database and add multiple objects to it using the objects create bulk ive had a good look on google to better understand how to use this method but im not sure how to achieve what it is im trying to achieve heres where im at so far ive created an api endpoint that lists all the inventory objects that currently exists ive also created an api endpoint that allows you to filter by playerid and will return all inventory items that player owns heres what im trying to do create an api endpoint that allows multiple elements to be added to a specified users inventory playerid i just need an endpoint to allow a post method to append multiple elements to a specified players inventory it should look something like this so hitting this endpoint with some data like this playerid elementid elementid elementid elementid elementid elementid should add elements to the player with the id of views py models py note i will be using plain javascript ajax calls to hit these endpoints so if a solution is found could you also take into consideration that i d need a way of saying something like add element elementid quantity so i can just choose what element s to add and how many to add i m really sorry this question is quite heavy and could definitely be worded better i ve searched everywhere on the internet for something similar but can only find people using the object creat bulk method where they hard code what data is posted if there s a better way to achieve what i m trying to achieve then i m all ears thanks in advance,0,58,304 python subprocess does not capture stderr of a pv command i need to run some bash script with python and show the output some of these scripts contains some pv command but from subprocess i am not able to get the pv output runnig this python script i simply get echo s outputs,how to change part of numpy array without reshaping i have the the following array i would like to change the attribute for part of the array filled with my custom class for example i would like to change elements starting from element then from row to row ideally i would do something comparable to the result would be something like the following unchanged x changed the problem with my array is that i first need to flatten it before i could do something like this or i should calculate how many columns and rows i before i can index the array itself is there a numpy function such that i can just iteratre over the array element by element row by row i hope my explanation is clear,0,52,131 pytorch says that optimizer got an empty parameter list here i make model forward step here is my output here i train my model but i got error however when i try to put the parameters in a optimizer class i get this error,is it possible to implement a keras layer that always propagates a fixed vector to the other layers i m trying to develop a neural network architecture that has two inputs however i would like to fixate one of these vector inputs during training i know that this seems to be nonsense for most of you but i would like to know how to do this for testing a hypothesis it is clear that one way to do this would be to prepare a dataset where i simply repeat the fixed value in all instances that i would like however this seems to be a bad solution i would like to know if it is possible to implement a keras layer that receives a vector as a fixed parameter and always propagate it to the following layers in each training step when the other input would vary i m representing the idea in the image attached is it possible to do that,0,44,160 how would i go about allowing the user to specify the number of coordinates how can i create variables depending on how many the user wants defined by a simple question at the start this simple code just produces a complete random line graph every time i would like to be able to pick how many coordinates are in that graph,replace all values for every subgroups with subgroup min value with panda apply function without loop i have a panda dataframe df for data visualization i do various boxplot with x diff hours and y diff temp i want to have subgroups of hours and replace all values of each subgroup by min subgroup value i don t want to use a loop is it possible to use panda apply function please,0,61,68 function return none python hi i am learning python on my own task reverse word without affecting special characters example abcd efgh dcba hgfe example a bcd efg h d cba hgf e my problem the function return none then i added this line return reverse text but it still return none can anyone show me where is my mistake is please my code,discord py bot make op gg so im trying to make a bot where when i type opgg it will then ask please give me summoner names and then when someone would type names it would split them up and add them onto the end of adding at the end i want it so i would have to type a name then send then it would ask for another name this is the code i have so far,0,61,82 what does sys executable do in jupyter notebook i bought a book which comes with jupyter notebook in the first chapter it asks me to install required libraries it use sys executable m i never see it before what does sys executable and m do also why use user at the end typically i just use pip install numpy anyone can help me understand it thank you,how to multiply two columns together with a condition applied to one of the columns in pandas python here is some example data i would like to create a new column called new value the logic for this column is something along the lines of the following for each row i attempted to create a list with the following loop and add it to df as a new column but many more values than expected were returned when i expected only corresponding with the number of rows in df it would be great if someone could point out where i ve gone wrong or suggest an alternate method,0,65,109 why is np arange data shape used to plot a heatmap i can t figure out what this piece of code does because if i delete it nothing changes in the heatmap and i don t know what data shape and shape are doing in general,http server not responding until after the connection closes i have an application which uses the requests package to post to a server in my testing environment i want to stand up a simple server so that i can validate the client s requests however when i call requests post it just hangs the server doesn t respond at all until after the client finally times out and the connection closes ironically the server then sends a ok here s my mre for the server here s my mre for the client,0,40,87 rabbitmq and celery subscribe to job done event i have a simple celery task py running with rabbitmq message broker and redis data storage and a listener py service with a trivial function i want to invoke add with a fire and forget style and let another service implementing on add handle results this is the diagram of the workflow how can i create a listener that subscribes to task completion events on celery s backend redis,gcloud auth login issue access denied when trying to run bigquery edit seems like this is only an issue for tables based on google drive files i am using auth login the jobs show up in bigquery ui as being run by me as the owner but return this error despite the fact i should have full perms for this data and the files it is based on i am having an issue getting gcloud to run bigquery and it is returning the error google api core exceptions forbidden access denied bigquery bigquery permission denied while getting drive credentials i have tried all the various login commands gcloud auth application default login gcloud auth login i then get taken to the browser and grant access permissions everything seems fine but i still get the same error when running the following my account shows up fine i can see my login credentials as a json file but i just cannot understand why it is saying i do not have access gloud auth list i can go into bigquery and see the query being requested by myself as the owner and then i can run the same query in the bigquery console but it just does not work when requested via the script here is the code i am running multiple people have run this code confirms it works and they have not done anything different to me i assume i have done something wrong with the gcloud login but struggling to understand what import streamlit as st import pandas as pd from datetime import datetime as dt from google cloud import bigquery def load data query file with open query file r as query file query query file read client bigquery client project my data df client query query result to dataframe return df def load current es ttl get current es names and pod args none returns pd dataframe columns full name str df load data data current es sql assert len df dataframe for current es is empty correct data types df df astype dtype columns return df df load current es print df head,0,71,334 concat multiple csv s with the same column name im having trouble with concatting these pandas dataframes as i keep getting a error saying pandas errors invalidindexerror reindexing only valid with uniquely valued index objects i am also trying to make my code less clunky and run smoother i was also wondering if there was a way to get multiple pages on one csv using python any help would be great,how to add songs to my templates in views if i post a song from my admin panel i want the list of song to appear in the templates i already created a models that allow me to post it but i don t know how to create a views that allowed the song to appear in the templates please how can i do this this is my empty views views py this is my models py i created models py,0,68,78 how to get the status of button in tkinter i want the function checktime to be called when my button is pressed but how to get the status of my button and compare it i want to use the function only if the button is pressed as a test that the user agree with his inputs,fast way to generate large scale random ndarray i want to generate a random matrix of shape e but i find numpy random rand becomes very slow at this scale is there a quicker way,0,57,33 why do i get an error when i try a ldap simple request with python i would like to make a small ldap request but i am facing the following error i don t see where the problem comes from is it the request or the connection to the ldap server,kivymd recycleview has low fps lags i am using python kivy kivymd i am running my app on pycharm on ubuntu lts on a asus rog strix gl vd my issue is that every time i use a for loop to generate content in kivymd bottomnavgation using recycleview no matter what content might be even a for i in range the app is starting to move very slow when manually resizing it takes around seconds to resize correctly also i have fps under on the tab in which i generated the data while in the empty ones i get fps the issue doesn t seem to happen when i run lets say for i in range in kivy but i would prefer to stick to kivymd i ve been looking in the last week on the internet for solutions but no luck and is a bit hard to understand kivy documentation regarding recycleview below is my code please correct me if i did something out of good practice i just started to learn kivy and i m a beginner in python year thank you very much edit also when deployed to android it works below fps on a xiaomi redmi note pro main py layouts kv,0,50,211 how to convert date time to timestampe in python i have a dataset that has a column of that date written in the following format how can i convert them to timestamp,add a comment row after a row if condition is met in a pandas dataframe i can figure out a way to do it with iterrows or itertuples but i was looking for a more efficient way probably with a lambda function code and data for the purpose of this question if for the sum of the digits in a row sum row the program adds a row below row the added row is not divided into columns but rather it consists of a single cell with a comment desired resulting dataframe should look like that thanks,0,32,100 dimension error when using model predict in keras my train set has columns including a target column that i m trying to predict while my test set dataframe test has columns when i run the code i receive this error my model looks like this,modulenotfounderror no module named slct english is not my mother tongue so there might be some grammatical errors in my question sorry about that i git clone a project from github to my vscode when i wanted to run demo code a modulenotfounderror occured i was confused about this error because i checked module and it did exit i also haven t install same name module before here is the project tree of the project only parts including slct are given slct demo py import slct from logparser when i ran slct demo py this error occured here is init py of slct from slct import thanks for spending time on my question have a nice day,0,44,108 trouble finding least common multiple of numbers i am currently trying to solve euler problem which wants to find the lcm of numbers the code above is brute force but for some reason it doesn t work can someone point me in the right direction,facing issue in passing metadata field with dataproccreateclusteroperator airflow i am facing some issues while installing packages in the dataproc cluster using dataproccreateclusteroperator i am trying to upgrade to airflow error message on further dig down came across a github link where this issue of valueerror metadata was invalid is discussed in community forum i followed the link and used cluster config way to generate the cluster config for dataproccreateclusteroperator but now running into another new issue as below i do not see much information around here is the code,0,47,92 when an object of a class has arguments how do you pass it as an argument of a method in another class this new class cashregister should accept retail object as an argument how do i go about it the class in retail has argument too,convert text file into array so i ve done a bit of researching and use a variety of different methods but nothing seems to work i m trying to have a program read a txt file in my folder then convert into an array so that a different program can call that program and initiate the program of the other below is the current code i have the print is to test and see if the output is true in return however i get it supposed to fill in things like zero guskgu tyran etc note that i m new to python and currently using the most recent version,0,46,108 send private direct message with bot i m going to send someone a message from a bot the following code snippet is what i wrote to do that when i type sendpm it will ask for an id and then for a message to send when i do this i get this error attributeerror bot object has no attribute get user info,how do i make my code not generate new integers when the user gets the answer wrong what the code below does is that it generates random integers and multiplies them together after the user has placed an input and gets it corrects it will automatically generate another pair of random integers how could i make it so that when the user input is wrong it does not generate a number but waits till the user to finally calculate the correct answer and then it generates a new set of integers i ve been playing around with having a loop within the main loop but it hasn t solved my problem,0,59,110 problems with putting the apply method the error i am getting is the following int object is not iterable i think i am applying the apply function correctly but still getting an error,why converting numpy array into csv file show no attributes name but rather put the first row values as the attribute names i have a dataset that i handled its missing values using numpy the result was numpy array then i converted the array into a csv file but the dataset appears without the names of the attributes but rather they put the first row values as the attribute name how can i add the attribute names again example of the dataset after conversion,0,33,84 how to implement string in python class i m working on a problem called employee class and mostly thru it but it s not printing what i want this is my program and this is the file with my class in it i know i need to implement a string but i m stuck,error message that reads valueerror a is not in list when executing script that encrypts decrypts strings in french this python program encrypts decrypts the english alphabet perfectly fine but as soon as i replace it with the french alphabet i run into errors when debugging the entire error message reads,0,51,49 how to get video data from webrtc server in python i have a problem i want to receive data from a webrtc server c and process it on python but i can t see any example for it anyone can help me,parallelization with ray not working as expected i am a beginner with parallel processing and i currently experiment with a simple program to understand how ray works i am getting much slower performance with ray in fact if i scale up the input data i get messages in the terminal with the pid of the function and the program stalls essentially i try to split computations in batches of rows and assign each computation to a cpu core what am i doing wrong,0,41,83 how to resolve this circulary dependancy with python enums so i have enumerations the problem is that the first enumration is referencing the second and the second is referencing it too here the problem is that the universe enumeration cannot use the civilisation enumeration since it is declared below is there no way around this i d like to be able to have the all the universe civilisation in the universe enum thanks,can i call a function in both create and update in modelserializer hi im fairly new at this and trying to implement my code using the dry principle so im calling a function say for create update password in modelserializer s while creating or changing the password for this i have to override create and update in modelserializer and create update password in both of them im not doing any extra functionality in any of them them apart from calling this function so is there any way that i can invoke this function in create and update without overrding it ill really appericiate it if anyone can give any suggestion below is the code example thanks you,0,73,112 how to automatically deduct and add value from the output i am making a program of basic automatic computation for math i am having a problem of automatically deducting the sch to get the qualified output of the percentage for example the input would be the output should be automatically the scho is automatically deducted to add value for the mgr to make it automatically if it is,eyes for a robot in python with pygame i have a robot eye code made in pygame that works perfectly it is the following the robot s eyes look like this my problem is that i want to change the expressions with the conditional eyes the conditional is outside the while and when it enters the loop it does not recognize the outside values the conditional cannot go inside the while because it glitches it is seen that it changes very fast the original code is from this page update when i enter the expressions in the while it fails,0,72,101 value is not updated in the if statement i know this is a silly question but i would like to know why dictx is not being updated the functions returns dictx value ignoring the if block thanks,pandas create a new column based on percentage growth rates from another column i am pretty sure i am struggling with something very simple but i need some help i am trying o add in the column portfolio the total values of shares based on their daily price development i am using therefore the following function as you can see i am not able to aply the formula for a portfolio ion a day based on the day before is there someone who could help me please,0,37,87 not iterating other links hello guys i am trying to parse ingredients from a website but when i run the code in the ingredients key in shows only one ingredient and not going through other ingredients thank you for your time the results are,url strip section part of url adress i have urls and i want to strip get rid of the part behind the actual url these urls point to the same page but to a different section i want to strip the section part of a url,0,43,47 discord py on message nothin happens when i type the message in the first client event when i use the command given there prefix hey nothing happens it doesnt give the desired reply attributeerror client object has no attribute reply thats the error i get,how to put the dates in chronological order in python csv so i am working on processing some data and after running my file everything is fine except that the date are not in order i used the code below to try putting them in order but didnt work by the way updated at is the column i am trying to put in chronological please let me know how i can make this work i have attached a picture to for better understanding of my question updated at column pic,0,43,88 problems with pandas ta indicators rsi i try to put por trading strategy when rsi if and if the previous period if raise this error cannot perform rand with a dtyped float array and scalar of type bool,implementing gridsearchcv and pipelines to perform hyperparameters tuning for knn algorithm i have been reading about perfroming hyperparameters tuning for knn algorthim and understood that the best practice of implementing it is to make sure that for each fold my dataset should be normalized and oversamplmed using a pipeline to avoid data leakage and overfitting what i m trying to do is that i m trying to identify the best number of neighbors n neighbors possible that gives me the best accuracy in training in the code i have set the number of neighbors to be a list range and the number of iterations cv my code below at step grid search fit x train y bin train the program is repeating the error that i m getting is i m not sure from which side is this error coming from is it because i m importing knn algorthim from cuml library instead of sklearn or is there something wrong wtih my pipeline and gridsearchcv implementation,0,43,157 subordinate function call from main function throwing error as can be seen i am declaring x x and x as global variables in the subordinate function and already including these variables as arguments for the main function appreciate any help,attribute error list object has no attribute checkclick in the swap function i am checking under some index a button class instance which i checked using print statements but for some reason it still gives me an error saying that it has no such attribute check click any tips on formatting are also welcome i am just a beginner i am using three different arrays to hold various instances values and coordinates for each corresponding array position i am trying to make a sort of match game thanks for any help,0,40,92 pause and resume for tkinter pomodoro clock i ve been working on a python tkinter pomodoro clock about everything else works perfectly except for the resume button this is my code the pause function has some issues i can get it the stopwatch to pause but when resumes the stopwatch starts increasing and decreasing randomly help would be greatly appreciated,how to accept urls without a protocol the following is a subclass of pydantic s basemodel when i send a request with a body like this the second url is invalid how to accept urls without a protocol,0,59,37 import information to classes from a txt file my issue is that information in the txt file is has columns and the space between columns is not the same here is the sample i need to somehow import info into the class i created here is the class i tried strip split didnt work if anyone has sugesstions i would be extremely grateful,jsondecodererror expected value line column error in jupyter notebook i m putting a predictive model into production when i run requests post in the code below i get an error jsondecodererror expected value line column error if i remove json from the end it runs fine so i m thinking it s saying the customer is not json but i ve looked over customer and it appears to be correct would anything else cause this error,0,65,75 problem with assigning d array as a one slice of d array i try to load series of dicom files into d array i do this on bad way because i got an error something like this not fluent in python valueerror could not broadcast input array from shape into shape i don t understand why because i specify the shape as,fastapi pydantic optional field currently i m learning python and fastapi and i can t figure out what typing optional is for both work i don t understand what s the difference,0,64,27 why isn t my code working where i m wrong write a function rotate m that takes a list representation m of a square matrix as input and returns the matrix obtained by rotating the original matrix clockwize by degrees for instance if we rotate the matrix above we get rotate your function should not modify the argument m provided to the function rotate print rotate,tickval does not assign correct position to ticktext i am plotting an annotated heatmap with a colour bar using the code below inspired in part by this very helpful tutorial its part of a larger bit of code which i ll put at the end final df is a dataframe whose columns are protein ids and index is features of interest only one in this example m a non int in a heatmap cell means the protein associated with the cell is part of the feature associated with the row index and each non int between and maps to a protein grouping that i d like to use to color my cells i m plotting the heatmap with the code block below unfortunately my colorbar ticktexts dont match up with tickvals and i have no idea why it should be one label biosynthetic etc per colored block in the colorbar on the right of the image any pointers cheers tim full code,0,68,161 any trick to override idex function in python so exception won t be raised if a string is not found it obviously returns but also an exception so my question is simply how to remove the exception from the output and let as the output only,python how to add items to a menu of an ipyvuetify toolbar i would like to find out the way to add items to a toolbar menu created with ipyvuetify the code above displays the tool bar as follows but i dont know how to add content to the menu like buttons and or input fields does someone know how to code the menu and add it to the lateral toolbar menu symbol thanks,0,47,73 generate random binary strings of length i want to generate random binary strings of length i e from to where each string is length i m wondering how i could do this efficiently or pythonically right now i randomly choose between and times and then append the results into a string this seems pretty inefficient and not pythonic is there some library functions i could use for this,kubernetes create a persistent volume and use in my django app i wouldd to create a persistent volume on my kubernetes gcp cluster and use it in my django app as for example media folder on my kubernetes side i do first create a volumes claim then in my deployments yaml i create a volume and associate to the pod then in my django settings here my dockerfile when i apply volume claim on my cluster all was done volume claim was created but whe apply deployment yaml no volume was created for the pods also if i connect in bash to my pods no folder test files exist how can i create a volume on my deployments pods and use it in my django app so many thanks in advance,0,75,128 having problem in reading data from multi level columns pivoted format to dataframe in python i have data in a google sheet with columns in below format i want to adjust row and in columns to create a dataframe original dataset i tried result will ignore first two rows looking something to bring first two rows in columns also output req below groupby with year,remove entries in a python set based on condition i used scipy spatial kdtree query pairs which returned a python set of tuples let s say this is the output next i want to erase all the tuples in the set which do not fulfill the condition what would be the most elegant fast pythonic way should i maybe convert to a numpy array,0,68,57 python scrapy item add xpath error invalid syntax hello stack overflow friends i m having some trouble with scrapy it s returning syntax error at the item add xpath command here s the script the error returned,make negative values of numpy array positive i have i want to make the negative values positive e g is there an easy way to do this thank you so much in advance,0,30,40 what is the right function to use for for loop with arguments i m currently stuck and have no idea what function or code of line i should type hopefully i can get some idea here whenever i try to print it keeps giving me an error,odoo error when creating a name search method for a model odoo in my odoo app i have an area model and a department model every area has a department many one relation every department has a code and name i wanted to overwrite the name search function in the department so it can be searched using both code and name but when i am on the area form view and i start typing in the department id field for selecting a department on that area odoo shows an error i am working with odoo here is my code and here is the full error code,0,47,104 proper c type for nested list of arbitrary and variable depth i m trying to port some code from python to c the python code has a function foo that can take nested lists of ints with variable list depth for example these are legitimate function calls to foo what should the method signature s be for a c method that can accept this kind of argument,change inherit field to required in a serializer i have a serializer like that i want to inherit this class but changing field to required true who can i do that i know that i can redefine the field like this but i dont like to do this,0,65,46 remove xml tag using python if a certain text is found i need to remove all tags from xml document if a certain text is found example so for each first line into the xml document i want to remove the whole tag,confusion with python import i have a package of utility modules and classes that are imported using the following example statement when marixframework is installed as a package the above statement works fine however i want to do some local testing of the package contents so i want to import directly from my local folder tree that has the following structure if i add workspace marixframework to sys path then i get the following error the import procedure has obviously found the desired source file but fails to import from it why what i am trying to achieve is to import the marixframework modules directly from the folder tree then when my local testing is complete i can just rebuild and install it as a package without having to change the import statement syntax,0,42,132 how to populate a dataframe column based on condition met in another column i was wondering how for the following dataframe can make a new column for example b and for each row define if its value is a x a between a between or a x i tried the following code but it didnt work,lookup table in xarray so i want to merge datasets is a single band raster dataset that came from rioxarray open rasterio the other a lookup table with an index dim mukey the coords along mukey correspond to mukey index values in the lookup table the desired result is a dataset with identical x and y coords to the raster dataset with variables n and k whose values are populated by merging on the mukey if you are familiar with arcgis this is the analogous operation xr merge and assign don t quite seem to perform this operation and cheating by converting into pandas or numpy hits memory issues on my gb machine does xarray provide any support for this simple use case thanks,0,56,122 i have list of list in that i want to make a list from list before empty list i want like that using python,how can i parse a string number to a float python from excel i have a number in the following type so i ve been trying strip replace among others but i couldn t get a float from my code result monto float m valueerror could not convert string to float,0,24,52 takes positional argument but were given error for dict how to add two dict in cs list i want to add two dictionaries to the cs list in the addcoursess function but it gives an error text error takes positional argument but were given mainlist here is the class in which it is error addcoursess function here,pandas re indexing after picking those that meet a condition i m trying to learn more about re indexing for background context i have a data frame called sleep cycle in this data frame the columns are name age average sleep time i want to pick out only those who s names begin with the letter b i then want to re index these b people so that i have a new data frame that has the same columns but only has those who s name begins with b here was my attempt to do it results re indexing was succesful managed to pick those who only began with the letter b and the columns remained the same great problem was all the data has been replaced with nan can someone help me with this one what am i doing wrong it would be best appreciated if you could suggest a solution that is only in one line of code,0,61,152 opening anaconda prompt with python i want to create a script that will help me with installing packages for spyder therefore i want to use python and have the script first open anaconda prompt then execute the commands and then close that window however i can get it to open for example the calculator but it doesn t seem to open the command prompt for opening the calculator i used how can i get it to open the command prompt,converting rows to wide columns based on duplicated ids in another column in pandas my question is similar to this this and this questions but still cannot resolve it i have a dataframe with duplicated ids i want to make it wide but i do not know how many publication type will i have maybe maybe thus i do not know how many columns wide will i need the max size of wide columns for publication type must be not be more than the number of types for each id expected output for now i do not need to put the same publication type into the same column i do not need all articles in the same column thanks,0,79,121 forecasting with sarimax unexpected results i m trying to forecast with steps with a sarimax model first i remove heterocedasticity via sqrt and trend via a linear model fitted values of the model are similar to the series but when i try to forecast the results are a bit off i don t know if i messed up some parameter or something here is my code,installing sasl in python when trying to install sasl in python to connect with hive it gives an error please advise how to treat it pip install sasl c users dpgorbunov appdata local temp pip install g wo vhy sasl edfeed a f be setup py file c users dpgorbunov appdata local temp pip install g wo vhy sasl edfeed a f be setup py f getattr tokenize open open file code f read replace r n n f close exec compile code file exec bdist wheel d c users dpgorbunov appdata local temp pip wheel bq ujy cwd c users dpgorbunov appdata local temp pip install g wo vhy sasl edfeed a f be complete output lines running bdist wheel running build running build py creating build creating build lib win amd creating build lib win amd sasl copying sasl init py build lib win amd sasl running egg info writing sasl egg info pkg info writing dependency links to sasl egg info dependency links txt writing requirements to sasl egg info requires txt writing top level names to sasl egg info top level txt reading manifest file sasl egg info sources txt reading manifest template manifest in writing manifest file sasl egg info sources txt copying sasl saslwrapper cpp build lib win amd sasl copying sasl saslwrapper h build lib win amd sasl copying sasl saslwrapper pyx build lib win amd sasl running build ext building sasl saslwrapper extension creating build temp win amd creating build temp win amd release creating build temp win amd release sasl c program files x microsoft visual studio buildtools vc tools msvc bin hostx x cl exe c nologo ox w gl dndebug md isasl ic users dpgorbunov anaconda include ic users dpgorbunov anaconda include ic program files x microsoft visual studio buildtools vc tools msvc atlmfc include ic program files x microsoft visual studio buildtools vc tools msvc include ic program files x windows kits netfxsdk include um ic program files x windows kits include ucrt ic program files x windows kits include shared ic program files x windows kits include um ic program files x windows kits include winrt ic program files x windows kits include cppwinrt ehsc tpsasl saslwrapper cpp fobuild temp win amd release sasl saslwrapper obj saslwrapper cpp c users dpgorbunov appdata local temp pip install g wo vhy sasl edfeed a f be sasl saslwrapper h fatal error c sasl sasl h no such file or directory error command c program files x microsoft visual studio buildtools vc tools msvc bin hostx x cl exe failed with exit status error failed building wheel for sasl error command errored out with exit status command c users dpgorbunov anaconda python exe u c import sys setuptools tokenize sys argv c users dpgorbunov appdata local temp pip install g wo vhy sasl edfeed a f be setup py file c users dpgorbunov appdata local temp pip install g wo vhy sasl edfeed a f be setup py f getattr tokenize open open file code f read replace r n n f close exec compile code file exec install record c users dpgorbunov appdata local temp pip record hb t nd install record txt single version externally managed compile install headers c users dpgorbunov anaconda include sasl cwd c users dpgorbunov appdata local temp pip install g wo vhy sasl edfeed a f be complete output lines running install running build running build py creating build creating build lib win amd creating build lib win amd sasl copying sasl init py build lib win amd sasl running egg info writing sasl egg info pkg info writing dependency links to sasl egg info dependency links txt writing requirements to sasl egg info requires txt writing top level names to sasl egg info top level txt reading manifest file sasl egg info sources txt reading manifest template manifest in writing manifest file sasl egg info sources txt copying sasl saslwrapper cpp build lib win amd sasl copying sasl saslwrapper h build lib win amd sasl copying sasl saslwrapper pyx build lib win amd sasl running build ext building sasl saslwrapper extension creating build temp win amd creating build temp win amd release creating build temp win amd release sasl c program files x microsoft visual studio buildtools vc tools msvc bin hostx x cl exe c nologo ox w gl dndebug md isasl ic users dpgorbunov anaconda include ic users dpgorbunov anaconda include ic program files x microsoft visual studio buildtools vc tools msvc atlmfc include ic program files x microsoft visual studio buildtools vc tools msvc include ic program files x windows kits netfxsdk include um ic program files x windows kits include ucrt ic program files x windows kits include shared ic program files x windows kits include um ic program files x windows kits include winrt ic program files x windows kits include cppwinrt ehsc tpsasl saslwrapper cpp fobuild temp win amd release sasl saslwrapper obj saslwrapper cpp c users dpgorbunov appdata local temp pip install g wo vhy sasl edfeed a f be sasl saslwrapper h fatal error c sasl sasl h no such file or directory error command c program files x microsoft visual studio buildtools vc tools msvc bin hostx x cl exe failed with exit status error command errored out with exit status c users dpgorbunov anaconda python exe u c import sys setuptools tokenize sys argv c users dpgorbunov appdata local temp pip install g wo vhy sasl edfeed a f be setup py file c users dpgorbunov appdata local temp pip install g wo vhy sasl edfeed a f be setup py f getattr tokenize open open file code f read replace r n n f close exec compile code file exec install record c users dpgorbunov appdata local temp pip record hb t nd install record txt single version externally managed compile install headers c users dpgorbunov anaconda include sasl check the logs for full command output,0,65,424 django app incorrect datetime during deployment i have a django model with a datetime field like this locally on my machine this control is created with the local date and time when the application is deployed the field is not created with local time i tried to do this it does not work how to solve this problem i am in central africa,function to filter dataframe with multiple if and conditions look at a dataframe and a variable and return a set of clients which are in both the infolist and dataframe and any client in infolist with membership fee larger than offer price any client in infolist who feedback is or higher example dataframe infolist expected outcome code tried so far not sure why this isn t working after tons of research,0,64,71 how can i create a script to switch between my arm conda and x conda i am on an apple silicon m macbook pro i would like to have a native arm python environment and an environment that runs on x architecture with rosetta i have installed two mini forge distributions both in the home directory miniforge for the native arm installation and miniforge x for the x installation,running selenium webdriver in github actions for unit tests i m trying to run a unit test in github actions before deploying my aws lambda where i m running selenium webdriver with a functioning selenium chromium lambda layer i m running my environment in python and using chromedriver version i kept on encountering this error upon running the unit test i used the same chrome options as when i m running my aws lambda which works with some additional options that are lambda specific tmp folder is the file system provided by aws where tmp folder tmp lastly i m starting the driver this works perfectly well in the lambda but fails every time i try to run the unit test in github actions this is the configuration when running the job in github actions the configuration entirely is taken from the chrome setup in gibhub actions made by selenium themselves and it works great this github actions configuration is using the latest chromedriver so i ve both tried older versions as mentioned before and the latest one but i m still getting the same error,0,69,183 driver find elements by xpath div data testid tweet gives no output i am trying to scrape tweets using twitter scraper i have tried a lot of solutions but it gives out empty list whole chunk screenshot it s same as that in twitter scraper github repository,skipping an iteration in a specific list when iterating through multiple lists this question is somewhat similar to this question but different in that it entails multiple lists i have three lists i am iterating through the list as follows i would like to add a condition which is expressed in the following pseudo code how could i accomplish this is there a function in itertools that could be used to accomplish this,0,40,72 can i put input in mindstorms while programming in python when i was programming in mindstorms robot inventor and decided to put an input in my code i bumped into this nameerrorthis is the error is it even possible to put an input in mindstorms,how do i send the ouput from azure ml model to eventhub hi i m new to azure ml and have little knowledge of it i ve built a azure ml model using automl package and generated some outputs to be sent to the eventhub our data flow would be azure ml eventhub adls sql dw i ve registered the model but not sure how to deploy it i looked up some documents and it s all about having webservice as the endpoint any help would be appreciated,0,46,87 how to set a subset with specific category in fashion mnist tensorflow now i have use orginal data with fashion mnist how can i create a subset with specific category like t shirt and dress and in each other category,splitting d array in numpy to make smaller equal d array i have an array shape i want to divide it in blocks like the image each array shape would be then how do i achieve this octant box splitting,0,41,44 starting multiple discord tokens discord py how would i be able to start multiple token with discord py discord python with fetching the tokens from and external and then run each one how would i be to give them a random status,for loop open netcdf files in different directories i am new to python and looking to open specific netcdf files in different directories so i can average and plot them surface temperature data the directories are in yyyy mm dd filename two nc files for each day day and night i e i want to open all the files in daytime and then so on for every month of how do i do this please i m looking into for loops and xarray but i can t work it out thank you,0,40,87 i can t connect to postgres using docker and django this is the docker compose file i m using the python image on a ubuntu system i ve already changed the files in etc postgresql main i m getting this error this is the database i m setting up in django,easy way of checking whether pyspark dataframe is nested is there any easy way to check whether a pyspark dataframe is nested i know that you can print out the schema and visually see determine if the dataframe is nested is there a programmatic way of checking this,0,46,48 python use tkinter to show a plot in an independent window jupyter notebook i referred to the following useful tutorial video and i used his codes see however the graph was plotted under the cell instead of the independent window how to overcome this thanks,oserror unable to open file file signature not found i am currently doing an assignment on deep learning by downloading the assignment files from github you are given a dataset data h containing a training set of m train images labeled as cat y or non cat y a test set of m test images labeled as cat or non cat each image is of shape num px num px where is for the channels rgb thus each image is square height num px and width num px i ran the setup sh file too but the error doesn t seem to go away lr utils py file kindly help,0,47,105 what is the main problem in this situation,python change time format i m trying to change the time format of my data that s now in form of or hh mm ss msmsmsms to seconds i browsed through some of the pandas documentation but can t seem to find this format anywhere would it be possible to simply calculate the seconds from that time format row by row,0,8,56 valueerror at admin services blog add blog objects need to have a primary key value before you can access their tags i m trying to create a blog by the admin panell but i m not able to save can you please help model py for some reason when i m trying to save the tags and the data i m getting this error,add json to a file i have this python code which should add this json to the end of the current test json file however when i run it i get this error how can i make this code add this json to the end of the file,0,55,47 issue while working with django orm or raw sql query list edit drivers html this is html file for showing data at front end urls py ajax call driverviewset url and html render list edit drivers url views py serializers py i need to this sql query implement for change logic i don t need to change existing field name and all only change logic based on below sql query raw query or orm both okay sql query output ex models py,how to get a new date from two date hour columns i have a dataframe including a datetime column for date and a column for date of change example i need a new datetime column based on the cdate column example how can i do it,0,74,45 how to call methods using schedule module in python we can call a simple function using schedule like this but when im creating a class and calling a method i get,error your client does not have permission to get url in python google cloud module uptade according to what our system expert told me they fixed the problem as follows v ips must be disabled in the operating systems they are in i have a python file on the server that is scheduled to run every week like this but the file that works every week gave an error today when i run the same file on my local computer i didn t get any errors i updated the outdated python libraries on the server but it didn t work also i get the same error on all files using the google cloud module what could this problem be caused by,0,31,121 python result from console error string format i have a problem with my console program a total of four initial results are expected from me the interesting thing is that two of them work correctly the other two make the following mistake also since i m a beginner i want to ask how to create a variable that can read both text and number,how to get row number and specify tooltip from another columns in that row the problem is that i can t iterate through whole dataframe and for each cellwidgetitem in specific row in column specify tooltip from another columns in the same row above code works and does show whole dataframe in qtablewidget and below code works for extracting text from several columns and settooltip for cellwidgetitem from row and column but when i get more than one hundred rows it would be such a long code to copy and specify manually for each cellwidgetitem from row etc the tooltip i tried this code below to get it work but unfortunately i can t nothing happens but it passes so that it has no errors please give me a solution thank you very much,0,62,135 pandas extract value from dictionary in a df from a column containing list of dictionaries i have the below that i ve created a df with i ve tried this but its only extracts the dictionary and i want to get the numerical value only for ex,python function to translate text am new to python programming and am trying to work on an assignment to translate english text to french using a function in ibm language translator i get no output when i return the function please any help here is my code below,0,47,48 how to get h over below h when ordering having this dataframe what i would is to have the rows that have the start time with xx xx at the top descending for example ps start time comes from df start dt time,how to update column value in postgres table from python based on condition i have postgres table alpha with following values alpha my connection string i want to update the active status to expired based on two conditions expected output how could the update query written from python for postgres,0,36,49 selenium python how to web scrape the element text i am trying to webscrap data from roulette game while trying to i am getting this output any idea how to scrap this value in this case number my code screen shot from devtools,how to correctly replace na with in pandas dataframe i have a dataframe and when i run this code it brings here how col looks for example df col however after i do this it turns col and col into how to replace na in those columns correctly what i do wrong,0,44,52 append items in front to every list inside list of lists not to the back i have the following list of lists i would like to append item name to the front of the list such that it looks like this here is the python code i wrote to do this the code appends the items to the back of the list what i want is append to the front of the list i am using python,how to retrieve aws s objects url using python i need to write a lambda function that retrieves s object url for object preview i came across this solution but i have a question about it in my case i would like to retrieve url of any object in my s bucket hence there is no keyname how can i retriece url of any future objects stored in my s bucket,0,77,70 how to group by the mean of specific columns in python in the dataframe below i want to do the following find the average of each unique series per aic trx for each grwth time grwth time grwth time grwth time export all the outputs as one xlsx file refer to the figure below the desired outputs look like the figure below note the numbers in this output are not the actual average values they were randomly generated my attempt thanks in advance,python requests response forbidden so i am trying to scrape this website i was able to scrape data from it without any problems but today it gives me response i tried using proxies passing more information to headers but unfortunately nothing seems to work i could not find any solution on the internet i tried different methods the code that worked before without any problems,0,77,68 extract tar gz some integer in python i am trying to extract a file name with this format filename tar gz i have tried mutpile wayd but for all of them i get the error that is unknow format it works fine for files ends with tar gz i tried to change the name but still does not work here are what i have tried another way is thanks for your help in advance,regular tensorflow ops not supported by the interpreter error during inference i am currently trying to convert a saved model trained using tensorflow v and keras to a tensorflow lite model the structure of the model is the following the model conversion performed using the following code fragment succeeds meaning no error is thrown and the converted model is written to the output file however when trying to perform an inference on a dummy test input tensor consisting of a single element of the desired shape therefore using the following code the last instruction returns the following error if instead i remove the support to select tf ops during the conversion the following error arises do you have any idea on why this is happening am i missing some steps or did i encounter a layer which is currently not yet supported by tensorflow lite without recognising it thank you in advance for your help python version tensorflow version used both for training and conversion,0,69,166 how can i return values from a recursive function i have my code which does a quick sort on a list of values this throws the error i have the inner function because i want to return both the original list and the sorted list how can i fix this,pandas sort dataframe correctly with german umlauts upper lowercase and numbers i have this dataframe all strings i want to sort it so that german umlauts are correct also lowercase and numbers are correct here is my code to generate the dataframe and result the result is almost correct but the numbers are sorted in the wrong order should be before how can i fix the number sorting while maintaining all the other characteristics,0,50,75 how to add hoverdata to the argument of fig add scatter in plotly how to add hover data to the argument of fig add scatter in plotly it belongs to fig px scatter but i used this for a point to provide name argument thank you here is the data here is the code,unexpected requests exceptions connectionerror i was trying to run this code but a big error has raised i tried to ping this host but failed and google didn t give useful advice could you please tell me why and how to deal with it thanks a lot i have also asked this question on github at,0,50,54 how to predict with affinity propagation in python i am trying to train and predict with an affinity propagation model for the first time here is my code however when i run this i get the following error am i misunderstanding how affinity propagation works with prediction i want to be able to feed my trained model new data does the number of dimensions i e length of each sub list need to be the same as the trained data,exporting d points to blender via the ply format creates an empty object while it works in meshlab i made a python script to create a ply file using the image and the cloud of points of a scan d stored as a numpy array i can open the resulting file ply in meshlab it works well but when i import it in blender there is no point the resulting object is empty do you have an idea on how to solve that thanks,0,78,83 how to check if xgboost uses the gpu i m writing a pytest file to check if my machine learning libraries use the gpu for tensorflow i can check this with tf config list physical devices for xgboost i ve so far checked it by looking at gpu utilization nvdidia smi while running my software but how can i check this in a simple test something similar to the test i have for tensorflow would do,formatting a dictionary with pandas python how would i be able to rearrange the values of dictionary a so that it turns into the format of a all the columns values will be turned into keys with their corresponding values how would i be able to get the expected output below code expected output,0,69,54 uploading directory to pinata ipfs api i m trying to upload a directory of pngs to pinata but i keep getting this error here is the code that i ve tried that filepath is indeed a valid filepath i need to have a ipfs or pinata directory with a cid and then a bunch of number pictures in there if there is any other way to do this lmk thank you,how to solve error in passing variables to sql query i have a list of existing tables in database i need to update existing tables with csv files so what i have done is i have created temp tables in database and i have inserted the values from csv files to the temp tables in database then i have made two lists one list consists of existing tables and other list consists of temp table i created my temp tables with prefixed existing tables names ending with temp eg tablenametemp so that i can match with existing tables once i found the match then i will update the existing tables with the temp tables with matching primary keys if the primary key already exists the i will update the existing records else i will insert it as a new record to the table once all done temp tables are removed here is the code which i have done for a in list table if a temp in list temp when i execute this code i got the error like this the sql contains parameter markers but parameters were supplied hy i think this error is thrown when i execute the sql merge query and i really got no idea of how to solve this please help me,0,69,217 having issue while printing specific value from df in the above code i want to extract only the price which is for today but the value i am getting is n n is there any way to get the specific value while web scrapping,i don t know the cause and solution of keyerror i m a beginner what i used was flask and pymongo if you press the button it s like it should be but there is a key error at the bottom my python route code this is how i post from js function like movie title ajax type post url api like data title give title success function response console log response alert response msg window location reload i get an exception as below what i want is if it s like btn if you press the button it becomes,0,47,92 python regex with brackets i m trying to get a subset of strings like bellow i need to first capture contents between and and then put each of some content in the separate index of an array what i have till now is but it does not work as expected my expected result is something like bellow any help is appreciated update please consider the following as an input string expected output,use namedtuple instead of tuple with typing optional how can i use namedtuple with typing optional instead of this tuple i want to to call the function in the format of result final power stats min max none thank you i tried with stats namedtuple stats optional int optional int,0,73,42 i want add my simples list in list of comprehension in python i have two lists of values and i would like to create a list which could be seen as a x matrix where the first column is my the values of my first list and the other column is the values of my second list here are my two lists,how to make an if statement with multiple indices of a list equal to an object in the list in python my current code works to a certain point i have another function called check x win status which does the same thing that the one below does except it checks for instead of anyone have any ideas as to how to make this more compact also i sometimes get an error in which the code prints win even if the game status,0,63,90 pyyaml how to set a default representer for non standard objects is it possible to specify a default pyyaml representer for non standard python objects how to instruct pyyaml to use a default representer for all non standard objects for instance i would like to invoke an object s str or repr method iff it cannot be represented safely,python inner class inheritence i m trying to define my config py using class in python such that every class will have some static members that will be read for my configuration settings i m using inner classes and using inheritence among them here is an example of what i m trying to do i m getting the error when i m setting var in class mode it says default configs is not defined as if it is treating default configs as a member variable so what am i doing wrong and how can i get this to work also mode var and mode var have values as expected i tried using parent reference as well like prod default configs var but that did not work either i also tried accessing var directly as if inherited it should be usable but i was wrong again,0,55,131 replace cell in dataframe if it contains a string i need to replace every cell in a python dataframe if it contains the string p to make it look like i tried it with which didnt work can someone tell me why it didnt,psql sqlalchemy paginate jsonb array i have a model which includes jsonb column result structure is following i have the following query this query returns all rows inside result and i need to include pagination here how can i do this,0,44,41 python s enumerate equivalent in c i am learning c and have been taking a lot of online courses i am looking for a simpler neater way to enumerate a list within a list in python we can do something like this in just one line does it have to involve lambda and linq in c if so what would be the solution i tried it with dictionary in c but my gut tells me this is not a perfect solution,int index object has no attribute get values i am doing the following manual i m getting the following error from this code error attributeerror int index object has no attribute get values,0,79,29 how can i programmatically get an element from the drop down menu on this web page i retrieved this html with a web scraper i want to extract the element for the second option a class c menuitem link href lists members import id import contacts a how can i do this i have this code so far but it doesn t work,calculate relative frequency of bigrams in pyspark i m trying to count word pairs in a text file first i ve done some pre processing on the text and then i counted word pairs as shown below aspire to to inspire inspire before now i want to report the most frequent pairs sorted by here s what i ve done so far i think i m relatively close to the result i want but i can t figure it out i m new to spark and dataframes in general i also tried any help would be appreciated edit here s a sample of the frame dataframe,0,53,104 no module named tabulate i have tried to install tabulate with pip and pip in my virtual environment and the installation goes well when i try to execute the code it tells me that it does not find the module no module named tabulate i ve seen that this is a widespread problem are there any solutions,linux tmp folder bad file im writring a python script that checks some permmission and if you have permmission it will open xfreerdp now i have a problem if i just write in terminal the xfreerdp command it will open this but if i use this python script it won t the error is that usr bin xfreerdp tmp mei cxde libz so version zlib not found required by lib x linux gnu libpng so but if i replace the libz so with lib x linux gnu libz so while running the python script it will work how can i tell what libz so copy in this temp file,0,57,90 converts an abnormal character into a normal character e g an unicode character in python how to converts an abnormal character into a normal character e g an unicode character in other words decoding an abnormal characters string like aaa to reveal its contents output i would like to print the string without these characters aaa,django test key association i am new to django and unit testing i m writing tests for my app which is a learning platform consisting of several labs that include a lesson and questions of different types the relationship between questions and labs is done via foreign key i am trying to write tests in which i add a lab to the database and a multiple choice question the problem is that the tests always end with the same error i understand the meaning of the sentence but how come this happens if i provide an id to the questions to link them to the respective test lab thank you models py test py update update i changed the test and i gave the questionmultiplechoice different parameters result now is,0,53,127 count the sum of the nested list which contains strings and ints in python i know how to get the sum of a nested list that only contains numbers but how do i get the sum of a nested list that contains both strings and numbers i wanted to use double recursion to solve this problem but i don t manage to get the isinstance part right is the input,how do i sort a list of tuples by both elements i have a list of tuples for example i need a list of a set length for example using any combination of these tuples where both elements are sorted in ascending order like so wouldn t work because it s sorted by the first element but not the second is it possible to sort a list the way i need,0,69,92 picking only the first value equals in time period i have the df which has index with dates and values or i need to filter every first from this data frame in several time periods for example each in df ind means the beginning of time period now i m interested to get the first in each time period,trying to print ascii characters to why does it stop at i m new to python and i m learning coding encoding unicode ascii and so on i would like to print ascii characters according to their codes and using chr function unfortunately the result is wrong it stops at the code i understand these codes return blank but why do they stop the process setup when i run this code in visual studio code the script produces output through but in my console linux mate it blocks that s difficult to understand for me,0,63,97 is it possible to shorten the code in pyqt by sticking lineedit in for i have lineedit blocks and i want the textchanged function to trigger when any of them change i decided to take the easy route and write them out in order but now i want to shorten my code i wanna shorted this like this or like this but it does not work thanks for your attention,scrape responsive table from site whose url doesnt change i want price history scraped from this site upon click of price history button the table gets loaded but the url remains same i want to scrape the table loaded,0,71,39 iterate over a list and save values im trying to do that but i cant i have a variable that gives me values and i want something like that and the list is continuously filled and when it fills up it would come back and exchange the value for the first position and so on i m a recent programmer i tried several ways and i couldn t,python selenium check all checkboxes on page i m trying to tick all checkboxes on a page there are about of them and this code seems to work but only ticks what is visible on the screen it doesn t scroll down the table and tick the remaining boxes i m thinking it s only finding those on the screen as the rest are still loading i need to wait until all checkboxes have loaded but i m not sure about how to go about this any help is appreciated below is the table row,0,66,91 datetime index in plotting doesn t work why i want to plot one month of data one data per hour the dataset is over one year why is this code not working error message typeerror cannot do slice indexing on rangeindex with these indexers of type str thanks a lot,i m trying to understand the shap values of a predictive model below please help me understand what s the o p of value explainer means o p o p array although with the summary plot i understood what is the contribution of each feature to the model please explain me what s this numbers in both the output means and array,0,51,63 python valueerror invalid variable py version nodot plat i am trying to install on cmd windows this library i get this message please read the complete error message here,virtual key media stop not working in windows vk media stop xb python this code will successfully stop any media playing whether its chrome or windows media player etc on windows but after updating to windows it no longer works i have tried on different windows computers and i get the same problem if i change the virtual key to something else from the microsoft list of virtual keys like vk media play pause xb play pause media key it works in windows did microsoft change something for this feature in windows,0,26,95 why does this not work when n gets to i wanted to write a program that tried to look for these primes i have run it a few times and when n gets to it does not have an output in over hours is this just because it will take a while or because something is wrong with it here is my code credit for the isprime function,pod to pod communication doens t work with python socket in k s in our project we want two pods working as server client that communicate via the python socket library both containers are built locally with docker build pulled locally via imagepullpolicy ifnotpresent on the yaml files and run on the same node of the k s cluster i m running kubernetes vanilla if that s important the communication works well when we the communication fails when both server and client are deployed in k s kubectl logs client f returns i suspect there s a problem with the outgoing request from the client script when it s deployed on the cluster but i can t find where the problem lies server py server yaml client py client yaml,0,72,115 javascript await and python await are they same concept from a user point of view when we think of for loop we could say for loop in javascript or python are the same thing conceptually can we say await in both languages are conceptually same i smell this can be a bad question but albeit interesting question for me,function return first index meets condition my function doesn t stop when the first time the condition is met the lowest value in list started when started at start index what do i have to add to achieve it my code is it returns index instead of index start index is,0,59,52 list count in python dears please need help in count method if and if using count and searching on or or false list count or list count or list count false return only not while there are another elements consider as false as below bool function if we used bool or bool or bool to know its boolean value will return false also i tried to check will return false not true,how to install pytorch with cuda support with pip in visual studio i am trying to install torch with cuda enabled in visual studio environment i right clicked on python environments in solution explorer uninstalled the existing version of torch that is not compiled with cuda and tried to run this pip command from the official pytorch website the command is pip install torch cu torchvision cu torchaudio cu f visual studio reports this error looking in links error could not find a version that satisfies the requirement pip from versions none error no matching distribution found for pip i have seen similar questions asked on this site but some are circumventing on conda while others did have unclear answers which were not accepted so i was in doubt whether to follow the answers or not i have a very important project i need to present and i can t do that unless i install torch with cuda enabled please help me and thanks,0,75,162 how to delete outliers of a specific column i d to delete some outliers from my dataframe outliers i d like to delete are values bigger than and below from columns ending by g and in that case i found a way to filter columns ending by g but at this point i can t find a way to delete my outliers,using arrays as values with matplotlib im currently trying to plot the data i recieve from an api hypixel by pushing the values into an array and using that array as input for a matplotlib graph i wanted to make sure it worked so i made a test program see below and sure enough i couldnt get it to work im completely lost so i just wanted to ask if any of you knew how to use an array as input for a matplotlib thanks,0,63,86 how to recall random valuable from python when i check the if condition the valuable num doesn t work only else work why please help me i don t know what to do,how did print a a pop change this code python prints does the pop before unpacking python prints does the pop after unpacking what caused the change i didn t find it in the changelog edit not just in function calls but also for example in a list display prints vs and expression lists says the expressions are evaluated from left to right that s the link to python documentation so i d expect the unpacking expression to happen first,0,31,92 utf error while adding data to postgresql with python error characternotinrepertoire error invalid byte sequence for language encoding utf the csv file contains letters containing s i o g i i think the error is caused by this but i don t want to change them,selenium next pages with javascript throwing elementclickinterceptedexception error my code is working fine but the pagination portion throwing the following exception your help is much appreciate script,0,41,27 coordinates python i am facing with the sorting coordinates in particular given a set of coordinates which are not sorted i have to sorted them starting from the trailing edge upper surface,google colab change variable name everywhere in code cell when i highlight a variable within a cell in colab all the instances of that variable shines up is it possible to change all these instances of the variables at the same time and if such how,0,32,46 use domain in act window odoo i worked with stock picking model i added a button in the form view when i click in this button i want to create a new record in helpdesk ticket model with domain of field product id same of list of products in stock move lines here is my code i tried it with domain but doesn t work any help please thanks,backend youtube dl py line in fetch basic self dislikes self ydl info dislike count keyerror dislike count i have the below code that has been used to download youtube videos i automatically detect if it s a playlist or single video however all the sudden it is giving the above error what can be the problem,0,66,48 how to output this json which is in the format below in discord the code works by the user inputting on discord cryptoupdate bitcoin i want the program to output the following without the speech marks and curly brackets click here for json response output on discord code,how to install python package libpmf from makefile i would like to install package libpmf whose official website is the complete file of this package can be downloaded from here after unzip we have inside folder python we have inside readme we have my os is windows pro version h build and my anaconda is anaconda windows x i could not understand the instruction type make in this directory could you please elaborate on how to install the package in this situation,0,48,83 package unixodbc bin is not available but is referred to by another package i was following this answer to be able to connect to an external sql server using the google console cloud run however i am receiving the following error when deploying docker file i also created the odbcinst ini file as described here the python image it is using is any help would be appreciated,printing out a matrix out of a two dimensional list i would like to implement the str method to nicely format the string representation of the matrix one line per row two characters per number d and a space between numbers for example i ve tried this but my output becomes how would i solve this because the none shouldn t be there,0,68,61 getting output as character and it s occurrence in the string the input i gave is like this input abccdddeffg and the output i want is character and it s occurrence number output a b c d e f g my code thanks in advance,valueerror and ambiguous truth value when using if statement in pandas i get this error when i run my if statement in pandas my code so what i m trying to figure out how many hours we need to top up if they re a full time or part time worker their minimum is and the if statement i m trying to execute is supposed to add the remainder hours the minimum hours hours worked and add it to the existing hours that they actually worked to reach the minimum otherwise if they exceeded the hours for the week then just return hours worked is there another way i can do this where i can just replace their hours worked with either or depending on their work status if the hours is the numbers in the ftorpt dict sample data expectations thanks,0,37,142 message default backend selenium python i m trying to start a selenium application with python via webdriver remote like they recomends on documentation but when i run the code below i get the following error message my code is here i ve already tried to remove the options and use only the recommended code as below but i got the same problem,connect python to mysql database how can i connect to mysql but my database is not localhost here my env i try to change the host to,0,62,28 find python exe path on another drive hi i m trying to find any python exe s on a drive other than my c drive i ve written a python script that runs off my a drive however when i change my drive and run python it uses the python exe from my c drive but i want to find out where on my a drive any python exes are installed how can i do this,how can i make specific styling according to my column name pandas the data looks like the below i should be able to ignore applying the style on some column example in this case col doesn t have to be always col i should be able to ignore it by specifying the name of the column not every column should have the same style example for col and i want to color in green positive values and in red negative values however for col i want to color in purple values below and yellow the rest the actual dataset has dozens of columns which different conditions to each regarding the coloring code which is function of column name what i have tried but this doesn t give me any way to specify column name although it did color all my data red or green i tried to pass the column name as parameter for color red or green and adjusted the function accordingly but then had an exception typeerror the first argument must be callable on styler to excel output xlsx line,0,73,175 how to rank the column values based on a dictionary and retain the highest value lets say i have a dataframe as following and the dictionary is the output dataframe must be,how do i merge items from a dataframe into a query i have a dataframe like this and want to combine these column into a query like this in python sel crd from t union select deb from t union select lon from t thank you,0,34,48 resize treeview widget in tkinter i m new to tkinter gui framework of python i have a doubt in treeview widget of the tkinter gui my doubt is how to resize the treeview widget so that i can place the two treeview widget aside photos attached below and i doing a project on mysql database so for the frontend i used tkinter gui screenshot of output which arugument i should use to change the size of treeview widget,scrapy shell view response not working proprly when i open the scrapy shell through the command scrapy shell this example comes from the scrapy tutorial i enter the command view response which opens my navigator firefox to be precise with a path looking like file tmp tmpnzkkilst html and the error file not found any idea on how to solve this issue,0,78,59 env file always returning none using os environ get and os environ i m trying to access the env file but it always returns none here is my file structure in my env file i ve written i ve tried doing and both of these methods return none so what am i doing wrong here any reply will be appreciated here is also the error message just in case it s useful,can someone please explain how can i find the winner of each game in a dictionary so i m supposed to find the winners from p n p n where n and n are the number of games player p and player p win in the match i have to write a function winner records list dict str int that takes a list of all match records and returns the name of the tournament winner the tournament winner is determined as the player with the most wins from each input also the function should return a string if it cannot determine the winner example here is my attempt at the code so far but it doesn t really work what changes to my code should i make,0,65,122 how to copy every repository folder from one jfrog artifactory to another jfrog artifactory using python there is a package called dohq artifactory in python which copies file from one to another artifactory but not folders repositories i have tried to copy folder with same package but it didn t work please let me know how to accomplish this with python or suggest if there is any better way to accomplish this,linux tmp folder bad file im writring a python script that checks some permmission and if you have permmission it will open xfreerdp now i have a problem if i just write in terminal the xfreerdp command it will open this but if i use this python script it won t the error is that usr bin xfreerdp tmp mei cxde libz so version zlib not found required by lib x linux gnu libpng so but if i replace the libz so with lib x linux gnu libz so while running the python script it will work how can i tell what libz so copy in this temp file,0,68,90 adding the last position of an array to the same array in matlab one can do how can i replicate this in python,pytorch error expected isfloatingtype grad scalar type input is complex grad is complex to be true but got false i am working on the implementation of the classification problem my code works well before inserting the complex noise into the output layer the following code does not work with pytorch error before adding start of error point end of error point lines the code works well and classification works but i get the following error on last line after adding codes this forward function models transmitting images on a complex awgn channel so input x is an image and start of error point end of error point parts denotes an adding complex noise is this problem because the complex value is added in the middle of the forward x function so the learning does not work if input is real but i want to put the complex value in the middle of the forward function then what should i do,0,23,167 relationship between batch size and data size i have simple and basic question about batch size for example this simple rnn use datasets this fit shows these result however dataset is and batch size is so it must be like around or am i wrong somehow there comes,http server not responding until after the connection closes i have an application which uses the requests package to post to a server in my testing environment i want to stand up a simple server so that i can validate the client s requests however when i call requests post it just hangs the server doesn t respond at all until after the client finally times out and the connection closes ironically the server then sends a ok here s my mre for the server here s my mre for the client,0,52,87 pandas dataframe multiply with a column of another dataframe is there a way to multiply each element of a row of a dataframe by an element of the same row from a particular column of another dataframe for example such that df and df results in so basically such that df i df i j df i,comparing timestamp of the same dataframe in pandas i am working with a dataframe similar to the one below i have to compare the timestamp of rows if the timestamp of the rows is within hour then get the name from the row which has a value and populate it in other rows which don t have current data expected data but i can not find logic to this problem any idea,0,55,72 attributeerror relatedmanager object has no attribute reverse connection i m trying to implement reverse connection but i get this error admin i mobileinv imei invoice seller username attributeerror relatedmanager object has no attribute invoice this is my models py im trying to return seller name from imei model here is my views py is there something i ve missed please or should i change something please thank you for helping,running python scripts simultaneously in vs code consider the following scenario i have two python scripts the first a long running process and the second a short running process i heavily use the shift enter shortcut to run code directly from my py files currently in vs code i can only manage to have the interactive environment with one script that is if i run the first long running script and then open a new python terminal window running a line such as print hello world will run in the first terminal i want to learn how to change the shift enter so that it executes in the second newly opened terminal window i ve looked at a few so questions namely this one but the solutions either don t work or are not applicable to my use case,0,63,134 django attributeerror when saving data with drf i have a problem when i make a post the entry is created i can see it in django admin panel but drf is throwing me an error attributeerror at api v reviews review object has no attribute review score review score beeing a serializermethodfield in serializer py needed for the frontend get is working perfectly model py views py serializer py,pyparsing issue with works with pyparsing this is working fine with pyparsing but doesn t work with latest pyparsing version the example input given is this results in exception with latest pyparsing module i tried different ways to solve this but not getting rid of this exception let me know if there is any obvious mistake in this approach,0,61,62 is there anyway to write latex algorithm in sphinx doc i want to write algorithm in latex in sphinx doc is there anyway to do so,error when posting payload data string to hubspot using an aws lambda python api call i have recently uploaded contact records to hubspot using postman here is a raw json data example and post method that i use to successfully upload a contact next i then created a python lambda function to automate this process because we want to ingest csv files that may have many records to extract so i had constructed the dictionary to look the same as the string above which had worked great fine with postman however when i try and do a post method api call to hubspot using my dictionary payload i am getting this error invalid input json cannot build objectschemaegg invalid input json on line column cannot build objectschemaegg some of required attributes are not set name labels here is the processed dictionary string that my code constructed for the api call here is my lambda code in full give special attention to both the call to post to hubspot and also the post to hubspot function itself the code that loads the dynamo table is working correctly what could be the problem thanks for your help,0,24,193 selenium common exceptions invalidargumentexception message invalid argument user data directory is already in use error with real chrome browser i m trying to open website in my real chrome not a driver but i got list of errors and it does t open the url here is my code the errors like,appium driver find element reutrn dict instead of webelement ev appium node v jdk v android sdk python i want to locate the element but the function returns a dictionary type and throw an attributeerror dict object has no attribute click this is the code good is element the following is the return information displayed on appium is this normal if so how should i click the element any help would be appreciated,0,48,79 compatibility of datetime with cudf and pandas for filter datetime in python i want to test cudf but stuck with a first simple task of filtering by datetime code works perfect with pandas but not with cudf testdata csv looks like with cudf throws keyerror datetime,why does my ide keep saying that my variable can be undefined i am writing a program to calculate the sum of the first n natural numbers but i am having a hard time coding the first part of the program in which i ask for the input from the user about how many successive natural numbers to add it s a very long code for such a simple task because i want the program to be able to ask to try again in case the input isn t a natural number accept mathematical expressions that are equal to a natural number e g to get back to the point why does my ide keep telling me that n can be undefined and if you d be willing to take the time to tell me how to shorten my code that seems a little repetitive i d really appreciate it thank you for your time,0,45,153 typeerror unhashable type numpy ndarray python image classification using tensorflow and keras i try this sample code for image classification the terminal pop this i try to check the data from the pred with output im not sure why because the data is from set of an array im new with this and im using python can someone help me,function within if statement not returning a value instead getting name error i am doing some fuzzy matching on addresses and am filtering on a high score if that score exists in my data set then i want to call another function that looks at the data and checks to see if there are sales calls associated with it i want to ultimately return a list of values that fit the criteria in that function while debugging i can see the sales and calls test function works i see the values getting appended to my lists however when i go to the next iteration i see my lists in my debug watch change from a value to a name error name call list sales list not defined can someone please look over my syntax and show me what im missing thanks here s my code,0,59,138 issue while working with django orm or raw sql query list edit drivers html this is html file for showing data at front end urls py ajax call driverviewset url and html render list edit drivers url views py serializers py i need to this sql query implement for change logic i don t need to change existing field name and all only change logic based on below sql query raw query or orm both okay sql query output ex models py,filter data from multiple files at once i have multiple folders each containing several thousand files i need to filter each file in each folder based on date once all the files in a folder are filtered i need to create a zip file of each folder containing all the filtered data csvs the below function creates a zip file of the individual files which is not really what i want one solution that works is creating a new file for every file in a new folder with the filtered data then creating a zip of the new folder i don t want to do this as the data files will be repeated across multiple folders i ll run out of disk space additionally it s massively time consuming given i am dealing with several terabytes of data is there a way i can filter out data from all files at ones into it s own csv in memory zip it all up,0,74,164 cluster values within two columns in groups in pandas i have a dataframe like this and i would like to cluster into groups the val and val values for instance and i should then get here is the dataframe if it can help,generate random binary strings of length i want to generate random binary strings of length i e from to where each string is length i m wondering how i could do this efficiently or pythonically right now i randomly choose between and times and then append the results into a string this seems pretty inefficient and not pythonic is there some library functions i could use for this,0,44,75 dynamically slice tensor of arbitrary dims i m writing a definition that needs to take slices of a tensor with an arbitrary number of dimensions the slice will always be on the batch dimension of here is a simple example of what i want i want to be able to feed it various sized tensors and get the indexed slices out as a batch such as thanks in advance,rare misspelled words messes my fasttext word embedding classfiers i m currently trying to make a sentiment analysis on the imdb review dataset as a part of homework assignment for my college i m required to firstly do some preprocessing e g tokenization stop words removal stemming lemmatization then use different ways to convert this data to vectors to be classfied by different classfiers gensim fasttext library was one of the required models to obtain word embeddings on the data i got from text pre processing step the problem i faced with gensim is that i firstly tried to train on my data using vectors of feature size but yet they always fail at some point i tried later to use many pre trained gensim data vectors but none of them worked to find word embeddings for all of the words they d rather fail at some point with error the ones i ve tried so far are conceptnet numberbatch doesn t contain glass word vec google news ram insufficient in google colab glove twitter doesn t contain crawl d m doesn t contain waltons wiki news d m doesn t contain waltons glove wiki gigaword doesn t contain riget got their names from these sources here and here by inspecting the failing words i found that even the largest libraries would usually fail because of the misspelled words that has no meaning like riget waltons etc is their a way to classify and neglect this strange words before trying to inject them to gensim and receiving this error or am i using gensim very wrong and there s another way to use it any snippet of code or some sort of lead on what to do would be appreciated my code so far,0,69,279 why f refer to attribute when m refer to method does anybody know why f refers to attribute when m refers to method i mean why don t use a to refer to attribute,i need to make a generator function that takes args as an input i need to make a function which will return successively as a generator the square of the difference of each value from the average of all the values given as input the function must a accept an undefined number of parameters b be a generator function the values will be integers to calculate the average of all values i can import statistics have you got any idea the code i tried to write,0,33,86 no module named tabulate i have tried to install tabulate with pip and pip in my virtual environment and the installation goes well when i try to execute the code it tells me that it does not find the module no module named tabulate i ve seen that this is a widespread problem are there any solutions,how do i increase number of order detail without refreshing i am beginner in django i create checkout page and when user on change input range number enter image description here it s send to server but it work for first one i think because i set same id for all input and i can t change it because it s in for tag how can i fix it django part ajax part html part,0,57,75 flask event handler not receiving events from socketio i ve been working on a flask chat application for the past few days while trying to add socketio the flask console displays that it is receiving the message but the event handler in my script is not getting executed that is the output the flask console is showing me the browser console outputs nothing here is app py and here is the html file,pygme spritecollideany argument must be rect style object,0,71,8 randomly select layer in tensorflow model i want to use different layers with specific probabilities in my network layers are the following classes and the network is like below each time i run the code below i get the same output but i expected different ones is there any way to implement this,can t upload file from python requests while curl is work fine i am trying to upload file to some api with this function and get client error unprocessable entity for url while curl command works fine what makes the difference,0,53,42 valueerror unexpectedly found an instance of type class keras layers core lambda layer lambda expected a symbolic tensor instance i am trying to train a cifar dataset using transfer learning and a research paper used a resize technique but the functions change names i am getting this error how can i fix this valueerror unexpectedly found an instance of type class keras layers core lambda layer lambda expected a symbolic tensor instance,crop the image using tensoflow imagegenerator preprocessing fucntion by opencv i create a function for croping eye image because outer side of eye image is balack and unnecessary pixel but if i using this function for loading image in opencv for large resolution allocate the memory i want to crop the image using tensorflow imagedatagenerator preprocessing function by opencv crop image is my function and its work properly train is a path train normal and abnormal file where image are stored after using this it see the number of image but show a error systemerror returned null without setting an error how to solve this problem,0,62,108 checking if in a table in mysql are two rows with the same elements let s say we have the tables table and table in both table and table we store a name age and date how can i check if an entry from table and an entry from table have the same name and age,custom function for annotate i am trying to extract records with my django orm model the model is represented by goal my goal is to process user level in the query in order to transform those ids in text i have a dict key value with those ids for that i was thinking of writing a function custom level to process the pairing job i am using annotate but i am not really sure of its correct use how would you process the pairing between ids and text in order to get a single text line any clue thank you,0,55,97 is there a way to not get duplicates i was wondering what i am doing wrong i m writing a python program that converts my joke made programming language into python i always get this weird mess this is my code i used this file as a test python puts out this file when running the program i want my output to be,use numpy functions on objects extending numbers real pep introduces abstract base classes for different kinds of numbers to allow custom implementations i want to derive a class from numbers real and calculate its sine value using pythons math module this works fine when i try the same in numpy i get an error results in it seems like numpy tries to call a sin method of its argument to me this is quite confusing since the standard data types like float do not have such a method either but np sin works on them is there just some kind of hardcoded check for standard data types and pep is not supported or did i miss something in my class because it is quite tedious to implement all required methods here is my current code that works with the math module,0,61,137 why height parameter is not working in label widget pycharm showing me to remove the attribute height it is not an option,click unable to register group command i am trying to run a click cli through a bash with a different command groups run through a single command collection src preprocessing extract data scripts main py src scripts main py scripts entrypoint sh i run it using scripts entrypoint sh start date end date today but it keeps failing and throws the following error,0,22,48 getting error message while runing code in pycharm i m trying to run a code that will draw a love image using pycharm but i get an error that i seem unable to fix please i need help with this what am i doing wrong i get this error while runing the code below in pycharm i don t know what am doing wrong,how to filter on index date and add the first new future date in a new column i have a dataframe name data that have daily date as index datetimeindex and column with price i want to add a new column that will gave me the first future date between the and of future year here s an example of my data frame i tried to create a column month an array with conditions and add a new column base on those conditions but it don t work i also try a loop but won t work neither here s the code that i tried but would love an easy solution to my problem,0,62,114 can you set a different json for every users in locust so i have a scenario for a load test where each spawning user post a different json in this case i spawning user this is the example json for post where site code should be different for every request and here is the example for implementing the task for each users how can i achieve this with locust,how to create working callback on legenditem in bokeh i want to call a customjs callback on a legend or a legenditem when the visible attribute of a renderer changes i have this minimal example when i use the pantool i can see a the text output xrange if i click on the legend and hide the line the log shows no message how to modify the code to call a callback if the legend is clicked or a legenditems hides,0,70,81 azure ml studio container has crashed did your init method fail i am trying to deploy an ml model through the azure ml studio using the notebook itself the commands we are using can be found here we have registered the model as below but while running this command we are getting the error that container has crashed did your init method fail the logs are the init method is,call a method in map and lambda using dictionary as input in python without using lambda and map i tried below line to iterate using lambda and map expected output using map and lambda,0,71,34 when run pip compile requirements in in macos monterey using venv python pg config not found os monterey macosv python venv requirements in after i turn on venv then i type pip compile requirements in then i get a bunch of errors about pg config not found this is my asciinema i have tried env ldflags l usr local lib l usr local opt openssl lib l usr local opt readline lib pip compile requirements in but same please advise,python beautifulsoup google search page scraping with specific text not giving any title i am completely new to web scraping using python beautifulsoup using so and other blogs i have tried to build my first piece of code objective given a string as input the code will search in and get the search results with following information say i want to search core banking solution by accenture to do so i am getting an error for title clearly it is not getting any title object from soup find all a question what trick i have to apply here to get the title does soup find all a really contains any title tag what i am missing here update based on the suggestions received i have updated code piece now it is working although need to check the results in details,0,59,137 python how to print only keys of list of dictionaries i would like to be able my list of dictionaries by key however my code is returning the key and the value as follows output if i omit the index in my code i get the following error what is strange about that to me is that if i run this code it returns is this a data structure issue,how to exit an input at a specific time in python i am new to python and am looking for a way to stop an input after a certain time for example while waiting for user input after seconds i want to check the time if the time is a certain time then i want to stop the input and move on i tried using a non blocking input for this but i was not able to find a way for it to work i also do not want to use threading i am also looking for a cross platform solution i know i have a lot of requirements but any help would be appreciated thanks,0,71,115 how to clip a polyhedron using a plane in python i want to split a parent convex polyhedron d using a plane d into child closed convex polyhedrons how to do this in python an illustrative example is shown in image below,i can t get image url scraped from website i am using this python code to extract cars details however i managed to extract them except the image source url which am facing trouble with you can at my code below in terms of error am getting the following output anyone have idea what am missing out here,0,43,57 why is there a difference in how the in operator behaves this works perfectly but when i apply the in operator to an array like this it fails,how to use temporary file from form upload python django i have a form where users can upload up to images at a time i have changed my file upload max memory size in django settings to so all files uploaded via a form are written to a temp directory in my root folder i am then trying to process the images with opencv this returns the absolute file path of the temp image in a string format so i put that in the cv imread however it creates a nonetype instead of a numpy array like it should and then my program cannot run when it reaches how do i read the temporary file into opencv any help is much appreciated,0,28,120 object has no attribute read error pil library i am trying to load an image from a specific url using the image open method from the pil library however i am getting the following error my code is as follows,pandas jupyterlab hiding first half of string between when i display this pandas dataframe in jupterlab it appears like this with hidden values in boxes between the columns it s obviously the bracketing with the two that s making this happen but i can t find this anywhere in the documentation has anyone run into this before what s the purpose of the functionality,0,39,61 attributeerror relatedmanager object has no attribute reverse connection i m trying to implement reverse connection but i get this error admin i mobileinv imei invoice seller username attributeerror relatedmanager object has no attribute invoice this is my models py im trying to return seller name from imei model here is my views py is there something i ve missed please or should i change something please thank you for helping,python error when i try to install cloudgenix config i installed python and i am trying to run pip install cloudgenix config or pip install cloudgenix config i keep getting the attached error,0,63,31 python requests from window state i tried to extract the location from this url but it seems that the returned information is different from if open that url in browser my simple code is can someone explain me why my only guess is this information is in window state and im not sure how to deal with it thanks a lot,how do i replace memcachedcache with pymemcachecache in django i m running my website on django i read in djangos cache framework that memcachedcache and python memcached are deprecated i installed pymemcache on my staging server and changed to cache url pymemcache in env ini but if i uninstall python memcached with pip i receive an error message that indicates that memcachedcache is still used by my code and it fails on import memcache my code uses the following imports how do i replace memcachedcache with pymemcachecache so that memcachedcache will not be used in my code i m using django environ and caches is defined in my settings env is defined as environ env my traceback my repository update i checked the email message i received for debugging and i see that the caches in settings is equal to default backend django core cache backends memcached memcachedcache location i submitted an issue possibly a bug on,0,60,147 problem with eliminating rows that contain nan in selected rows in ascii data file i have an ascii data file containing nans in each row my goal is to keep the rows where column name lat is not nan here s the partial listing of my data file here s my code any help thanks,how to analyse space complexity of algorithm for countnondivisible i m trying to analyse the worst case space complexity of this algorithm for solving codility s countnondivisible problem the problem statement youre given an array a consisting of n integers for each number a i such that i n we want to count the number of elements of the array that are not the divisors of a i we say that these elements are non divisors write a function that given such an array returns a sequence of integers representing the amount of non divisors for each element write an efficient algorithm for the following assumptions the algorithm with comments added by me the article states that the expected worst case space complexity is o n but the divisors dict requires space for the sets of divisors it stores if each value in the dict were an integer it would be clear to me why the worst case space complexity is o n but each value is a set of integers so i think it follows that the total space required for the sets of divisors is proportional to the total number of divisors in the worst case roughly how many divisors will be stored across all these sets the worst case should occur when for a given n we maximise the total number of divisors stored across all the sets to do this i think we could use the following algorithm as an example if n then n and before sorting bi b and after sorting bi b and input array a the total number of divisors is what im struggling with is how to generalise this for any n in the range i assume the o n worst case space complexity is stated proved somewhere by codility but i havent been able to find where is my analysis above on the right lines if so how would i finish calculating the worst case space complexity if not then is it actually o n and if its o n what am i doing wrong in my analysis,0,53,454 how to detect tcp port scan using python i am a newbie to network programming in python i would like to know if there is any way that we can code in python to detect this kind of scan i would like to build a open source project by using the method that you might suggest thanks in advance,finding previous group s name in pandas dataframe i want to add a column to my dataframe with repetitive values which contains the name of previous group float and sortable any idea before after,0,60,33 parsing xml in python by using xml etree elementtree i get an xml file using the request module then i want to use the xml etree elementtree module to get the output of the element core usg but i m already confused how to do it im stuck i tried writing this simple code to get the sysname element but i get an empty output python code xml file,convert all dates column to datetime of multiple dataframes in a dictionary i have multiple dataframes stored in a dictionary and i try to change the type of the dates column from object to datetime for all dataframes in the dictionary at the same time this would be an example with two dataframes df df i try to figure out a way to convert the column dates to datetime format within the dictionary for all dataframes at the same time so far i was only able to convert them individually before putting them together into a dictionary with df dates pd to datetime df dates thanks a lot,0,63,105 i want store a specific number when achieving the condition in to a list python i want to store and in a list when achieving the conditional wholesale i want to store value ms explain more about what i want i am new to programming sorry if there are errors in the code,selenium python proxy i want to use proxy with selenium i watched the video from youtube how to do it but it doesn t work this is my code why proxy doesn t work please help me kind people,0,55,37 valueerror could not convert string to float mme when i run the following code in jupyter lab then it went errors and note that valueerror could not convert string to float mme details are like these i tried to print titanic predictors and titanic survived then the details are follows how to solve this problem,how to i update my trained space ner model with new training dataset i m new to nlp i started learning how to train the custom ner in spacy training the blank spacy model for the first time saving my trained spacy model my question here is how to update the saved model with new training data new training data could any one help me with your solution and tip for this thanks in advance,0,51,74 redis get stuck indefinitely i am trying to connect to remote redis server using python for that i am using version redis but when i print redis get it is stuck indefinitely below s the code snippet this is working now had to add ssl true for my remote connections,filter time in a dataframe using python i have a column where there is only time after reading that csv file i have converted that column to datetime datatype as it was object when i read it in jupyter notebook when i try to filter i am getting error like below code sample data here i am trying display the rows whose appointment time is between to datatype info could anyone help thanks in advance,0,47,75 opencv qrcodedetector causes valueerror too many values to unpack expected help me i have a problem about error,extracting url from html in python i am trying to obtain a list containing different url that appear partially when you see the html version of this webpage i have tried a couple of different things yet they don t really work first attempt links contains the following in it you can see the pieces that i want for example url content renfe es es cercanias cercanias valencia lineas jcr content root responsivegrid rftabdetailline item html i would like to obtain all the different content renfe es es cercanias cercanias valencia lineas jcr content root responsivegrid rftabdetailline item whatever html in a list in order to do so i have tried an extract and using regular expressions but i have not been succesful second attempt following the steps that are shown in the answer to this question extractinf info form html that has no tags i obtained the next piece of code i thought that it would work because of the similarities in the output it produces but when defining parsed list the next error is returned does anyone have anythoughts thank you all in advance,0,19,157 how to add songs to my templates in views if i post a song from my admin panel i want the list of song to appear in the templates i already created a models that allow me to post it but i don t know how to create a views that allowed the song to appear in the templates please how can i do this this is my empty views views py this is my models py i created models py,how to embed facebook video in django project what is the easiest way to embed facebook live video or any facebook video in any django website i used package but it s work only for youtube video,0,78,39 how can i reorder a numpy array from high to low in another array without using in built functions i am having a bit of trouble here plus i am new to using numpy what i want to do is reorder the array t in v from high to low and changing the highest number to everytime in the array t without using unbuilt functions i would truly appreciate any help thank you,dataframe slice after every nth column in python my dataframe has rows and columns and i need to slice the dataframe such that all slices chunks are of a size each so i want a since after every nd column finally i want to append all these slices one below another so i get a final dataframe of size any help will be appreciated,0,74,74 python numpy array of numpy arrays as object i have some np arrays i want to concatenate them as objects in an np array i want to obtain coordsall this is my code coordsall is now but i want two objects in my output array like many thanks,i either don t understand multiprocessing in python or flask sqlalchemy some time ago i wrote a flask application in python which spawns a new thread that does some processing then updates the application db sqlite on a regular basis the function i use to update the db is quite simple this worked quite well my thread has spawned several other threads each of these calling the update db function above which updated the db correctly now i changed my code because i wanted to make use of a process instead of a thread which would then again spawn those other threads so i did nothing more than simply inherit my class from python multiprocessing process instead of threading thread this child process now does all the work and still correctly very well but what i don t understand is why my db updates still work as before even though i have not changed the logic shown above the global variables flask app and database are set in my main application process before the new process is being started then in this new process i still call the global function update db as above and that still works first how can another process access these two global variables they are not passed from the main process to the child process the latter simply accesses them without any change in code since they are global objects in the python script moreover how can the child process access and update the db if both flask app and database objects have been created in the main process and again never been passed to the child process,0,48,267 google colaboratory os mkdir filenotfounderror errno no such file or directory i am trying to run autoencoder train ipynb on google colaboratory however i am getting this error what is going wrong here here is a link to my file,how to forward message from a specific chat in telethon this is a continuation of this short forum how forward message to other contact with telethon i replaced entity with the group id for gc a and it works since i type something in gc b the bot forwards it to gc a however when i message gc a the bot still forwards the messages to gc a which i don t want i just want it to not react the bot forwards every new message because the event type is new messages so i was thinking is there a way to filter it so that it only triggers when there are new messages on a specific group looking at the documentation there is an example with the argument from chat so i placed the group id of gc b but it doesn t work await client forward messages chat message id from chat i also tried making the argument look like this to copy the examples better but it does not work await client forward messages entity group id event message from chat group id,0,38,171 cluster values within two columns in groups in pandas i have a dataframe like this and i would like to cluster into groups the val and val values for instance and i should then get here is the dataframe if it can help,question about python string q how can i fix this i m taking a python intro course and couldn t solve this problem make this string correct and store it in a variable named q any help would be much appreciated,0,44,49 how can i make a variable for each person in my discord server with python i am making a game for my discord server and i need every member of the discord server to have their own number of coins therefore i need every member of my discord server to have their own variable for their coins if anyone knows how i could do this that would be a huge help thanks,can not make detailview render data hello guys i m new with django class based views i m learning what am i doing wrong it suppose to render ids but it does not url py views py html,0,72,35 run function inside a loop without its stopping i d like to run the loop and return some value from the function with time sleep without interrupting the loop how to make the function and the loop work simultaneously the function prt uses time sleep i d like not to wait this time in the loop i need the loop to keep running while the function is sleeping to get something like that,python non blocking read on stdin in an asynchronous context i m trying to build a script that runs asynchronously while having a start stop mechanism based on user input from stdin i created two threads one for the asynchronous work and one for reading from stdin my idea is that the program runs until the user types stop in stdin and the asynchronous tasks wait until the user types start in stdin here is my current code expected behavior current behavior besides having to keep the pool input thread active in some way because once it reads the input once the thread ends and i never start it again i don t know how to make the desired outcome work,0,69,117 python comment preserving parsing using only builtin libraries i wrote a library using just ast and inspect libraries to parse and emit uses astor on python internal python constructs just realised that i really need to preserve comments afterall preferably without resorting to a redbaron or libcst as i just need to emit the unaltered commentary is there a clean and concise way of comment preserving parsing emitting python source with just stdlib,function within f string is returning the function outside the string and returning none inside the string i m new to python and trying to do an f string as follows where east room is an instance of a class and get highest priority is a method within the class to display a patient with the highest integer for the severity attribute as follows this is the output conor naseau the next patient is none please i know that this method works as it works perfectly if i call it without the f string thanks for you help,0,72,92 package unixodbc bin is not available but is referred to by another package i was following this answer to be able to connect to an external sql server using the google console cloud run however i am receiving the following error when deploying docker file i also created the odbcinst ini file as described here the python image it is using is any help would be appreciated,printing out a matrix out of a two dimensional list i would like to implement the str method to nicely format the string representation of the matrix one line per row two characters per number d and a space between numbers for example i ve tried this but my output becomes how would i solve this because the none shouldn t be there,0,68,61 how to draw semi infinite line ray in matplotlib we can draw infinite lines from a given point with given slope in matplotlib with plt axline is there a clean way to draw a semi infinite line or ray from a given point in a given direction preferably without having to calculate the axis limits for axhline and axvline we can use one of xmin xmax ymin ymax arguments to get a ray but axline doesn t accept these related questions,how can i sort a list by the second item descending and first one ascending i have a list like this i wish to sort the number in descending order and if numbers were the same according to the name in ascending order i tried the following code and the reverse but i couldn t figure out to do it the answer that i m looking for is,0,78,66 how to make particular column values as upper case if i have a dataframe like now how do i make a and b column values as uppercase for single column for all columns or expected output how do we do it for two columns at once like we could do the single column one twice but looking for how to do for both columns,what unit is my distance in between two lat long points i have calculated the distance between two points using geopanda s gdf distance function i have my distances but i don t know what unit they are in my geodataframe has a crs of epsg i understand that my coordinate system is using decimal degrees lat long and that the distance function calculates the euclidean distance but what is this distance in my code output,0,64,71 error while running python code into c please how to solve it hey everyone i m trying to run script python into c as i m a beginner but i got this error microsoft scripting syntaxerrorexception unexpected token from my c code and my python code is but i don t know how to solve it the full issue and the error by details i don t know how to solve it please help,i am getting error while installing web module in my django project i am getting this error when i am trying to install web in my django project cant understand whats wrong if anybody knows please help i am installing it in my virtual environment meta c users saran onedrive desktop interview crypto core,0,69,47 trying to create mongodb collection using below two mongodb collection based on id using python trying to create mongodb collection using below two mongodb collection based on id using python mongo collecton abc mongodb collection def compare mongodb collection abc and def based on id and if matches get abc action from abc and other key value pairs from def result,tkinter fullscreen still available after root resizable false false i am trying to make a python application that requires disabling the window resize and fullscreen mode on a mac i used root resizable false false to do the work it does stop the window from resizing but for disabling the fullscreen mode only if you iconify it first and then deiconify it i wonder why and is there a workaround edit found out that adding the window icon caused this problem solution to this is adding root withdraw and root deiconify after putting the icon,0,60,87 beautiful soup test if a div is children of a div is it possible to test with beautiful soup whether a div is a not necessarily immediate child of a div eg now i want to test whether the div with class aaaa and the div with class abaa are not necessarily immediate children of the div with class aa how can this be done of course the actual html is more complicated with more nested divs,how to get random names from a list without repeating names python i am very new to python and i have run into a problem that i can t find the solution for i am trying to create a unique character generator to create the names i have a pool of names that are in a txt file and also suffix which are in another one however i run into the problem that when i run the code sometimes the same names appear as they are chosen at random each time round this is the code that i have written for it i will be thankful for any help,0,77,108 discord py how to make bot reply to multiple messages i m new to coding and i was following a tutorial on how to make a bot and it left off with one response and i was wondering how to add additional response options to the bot here is the code,pypi package not getting installed i m working on publishing a utility library for python mostly for my own use you can find it on pypi here repository is here here s my setup cfg i m building with python m build which gives me a tar gz and whl file when i pipenv install raddoo in another location nothing appears to get installed into site packages trying to import it fails as well what am i doing wrong,0,49,73 how to convert duplicate column names python dataframe to json how to convert dataframe to json df required format,numerical differentiation with python i have such a task you need to write a function with the following signature def derforward f i h this function should get as input function f and segment I as python list of two elements ends of the segment in the function you are asked to divide the segment I into small segments of length h thus getting a grid x your function should return dy forward differences for each point x except the border since the formula asks for the next value you should return both x and dy arrays of the same length my answer looks this way this function has to pass tests for errors and accuracy but now it is failing with tests and and i don t understand why i can pass only test the checker looks like this,0,19,145 in psynet i am unable to do dallinger generate constraint dallinger generate constraints fails error includes,socket programming encode decode data text more specific special characters send and receive through sockets win bit server in c the java client python client ran some experiments with special characters but neither the clients or server can handle it the java client result encoding done with utf the python app throws and exception because it can not decode the data received from socket python i tried to save the server in different encoding but i think this is not the case possibly some changes needed on the socket declaration clients are the same machine as server this is my actual question to overcome this problem,0,15,109 how to get only the last folder and filename of a path how can i get the last folder and the filename of a path in python i am doing is there a simpler way,selenium gives server error after click django pytest i have a django app that i want to test via pytest and selenium the routine i m trying to go through is to let selenium log in then go to the menu choose one of the options this redirects to a new page which is found fine there i let selenium enter data and click a button to start a submission this too works and redirects to a third page on this third your submission was created successfully page there is a link displayed that the user can click to collect the results of their submission this page this link is displayed correctly the href url is fine but when i let selenium click on it i suddenly get a server error when i do the exact same thing manually it works fine here s my test code slightly simplified i have already tried to use webdriverwait self driver until ec element to be clickable by link text click here for your results click and that doesn t seem to even click i know that error mean s the error is on the server side but before clicking the server is fine all the redirections before this step work fine the urls also check out and manually everything works as expected i have no idea how to narrow down the problem further how can i investigate the reason for this error and hopefully fix it,0,35,233 is there is way to display output of scala program in databricks i was trying to run the below scala code in the azure data bricks notebook it was running fine but not printing anything it just shows defined object mainobj after running how can i display output,how do i sum a list of attributes from a google datastore query result looking for an efficient way to sum a list of attributes using ndb queries currently i just fetch the results and run a for loop over them,0,47,41 viewing the source code behind python modules such as pandas and random i would like to see how to view the code behind these modules such as how randint from random works etc for example,check if value is maximum minimum of previous current and next value i have a time series data frame and i want to list the days when in three consecutive days high was the highest the second day and the same thing but the value of low was the lowest the second day i tried these two lines but i hardcoded the date after viewing the data i want to know if there is a way to not hardcode it df highest df loc high max df lowest df loc low min here s a piece of data,0,35,91 django form has no attribute cleaned data this is the code i have and when i run it on django i am met with this error title object has no attribute cleaned data,retrieving data from django html form and passing it to a mysql database i have a database with multiple user names and phone numbers attached to each user on the django template that i created the user is presented with a list of names and the user can click on a name or multiple names and the database is to respond with the phone number assigned to the name however i am using a for loop within the django template to iterate over the names in the database to display for the user as the count can change it works correctly when i select one name however if i select multiple name it takes the last name selected versus displaying all names this error is due to my for loop solution which has the same name assigned to all inputs anyone have an idea on how i can approach this my view form my template image of the html doc,0,31,160 can someone please fix it so that the function can detect whether the input has at least one symbol in it i want to see if i can fix this part because i am not sure how i can use this function to find a special character in the password,issues adding variable to getwindowswithtitle so i am having issues with getwindowswithtitle function from pygetwindow when i ask for input before the getwindowswithtitle call i get the following error if i comment out my input call the getwindowswithtitle works just fine the following is my code so far i am trying to get input to choose which window to select but even putting target in the getwindowswithtitle it gives me the same error does anyone know why i am getting this error after putting in my input,0,50,87 tuple manipulation in pyspark with lambda python i have a parallelized list of tuples in the format what i want is to multiply the integers within the tuples which will give me this output i have tried but with not effect,how to extract only the first sentence from the dictionary i m trying to create a game in python called save the girl one man will kidnap a girl and will keep him in his place and ask money from her family to reach his place he will ask three questions first he will ask one question and if they answer it then he will give a clue to reach his place for this i m storing all the questions and answer in a form of dictionary eg now i just want the first question from the dictionary how to do that i gave the command like but the output was the first letter of the first question ie w please help me out,0,41,121 swapexacttokensfortokens transaction has different ratio than router interface transaction i m writing a decentralized buy sell program and i ve stumbled on an issue that i find hard to figure out i m using swapexacttokensfortokens to swap this token for wmatic on quickswap the ratio is all wrong tokens for wmatic if i m using the qs interface i can swap tokens for wmatic passing through eth so not a direct swap my questions are,how to replace multiple values with other conditional strings or int values in a pandas dataframe series i m dealing with a huge excel sheet about k rows of raw data and i need to replace multiple values from one column with conditionals from another column something like if column a has written word in any row then replace str str in column b of the same row i ve done another replacements with replace function using lists this has worked perfectly but now i need to do multiple replacements for example current df excpected output in the example i would need to replace the column b with another value with the condition of the objects str or int of column a a a so the condition would be value value value the resulting value in the b could be anything i ve also tried this for loop but it replaces other values i don t want i have tried with subsetting also but didn t work,0,78,161 attribute error list object has no attribute split i am trying to split the links of the images what is wrong in my code,extracting floating values from a string in a dataframe i have the following dataframe df the dtypes of the result column is dtype o i need to extract the float values and filter them with a particular threshold i tried the following script to extract the values and change them to float however i m not sure if i m getting the right output especially when the value has a range in this scenario i want the max value i e desired output what would be the smartest way of doing it any suggestions would be appreciated thanks,0,25,96 issue with pip instalation of pyqt i m trying to install pyqt using pip i did it but in code it still doesn t recognise pyqt it is the ouput of terminal but the error still exist import pyqt cannot be resolved,how to slice an image with different dimensions in python i have a x image and i want to slice it with boxes which are different sizes and will be selected randomly for example pieces x pieces x etc box positions is not important and i want to use every pixel only one time below is my code but when i run it a lot of pictures are created and same regions are being used how can i make that each pixel will be used only time below picture represents which i want that is what i want,0,39,101 cluster values within two columns in groups in pandas i have a dataframe like this and i would like to cluster into groups the val and val values for instance and i should then get here is the dataframe if it can help,how to fix command injection issue on checkmarx for parse args i have python code that parses input parameters checkmarx says the following the application s main method calls an os shell command with cmd using an untrusted string with the command to execute this could allow an attacker to inject an arbitrary command and enable a command injection attack the attacker may be able to inject the executed command via user input parse args i think i need to strip the unneeded characters like and but am unsure how where to do it can i do it before this line opt agrs parser parse args thanks,0,44,101 calculating standard error does not give expected result i want calculate standard error of vector and i don t understand why it doesn t work let s consider vector calculating standard error of mean is just to calculate standard deviation and divide it by square root of length of vector however when i calculate this by function i obtain completely something different could you please explain to me why i don t unsterstand why this difference occurs,commanderror d python project resume already exists i am creating a django project i can successfully create virtual environment and pip install django but when i try to create project using there is an error that showed i tried uninstalling django twice but it only allowed me to uninstall once so it is likely not about duplicate django i also checked the lib site packages there are no duplicated folders or folders either however i do have two versions of python right now one installed along with anaconda one is separated from anaconda and directly downloaded from python org right now i am just using the separate python i even checked the python version and the pip version so it should be fine still i could be wrong since i am not that experienced what should i do,0,73,132 problems with pandas ta indicators rsi i try to put por trading strategy when rsi if and if the previous period if raise this error cannot perform rand with a dtyped float array and scalar of type bool,how to replace string values from column with na and turn column into float i have a column in my dataframe which looks like this dtype object i want to replace unknown with na and turn object into float type but when i do this this error appears typeerror cannot compare types ndarray dtype float and str how to solve this,0,43,59 not able to connect to aws aurora db server less mysql engine i have created an aws aurora db serverless publically available and i am trying to connect to the db using python but i am unable to connect and i suspect the vpc please suggest if i have to check anything else also i have these below queries code snippets method method method thanks nikhil,callback function doesn t print unless ran by jupyter here is the minimal code needed to reproduce the problem i call an api with a callback function that prints what comes out of the api call if i run this code in jupyter i get the output if i run it with python file py i don t get any output i already checked the api s code but that does nothing weird setting debugging to true isn t helpful either note that there is once dependency the bitvavo api install it with pip install python bitvavo api here is the expected output i get from jupyter,0,69,100 how to go back to a list of choices so i m new to python just wanted to know is it possible to use something like goto in c i make a choice like this after him choosing the choice and getting what he chose how do i make him get back to be able to choose from all of the choices again thanks pretty new to python and just learning how to make a basic cmd app,pandas keep the latest rows for the same id with some conditional column values i want to keep the latest rows with the same id and also the rows that match certain column values sample input here id has two values so i ll keep the latest row but for id once the survey is complete it can t have any other options like rang but did not connect so i want to keep the latest timestamps data and also keep those rows where once the data is complete survey but the latest data shows incomplete survey or did not connect all data after seeing complete survey so my sample output will be,0,79,112 even though assigned zero to variables yet i am getting error cannot aasign to literal error what is the issue here,is there any way in python to create list using key value pairs how to create a list of key value pairs in python i have these two lists i have tried this code output i am getting expected output,0,21,40 importing error of tensorflow via jupyterlab on python recently i ve downloaded tensorflow it s working when i start ipython using the terminal with the command jupyter notebook however when i use jupyter lab i can t import tensorflow i tried to reinstall tensorflow again but it isn t working any ideas on how to fix this issue n b i m using macos with m chip i m not sure if that s relevant anyway,only django request body contains data not request post i am using forms in django and trying to get the get the data back using request post but this returns an empty dictionary for me querydict when using request body however i get the raw data back how can i get the data from request post as well because i do not want to work with raw data the console output of the print statements are put in comments next to them forms py views py blank html,0,66,81 no module named tabulate i have tried to install tabulate with pip and pip in my virtual environment and the installation goes well when i try to execute the code it tells me that it does not find the module no module named tabulate i ve seen that this is a widespread problem are there any solutions,how do i increase number of order detail without refreshing i am beginner in django i create checkout page and when user on change input range number enter image description here it s send to server but it work for first one i think because i set same id for all input and i can t change it because it s in for tag how can i fix it django part ajax part html part,0,57,75 assert variable that can have different datatypes my x variable can be either string or int this line of code does what i need my concern is that i compare x variable against different datatypes can some unexpected problems arise because of that whouldn t it be better to always cast x to a string and do is there any recommnedated way of doing that,get all possible combinations from a list of lists by picking one item from each list i have a list of lists and i would like to get all possible combinations by picking one item from each list for example the following list the output should be the number of lists and their items is random,0,64,56 pyinstaller pymongo no worked hello after pyinstaller my programm no worked,python add nested items to one nested list i am trying to create one nested python dictionary called results i am using aws rekognition to get an image and output the results the results dict only contains one result after it s complated and i wish to have all the results in one nested loop i m trying to get but i m getting the code is replacing the text and i want to add another set of name and confidence my code is,0,12,81 maya setting frame range programmatically with the render setup api i am trying to set the start frame with the rendersetup python api in maya like this for some reason the value gets translated in how to set it to the proper value,how to convert py file to executable file to run in linux on my windows pc i created a python script now i want to run this on linux machine using pyinstaller i can able to create exe file but how can i create an executable file on windows pc which should run in linux machine thanks for help,0,47,58 getting a maximum value from a list in pandas columns i have the following dataframe df i would like to apply max of all in the list values and would like to get the following result i have tried this but couldn t succeed can any one help on this,need help deleting two lines in a text file in python so i m working on a school proj and i ve been trying to get a function to work for over a week i still haven t been able to i need to be able to delete a contact which takes up two lines on the code the code either erases everything keeps only the two lines keeps only one line or doubles every line except the first one which he erases please help,0,47,82 a way to blit multiple buttons from a list with working alpha and color i wanted to blit several button choices depending on the number that a list gives but putting them in a for loop makes the alpha and fill function stop working is there a way to fix this or there s a better alternative to code multiple buttons starting code button and scene class the rest of the code,apply pd get dummies on string type columns of pandas dataframe i have the following dataframe all the dtypes columns b c d are of type string if i call df df convert dtypes and then call pd get dummies nothing happens but when i call it on just one column of the dataframe it works why is this happening is it a bug,0,71,59 how to get every value of a key of a json file with multiple dicts how to get every value of a key of a json file with multiple dicts i want to extract every value of username key data json this is what my code so far but it gave me this error keyerror username main py,dask map partitions fails when dataframe contains date field the following code fails saying that field date doesn t have the month attribute because date type is series when its type is clearly a date what am i missing error is attributeerror series object has no attribute month,0,56,46 why do i get an error when trying to access the first two columns in an html table output,dealing with dependent pyspark dataframes suppose we have a nested pyspark dataframe df with the following schema suppose we have a process that flattens the nested dataframe in two flattened data frames df and df with the following schemas df schema and df schema is there a way of preserving the dependence of df on df for example if a changes then dt and dt might change this would be easy to do in a single pyspark data frame can you do this using two flattened pyspark data frames,0,19,90 problem with finding th prime number off the answer is supposed to be but for some reason my brute force program gets more does anyone know why it is one off,how to output this json which is in the format below in discord the code works by the user inputting on discord cryptoupdate bitcoin i want the program to output the following without the speech marks and curly brackets click here for json response output on discord code,0,35,48 html input label to python file how do i take the input from an html input label and use it in a python file without having to create a local host i don t need to save the input but just run it in python,how to check time spent on voice channel of a particular user discord py i m using this code to check time spent on the voice channel of a particular user but for some reason i m getting this attribute error it is returning none in after channel here is the extract of voice data json,0,44,49 eval and extract field with pd series for multiple columns hi i have a bunch of json ish strings stored in columns as shown in a and i would like to extract the form field i would like to do this per row for all columns i can get it to work per cell with the code below but i am having trouble getting it to work on a dataframe scale any advice is welcomed thank you for looking cheers,how can i make a function out of this so i don t have to copy paste the same piece of code currently in my code i am just copy and pasting blocks of code like these times i need some help on how to make this into a function to save space,0,78,53 printing youtube video title in selenium i m trying to print the title of a youtube video in selenium i tried it different ways and only one way worked so i just want to know why the other ways didn t work my first try this didn t work and the error is my second try this also didn t work and i got the same error,how should i parse this json from the api using python python returns json decoder jsondecodeerror expecting value line column char i am trying to parse json from this api but when i do it returns as json decoder jsondecodeerror expecting value line column char my code is here,0,64,52 permission error errno permission denied traccert tesseract exe while run our flask application when i run the application on local host its working fine but when i run the application on heroku and try to convert the image to text its show an error you may check the image below this is path to tesseract pytesseract pytesseract tesseract cmd traccert tesseract exe click here to see the image of an error,r to python stochastic process translation i want to translate the r code below into python it is mainly a stochastic process that i need to translate it into python the code implements a markov chain simulation of a jump process with two volatility stages the python attempt is the following i think that i am mis using the sapply like function in pandas but i am receiving an error on what is my mistake,0,67,76 tflitekerasmodelconverterv object has no attribute predict i am trying to predict values by loading a saved version of my model here is the code for it my model throws an error tflitekerasmodelconverterv object has no attribute predict can anyone please tell me what can i change here,sympy very slow at solving equations using solve i am currently trying to solve an equation for t but unfortunately i am unable to get a solution due to the program running for too long is there a way to speed up the time taken to solve the equation code,0,48,50 generate random binary strings of length i want to generate random binary strings of length i e from to where each string is length i m wondering how i could do this efficiently or pythonically right now i randomly choose between and times and then append the results into a string this seems pretty inefficient and not pythonic is there some library functions i could use for this,import crowdcount to python shows error even once i installed it i would like to import this models to my python code when i run my code it shows this error i installed the crowdcount and also shows this error the problem with src if i did only import crowdcount it works fine,0,75,53 creating and filling empty dates with zeroes i have a dataframe df i want to fill the missing dates for each product id with restocking events to start i have created a date range dataframe using dfdate pd dataframe date pd date range simple date min simple date max where simple is some master dataframe and min and max dates are and,how to find a slice from n m of singular value decomposition matrix whithout cicles svd is equal to uvt where u m k matrix k k diagonal matrix vt transposed k m matrix also uvt can be determined as a u vt u vt u vt where u first column of u first element of vt first column of v scipy contains function svd a which returns uvt how to find for example a u vt u vt without cycles,0,50,91 why is my subtract function working in a static context when i haven t used the staticmethod decorator so i did not know what static methods were so i searched it up and i made this my question is why does the sub method works in a static context even without the staticmethod decorator does it have something to do with the fact that the sub method doesn t use self num or self num or am i just implementing this wrong,given a set of positive numbers find the additive combinations that are the closest possible to a given constant let s say i have a set of numbers now i want to find out by what additive combinations will they deviate from the least in total each number can only pair with one other number for example the numbers are and pair pair then let d i be the deviation of pair i how to find the additive combinations that achieve the minimal sum of d i i have done a lot of thinking and searching still could not solve this question by python one combination that deviate from the least could cause another combination to deviate from it more sos plz,0,78,126 twitter api how to get the latest tweet python i have these lines of code just basically gets last tweet from a person i want to have last one only how plz help me,stuck creating a django posts filter i need to filter the posts by the options selected between most commented category date this is actually my code models at the moment i tried creating a custom filter like with this views and this template expecting to see only the posts which have the category name written but it doesn t work,0,35,59 sql select list of columns i want to pass an str or list argument and want that sql knows how to treat it example of list col date date date date and at the end i want to have dataframe date date date id does anyone knows how to do it please,customise polar contour plot axes style i am using gridspec to create a grid of polar contour plots in matplotlib to aid with the visuals i am trying the customise the appearance of the contour plots see this single polar plot as an example mwe below i have two formatting questions in mind how can i customise the r axis to show only and values how can i also make these numbers display in white when plotting multiple polar plots i am choosing to remove the axes and ticks on the other by using ax grid false ax set xticklabels and ax set yticklabels however a white bar along theta remains which i would like to remove see this image as an example of what i mean mwe,0,50,126 how to delete a specific element from a numpy nd array i am working on nd arrays whose dimensions can vary i want to delete specific elements from the array given its index like i am expecting to get the result as i have tried numpy delete but this flattens the array,solve two simultaneous equations one contains a python function on the below map i have two known points a and b with their coordinates longitude latitude i need to derive the coordinates of a point c which is on the line and is kilometres away from a first i created a function to calculate the distances between two points in kilometres then using the slope and the distance the coordinates of point c should be the solution to the below equations then i try to solve these two equations in python the error is typeerror can t convert expression to float i may understand the error because the get distance function is expecting inputs as floats while my x and y in eq are sympy core symbol symbol i tried to add np float x but the same error remains is there a way to solve equations like these or do you have better ways to achieve what is needed many thanks,0,50,156 how to use wildcard in numpy array operations for instance define a numpy array with numpy str format and doing the replace operation supported by numpy char the returned result would be a b c d e f g h but i i i d i i i h is expected,adding missing columns to a dataframe pyspark when reading data from a text file using pyspark using following code my data text file looks like but the output i got was is there a way to add those missing columns for the dataframe expecting,0,37,44 python extract specific values from dictionary i have the following dictionary i want to extract values of k a k a k a in a separate list similary for k b k b k b and so on until the end how do i do it can anyone please suggest a solution,cv approxpolydp function returns an n x x array rather than n x i have a function that draws a polygon around some primary features in images by making use of opencv s contour detection i simplify these contours using the approxpolydp function in the snippet below to return a closed trapezoid around the regions and it works fine top poly cv approxpolydp top cnt top perimeter closed true top poly np squeeze top poly get rid of the singleton dimension however the approxpolydp returns a strange type of ndarray which has a shape of n x x when the expected output according to the documentation linked below is an array of n x d points n x i had to debug for a while until i found that singleton dimension in there can be carved out using np squeeze in the second line of the snippet thanks to this answer what does cv approxpolydp return my question is what is the purpose of this singleton dimension i worry i might be dropping some useful information and i don t enjoy having to use np squeeze in a way i don t completely understand thanks for any input that can shed some light on this,0,43,200 plotly subplots issue with specs value error i am trying to plot subplots with secondary y axis with plotly subplots but no matter what i am trying still getting this type of error valueerror the specs argument to make subplots must be a d list of dictionaries with dimensions x received value of type class list secondary y true secondary y true secondary y true thank you for help,how do i make turtles stop at certain line so i ve created a simple race game with turtle graphics and i have one issue there are racers they all start from y and when the first one hits the finish line y i want of them to stop and declare the winner i haven t written that part yet afterwards this code doesn t do what i wanted it to do though sometimes they all stop after of them passing the finish line sometimes none of them passes the line and they all stop i m relatively new to python and discovered turtle days ago can anyone tell me where did i do wrong i want to finish this asap and move on to better modules,0,68,126 detect when a specific url is copied to the clipboard how can i detect when the text copied to the clipboard has certain text i need to run a script whenever i copy a specific url to the clipboard,subtract one column by itself based on a condition set by another column i have the following data frame where time stamp is already sorted in the ascending order i want to create a new column in the above data frame that shows the time difference between each row s time stamp value and the first time stamp value above that row where indicator is not nan immediately above row where indicator is not nan below is how the output should look like time diff is a timedelta value but i ll just show subtraction by indices to better illustrate for example df time stamp df time stamp we can use a for loop that keeps track of the last nan entry but i m looking for a solution that does not use a for loop,0,39,133 create discord py server and delete all channels directly i want to create a small discord selfbot bot that completely copies a server everything works except that i can t delete the channels on the new server here is a small excerpt,does keras learn embeddings for words that are not included in the vocabulary that you specified sorry if this is a noob question although i havent found a similar thread i m trying to learn how to create word embeddings using a large dataset of tweets for sentiment classification i m using keras textvectorizer to convert the tweets into sequences i noticed that if a word is not in the vocabulary specified it always maps to integer wouldn t that mean that the model will also learn weights for words that are not in the vocabulary if yes how do you avoid that here s a snippet output tf tensor shape dtype int numpy array dtype int,0,40,161 how do i copy an error line from logfile to another file using python i m developing a script that should scan a night run log file this script should print the whole lines that the word error is shown there into another log file named analyzer which will going to create during the script running the output is an empty new log file without the willing lines the code is developed on python and i linked it to here,how to improve language model ex bert on unseen text in training so i am using pre trained language model for binary classification i fine tune the model by training on data my downstream task the results are good almost f measure however when i remove a specific similar sentence from the training data and add it to my test data the classifier fails to predict the class of that sentence for example sentiment analysis task i love the movie more specifically the acting was great i removed from training all sentences containing the words more specifically and surprisingly in the test set they were all misclassified so the precision decreased by a huge amount any ideas on how can i further fine tune improve my model to work better on unseen text in training to avoid the problem i described above of course without feeding the model on sentences containing the words more specifically note i observed the same performance regardless of the language model in use bert roberta etc,0,79,168 django attributeerror when saving data with drf i have a problem when i make a post the entry is created i can see it in django admin panel but drf is throwing me an error attributeerror at api v reviews review object has no attribute review score review score beeing a serializermethodfield in serializer py needed for the frontend get is working perfectly model py views py serializer py,how to exit an input at a specific time in python i am new to python and am looking for a way to stop an input after a certain time for example while waiting for user input after seconds i want to check the time if the time is a certain time then i want to stop the input and move on i tried using a non blocking input for this but i was not able to find a way for it to work i also do not want to use threading i am also looking for a cross platform solution i know i have a lot of requirements but any help would be appreciated thanks,0,61,115 how might i move away from globals in python in this example if i swap the commented code out the global variables work correctly i seem to failing to grok something fundamental about python here as passing the variables doesn t seem to work correctly example results i get from the non global version and the game loops forever,python not creating new file headers when it does not exist i want to write a new csv file with headers if it does not exist and append row data to it not sure why the following code doesn t add the file headers append works fine,0,57,46 how to overlay an image with another that has transparency using python with opencv i am trying to use opencv to add an image onto another i want to be able to combine this and this note the circle has a transparent background to create this unfortunately all of the solutions i ve found online just give me this i ve looked at at least different on this sight solutions but i cannot find a working one please advise thanks,how can i search a specific element on the page for text using xpath selenium i can t seem to find an example of this what i am trying to do is search a specific div element on the page for text that has the potential to change so it d be like this in my case the div coolid will always be present but the text within it s inner divs and child elements will change depending on which iteration of the page is loaded and i need to search for the presence of certain terms within this coolid div and cool div only because i know it will always be there and i d like to specify the search as much as possible so as not to potentially contaminate results with other text from other places on the page in my head i sort of see it like this using the above example or something to this effect does anyone know how to do this,0,79,163 why f refer to attribute when m refer to method does anybody know why f refers to attribute when m refers to method i mean why don t use a to refer to attribute,what is the right way to implement an interface like class in python what is the right way to make every class that inherits from the superclass have the same functionality in python the superclass doesn t implement anything it just defines the needed functionality for the child classes to be used by functions in some app what is the right way to implement such a thing in python,0,33,69 countvectorizer but for group of text using the following code countvectorizer break air dried meat into different vector but what i want is to keep air dried meat as vector how do i do it the code i run current output desired outpput,how to access environment name in kedro pipeline is there any way to access the kedro pipeline environment name actually below is my problem i am loading the config paths as below but i have few environments like conf server conf test etc so if i have env name available i can add it to conf paths as conf env name so that kedro will read the files from the respective env folder but now if the env path is not added to conf paths the files are not being read by kedro even if i specify the env name while i run kedro like kedro run env server i searched for all the docs but was not able to find any solution edit elaborating more on the problem i am using the above given parameters and catalog dicts in the nodes i only have keys that are common for all runs in conf base parameters yml and the environment specific keys in conf server parameters yml but when i do kedro run env server i am getting keyerror which means the keys in conf server parameters yml is not available in the parameters dict if i add conf server to config paths kedro is running well without keyerror,0,43,189 response when i use requests to make a post request my core code is as follows the variable url is my own website which is based on django i know i can use csrf exempt to disable csrf but i don t want to do that however it return response when i use requests to make a post request i wish someone could tell me what was wrong with my approach,how to make individual index html file for each category in pelican i m new to pelican and i recently made my personal blogs website website is hosted on gh pages branch with the help of ghp import here i want to generate custom category welcome homepage for each category i don t want to display all the articles of that specific category i tried this by creating index html file in the each specific folder of category but it didn t worked also searched on so and found some related answers but i cannot figure out what to do in my case here are those questions mentioning it cos maybe they are helpful how to achieve this thanks in advance,0,71,115 how can i check if a foreign key has an attribute on its model i have a model named product i am at product views py how can i check if an attribute exist in the order model what i m trying to do is this,including image files inside executable using pyinstaller conflicting sources i was trying to create a single exe file using pyinstaller and for the purpose of my app i needed to include some images after some reasearch the consensus across the web seem to be that implementation of a function as shown here example or here example should help when after creating executable you get an error saying unable to find files for me this approach didnt work eventually on second page of google results thats how desperate i was i found this example to my surprise adding image files to the derectory of the executable worked question remains as well as my confusion how can i do it without having to have extra files next to the executable or i really cant and should go down the not single file exec or maybe something else thank you,0,45,149 problems scraping a dynamic website with beautiful soup i would like to scrape crime news articles from the website but the soup object does not return the required div tag could anyone give me reasons for that,filter dataframe based on highest and lowest row values with increasing timeline i have the following dataframe of students with their exam scores in different dates sorted i need to keep only those rows where the highest score is increased by more than from the lowest score otherwise drop them here date is also important the highest score has to be in the latter date than the previous date for example for the student a the lowest score is and the score is increased to latter in the date so we re gonna keep that for the student b the lowest score is but there no score is increased after that it is basically decreased so we re gonna drop that for the student d the lowest score is and the score is increased to increase of only so we re gonna drop that i first tried df groupby student agg score np ptp but it was tough to track if the score is decreased or increased then i tried to use df loc df groupby student score idxmin and df loc df groupby student score idxmax to get the min and values but not sure how i would compare the dates maybe i merge them and then compare but it s too much of work desired output what would be the smartest way of doing it any suggestions would be appreciated thanks,0,37,219 how to follow a large file in python without loading it all in the memory i tried the solution in this answer since the file i m tailing can grow large than gb the server is choking any suggestions on how to follow it without storing all in memory,comparing two csv files in python and output i have two csv files i need to compare file with file and output any lines that are in file which are not in file issue is when there is two lines with exact value in file output should show the value that is not in file instead it is removing both values as duplicates is there any way to do this the code i am using now is file address value ce e ce e fb d fb d fb d fb d fb d fb d file address value ce e fb d fb d fb d fb d fb d fb d output should be address value ce e,0,48,106 attributeerror str object has no attribute descendants error with automation scraping with bs and selenium my objective with this code is to scrap the allocation of brazilian funds my problem starts with bs i already tried to scrap the table using soup find all table id dlaplics or using class all of them return an error i already saw a lot of videos but i m feeling unable to solve that by myself right now,group together consecutive numbers in a list i have an ordered python list of forms how can i group together consecutive numbers in a list a group like this i tried using groupby from here but was not able to tailor it to my need thanks,0,71,46 cloning existing python project anyjson setup command error i have this project shared to me via github after i clone and run this steps in pip install r it gives me this errors here is what inside the requirements txt already tried removing anyjson from requirements txt but still gives me error what am i missing here,replace strings and update file using sed from python im trying to replace the first line of a file which has double quotes the file contains something like this i want to create or update the file to show something as follows first line without double quotes typically this can be done using bash with sed i want to implement it from python using subprocess call my code but it throws an error i guess i have to create the file outputfile txt first but i want to do it all from python can you help me please thanks in advance,0,55,99 seaborn after dates num date x not showing x equals x y on the graph lmplot after converting dates to floats necessary to use dates in lmplot then when trying to set ax set xticklabels the x disappears on the graph in the lower right corner eg x y,python getting the complete url with os environ i would like to get the complete url using os environ i am rendering notebooks with voila and i would like to open url from a dashboard using parameters in the url so far i have assuming this is the url having a look at the whole collection of vars in os environ i dont see any that would include the whole url including what is there after in order to parse that part as well as with parameters some ideas i tried to print all the os environ variables with but it nothing seems to contain what is beyond the symbol in the url any ideas thanks related get current url in python,0,42,121 python convert signed int to bytes this code works fine but when i change an int to i get the following error a bytes big an int to bytes big overflowerror can t convert negative int to unsigned how can i convert signed int without getting error,scatterplot set hue to value of dataframe cells i made up this example data now i want to scatterplot this example data i have tried around with seaborn easiest way is this which gives me nearly what i want now my question is it possible to change y with the hue so that i have the my colums as y axis and the hue is based on the values of the cells,0,43,71 opening anaconda prompt with python i want to create a script that will help me with installing packages for spyder therefore i want to use python and have the script first open anaconda prompt then execute the commands and then close that window however i can get it to open for example the calculator but it doesn t seem to open the command prompt for opening the calculator i used how can i get it to open the command prompt,pyttsx runandwait slows down i use the pyttsx library and it slows down the runandwait what is the solution ps pyttsx runandwait method gets stuck i read it it didn t help,0,79,32 read multiple words as arguments from typer python how to read a unknown number of strings with spaces from cli using typer python i have this command add in my command line app it should read description of any length but the problem is it stops reading after the first whitespace how to read multiple unknown number of arguments in to the add command as arguments,runtimeerror install flask with the async extra in order to use async views when i try to run this locally with docker run locally i am getting the error below however i have already run pip install flask async and everything seems to be installed but i still get the same error does anybody have an idea on what s wrong,0,67,59 python pygame typeerror can only concatenate list not float to list my son is busy with the coding of pong in python bit with pygame here is the feedback from the terminal here is his code any assistance with regards to how to fix this problem and get the game to work will be appreciated,flask join children in my problem let s say there is person which can have many addresses and each address can have one location is it possible to get a query where persons contain addresses which are joined with their location so when i loop persons i can access data from both addresses and location as one,0,56,56 how to grab all the name keys once i wanted to grab all the name keys at one time but all the first dict key aren t the same meaning e g etc how to grab name from all of the above keys once,pyzbar doesn t recognize qrcode but works with barcodes i m working on an android app it s a qrcodescanner with kivy and python the code works fine on windows but when i compile to android it doesn t recognize qrcodes but it recognize only barcodes here is my code i also tried to use cv but it crashes at startup for something like not compatible with android buildozer spec file this is all what i changed also the camera is rotated by on android but on windows works fine have you got any idea to solve thanks in advance,0,43,96 how to combine turtle with tkinter so i ve got tkinter code that when ran opens up a new window with a square root calculator when i try to get turtle in the same window as the square root calculator windows pop up,trying to read and print netcdf variables in python i have imported a netcdf file into python and am now trying to access specific variables in the file of over variables this is the code i m using in order to just print and read each variables this returns me with the error any idea on how to overcome this error this is the only way i can find that is used to print each variable,0,43,76 how to sum a column of a pandas dataframe and keep only the result of the sum as the value of the column there is a dataframe the final result i would like to get is i use the method it doesn t achieve the results i want what method should i use to achieve my goal,how to get dataframe name from list for newt use in forloop can you please help me with this code i tried to create function to loop through dataframes used in current file listed in list of dfs the code gives me an error return error attributeerror nonetype object has no attribute to excel thank you,0,58,54 django context not passing in html template i am not understanding where i am doing mistake i am trying to passing context in my html page but why context isn t passing see my code views py urls py html see my terminal result where all object printing from context why i am not seeing any object in my html page where i am doing mistake,voice to email not sending the password python voice to email not working everything works just fine it records and gives me my message output but it doesn t send the password,0,63,31 keyerror after re running the same code a keyerror is returned when i try to run the below code my dataframe has the following columns i know that there are many questions on the keyerror name but what was weird is that without changing anything this error appeared while running the code but previously i could run the code with no errors nothing has changed any help on this would be great traceback,finding previous group s name in pandas dataframe i want to add a column to my dataframe with repetitive values which contains the name of previous group float and sortable any idea before after,0,72,33 django newbie templatedoesnotexist my project directory is called test and the app in question is called posts django tried loading these templates in this order using engine django views py urls py i have mentioned the app in settings py so that probably shouldn t be an issue what am i doing wrong filetree,rolling percentile pandas this gives percentile values for a column below but is there a way to get the rolling percentile values for a column by using this similar method without writing functions or loops and longer code currently when adding the rolling window it is not working if there is not pandas desperately needs to add this as a feature for the rolling it is there for quantile it makes no sense to not have it for the percentiles as well,0,52,82 python typeerror zipfile object is not callable when i type the code it shows this error as output how can i fix it any ideas what does it mean the zipfile object is not callable i even declared my zip function like this beforehand i declared extracting zip operation like this above i m writing this code in google colab i added the tensorflow part to my code here,tkinter copy to clipboard via bind control c shortcut clipboard is empty when closing program but via tkinter context menu everything is normal in a custom entry i have a context menu with the function copy the selected text which is performed by pyperclip when executing the copy to clipboard function from the context menu everything works fine the selected text is copied to clipboard when i close the program the text remains on the clipboard and i can paste it into any other application but when i run the same copy to clipboard function using the keyboard shortcut control c the text is copied to the clipboard normally but when i close the tkinter application the clipboard is erased how to solve this example,0,68,122 concatenation of the elements in two list in python for instance the message save our soul would be encrypted as sv u oliaeorsu and then i want to decrypt sv u oliaeorsu to its original ones i had performed the encryption but the decryption looks difficult and at the end i want to concatenate items of both list into a new one for example lst a c e g lst b d f the list i want is lst a b c d e f g output,volttron bacnet grab multiple configs py i am trying to auto discover bacnet devices in volttron on a lan with grab multiple configs this message below is from the linux terminal when i am trying run proxy grab bacnet config py where my args or something is incorrect usage grab multiple configs py h use proxy proxy id proxy id out directory out directory ini ini csv file this is my bacnet proxy id d cd b a f b bb b d when i run this from terminal python grab multiple configs py out directory desktop volttron scripts bacnet configs use proxy proxy id d cd b a f b bb b d multie csv i get the usage error is it because my args aren t in the correct order edit snip of vctl status,0,73,93 getting errors while making a serial connection using netmiko i ve tried dev ttys ttys com but no luck getting following errors while connecting via serial using netmiko,is it possible to implement a keras layer that always propagates a fixed vector to the other layers i m trying to develop a neural network architecture that has two inputs however i would like to fixate one of these vector inputs during training i know that this seems to be nonsense for most of you but i would like to know how to do this for testing a hypothesis it is clear that one way to do this would be to prepare a dataset where i simply repeat the fixed value in all instances that i would like however this seems to be a bad solution i would like to know if it is possible to implement a keras layer that receives a vector as a fixed parameter and always propagate it to the following layers in each training step when the other input would vary i m representing the idea in the image attached is it possible to do that,0,27,160 connect to mysql database over ssh in python script i am in a situation where i need to access a mysql database running on another computer computer b unfortunately the computers aren t on the same local network the only way i found that i can access the sql database on computer b from my laptop computer a is via ssh my question is can i access the sql database over ssh from python,how can i iterate through a list of songs and play them one after eachother i am looking to iterate through a list of songs such as songs song mp song mp song mp and i want to play each song one after each other i have tried various methods the most suggested seemed to use pygame however i have not been able to debug the tremendous amount of errors that come with using it my main source code and attempt at this is as shown below upon running this i receive error pygame error modplug load failed i am running this concurrently inside of a slideshow program i have i want this code to run as background music and i plan on checking for the end of the song in a function i already have set,0,73,133 indexerror list index out of range idk where although compilation works successfully i get an error indexerror list index out of range the function takes as argument a sequence and returns a list of items without any elements with the same value next to each other and preserving the original order of elements the code i write thanks for help,why plot python different with matlab and even excel im trying to read data from scv file and plot them reading process easily worked but by plotting is full missed up i have tried that with matlab and even excel both are plotting correct but in python i have problems it seems like that plot photo with python plot photo with matlab i would be thankful for your help,0,60,69 ros and python versions when launching nodes ros imu bno package works on noetic running ubuntu intel nuc but throws an error on kinetic running on raspberry pi ubiquity robotics image must be python vs python on the nuc python on the pi kinda stuck not sure where to geek from here process ros imu bno node started with pid,dynamically selecting columns in pandas based on a list of strings i currently have a dataframe like this how would i select the columns dynamically and append them to another list for example so that xx is the following something like this but on a much larger scale i keep getting the following error when i try i get,0,60,59 getting output as character and it s occurrence in the string the input i gave is like this input abccdddeffg and the output i want is character and it s occurrence number output a b c d e f g my code thanks in advance,pip install fails in dockerfile but is possible in container i have a rpi with bit base image for now i need to use bit so armv l architecture i want to run jupyterlab on it and do some data science i am also new to docker so please guide me gently for that i created a dockerfile jupyterlab and some other packages after i created a container from the image i cannot use matplotlib and pandas it misses libjpeg and some other dependencies i couldn t install after reinstalling matplotlib and pandas i finally can import them so why i cannot write this into my dockerfile but can run it inside the container in console this in this line i get an error here is are the build logs of docker i will also provide a pip freeze of the container with matplotlib and panday additionally installed afterwards maybe this helps these are some cmds i issued to partially solve the problem thank you for the time and effort,0,37,168 python cv draw contours and fill black is ignoring perimeter iam trying to remove objects from the image using the following method however as can be seen from outcome image there is a residual fine colored line around each object although i have dilated my image the lines are still present is there a way to remove those lines original image outcome image,no output when executing the script python vscode i m developing a simple reactive programming script example to download images from a web but when i execute the script in vscode i do not get any type of output i already tried creating a virtualenv in the terminal i get this output ps c users ernes desktop paradigmas c users ernes appdata local programs python python python exe c users ernes desktop paradigmas jose py ps c users ernes desktop paradigmas,0,63,59 nattype object has no attribute dt error when comparing null and not null stack overflow i am trying to create a column using the defined function below the goal is to count the number of days between dates based on the condition of columns however i am getting an error nattype object has no attribute dt i have also tried isnull notnull thanks for your help you are awesome,change y m d to y m csv manipulation taking data from a csv file trying to change the dates to the right format ie change from to this is the code right now it says the file has unconverted data and i don t know how to fix it,0,71,48 psycopg operationalerror ssl syscall error connection reset by peer x fatal no pg hba conf entry for host user database i have changed nothing about my computer i have however left the us for germany for about two weeks i can not connect to my database while on my remote server i can is this some odd dns issue my coworker in the states can access it fine edit for config,paraview script that saves a picture with the filename i have been trying to save a picture in paraview using a script that gets the name of the active file and saves it as a picture with the same name but different format e g jpg what i am struggling is using the split command or the replace command in paraview as i get this error the rest is okay i only have difficulties with the split command some of my code is here thanks,0,69,84 discord py bot won t leave a voice chat i m currently using these commands to make my bot leave join a vc joining works fine but leaving won t work any help in understanding why would be really appreciated,add a column filled with values that correspond to the max value in another column for every value in third column having this dataframe i need to make an additional column with values from in that correspond to max values in out for every state case case,0,35,47 python cv draw contours and fill black is ignoring perimeter iam trying to remove objects from the image using the following method however as can be seen from outcome image there is a residual fine colored line around each object although i have dilated my image the lines are still present is there a way to remove those lines original image outcome image,find duplicate values in list of dictionaries i need to find dictionaries in a list that have the same key value and create a new list in which only the first dictionary is kept example list duplicate key value to iterate over should be second so in the example the first and third dictionary are the same i have tried looking at find duplicates in python list of dictionaries and python list of dictionaries find duplicates based on value but i can t find the exact answer i am only looking at one key value the dictionaries will always have the same keys expected output,0,63,101 selecting column with smallest value in pandas dataframe i have a pandas dataframe with this structure df test i would like to add a new column minimum difference containing the column name with the smallest absolute value for that specific row ignoring v like this,create a matrix from two columns i m trying to create a matrix from two columns within an excel sheet the first column is a key with multiple repeating instances and the second column references the different values tied to the key i d like to be able to create a matrix of all the values in the second column to reference the number of times they are paired together for all the key instances and i d like to turn this sample dataframe into essentially using column a as a groupby to segment each key then making counts of the relationships encountered as a running tally can t quite figure out how to implement a pivot table or a cross tab to accomplish this if that s even the best route,0,43,127 brownie not working cython undefined symbol pygen send i set up my development environment on fedora and when i run any brownie command such as brownie console or even brownie version i get the following error setup python cython gcc gcc c fc x ganache cli v i have spent a whole day trying to fix this error please help me out,pandas looking to create a multiple nested dictionary here is what i am looking to generate here is the df and i have the following array so far i have the following code this results in the following dictionary now i feel like i ve gone down the wrong path as i m not sure how to get roll it up to the id level any help would be much appreciated,0,58,69 hide turtle problems am trying to create a opening screen for a pong video game however am struggling to hide the turtle pen when it s going down from the center,dealing with in out string parameters in swig python maybe someone know how to rewrite getversion to get in python version and legacyversion as a result of function instead of passing them as in out parameters for now i create additional function in swig inteface file but current implementation returns only one parameter instead of two update now i use ignore and extend features but i guess there is more elegant way here is my working swig interface snippet,0,30,77 attributeerror str object has no attribute descendants error with automation scraping with bs and selenium my objective with this code is to scrap the allocation of brazilian funds my problem starts with bs i already tried to scrap the table using soup find all table id dlaplics or using class all of them return an error i already saw a lot of videos but i m feeling unable to solve that by myself right now,rolling percentile pandas this gives percentile values for a column below but is there a way to get the rolling percentile values for a column by using this similar method without writing functions or loops and longer code currently when adding the rolling window it is not working if there is not pandas desperately needs to add this as a feature for the rolling it is there for quantile it makes no sense to not have it for the percentiles as well,0,71,82 how can i randomly assign powers to my heroes i m creating a hero game i ve created a dictionary containing magic powers my problem is how can i create a method that will randomly assign magic powers to of my heroes each hero get s powers without one magic power being assigned multiple times here s my code,how to change part of numpy array without reshaping i have the the following array i would like to change the attribute for part of the array filled with my custom class for example i would like to change elements starting from element then from row to row ideally i would do something comparable to the result would be something like the following unchanged x changed the problem with my array is that i first need to flatten it before i could do something like this or i should calculate how many columns and rows i before i can index the array itself is there a numpy function such that i can just iteratre over the array element by element row by row i hope my explanation is clear,0,58,131 how to extract elements based on condition they contains a specific element i d like to extract all href from item list that also contains class list item pay count every item is encapsulated in a div with class box information and has an a some of the items has lists with class list item pay count at the bottom of class list score only these items href i try to scrape,how to create new dataframe with all non nan values from other dataframes in one column i have two dataframes df and df and they both contain mostly nan values they have non nan values at the same locations in the data set based on these two dataframes i would like to create df with a column for all values from df and one column for df so that i have value pairs from both dataframes here i created a simple example for reproducibility thanks a lot for your suggestions,0,61,88 tf an internal error occurred activity id fc eca fed ae a fc f c ea im trying to push files into git repo via azure api but getting activity id error i followed their documentation and trying to add simple file in my repo here is my code anyone knows how to solve this issue i have also added this issue on their developer community,how to adress a attribute created by setattr i want to create a micropython class for an led strip when initializing the class can be called with any number of color pin pairs so my idea was to call def init self kwargs and then use i want to refer later e g to change the pwm value with self color duty my problem is i don t know how to create any kind of list of all created attributes so i can iterate through them later on thinking about something like but how can i put the created attributes into this color list update thank you for the first answers the problem is a simple list of the keys does not solve my problem i can t call self key from list as far as i know e g if i create a liste from keys color list r g b w i can t or don t know how to iterate through them will not work because the list only contains strings and i don t know how to call attributes of my class with that name if that makes any sense the full code looks like this update solved thank you guys for the answers using a dictionary instead of attributes solves the problem,0,57,195 how can i randomise the magnitude spectrum of an image whilst keeping the phase unchanged i am trying to randomise the magnitude component of the spectrum of the following image i was thinking of using numpy random rand for the generation of random values however i am not sure how to go about it is someone able to explain how i can proceed the following is the code to obtain the magnitude spectrum of the image attached,concatenate a numpy array of strings to numpy array of numbers i am learning multiple linear regression in python and for one particular instance i have the following equation y b m x m x m x i will like to print out the same equation on my terminal in the same format with the values inserted for m and b as of now i have the following code implemented i know that my question might be super basic but how should how do i concatenate the numpy array of integers m with array of strings x var thanks in advance,0,75,93 retrieve indices of certain value in a matrix and put it in a nested list i have this matrix let s say there are hundreds of x value and thousands of y lists inside this matrix how will i be able to retrieve the index of value and put it in a nested list here is the sample output,lat long to utm conversion failing for dataframe the error outofrangeerror latitude out of range must be between deg s and deg n appears when i use the utm from latlon function on a dataframe when i try it for a single lat long however it returns the result i m not sure what s going on e g dataframe my lat long is not reversed as i checked let s say utm function is defined as and i am calling the function as dataframe apply lambda row f row lat row lon axis,0,60,83 how to define folder name when saving json file in python how to define folder name when saving json file i tried to add myfoldername inside open but did not work also tried to myfoldername myfilename in filename definition error code,beautifulsoup finds an html element that contains spaces in its attributes how to use beautifulsoup to find an html element that contains spaces in its attributes i would like to know how to use soup find to find the title that i want because beautifulsoup considers the attribute attrs of title that i want like this class td p br but not like this class td p,0,40,65 table words and numerical values and generating text file i am trying to write a table in python but am unable to get the right outcome i am trying to get this output i am using the following code i am getting output also how can i link this to text file generation,converting integer to a letter encoded string i have seen websites generate short urls where they convert ids for items into a letter string here s an example this is for a website called letterboxd and the link takes you to a movie page i m guessing behind the scenes the movie has an integer id that is then converted into this letter string or maybe its stored as that letter value to begin with how is this accomplished,0,53,82 delete old file when uploaded new in django rest framework i wanted to delete old image from folder when uploaded new image and i tried but couldn t get result serializers py services py what i did so far i don t know what s wrong with it,ccc j s escape room solution python i am trying to solve the j s escape room problem from the ccc i can t figure out why the recursion does not stop at a return statement here is the link to the problems,0,42,41 youtube subscriptions list scraping i want to scrap my youtube subscriptions list into one csv file i typed this code but i didn t finish coding yet i found this error file users hendy youtube subscriptions scraping py line in soup beautifulsoup source lxml file library frameworks python framework versions lib python site packages bs init py line in init elif len markup and typeerror object of type response has no len i don t know what s the problem,looping through a filtered dataframe to see if a value is in a list column apologies for the vague title i m not entirely sure how to word it more correctly i have a dataframe like this which is created with this and the logic behind it is that each line is a customer record they can only ever save one product at a time which is why savedproduct has one product code but they can purchase multiple products which is why purchasedproduct contains a list what i want to do is so e g the product in line appears in line so preferably there d be a way to have both the first line s date and third line s date in the same row so we can calculate difference between the dates i thought a nested loop would do the job but i can t get it to work and there must be a more efficient way but the output is like this is there any way to do this better and also why is customerid producing nans when i have the output the print in the loop it works fine thanks for any help edit may have just figured it out using lists instead but if someone has a more efficient way would still be appreciated which has the following output,0,67,223 apscheduler id not found can date scheduled jobs have ids i don t know what i am doing wrong but whenever i run this code i get the error apscheduler jobstores base joblookuperror no job by the id of item last run was found,extract a specific url field from json output using jq i have json output as follows i want to extract the value for the example io creatorid field currently the following code returns all of the values under annotations however when i tried the below script appending example io creatorid it fails error can anyone tell me how to achieve this using jq fyi i am running this as a python script,0,38,68 append string to empty pandas column in a for loop the code uses an ocr to read text from urls in the list url list i am trying to append the output in the form of a string txt into an empty pandas column url text however the code does not append anything to the column url text when,how to check exception cause using pytest raises i d like to test that an exception is raised from another exception type i m surprised not to see a way to inspect the exception chain in the pytest raises docs is there a clean way to do this using ptyest raises,0,56,50 alternatively assign values to two column i have a dataset that looks as follows and i am trying to alternatively assign those values to two new columns called left and right something as follows is there a way i can do that,kubernetes create a persistent volume and use in my django app i wouldd to create a persistent volume on my kubernetes gcp cluster and use it in my django app as for example media folder on my kubernetes side i do first create a volumes claim then in my deployments yaml i create a volume and associate to the pod then in my django settings here my dockerfile when i apply volume claim on my cluster all was done volume claim was created but whe apply deployment yaml no volume was created for the pods also if i connect in bash to my pods no folder test files exist how can i create a volume on my deployments pods and use it in my django app so many thanks in advance,0,42,128 how to check if exe file is generating any errors when run i am generating a exe file through a python script the script runs fine but when i run exe file it is not receiving voice input properly i have used speech recognition and pyttsx modules for voice where can i see the errors that are present when i run the exe file,how to set a column value by fuzzy string matching with another dataframe i have referred to this post but cannot get it to run for my particular case i have two dataframes then i do the result is not what i expect can you help me with editing this code please note that i have millions of lines in df and millions in df so i need some efficiency as well basically i need to match people from df to people in df in the above example i am matching them on last name lname and first name fname i also have a third one which i leave out here for parsimony the expected result should look like,0,63,119 how to pass arguments from a message to a telebot my telegram bot receives messages in one line of the following form how can i send this string to three variables using telebot upd this works but i can t figure out how to get the data from telegram itself and transfer it to the text,tabnet classifier predictions returning and values i m trying to build a classification model with tabnet i want to output probabilities of s and s that would be value between and i successfully trained the model but predict function is returning only s and s and i don t know how to check probabilities can you help me out here is the code that i m using,0,61,68 getting google returned a response with code error in pytrend i want to get yesterday or todays data from pytrend but every time i use this code i keep getting the request failed google returned a response with code with the data and sometimes timeout or rate limit exceed error my code,how to reverse a dictionary in python and create a list out of the duplicate keys value i gave myself a task today just trying to figure out the exercise below in python how can i rather achieve the following result,0,54,41 implementing introspection validation from okta using authlib in python flask app i am trying to implement introspection on client side suing okta as my authorization server but continuously getting error error missing authorization error description missing authorization in headers my implementation i have been trying to resolve this for a while but could not succeed,how do you detect a number if it is in between numbers in python i m making a game where there are numbers the st and nd will be shown but the third will be hidden if the rd number is in between the st and the nd the user will win if not then the user will lose for example the st number is and the nd number is and the user will guess if the rd number is in between the numbers so if the rd number is which is in between and then the user would win but if the rd number is which is not in between and then the user will lose question is what comparisons do i have to make to do that the code below is just an example of what i have done is not working properly,0,53,155 indexerror list index out of range idk where although compilation works successfully i get an error indexerror list index out of range the function takes as argument a sequence and returns a list of items without any elements with the same value next to each other and preserving the original order of elements the code i write thanks for help,converting lowercase to uppercase in python using recursion i am a student relatively new to python learning it through classes we were given a question where we have a list as an input and we have to convert each element to uppercase here is my code so far and it does the job but the problem is it is not using recursion and i have absolutely no idea where to use it i am open to all suggestions but layman s terms are preferred edit adding example inputs input rohit mohan anjali ankit akshit output rohit mohan anjali ankit akshit,0,60,99 numpy array of array vs numpy array of list i have this two numpy arrays why when i m checking if the internal array list is none i m getting different results both have the same shape what is the way in numpy to check that each element in arr is none,combining fig legend with subfigures in matplotlib disclaimer i am aware that using subfigures is irrelevant in this simple example the latter is used only to show my problem i want to be able to use fig legend with fig subfigures i am currently discovering the new subfigure module of matplotlib i noticed that figure legends created using fig legend does not show up when the main figure contains subfigures note how that figure legend is absent for comparison note that is shows up when using only plt subplots,0,49,84 unsingning a signed value django rest i am using web personal sign nonce web eth coinbase callback to sign nonce at the front end but i am trying to build the backend in django rest using this to unsign the signed nonce but getting an error error does anyone have any ideas about how to unsign this nonce,creating class object inside same class in python i m trying to create a class object inside the class itself something like this this works and runs correctly but if i use inheritance to create another class as a daughter of this one e g car motor the car function doesn t work properly because it s creating an object of type motor not car is there any other way i could do this thanks,0,53,69 how to save all element index after removing element in python i did many attempt but stil having problem i know this is because python automatically updating the elements index but dont know how to control it any suggestion will help me,how to find a substring of text with a known starting point but unknown ending point in python i have a long string of text i want to condense that string at a certain point using a key word to indicate the start of my new string in python for example my string is hello my name john i am twenty five years old i live in new york city i work on wall street i want the text from new york to the end of the text i e i need code to pull the substring new york city i work on wall street any help would be much appreciated,0,42,109 object is not callable but i do not know how to divide the module into each other i have this trouble module object is not callable i want to split the values i get in modules how to do it better combine them into one module or can i do as i wanted in the code,noreversematch at reverse for user profile with arguments not found pattern s tried profile p pk please somebody help please am new to django and don t know how to get around this in my code am following a tutorial and that builds a chatroom with django everything works fine but then i wanted to modify it and display the posts written by a user on their profile page so that others can see it but instead i got this error noreversematch at reverse for user profile with arguments not found pattern s tried profile p here is my view file here is my url error during template rendering in template c users nonesi desktop studybudy base templates base feed component html error at line so here is my template,0,58,119 pandas multi index loc i have a pandas dataframe for graph edges with a multi index as such however doing a simple loc fails with the message keyerror why does it fail the index clearly shows that the tuple is in it and in the docs i see loc being used similarly edit apparently df loc works go figure it was probably interpreting the first iterable as separate keys,constrain only some elements of the variable to be integer i have a cvxpy optimization script with a variable made of elements the first need be integer the other don t the cvxpy documentation says integer bool or list of tuple is the variable integer the semantics are the same as the boolean argument for the boolean attribute they say boolean bool or list of tuple is the variable boolean i e or true which constrains the entire variable to be boolean false or a list of indices which should be constrained as boolean where each index is a tuple of length exactly equal to the length of shape if i use the following forcing all elements to be integer the script works flawlessy but if i try the following i get the follwing typeerror int object is not iterable what am i doing wrong thanks,0,72,151 pandas concise way of finding and writing unique occurrences for a dataframe such as this desired outcome unique occurrences of values in col and col in order of appearance by row i e unique list a d b c problem way to minimise iteration and processing due to number and size of dataframes,how to get row number and specify tooltip from another columns in that row the problem is that i can t iterate through whole dataframe and for each cellwidgetitem in specific row in column specify tooltip from another columns in the same row above code works and does show whole dataframe in qtablewidget and below code works for extracting text from several columns and settooltip for cellwidgetitem from row and column but when i get more than one hundred rows it would be such a long code to copy and specify manually for each cellwidgetitem from row etc the tooltip i tried this code below to get it work but unfortunately i can t nothing happens but it passes so that it has no errors please give me a solution thank you very much,0,52,135 how to parse all the gitlab ci yml files from all the repositories that i have access to how to parse all the gitlab ci yml files from all the repositories that i have access to i was searching documentation to do it using a python script but no luck any suggestions are highly appreciated thanks in advance guys,is it possible to pass array containing userids to add to telegram group in single request i don t want to make many request so was wondering if it s possible to create an array of users i intend to push to my telegram group and make a single request,0,55,48 remove certain word from string the program need to remove vowels from word i tried something but don t know why it s not working code,creating a column in pandas dataframe by calculation using four columns of the dataframe with some math methods i have a pandas dataframe that contains a number of features columns including two geographical locations with their longitudes and latitudes that means that the dataframe has two latitudes and two longitudes as columns my intention is to create a new column in the dataframe that would be the distance between the two geographical locations using their latitudes and longitudes i defined as function that would calculate the distance as follows i applied the function to create the distance column in my dataframe as follows this is the error message i got i also attempted creating additional columns for dlon and dlat as defined in the function above but got the same error message another attempt was to use a lambda function to create these new columns but got different type error such as attributeerror that rows do not have the attribute resident latitude,0,24,160 from mega py import mega modulenotfounderror no module named mega i have a problem for my project i need to move files from the directory to the mega cloud but when trying to run the code it gives an error also when trying to pip install mega py it turns out the following the limit of k characters does not allow you to write further i searched the whole internet please help,analog of os add dll directory for linux i am trying to load a so library in python using ctypes this library has many files in home me my library when i load i get note that the error is with not main so and not with main so all the files are within home me my library i think the problem is that i have to add the path to this library which in windows can be done using os add dll directory how would i do this in linux is there a cross platform way of doing this note i have tried with os environ ld library path home me my library but it does not work,0,70,97 best and fastest way to get first value from dictionary values what is the fastest and best way to get first value from dictionary values there are multiple techniques but what is the best memory and speed and why examples below i would be grateful for other techniques as well,my discord bot doesn t seem to be executing a function on member join i m new to coding discord bots so this might be some easy fix mistake i made but when a member joins my server the bot doesn t seem to react be it to add a role or just send a random message in the console i d also add i m using replit to host my bot,0,50,67 how to access linux s downloads folder using python in ubuntu the downloads folder is located in home ubuntu downloads but i don t know if different distros have the same style eg home arch downloads is there a universal path for all distros for anyone wondering i need to make a new directory in downloads,nested listed needed to converted as json i am trying to find a best case algorithm to make the nested list into a json the above is the nested list that need to be converted into a json and below is the written json structure which is derived from the nested list i am finding the best time complexity algorithm for the above problem using python language im bit confused what inbuilt function need to be used to solve this problem,0,50,80 scrape data from graph generated with highcharts trying to scrape the price history of several games from a website highcharts js is used to generate a graph with two series from historical data a sample page is i can access the data with javascript using and however i would like to know if there is another method i could use to get the data without having to parse javascript code,how to convert the data from solana account info to readable txt or json with python i get the output image attached blxrjfggrq wzt l hj d actually longer than this image attached my guess is this is some base or something but i have no idea what it is or how to convert the data to readable format in python any help is much appreciated,0,70,63 resize treeview widget in tkinter i m new to tkinter gui framework of python i have a doubt in treeview widget of the tkinter gui my doubt is how to resize the treeview widget so that i can place the two treeview widget aside photos attached below and i doing a project on mysql database so for the frontend i used tkinter gui screenshot of output which arugument i should use to change the size of treeview widget,loop only prints last value i have some working python code i am using in abaqus but i don t manage to make a loop out of it can someone help me with this rather simple problem i would like to print x y z coordinates called partxcord etc for different setsscrews it only prints the last setsscrews what am i missing thank you in advance,0,78,65 cannot delete or update a parent row a foreign key constraint fails sql error i m trying to delete the product row using the delete button on y frontend frontend is in reactjs but it throws this error message on the python sql server ysql connector errors integrityerror cannot delete or update a parent row a foreign key constraint fails grocery store order details constraint fk product id foreign key product id references products product id on update restrict delete route code product dao py file code postman request,library installation in python unsuccesful i m currently trying to install the python library yfinance for that i have used the command pip install yfinance which succeeded with multiple warnings regarding something about the paths can t recall exactly i used pip show yfinance to verfy that the library is indeed installed which it is however files containing import yfinance return an error message modulenotfounderror no module named yfinance i then figured that i maybe installed the library in the wrong directory so i retried with the following command pip install target d c users user appdata local programs python python lib yfinance no user that is the directory which also contains preinstalled librarys like tkinter that results in the following what am i doing wrong thanks for reading sorry for my english and lack of competence,0,77,124 how to get without using the return statement class inside function variable value it is my code i can not even use the database i need get without using the return statement class inside function variable values erorr,python group and aggregate unidirectionally a list of dictionaries by multiple keys am building a tree selector i need to structure my data like a tree of grouped items i have bellow input which is a list of dictionaries i want to get the following output after some researches i come up with this solution it s working but i believe it s not the most pythonic solution i did not manage to simplify it any help to propose another solution or improvement on above codes will be appreciated,0,37,87 how to efficiently filter create mask of numpy array based on list of tuples i try to create mask of numpy array based on list of tuples here is my solution that produces expected result output mask problem is that with bigger data array and increasing number of tuples in filter vals it is getting slower it there any better solution i tried to use np isin data filter vals but it does not provide result i need,update remove many to many field in django i have saved the object in the database with the many to many fields after saving the object in the database i want to append one more id in the many to many field so how can i do that in django models py json from frontend assume the object is saved now what if i want to add id to the account or remove id,0,70,74 how to reverse particular word in a string how to reverse a particular word in a string,find a connected subgraph with n nodes and e edges in python i have a very large undirected graph dataset in the form of txt which i converted to networkx graph i need to extract a connected subgraph containing n nodes and e edges if possible but not necessary how do i go about it this is the code i wrote for finding largest connected subgraph the subgraph i want is somewhere in the middle of min and max subgraphs any help help will be appreciated edit it can be any n nodes no specific nodes required,0,17,99 pass statement in python seems to fail my code is as follows below i ve ensured that the re match conditional does match however the pass statement seems to fail as the f write statement writes each line in the file what am i missing with the use of pass,conditional count of rows in a dataframe based on two columns in another dataframe i would like to add a column to df that includes a count of rows in df that have matching herd and ddat values the output i am looking for is,0,47,45 error when converting tweet object to pandas data frame i have extracted tweets using the tweepy library in python however when i try to convert the list object tweets into a pd data frame i get an error message i have looked around and cannot find a solution to the problem help is much appreciated the error occurs when i try to print tweet df update,modify python class to filter files new to python how can i modify the class to filter files in the folder with a string right now it returns all files in folder containing the content folder which could be millions of items the following works however i would like to isolate files that contain a specific string for example isolate all files that contain v frame the class that works requires a modification to filter file names that contain v frame i am learning python and just can t seem to come up with the solution hope you can help suggest a change to the class or calling method,0,65,101 any trick to override idex function in python so exception won t be raised if a string is not found it obviously returns but also an exception so my question is simply how to remove the exception from the output and let as the output only,python how to add items to a menu of an ipyvuetify toolbar i would like to find out the way to add items to a toolbar menu created with ipyvuetify the code above displays the tool bar as follows but i dont know how to add content to the menu like buttons and or input fields does someone know how to code the menu and add it to the lateral toolbar menu symbol thanks,0,47,73 good looking sphere in matplotlib i ve been trying to plot a d sphere with some curves on it using matplotlib but so far the my results are disappointing i ve tried with several rgb colors opacities and colormaps but the output is similar how could i do something like this bloch sphere that s just what i m looking for thanks in advance,extract from string with multiple lines in python i have been trying to extract the particular substring from multiple lines in python the string goes for lines with foreign characters as well for instance chinese the example is my string n up in the air n out of the woods n not all there n all the way to born to the purple what i want to do extract only the english part and put them in a list here is my way of doing it is that possible to do this in one line thank you,0,59,98 can i get the screenshot data as a file like object or the image in bytes without saving any file i want to send a screenshot over a discord webhook i am using the dhooks module for this to send a file i need a file like object so i want to get a file like object without having the need to store the screenshot as a file any idea how to do this,how to use csv as instance attritubes in python how do i import csv file and use it as instance attributes for my class here is the code ive written driverandteam csv looks like this i keep getting list of out range error in line of my code but im not understanding why how can i fix my code so it works,0,71,62 can t upload file from python requests while curl is work fine i am trying to upload file to some api with this function and get client error unprocessable entity for url while curl command works fine what makes the difference,plot resize and saving empty i m trying to plot a heatmap overlap an image using seaborn and matplotlib as shown in the code below result the first thing is that i can t resize it i ve tried changing aspect and figsize but nothing happen as the code shown on comment when i tried to save the plot generate is either and empty file savefig or an error uncommenting image plt imswho attributeerror tuple object has no attribute shape thanks,0,42,80 rear diagonal sum in the matrix i want a matrix amount that can be in any size for example x or x etc but reverse my problem with for loops along with if not working well would appreciate help for example the result is the function gets an initialized matrix with values and size,counting the occurrence of words in a dataframe column using a list of strings i have a list of strings and a dataframe with a text column in the text column i have lines of text i want to count how many times each word in the list of strings occurs in the text column i am aiming to add two columns to the dataframe one column with the word and the other column having the number of occurrences if there is a better solution i am open to it it would be great to learn different ways to accomplish this i would ideally like one dataframe in the end current dataframe dataframe in code attempting to get a dataframe like this,0,61,122 handling duplicates in a pandas dataframe i m pulling cryptocurrency data from binance api and storing it in an database its working but how do i work around duplicates in the database if i run the for loop a second time it raises valueerror table btcusdt already exists how do stop it from creating a new table and just inserting a value if it s not already there using a timestamp as the key,python find a double quoted specific string i have a block of html and i want to do the following and it always returns but pid only one dbl quote works but finds the wrong tag,0,72,37 modulenotfounderror no module named itemloaders whilst deploying to scraping hub i m trying to deploy my spider to scraping hub but i keep running into this error with one of my imports this works perfectly fine in development just not when i attempt to deploy to scraping hub import from item loaders py,how to one hot encode df column with list separated by pipe i have a df column containing lists separated by pipes and including extraneous information i m having trouble one hot encoding the list for example i want to encode as i ve tried but it seems to one not encode by individual characters,0,52,47 keyerror during handling of the above exception another exception occurred i have this error adding this line brings up this error i think that it s a data type problem data df id cont data df apply lambda row row product name row hour shift strftime y m d h m s axis hour shift is a datetime and product name equipment are object,how to store all the output before multiprocessing finish i want to run multiprocess in python here is an example myfunction in the real case takes really long time sometime i have to interupt the running and start again however the results will only be written to the output file when all pool starmap is done how can i store the intermediate cache result before it s finished i don t want to change myfunction from return to to csv thanks,0,45,76 is there a pandas function to create a df of an dict object inside a df so now i have a csv file which is a df to csv stuff and it looks like this i want to ask if there s someway to merge that dict stuff into the df you can find the whole csv file here here is my code,pandas dataframe custom indexing of nested dictionaris and lists i have a dictionary like this which is showing market orders of some cryptocurrency pairs and each list of bids and asks has a fixed number of elements and each element has two values which respectively are showing order price and order amount i m really an amateur in pandas and numpy so what i want to do is to create a dataframe of this dictionary let s name it df and get the first bid or ask of all of the pairs in a single line like this i ve tried a lot of ways but none of them worked as i wanted them to addition as far as possible i want to avoid using loops,0,60,125 heroku django virtual environment source code modification i managed to deploy my django app with mongodb as database on heroku but i need to modify some source code in django package in the virtual environment how can i access to virtual environment created by heroku from requirements txt or maybe how can i upload directly the virtual environment to heroku and make sure that my git django app is working on it thank you,dataframe slice after every nth column in python my dataframe has rows and columns and i need to slice the dataframe such that all slices chunks are of a size each so i want a since after every nd column finally i want to append all these slices one below another so i get a final dataframe of size any help will be appreciated,0,74,74 creating class object inside same class in python i m trying to create a class object inside the class itself something like this this works and runs correctly but if i use inheritance to create another class as a daughter of this one e g car motor the car function doesn t work properly because it s creating an object of type motor not car is there any other way i could do this thanks,filenotfounderror in subprocess check output i want to connect and use the functions of adb in a python environment in the terminal adb is connected well as shown below to use this in the python environment subprocess check output was used i wrote python code as below i got an error as below in my opinion subprocess check output does not seem to be able to import the path environment variable how should i solve it,0,69,70 how can we create object in desire database in rest framework i m creating project but that project is saving in the default database i want to create that project in other database i m using creatapiview i don t get it how can i use that using otherdataname in get serializer,gensim package installation word vec not recognised from gensim models import word vec results in the following error importerror cannot import name word vec from gensim models unknown location from gensim models word vec import word vec results in the same error after deleting all conda installations of this package pip uninstalling gensim pip installing gensim and pip install upgrade gensim i can finally do import gensim but when i try to use gensim models word vec it results in the error attributeerror module gensim models has no attribute word vec edit updated numpy and scipy as well note i am using a jupyter notebook that i run from my local machine i have not had this problem using pycharm where i was running gensim from a conda env but i m working on a group project in notebook so it would be nice if i didn t constantly have to copy paste between these workspaces any help would be appreciated,0,47,145 requests exceptions missingschema invalid url no schema supplied full code is stated above full output is stated below i have never ever seen an image link like only with backslashes not this and bs recommends me to use that and i dont know how to solve this error typically followed automate the boring stuff with python book same code as from that book but shoots this error when i try to scrape the site thanks for any help,how to format variable in template as currency i am trying to format a string in a template to display as a currency object cost would i be able to do something like f format object cost in the template,0,79,40 how do i put a space in a help command so i am making a help command for my bot and i have this section called bot stuff but it requires me to put a or in order for it to work,detecting whether build ext is building a python extension with debug information i have a python package that has a cython extension in my setup py file how can i tell whether build ext or bdist wheel were supplied with the debug flag i want to link against different libraries based on the debug flag,0,44,51 how to retrieve data from mysql database in django and display it in html page i am trying to retrieve data from mysql database and display it in a html page using python here is my view py models py html but i didnot retrieve anything any help will be highly appreciated,how can i change microseconds in a datetime how can i change my code to new output my code but i want to create new output remove the from and save whole new output,0,50,38 follow up i m trying to input an integer into a website box using selenium and i m getting an invalid syntax error on the send keys the cmd prompt then reads the following i m not sure what is causing the syntax error further help is appreciated i fixed a number if issues in my original code based on helpful responses to my original question but i m still getting a syntax error on the send keys,how do i expand a data variable along a time dimension using xarray i have a dataset ds object that looks like this where variable is i am trying to expand the zero dimensional variable by time so essentially change variable from a d to a d array in the shape variable would then have the same length as time but with the singular value of variable repeated times i was able to do this which gives variable the shape i need but this goes back into ds object as a coordinate variable for some reason why does this happen how do i get variable new added to ds object as a new data variable,0,73,113 replace values from non identical columns in other dataframe i have two dataframes and i need to replace values in df from df i get the error can only compare identically labeled series objects how can i make this work,how can i enable pdf page breaks from html maybe using a marker in the source html file i am using pdfkit to create a pdf from a html file like so i create the html file myself before doing this conversion what i m now trying to do is find a way to impleet a page break the html file doesn t use page breaks because well it s basic html but pdf s are page type structures so how can i pickup something in the html as a marker and then use that to implement a page break in the pdf of course pdfkit from file source target pdf is a simple single line there s no parsing of the content so i don t see how i could tell it what to look for any ideas edit with some advice from nathanial below i ve added to my css but i don t see pdfkit from file source target pdf picking it up opening the html file in the browser and printing to pdf works perfectly so this is more of a pdfkit issue found a similar question here how to insert a page break in html so wkhtmltopdf parses it i think the pdfkit wrapper for wkhtmltopdf is limited on the commnd line this works perfectly but how do i replicate that in python it s not my first choice to doa os execute,0,38,225 browser back button takes user back inside after logout i have been working on a web interface using flask and having some issues with back button in browser as after logging out hitting it takes user back inside i have found similar questions and tried their answers but the issue is not resolved i am attaching a simple example kindly have a look at it main login html logged in html,print to the console when my bot leaves a server i have recently released a discord bot and i want to know whenever it is kicked from a server is there a way to do this,0,68,36 swapexacttokensfortokens transaction has different ratio than router interface transaction i m writing a decentralized buy sell program and i ve stumbled on an issue that i find hard to figure out i m using swapexacttokensfortokens to swap this token for wmatic on quickswap the ratio is all wrong tokens for wmatic if i m using the qs interface i can swap tokens for wmatic passing through eth so not a direct swap my questions are,how to count unique values in pandas column base on dictionary values i have the below pandas data frame also i have the below dictionary i want to get a unique count of id based on the list inside the dictionary based on theire id column for example if we consider id g has only one list aasd aasd g i want to get how many unique id s are in the g id column in pandas data frame so it should be for aasd values those are the only three id values in pandas for aasd in g id so i want to create a table just like below for the list name and count of id s or is it possible to get kind a below out put is it possible to do this in python any suggestion would be appreciated thanks in advance,0,78,146 why can t i install the trumania package on my macos vscode i m trying to download trumania by using npx degit realimpactanalytics trumania trumania trumania in my terminal mac but it doesn t work i get this message all the time and it doesn t work in visual studio code this is the error i get in vs so i m not sure what i m doing wrong here can anybody help me out please,attributeerror super object has no attribute getattr troubleshooting kivy i am creating an android application using kivy garden mapviev i want the user to be able to move the marker hero icon with buttons when i add an int value to the value dumped from string to float i convert the result back to string when i try to do this i get an error i execute the entire application code in one file screen manager is a string in the file as screen helper when i try to execute the code get the error given in the subject i m new to kivy kivymd below application code and screenshots,0,68,108 heroku error while there s nothing here yet i have deployed simple flask app on heroku with docker and access using heroku simple flask prod herokuapp com however i get there s nothing here yet build something amazing error page as i know this happens with incorrect dns setting while using herokudns com but here i use herokuapp com link which should be accessible in any case so what is wrong here flask code my dockerfile my heroku yml,using pywin in a gitlab ci yml file getting error on pip install trying to run a python program using gitlab s ci pipeline i had this running in teamcity but i wanted to try in gitlab i supplied an explicit list of pip install commands including wmi when i ran the program i got modulenotfounderror no module named win com so i figured i had to explicitly add a line to pip install pywin that failed with results obtained it shouldn t be an os mismatch since the os of the build environment is windows as i see i also tried python m pip install r requirements txt but the results were the same how do i resolve this zach s answer is getting me on the right track i used the exact yaml as in the answer except with a tag of win i m not the admin this is what i found i just need to figure out the install problem,0,69,159 modulenotfounderror no module named djongo i am trying to run a django project which ironically uses the djongo python package i installed the requirements file for the project which includes djongo but i still get how can i get the djongo package installed locally,loop of list into a tabbed new list i am a high school student by observing the inputted sequence i want to create a program that creates general formulas on quadratic to a polynomial with nth power equations this posted code will function as a means of validation for inputted sequences if you have a better code please help me thank you the same concept was shown below here is my code,0,44,72 do python files need to be converted into an exe to run on users computers will a python file run on a random user s computer just fine or do i need to convert it into an exe first and then send the exe file to the user thank you,flask pagination arg resets on redirect so i am trying to setup an index page with the first events from my database with the option of going further or backwards here is my code it would be more concise but i am trying to debug it which is why the page backwards etc are at the top what is the baffling part the print part here works perfectly it prints ou the correct page but for some reason the return redirect misbehaves and is locked on to and what is happening upon clicking the previous next button it subs tracts adds to the page variable and then adds that variable as a argument the variable is updated correctly but whatever happens the return always redirects to either page which then goes to or page this is extremely baffling,0,49,141 with which library i can bind hotkeys in python code i have a function and i want to bind this function to ctrl alt i already used pynput but it reacts even on typical ctrl or alt how to realize it in more comfortable way i tried pyautogui but it too cause some strange things if i m not mistaken,creating columns in one dataframe only from non matching columns from another dataframe and set all values to i have two dataframes that look like this df and df share the same columns names except d which is only found in df what i would like to do is add d to df but fill all rows with s in other words if a column exists in df but it doesn t in df add that column to df but make all values in that column below i realize it would be very easy to add one column called d to df but this is just a dummy example when in reality i am dealing with much larger and many more dataframes so i am looking for a way to do this with a code i could implement in a loop or iteratively,0,57,144 soql query using like and string list i analysing data from salesforce using python and am searching for records with usernames containing jack jones or jill in them the current non ideal solution that i have is i have an example here and have managed to get the following example to work however i am unable to pass a list of strings such as is there a way to pass the list into the soql query itself thanks t,duplicate entry for key order details primary i am getting this error message mysql connector errors integrityerror duplicate entry for key order details primary when i try to add new order and its details using python and sql query complete error message here is my code orders order details order details foreign key,0,78,48 why does pandas groupby keep the key i would like to perform the following operations on a dataframe i got the result below my question is why the id column is kept i expect the id column disappear after this operation what i want is,pypi package not getting installed i m working on publishing a utility library for python mostly for my own use you can find it on pypi here repository is here here s my setup cfg i m building with python m build which gives me a tar gz and whl file when i pipenv install raddoo in another location nothing appears to get installed into site packages trying to import it fails as well what am i doing wrong,0,44,73 random function that choose only the available spots how to pick an available spot value in an array i need a function that always finds an available location,why is this code throwing an error in pandas i m trying to solve this problem on stepik the dataframe with the name my stat contains columns session value group time n users in the variables n users we replaced all negative values with the median value of n users excluding negative values of course here s what i wrote but i get this error how can i fix it,0,30,64 is there a way to find the value for the last day of each month in a dataframe i have a dataframe which gives me the daily quantity levels of various articles i want to get a dataframe which gives me the quantity levels on the last day of every month of each article original df target df is there any way to obtain it i tried group by item and date with tail but it didn t work,extracting url from html in python i am trying to obtain a list containing different url that appear partially when you see the html version of this webpage i have tried a couple of different things yet they don t really work first attempt links contains the following in it you can see the pieces that i want for example url content renfe es es cercanias cercanias valencia lineas jcr content root responsivegrid rftabdetailline item html i would like to obtain all the different content renfe es es cercanias cercanias valencia lineas jcr content root responsivegrid rftabdetailline item whatever html in a list in order to do so i have tried an extract and using regular expressions but i have not been succesful second attempt following the steps that are shown in the answer to this question extractinf info form html that has no tags i obtained the next piece of code i thought that it would work because of the similarities in the output it produces but when defining parsed list the next error is returned does anyone have anythoughts thank you all in advance,0,78,157 python wrong ip address detection reading this how do you determine if an ip address is private in python i wrote but that s not correct this is a public ip address how to fix this,fast way to generate large scale random ndarray i want to generate a random matrix of shape e but i find numpy random rand becomes very slow at this scale is there a quicker way,0,35,33 how do i copy an error line from logfile to another file using python i m developing a script that should scan a night run log file this script should print the whole lines that the word error is shown there into another log file named analyzer which will going to create during the script running the output is an empty new log file without the willing lines the code is developed on python and i linked it to here,selenium gives server error after click django pytest i have a django app that i want to test via pytest and selenium the routine i m trying to go through is to let selenium log in then go to the menu choose one of the options this redirects to a new page which is found fine there i let selenium enter data and click a button to start a submission this too works and redirects to a third page on this third your submission was created successfully page there is a link displayed that the user can click to collect the results of their submission this page this link is displayed correctly the href url is fine but when i let selenium click on it i suddenly get a server error when i do the exact same thing manually it works fine here s my test code slightly simplified i have already tried to use webdriverwait self driver until ec element to be clickable by link text click here for your results click and that doesn t seem to even click i know that error mean s the error is on the server side but before clicking the server is fine all the redirections before this step work fine the urls also check out and manually everything works as expected i have no idea how to narrow down the problem further how can i investigate the reason for this error and hopefully fix it,0,79,233 push rejected failed to compile python project django heroku it is my first deployment i am trying to push my django project into heroku but it is saying push rejected failed to compile python project i have tried changing the python lower versions but no luck any help would be much appreciated thanks here is my cmd output my pipfile py source url verify ssl true name pypi my pipfile lock my procfile,instead of printing each element in tuple python prints letters i try to create a validator by getting data from mysql after getting data from mysql i have a list containing tuples but when i tried to printing elements in tuples instead of printing elements from the tuple my code printed the letter of each of them here is my code here is the output i have account admin password and account admin password thank all of you so much edit when i use only for loop i get tuples,0,74,95 push rejected failed to compile python project django heroku it is my first deployment i am trying to push my django project into heroku but it is saying push rejected failed to compile python project i have tried changing the python lower versions but no luck any help would be much appreciated thanks here is my cmd output my pipfile py source url verify ssl true name pypi my pipfile lock my procfile,i m unable to pass the variable value into ldap code to create an account i m trying to pass variable to create account in active directory but i m not sure how to pass it it is creating an account in the variable name not the value of variable,0,74,47 how to use pretrained model pth in pytorch i have one question how to use the saved pre trained model for example i have a model and i train it with the dataset i have and then i save it with the pth extension how to use file pth to test new image thanks,random changing weight i need to implement a class where i am able generate random element based on their weight the tricky part is that i also need to be able to change the weight here is an example output my approach to solving is to find the prefix sum every time a weight is added and append the element current sum weight tuple into the list for set weight a and set weight b the array would be a b then i generate a random number between and the current sum then iterate through the array to find the first sum weight that is less than the random number and return that element however i don t know how to update the sum weight because then i would have to iterate through the array and then find the element and update all the weight of elements after what is a way that i can implement an update for the weight i don t know if using dictionary is better or maybe i should use an ordered dictionary,0,53,175 keyerror during handling of the above exception another exception occurred i have this error adding this line brings up this error i think that it s a data type problem data df id cont data df apply lambda row row product name row hour shift strftime y m d h m s axis hour shift is a datetime and product name equipment are object,django not showing images in editor error i m try create post and add to this post images and i m use for this django summernote in django picture upload to folder on hard disk but not showing in editor console show error please give me advice how to fix it thank you settings py urls py models py screenshot from console,0,45,59 what does this n method do what does n method do in this traingen n in train and evaluate model function this is the whole code i m trying to learn thank you for your help it keeps asking me to put more since i post mostly code so this sentence is just a filler thank you and my deepest apology for wasting seconds of your time to read this whole sentence,django valueerror cannot assign vehicle driver id must be a driver instance but how i would pass objrct in json model serializer json request gives an error message and when i submit this request it throws this error then how can i pass the driver id in the json request,0,67,49 valueerror input of layer sequential is incompatible with the layer expected shape none found shape none hi i have the following error i don t know how fix the next error the error happens only in the last part when i want to predict the next day my full code is this,tkinter very odd behaviour when using the root after function in tkinter i am trying to create a stopwatch timer and i have the basic code done however something odd happens and i have no idea how to explain it so just see this video and if just keeps on going here is the code that handles the timer and here is the code that mentions the timeron variable i am obviously trying to make it go down each second but i have no idea whats happening here,0,55,87 why is this dictionary comprehension for list of dictionaries not returning values i am iterating over a list of dictionaries in a list formatted as follows each dictionary relates to one item of clothing i have only listed the first this is returning the reason for the if statement in there is that not every product has a value for uniq id so i was getting a key error on an earlier version of my code,regex to match a pattern multiple times i have this following string values using regex how to extract as below get rid of the last two digits the regex used d only matches one patern eg or i want to match and as well help needed,0,75,50 how to apply the find method to a series i get this error the newdf dataframe is this,visual studio code doesn t move to next line usign asyncio and pyppeteer my goal is to open an browser using pyppeteer and creating a new tab but visual studio stops executing the code after the browser await launch headless false line but executing the same code in for example thonny does work any help here is the code its just an example form the internet,0,18,64 how to count the number of values for each index in python pandas dataframe i have the next dataframe i need to create the new column len x in dataframe and insert into it the amount of values in each cell i need the next result i will be grateful for help,unable to get instance of seleniumlibrary in robotframework i am using robot framework with python i am trying to get seleniumlibrary instance in python file using following code when i try use self myinstance to populate keywords its not showing in py file in robot file i can easily access robot and seleniumlibrary keywords but unable to use seleniumlibrary instance in python file below are configuration details is there any setting in pycharm or am i missing anything could anybody please help me with this issue thanks,0,50,86 shamir s secret sharing doesn t work with large ints i am to use a python example of shamir s secret sharing from wikipedia when i give it number a larger than it gives completely different output why doesn t it work after that number and is there a way to get around this,why do i have conda error in vs code for running a python file i ve been trying to get used to vs code and following their video tutorials i followed their debugging video and applied similar thing myself however i get the following error about conda i don t see any print outputs on the screen nor i can t use the input function in the code is there something that i m missing or doing wrong thank you,0,51,76 pandas df set dynamic column values by filtered rows here is my dataset i want to do something like this that will update dynamically the correct columns and not add new columns the output result should be i tried many combination but to no avail any help will be very appreciated,taking unique variables from one column and adding up the totals in another python i need some assistance with my code in python that i tried to write my objective is to count the authors who have written a unique number of books in a given time frame the data has multiple duplicate books that need to be removed this is an example of what it looks like now this is how i would like the outcome to be code,0,52,85 edit dict in string i want to edit string data i want to replace with every id in and want output to be i tried with format but it is not working,how to use a variable to find a matching key in a dictionary and return the value i am trying to get the value from the key in my dictionary i am trying to match known fingerprints of host devices and return the associated value i believe it is not properly interperting the variable since there is a slash in it the code is below the first print statements work as expected and the output of host fingprint is aaaa ccc how can i properly use the variable to print the value in the dictionary when trying with subprocess check output i am getting what finally ended up working was to add a couple pieces to the end of the subprocess and then strip the newline charachter,0,33,124 pygame invalid position for blit i am trying to make a game but when i run the code the game makes enemies appear on the screen it says invalid position for blit however i don t know where to put the blit otherwise i don t know what to do because i m still learning the code was fine before adding the copies not sure why that changed anything this is the full code,how to catch the elements selected through both the conditions once page changes i m trying to scrape some urls but depending on the amount of results the page code changes both below are working but none returns me of the results i m trying to create a if of some sort that will leave no nan results and would much appreciate your help,0,72,63 how to schedule code to run at a specific time every day need help to run code that automatically starts at pm every day on python visual studio code i don t want to print anything i just want to execute my commands like pg keyup enter for example only works with printing text,pythonic way to loop through dataframe for a non decreasing id there are debit and credit transactions in the dataframe df the transactions are random but ensure that at any point account is not in net debit i e at any row cumulative debit amount cumulative credit amount what is the most efficient algo to deduct each debit entry from credit entries such that credit entries with lowest id get exhausted to zero before debiting from subsequent credit entries for example desired output for this is,0,51,85 json data parsing using python to get the specific headers value i have a following json file format in which the data will be having dynamic update i have to parse the json file using python with the following scenario if the status pass then the results of value should be maths q q kindly me with this scenario using python,how we can compute the training time of deep neural networks i am currently working on a deep neural network but i am confused about how we can compute the training time of a deep neural network how i will know that my neural network takes less time compared to other deep neural networks i am looking forward to your help and any article recommendation,0,60,65 pandas calendar issue this code for custombusinessday works fine output however when adding an optional calendar as in date functionality it produces the next business day even though today s date dec is not a holiday according to a specified calendar below output,extracting coefficients from ransac regression i have this code snippet taken from here what i m failing to do is to extract the parameters from the predicted data i e for the cubic function i would like to know the a b c and d from the ax bx cx d equation how can this be done in the pipeline especially for the ransac estimator,0,45,66 iterate on xml tags and get elements xpath in python i want to iterate on every p tags in a xml document and be able to get the current element s xpath but i don t find anything that does it the kind of code i tried here is a sample xml file that i try to parse i would like my code to output,field clashes in django orm i have some problems with django orm i have three classes transaction py payments py and when i trying to do migration i have this error as i understand the problem related to inheritance and its specific in orm but i m not sure,0,63,46 issues adding a student to a specific class in microsoft teams graph api in python my code i am having issues with the format for my request body based on microsoft docs my request body is supposed to supply a json representation of an educationuser object i have shown my code and the example given by microsoft and i do not know what is wrong with my request body since it is the same format please help microsoft example,firefoxprofile not working if firefoxbinary is set as webdriver firefox firefox profile profile firefox binary binary i noticed if i use firefox binary within webdriver the firefox profile is not working im getting my standard useragent but if use driver webdriver firefox firefox profile profile i see the updated useragent but then normal firefox is opening with my standard ip what am i doing wrong my os is on windows and python i also see when im using the webdriver with firefox binary right of address bar not connected but the website for example is showing another ip always is that a problem if i use webdriver without firefox binary is see nothing right of the address bar,0,79,107 scraping tabbed table from aws pricing i am trying to builder scraper to scrape tabs which are tables in this page i am only interested in the data thats training processing and few others but it looks like i have to use some sort of a dynamic mechanism to get the tabbed switch assume we clicked on training tab my goal is to build a file that stores scraped data,mocking methods called within multiprocessing doesn t work on mac i encountered a very weird bug in my project i have unit tests where i mock some methods download methods for instance that are called within a multiprocessing operation those unit tests work fine on my ci but when i try to run them locally on mac osx the mock isn t taken into account i implemented the following minimal reproducible example that i launch with if i launch those tests within the docker image python buster with pytest installed they are all successful but if i launch the same tests directly on my host machine mac osx within a virtualenv with only pytest installed i have the following output,0,71,117 python exceeds recurssion limit im trying to develop a merge sort algorithm using divide and conqueror strategy however during the divide portion i am getting a reccurive error that i have exceeded the recurssion here is what i ve got,can t parse selenium python flashscore i m sorry guys my brain is buffering in this problem since a lot of time i m trying to get all match summary deatails results and date i m parsing it filtering the score now what i want is to get the match if in the last match team last match team and h h btw them there is minimum goal if there is one result match i don t get anything for now i m stacked here how to put the if condition inside the for i tried everything but nothing worked for now thank yuou a lot guys i mean i want to get first matches with results of team team and h h btw them and if there is a in the score i won t get it this is example page of flashscore overall enter image description here enter image description here,0,39,155 how to remove edit element in xml file using python i have below xml file i want to remove path and also want to edit source source so it looks like below to remove the path i used below code it runs fine but not able to remove path what changes i should do to remove the path and modify source please help thanks,wondering about pixel perfect mousepointer collision in the case of a button i ve got a pretty simple code up right now that just moves between two menu screens once the button for each is pressed i know that you can mask images in pygame to get pixel perfect collision but not sure how i d go about doing it for the buttons in this code it s just pretty annoying that you can click slightly off and have it still transfer you to the other menu a follow up question i had was on how i could do fade transitions between the screens i ve seen some tutorials but they ve all seemed overcomplicated,0,63,110 probleme when trying to login in django admin hello i have a legacy database wiche use unix time and i have override an absractbaseuser here is my model what i have done to insert unix time in my last login is to change behavior of django signal user logged in like this the get current unix timestamp is a sample function that convert to unix timestamp the get current unix timestamp function when i try to login in django admin i get this error,dictionary entries are all the same i am using nested loops to fill the entries in a dictionary each entry in the dictionary contains a numpy array each numpy array contains three values each dictionary entry is supposed to contain a unique numpy array but when the script is run all of the dictionary entries are being filled with the exact same numpy array each one should be different after trying to debug i realized that the repeated entry is actually the correct value for entry the very last one i m not why this is happening because the command print ic sub units is outputting the correct values in the i o console but when i try to store them in the dictionary all entries turn out the same i m guessing the issue is in the last piece of code ic units i ic sub units i ve been trying to solve this for hours on end it s probably something really simple any ideas printing ic units produces the following output for dictionary entries through the value shown below is the correct value for entry but for some reason it s appearing in every dictionary entry,0,77,191 google colab change variable name everywhere in code cell when i highlight a variable within a cell in colab all the instances of that variable shines up is it possible to change all these instances of the variables at the same time and if such how,how do i get data from website with scrapy i want to get all address for all whale btc from website but the result is empty respones xpath my code is scrappy,0,46,32 how to merge multiple lists into but only those elements that were in all of the initial lists i need to merge lists of which any list can be empty that way so that only items that were in all initial lists are included in the newly formed list so now i need to make a list filtered with merged data from all filtered lists how should i do that,why do i get type error on one line but not the others so i have this piece of code which is used to add subtract from the x and y value in a list with dictionaries the thing is the code must account for the fact that the dictionary can be given like a string with quotes around it so for that reason i use ast literal eval point to turn the string into a dictionary however for some reason with this line that has been changed following commands don t work like they do with the others commands in question point x offset x and point y offset y i am very confused both with the issue in question and the code in general as it was translated from js the error goes as following,0,74,130 why isn t selenium successfully clicking my download link i am trying to use selenium to download an excel file from a website i am not sure why the code isn t allowing me to download it i get an exit code so everything ran successfully but i am not seeing the file in my downloads,change y m d to y m csv manipulation taking data from a csv file trying to change the dates to the right format ie change from to this is the code right now it says the file has unconverted data and i don t know how to fix it,0,55,48 integer solution constraint for scipy optimize differential evolution i am trying to use the scipy optimize differential evolution optimizer in my program but i need the solution to be of only integers right now the solution the attribute x of scipy optimize optimizeresult always looks something like this but i need all the elements in the solution to be integers e g is there any way to enforce this or is there any other better suited package i could use for this,find cosine similarity between two columns of type array double in pyspark i am trying to find the cosine similarity between two columns of type array in a pyspark dataframe and add the cosine similarity as a third column as shown below the current implementation i have is but i guess the above code only for works for columns with integer values is there anyway i would be able to extend the above function to achieve a similar behavior for array columns,0,72,81 attribute error in web scraping in python written some code to scrape a website but i m getting an error nontype object has no attribute text failed to find a solution for this so how can i can fix this error,issue with turning tuple entry variables into an int for a math problem currently i ve been trying to have my tuple variables templentry windlentry dewpointlentry be converted into an integer so i can use them in the math sequence however i keep getting this error whenever it happens typeerror int argument must be a string a bytes like object or a real number not entry i was hoping someone could point in the right direction thank you the code is below,0,41,78 picking only the first value equals in time period i have the df which has index with dates and values or i need to filter every first from this data frame in several time periods for example each in df ind means the beginning of time period now i m interested to get the first in each time period,leetcode smallest string with swaps time limit exceeded problem using python the problem is to use unionfind to solve the problem below is the correct solution i kept getting the time limit exceeded error if my find in unionfind class is either or there are total test cases for this problem using the two find methods above will only get passed so what s the difference between the correct find and the two above thanks,0,63,77 issue in installing python using pyenv in macos m arm tried to install python using the below command error i tried several combinations as mentioned in this issue thread but it is always resulting in the above error zshrc file,why does this list comprehension based on zip object does not work in subsequent loop iterations i have a piece of code where i want to filter out a part of a list in consecutive loop iterations in the first iteration the code works as expected but in the subsequent iterations the list comprehension returns an empty list i know that this should not be the case based on the data i m passing also the following code works as expected what am i doing wrong here,0,47,86 dimension error when using model predict in keras my train set has columns including a target column that i m trying to predict while my test set dataframe test has columns when i run the code i receive this error my model looks like this,how can i access the aiohttp s request from a restrequest in minos i have a handling function decorated with the enroute rest command decorator so that my function receives a restrequest instance but i want to directly access the aiohttp web request to directly access to the rel url attribute how can i do that my current code looks like,0,44,55 add quotes to each word of string in column of pandas dataframe i have a pandas dataframe something like below i want to add double quotes to each word which does not already have it also replace with word and my final dataframe should look like below i am using python for it can anyone suggest a way to do that,converting multidimensional list into a single string in python the result i get can anyone help me to solve this,0,64,21 javascript await and python await are they same concept from a user point of view when we think of for loop we could say for loop in javascript or python are the same thing conceptually can we say await in both languages are conceptually same i smell this can be a bad question but albeit interesting question for me,attempted relative import with no known parent package when doing automated testing my simplified folder structure is in util py i have the following function i have written the corresponding test build format string function inside test util py as follows when running the automated test from command line as python m pytest test util py or py test test util py i get the attempted relative import beyond top level package error message while when running the test util py in debug mode in my code editor i get a similar attempted relative import with no known parent package error i have already read through a bunch of so comments on this very frequent error but i am now even more confused than before in many i read that init py should be placed in every folder and subfolder but this is exactly what i have here still relative importing doesn t work but without importing the function s located in src util i can t have my automated tests to run how can i get this to work,0,59,161 when why use types from typing module for type hints what is exactly the right way for type hinting my ide and resulting code works fine for type hints using either of below options but some types can be imported from the typing module is there a preference for using the import from the typing module over builtins like list or dict examples and,giving input such that it reads the exact dataset among the others tkinter i have a certain number of datasets and i ve given numbers to each of them as the names let s consider datasets so the names are csv csv and so on i m trying to give an input here the number name of the dataset so that my code reads and works on that dataset how do i make that possible i ve done something like giving input and changing it into a string and using pandas read csv string csv but the code s not working can anyone help out,0,63,97 how can i apply base html file for extending to every template in django is there a way to extend base html file in python django by default i want it because i am overwriting extends tag in every html file,python how to add text on plot d mesh typeerror str object is not a mapping i am looking for adding node number on the plot as the figure attached unfortunately i started with the following code however it generates the following error typeerror str object is not a mapping given the following information coordinates of each node what nodes belong to each element and the value each node has,0,41,70 tkinter attributeerror button object has no attribute get when trying to access file from filedialog askopenfilename so i have something like this what i m trying to do is to store the dataframe created in open file to use it in get info i m getting attributeerror button object has no attribute get how could i access the dataframe created in open button,translator on python not working coming with error saying baseblob translate got an unexpected keyword argument the code basically asks user to input a number and converts it into the spelling for the number i need to make a translator for the output on the gui it has a combo dropdown box and the user can select what language it needs to be translated to however the code does not work what should i do whenever i change the language an error saying baseblob translate got an unexpected keyword argument comes up i made it so a message box shows an error,0,57,99 jupyter kernel keeps dying i am trying to load the images from my dataset the images are in tif format and x pixels my kernel dies when i run the following code,selenium not finding xpath button element on twitter this is the path i am using to find the button on twitters website but selenium always returns this error am i doing something wrong or is their another way to select the button element for selenium to click on does twitter have a way of making their html unfindable to selenium p s it is also not as simple as selecting the class or span i have tried those and the same issue arises i have gotten this to work so i am confused if i do the same thing with the nextbut it still doesn t work with the correct xpath here is full code for problem doesn t seem to want to work to find said element but when i do python i main py and do it interactively it finds the element,0,32,140 pyttsx not working process finished with exit code i am making an artificial intelligence ai assistant and i wrote this to make it speak it does not speak and shows how to fix it,how to deal with consecutive missing values of stock price in a time series using python i have a data frame consisting of two time series describing two different stock prices spanning over five years with an interval of approximately minutes i am struggling to decide how to deal with the missing values to build a meaningful model some info about the data frame total number rows number of missing values in series number of missing values in series often there are missing values in consecutive rows which is what makes me confused about how to deal with this dataset below is a portion of the data plots of series column and series column visualisation of series visualisation of series any advice would be appreciated thanks,0,35,131 how to solve this loop to print all the values it should print but it is only printing how to print both values,how can i uninstall a corrupted pip instance on windows today i was trying to install python i was successful in this but then as i was installing flask pip will tell me that it installed then when i run the script it says nothing is installed after a while i realized i was running my python scripts in python but i was running pip in python i did as this post said and ran pip version to discover this i ran pip show flask to see where the module is and it s in the python folder however when i tried to uninstall python i can t find it in my start menu or in control panel programs programs features i believe i had uninstalled it a long time ago to counteract this i did as some youtube video said i lost the link to it and re installed python checked the add to path option checked to install for all users and checked on the pip install after doing this i upgraded my pip version to the latest version uninstalled flask and re installed it it was still installed in the python folder next i decided i will just uninstall pip i ran cmd as an administrator and typed pip uninstall pip as instructed here however when i did this it says i m missing access to the places it wants to modify i found that strange so i checked if i m actually running it administrator and yes i am i looked at the directories that it wants to modify and gave administrators ownership of all of them absolutely nothing changed and did it again i gave myself ownership of it and did it again absolutely nothing changed then i decided to run pip uninstall pip again it says pip is not installed that s strange i typed pip and the help command for pip shows up then i probably stupidly went to all the directories and files pip listed that it wants to uninstall and manually deleted them then uninstalled python and made sure to install pip from there and now we re back at python and pip still isn t installed somehow i don t know what s happening i haven t coded anything in python for or years and i want to try again but this is starting to confuse me could anyone help edit based on the suggestion of one of the answerers i tried to manually delete pip i couldn t find it in appdata but pip version shows me the path i tried deleting pip from there but it says i need permission from administrators i am an administrator on my computer anyways i tried to take ownership of the folder but nothing ever came of that,0,25,468 count the frequency that a bunch of values occurs in a dataframe column pretty new to python and pandas i have a values in a column of my dataframe like this i want to get in output a result like this im a bit lost with groupby or count values etc thanks for the help,how to fix connection refuse error using mail sent function in django hello i am new to django i am making a blog project i want to add sharing feature in my project via email i am facing an error called connection refuse error error look like that connectionrefusederror at url win error no connection could be made because the target machine actively refused it setting py where i defined my views function my views file look like that views py,0,57,79 how we can merge dictionaries having same id with the condition to merge test type values how can we merge the dictionary having same id and with condition to merge test type values input expected output,how to apply a python code to multiple excel files in a folder i am new in programming with python i need to apply a code to multiple excel files saved in the same folder how can i do i tried with os listdir but the program gives me an error for not finding the file in the directory here is the code that i wrote,0,34,65 how to communicate between two raspberry pi via bluetooth and send sensor data from one pi to another i m working for some school project i want to send temperature sensor data from one raspberry pi to another pi via bluetooth i searched a lot for tutorial but i didn t find any related tutorial please anyone help with this or any suggestions would be very helpful,change y m d to y m csv manipulation taking data from a csv file trying to change the dates to the right format ie change from to this is the code right now it says the file has unconverted data and i don t know how to fix it,0,67,48 how to convert mid to mp using ffmpeg i have mid mid file and want to convert in mp format but it shows mid mid invalid data found when processing input here is cmd i m using ffmpeg i mid mid out mp,how to remove a tuple from a list of tuples on variable condition i have list of tuples that needs to stripped based on condition from separate variable when appenv non production i want to remove entire production tuple while when appenv production only production must remain,0,39,48 perceptron algorithm confusion i have this problem that i m trying to solve this is where i need to implement the function but when i try to use my formula but with my input code and run my asserts i get an operands could not be broadcast together with shapes apparently the assertions are correct so i m doing somethin wrong in my predictone function can anyone help,how can i optimize this pandas dataframe code i have a large dataframe resultsdf set up with a sort of three column index ticker fiscal year fiscal period like so part one i m creating a column beat market overall to track if the average roi for the ticker is greater than the average return of the market since it tracks the averages that new column will be either one or zero for the whole stock so every value in beat market overall for aa might be where as every value in beat market overall for zts might be the complicated thing about it is that those roi s would need to be summed for each ticker possibly using the groupby function but i m not sure how to use that in this context part two i have a lookup dataframe companies that holds industry id information for each ticker i want to match up the sector column in the final dataframe to the correct industry id for each ticker without using a loop the problem is that running this code for this dataset takes a way too long and if i could vectorize it it would be much faster here s the loop i d like to vectorize the final dataframe less some other columns would look like this,0,68,216 loop in pandas dataframe i have this problem looping through this dataframe its printing the same column for each value thanks,how to align text in restructured text so that will be aligned in latexpdf i ve tried to write own rst classes and apply it to h h headers like or and it works good when i make html but in pdf it looks like headers it is unexpected please help me to solve this problem i need to provide my report with good title page for my university but i don t know how to do it in rest p s sorry for my english i m russian in the pdf here each part is on its own page like this and the contents rst is at,0,21,107 split one column into three different ones i have a dataframe like this and i would like to split the names columns into columns like this where here is the dataframe in dict format if it helps,better way to execute code at a specific time i need to execute code at exact time for example so far it seems to work but if i launch the code for example one hour before launch i feel like there is a lag in the execution is this the best to achieve what i want,0,38,57 avoid y and x in pandas dataframe i want to do a left join like below but i m getting date x date y and date x and date y what i want is to replace the column if it exists df df expected resulting df i tried the code below but i noticed that my column id disappears from my columns,how to solve badzipfile file is not a zip file error in jupyter notebook i m trying to read xlsx files from folders in a specific directory and to write export them into new xlsx files which every new xlsx will be containing data catalog per year the script works well when i tried it some months ago but it s not working anymore it keeps on resulting badzipfile file is not a zip file error do i miss something i ve tried upgrading and downgrading the anaconda python openpyxl and pandas version but it doesn t help the script works well until year folder giving the output here s the traceback,0,57,107 keep getting none at every input statement i was just making a rock paper and scissor game in python version but whenever i try to run there is none written at every input statement my whole program works fine but i am really annoyed with none is there anything i am doing something wrong in my code i will really appreciate your help here is my code and here is the none written in every input statement,how to iterate over two lists in a specific order i have two lists i would like to create these new names and append them to an empty list the structure is the st item in list with st item in list and so on i only want these names this is what i ve done so far the problem with this it creates every possible combination of names between list list how do i limit my loop to only produce names i want,0,77,85 matplotlib animation not completing i ve tried to create an animation using matplotlib it seems to be animating correctly but it s not showing all the data points in the dataset its a time series from jan to dec it seems to be animating to only right now below is the entire code,how to filter string of dictionary from a list of python i have a list tht contains strings and those string could be a simple string or key value pair in a string please see below sample i know a way to convert string to list of dictionaries using json loads replace method but the condition is to have all elements as dictionary but in my case a list contains a string and dictionary as a string how to filter in such condition any suggestion,0,55,85 ray tune fail to start to run i just run a python script as is shown on however when runing the script it seems that no change happened for a long time when interrupting it with ctrl c it shows below i have no idea what have happened and what to do the script the feedback,how to find the average of the list elements within a dictionary the dict sweets has different keys and list values pairs i would like to get your help on finding the average of the numbers in the value list and return the key with the highest average value as output,0,56,51 generate a specific designed pdf from basic html input i want to generate a pdf with a specific background from three simple input fields a title a message and a signature as shown in the picture below example of desired result i have some experience with creating web sites with python flask but i struggle with how to tackle this challenge,parallel job processing with azure service bus queues i have an azure service bus queue with rest api requests for database ingestion jobs for this i have a requirement to create task workers to complete each job asynchronously as given in the below diagram i want to process these messages in parallel will celery work for this is there any suggestion on what i can choose to complete this thanks in advance,0,59,72 new column which is min of two other columns if condition is true if df freq i want to transform all values in freq new to the minimun between df freq cell and i try this and it didnt work,closest output to euler python how to find which formula is closer to euler without programming first e n n first second e n n second so first is closer to euler but my output always is give me second why forgot to mention n is,0,37,55 how to fit mixture of gaussian with custom made function i am familar with matlab and used to do mixed distribution fitting with my own function i wanted to learn the same thing with python but struggling to do i am not sure how to define the parameter constants and get the value of fitted parameters i e mu sigma mu sigma and probability any help will be appreciated,how to create multiple data frames in for loop i have a list of names i changed them to letters that correspond with values in a data frame column i am trying to create a separate data frame for each name containing that name s associated qty grouped by part number as you can see from the code each time it loops it writes the new loop data over the previous loop s data in df how to i iterate a new data frame name each time it loops so that i end of with separate data frames,0,67,97 how to flatten a multi level columns in pandas please see the data in excel above when use df columns this is the printout i want to turn this multi level column into a single level column with column name changed as jan thanks a lot for help,how to loop through each column in a row using pandas i got the dataframe like this how can i use pandas to loops all column in a rows and get the result like this thanks you for all your helping,0,45,41 real tme keras rl dqn predictions hello everyone i followed that tutorial to train a dqn agent everything works now rather than make a random choice i want to use the dqn without having to do something like dqn predict but i did not find that in their documentation can you help please,grouping the same value based on a column increment using python pandas what i am trying to do is group values of in a certain period of time using a python dataframe for example i have and the output what i m expecting is,0,53,44 it say typeerror object bool can t be used in await expression,convert colormap to list if i run then i get however if i do then i get an error is there a way to convert a colormap to a list like i could do above when i passed as cmap false here s what i would like to end up with returning a list like the one above how can i write such a func,0,11,62 how fill the missing values in the dataframe as ffill function needs nan none which are not in my dataframe as in the question above is there any other way to do it because i care about not using values np nan input dataframe output,web scraping pagination using beautiful soup python it gives me this error kinldy explain how can i solve it,0,43,19 execute python function as on time depend execution i am new here so let me describe the concept first i am having a function the function should execute as above but the problem is if i set everything up the following error are occoured if i set the function to be execute after pm then i cant impliment the function before pm anyone having the concept,flask correctjinja exceptions templatenotfound base html i m getting error flask jinja exceptions templatenotfound base html on the line extends base html block title home endblock but if i ll render the base html template there s no issue,0,68,33 set the range for colorbar of a d surface plot created using plotly how to manually set the range of the colorbar of d surface plot created using plotly,using np isclose function to compare two dataframes i have two dataframe with the same size and same variables in my code i m using np isclose function to return a boolean array where two arrays are element wise equal within a tolerance as follows the code is working ok without any error but the issue for me is that i want to make this process more general and automatic in other word it should be working with any other datasets the important thing is that i dont want to specify the columns name in the code so i want use for loop to automatically iterate over each column and doing the same thing instead of having three codes lines for each column like feature feature feature i want to write one code line to do the same job for any number of columns something like this the parameter for atol should be also predefined in advance for example i,0,29,160 question regarding negative indices in tuples and lists in python in this program why is the output and not this is the case with lists also i noticed print t doesn t give the output as but instead gives what is going on here why can t we go backwards please help me i ve just started python i have no background in programming,how to put the dates in chronological order in python csv so i am working on processing some data and after running my file everything is fine except that the date are not in order i used the code below to try putting them in order but didnt work by the way updated at is the column i am trying to put in chronological please let me know how i can make this work i have attached a picture to for better understanding of my question updated at column pic,0,64,88 list divide based on element from another list i have two lists as follows so basically i want to break list a into smaller chunks based on start stop values from list b e g something like this can someone please help me figure this out,installing wxpython on windows distutilsplatformerror microsoft visual c or greater is required i have installed when trying to install wxpython in my project s virtualenv i get this error distutils errors distutilsplatformerror microsoft visual c or greater is required get it with microsoft c build tools both the error and anything i can find on the internet including here tells me to download c build tools and install c or greater the latest version i have what am i missing here is there some sort of path variable that i need to configure somewhere so pip wheel setuptools knows where to find the compiler,0,45,104 how can i fix the error attributeerror function object has no attribute str i coded a table in python and i need to create a new column that count the number of s this is my code but the code raises an error,how do you use get with a multiframe shopping cart in python tkinter in this code i want display the information from the frame i hit the buy button on i m sure it is a simple solution but it has eluded me i ve been going through google and stack overflow with no solution yet i tried making the newframe global but that just does the last one made i get this error when hitting the buy button with or without information entered into the boxes from that frame,0,43,88 check if syntax in pandas column meets certain criteria i have the dataframe underneath i want to know in what row the syntax is similar to xx example so two letters followed by a stop followed by three numbers followed by a stop followed by three numbers again the desired outcome looks as follows is there a fast and pythonic way to do this,how to extract only the first sentence from the dictionary i m trying to create a game in python called save the girl one man will kidnap a girl and will keep him in his place and ask money from her family to reach his place he will ask three questions first he will ask one question and if they answer it then he will give a clue to reach his place for this i m storing all the questions and answer in a form of dictionary eg now i just want the first question from the dictionary how to do that i gave the command like but the output was the first letter of the first question ie w please help me out,0,66,121 how to splice a dataframe into smaller tables and save each table to an excel sheet here is a table i would like to create mini tables from this table and save each mini table as a sheet in excel file the first stage should contain columns age and eye second fortune food and the third job and kids this is what i ve attempted but it doesn t make much sense,tkinter macos is there a way to change the color of the titlebar the title pretty much explains what i need done i m not sure if its even possible but i cannot figure out a way to change the title bar color in macos an example would be like how the google chrome or discord titlebar is completely different from the default example,0,73,63 print row and column header if column row is not nan pandas it s a weird question but can y all think of a good way to just print the rows or a list of the rows and their corresponding column headers if the dataframe cell is not nan imagine a dataframe like this result should look something like this thanks in advance,python pandas groupby and if any condition i have a dataframe similar to the one below and i would like to create a new variable which contains true false if for each project the sector a has been covered at least once i m trying with the group by function and wanted to use the transform method but since my data is text i don t know how to use it,0,61,67 how to use queue with threading properly i am new to queue threads kindly help with the below code here i am trying to execute the function hd i need to run the function multiple times but only after a single run has been completed current output expected output,why is this float conversion made i have this dataframe an integer value from an integer column is converted to a float in the example but i do not see the reason for this conversion in both cases i assume i pick the value from the selected column from the first row what is going on,0,50,56 replace multiple values of columns i have a data frame with different columns name asset new few value issue etc and i want to change some characters or symbols in the name of columns i can do it in this form but i think it should have a better and shorter way,python search website in google that end with specific word i tried to search all websites in google that end with gencat cat my code output that i have the problem is that only a few websites are searched and also it takes some urls without gencat cat in them or repeats pages from the same site output that i want,0,50,59 python files not executing on server i have installed python on root created python app folder inside public html directory running this py file but it is rendered as plain text in browser htaccess any solution,pyqt custom widget opens in another window i started out with pyqt recently i wanted to create a custom widget and then insert it into the main window of an application the custom widget and this is the main application why is it that whenever i run the main application the custom widget appears in another window i even tried removing the frame and setting the parent to none but none of that changed this behavior how do i fix this,0,34,81 how to resolve this circulary dependancy with python enums so i have enumerations the problem is that the first enumration is referencing the second and the second is referencing it too here the problem is that the universe enumeration cannot use the civilisation enumeration since it is declared below is there no way around this i d like to be able to have the all the universe civilisation in the universe enum thanks,can i call a function in both create and update in modelserializer hi im fairly new at this and trying to implement my code using the dry principle so im calling a function say for create update password in modelserializer s while creating or changing the password for this i have to override create and update in modelserializer and create update password in both of them im not doing any extra functionality in any of them them apart from calling this function so is there any way that i can invoke this function in create and update without overrding it ill really appericiate it if anyone can give any suggestion below is the code example thanks you,0,73,112 i m making a discord py bot that triggers a while loop and starts censoring bad words so i want to create a boolean variable that would normally be false when i say aimby initiate censor protocol it should make the variable true thus also triggering the while loop but for some reason the censorprotocol variable does not change states true or false and the bot doesn t read the text in the while loop plus i don t think it works,calculation of rolling weights with initial weight at the first day i have a dataframe for weights and returns and i want to adjust the weights based on the returns one day before except for the initial weights the basic idea is that the weights are changing based on the returns i created an example with the weights returns and the preferred rolling weights with these weights and returns i try to calculate the rolling weights for k w as follows for reproducibility thank you very much for your suggestions,0,79,90 how do i print the number of items with for loops in a list and dictionary how do i print the number of items with for loops in a list and dictionary here s my code,comparing dataframe columns with acceptable deviation in python how can i have the comparison between two pandas dataframe rows considering an acceptable deviation instead of a match for example with acceptable deviation i want to generate the result column below based on the other columns i wasn t able to find any built in functions or pandas functions,0,35,59 how to aggregate on nested embedded object in mongodb how can i show only those headers whose active value is false,how to create a table and store data from df to send mails i need to add my sql table data to email body and send it to required parties so i have used following method then i add all the output to a variable as below since these data type is a list i converted them in to a str values finally i made the email body as a table and combineed it it works fine but the issue is i am not getting new rows for each set all the data are in a same cell as below can someone show me where i have messed up this is how i have used to send emails,0,21,117 what is this error and how do i fix it process finished with exit code xc i have a tensorflow script i m trying to run and every time i run it i get this error and google hasn t helped me figure out the cause process finished with exit code xc thanks for any help here s a more extensive error message,can t reach localhost urls provided when running docker images when i try to run a docker container that starts jupyter with os command inside a script or a neo j docker image i have a network issue i either have err socket not connected or err connection refused whe i run jupyter notebook it seems everything is working right in the terminal but none of the links work i think it is because jupyter can t be reached from the docker image because when i did it from the machine where there is jupyter i can access the notebook in the requirements there is jupyterlab i don t know if it is enough the dockerfile for sure downloads the requirements so it seems to be a network error because when i tried to move the notebook from the container s localhost i still have the error this site cant be reached err socket not connected here is the full output interestingly i have a similar network problem with when running a neo j docker image i can t reach the neo j docker image that i tried to run and i get err connection refused i will test a django webapp and add the results maybe there is an issue in the ip addr the colleague who left me this image tells me that the working directory must be mounted as a volume but same error and it seems it serves the right directory right pero aqui esta lo que me contesta el navigador,0,62,238 unable to see messages using django register i have an app with views py as follows i have added a for loop for showing the messages in register html i can t able to see messages when the for loop is available but i can see message address when for loop is removed can some explain and help me how to proceed,working with image data from memory in pytorch question if i have an array in memory with dims n height width channels and i want to get a pytorch classifier to feed them forward and give me an array with class predictions for each of the n images in the array how do i do that background i am working with a computer vision problem where i modify some images using pre existing code and want to send the modified images into a pytorch classifier cnn not developed or controlled by me i am accustomed to tensorflow keras more than pytorch with tensorflow keras models you can give them a bunch of images in a numpy array and it ll go ahead and feed them forward through the model ps a colleague suggested saving all the images to disk first then reading them in with dataloader but that is so unnecessary when i already have the images in memory sorry if it s a dumb question i tried to find a solution elsewhere but obviously haven t had much success,0,59,174 plot confidence interval of a duration series i measured the duration of requests i got now an array of elements each element represents the duration of a connection request in milliseconds i want to plot the confidence interval in python and in a clearly arranged manner do you have any idea how i should plot them,how to find the reverse of power mod a b c when using power mod a b c we get a b c returning x i have a c and x but am having a difficult time reversing the c is there a function that already exists to reverse this or would i need to implement euclidean algorithm to find what b is and return that,0,59,57 how to infer and convert dtypes in pandas dataframe here is my sample dataframe i would like to convert the dtypes to boolean in column a and b string in c and integer in d and e i am trying to use panda s method convert dtypes but it returns string for every one how can i automatically convert the types df convert types dtypes gives,detecting kick discord py i tried to add a functionality to my discord bot that would detect when some moderator kicks someone and retrieve the kicked user s id i am thinking of an event like on message or on member join but couldn t find an answer to my question thanks for the help,0,61,49 error when using tf data dataset from generator i am trying to make tensorflow dataset using tensorflow from generator i am quite sure that i have made a python generator that work perfectly fine but when i tried to pass it to from generator i always got an error this is the piece of code that i use to create the dataset but when i run it it always produce error,load multiple files to multiple arrays with for loop and pandas i have an unknown number of txt files and each file contains two columns for numbers i am trying to make a python script that loads whatever it finds in that directory and create numpy d arrays for each column automatically here s my attempt in which i don t know how to update the names of the arrays and how to pass them to numpy what i need are a bunch of x y x y etc where i can gather them in a dictionary for further manipulations thanks,0,65,99 background wont change tkinter im using a mac and i have this problem after creating window using tkinter its bugs out the background color code example window example,tensorflow crashes on mac m i am trying to start using tensorflow on my m mac however i only get the following message when i try to import tensorflow i have tried using tensorflow versions and but all have the same problem,0,28,45 how to plot the cluster centers by using this k means clustering from scratch how can i plot the initial random cluster centers for k on the scatter plot in the photo photo for iris dataset,how to convert lmd file to csv flow cytometry data lmd file extension is often used for generating flow cytometry data but this couldn t be directly used for processing either in r or python is there a way to somehow convert it to csv or some renowned format,0,35,48 python unittest mock pyspark chain i d like to write some unit tests for simple methods which have pyspark code how can i mock the spark read part i ve tried this but it fails with this error py j py jexception method join class java util arraylist class org apache spark sql column class java lang string does not exist looks like the mocking didn t work as i expected what should i do with it so the spark read load returns the test dataframe that i specified edit full code here,sort a defaultdict list by highest item number i have the following code that i have created from running some analysis and i have put the results in a defaultdict list afterwards i put the results into a csv file id like to sort the values that im returning so that the more important items go to the top i want to sort my defaultdict list by check from greatest to least how would i sort the values so that for each key address the dictionary with the highest check comes first result would look like this,0,76,93 python create project structure and import packages i am novice to python i need to create project structure where i need to call the packages files inside my testproj directory s main py file could you please let me know how to call the functions f and f inside main py,running selenium webdriver in github actions for unit tests i m trying to run a unit test in github actions before deploying my aws lambda where i m running selenium webdriver with a functioning selenium chromium lambda layer i m running my environment in python and using chromedriver version i kept on encountering this error upon running the unit test i used the same chrome options as when i m running my aws lambda which works with some additional options that are lambda specific tmp folder is the file system provided by aws where tmp folder tmp lastly i m starting the driver this works perfectly well in the lambda but fails every time i try to run the unit test in github actions this is the configuration when running the job in github actions the configuration entirely is taken from the chrome setup in gibhub actions made by selenium themselves and it works great this github actions configuration is using the latest chromedriver so i ve both tried older versions as mentioned before and the latest one but i m still getting the same error,0,48,183 program to download pdf from google using google search i code a program which you give him the topic you want to download pdf of it but it s not working well so could anyone help me with that the error message is here,binary classification but only one class gives results i am trying to train a neural network i have two classes precision and recall for one of the classes equals all the time here s the code for the neural network here s the training loop after training the precision and recall of one of the classes equals and the other one is pr and recall is there something wrong with the data i self collected the data and i can t understand whether the problem is with the data or something is wrong in my code,0,43,98 player is lagging when moved around i followed up a tutorial to make a platformer game in pygame and completed it but when i try to make them with my own lines of code the movement of the player is lagging i don t know how to solve this this is the player s code from settings import player speed the player speed is and the clock tick is please help,venv pip not found i am using windows python i am new to python after i created venv and facing the following errors my venv is able to catch the pip path when i use the command where pip which is in f drive but when i use pip list or pip install package name i am getting error modulenotfounderror no module named pip,0,69,68 how does one downgrading pyobjc to version so i have been trying to write a script with pynput however when i write however i get the error i read here that downgrading to pyobjc worked for some people how do i do that using macos air m chip,selenium wait until method hello fellow programmers i have a simple question is equivalent to i m developing this selenium app and sometimes the server traffic is quite massive which leads to different loading times when moving from page to page i found time sleep n isn t efficient but if i use the wait until ec block will the code execute once the condition is met it won t waste time if use wait webdriverwait browser and the page loads in seconds,0,51,79 counting relative frequency in pairs a strips mapreduce i am new in python and i want to use mrjob package for countind relative frequency of pair words i wrote below code but it doesn t make correct output can you plz help me with my mistakes f A B count A B count B count A B a count A B,kivy and infinite thread loop app freezes i have to divide long tasks into threads creating thread anywhere in kivy app makes the whole app wait for end of the thread function so there is no difference when using threads or not what am i doing wrong kv file python code once button is clicked and thread created app freezes how to create background thread,0,52,66 loop to match dictionary keys from list append dictionary with associated data in other columns i want to loop through my data and population my dictonairies with event value and their corresponding xcordadjusted and ycordadjusted dataframe my work output,what is the proper parsing for sqs receive message i ve been troubleshooting this for a few days now and i can t seem to understand where to address this error i ve tested against the receive message response syntax based on what is documented in boto sqs documentation and lambda tests to no avail i took this python snippet directly from the boto sdk documentation,0,39,61 typeerror unsupported operand type s for list and float in python bar chart i am trying to plot grouped bar chart i have this data i want to plot graph like this with labels printing at degree angle getting this error my code is this,how do i select element in a list present in an un ordered list using selenium python this the website i am dealing with here i am able to send the code for the security name but in order to submit it i need to click the dropdown element that comes after giving the security name how do i achieve this with selenium i used the code below and its not working staleelementreferenceexception,0,46,71 itertools permutations not working when repetition is above why does python itertools permutations not work when repetition is above,how to import selenium library using bultin import library so i m trying to import selenium through python code this is the code when i run i get this error what should i do update this is the whole code then i run this code using this command python test py,0,19,47 sympy gives a residual value when trying to solve the logistics equation if i try solving the logistics differential equation in sympy i get a residual value which prevents sympy from getting the correct values for the initial coditions if i run this code import sympy as sp i get how can one get rid of these residuals in the solution,how to get conv d kernel values in tensorflow i have a conv d layer i would like to find out the exact values in the filter kernel matrix used not just the number of them how can i access kernel matrix values i created a numpy array cast it to a shape tensor apply a conv d layer to it with strides this means that the output will be a by matrix the top left value in it will be equal to the top left value in the kernel matrix top right of the result will be equal to top right of the kernel matrix and so on the particular zeros and ones in x core achieve this however y changes if i rerun the code ie the filter is not constant suggesting that the kernel matrix is drawn from a distribution similar but different question how to get cnn kernel values in tensorflow this method only worked in tensorflow problems with it gr tf get default graph gives attributeerror module tensorflow has no attribute get default graph if i replace get default graph with graph as i believe that is the newer equivalent put name conv to my layer definition conv layer tf keras layers conv d strides activation none input shape x shape name conv then run conv kernel val tf graph get tensor by name conv kernel eval as suggested i get keyerror the name conv kernel refers to a tensor which does not exist the operation conv kernel does not exist in the graph,0,62,233 how can i get the dispatch service name using nameko i have a green event that can be dispatched by two different services how can i get the variable with the service name,automatic change of discord about me the problem in discord as you may know there is a about me section this section is as description of a profile that you can write yourself bots can have a about me section what i want is to edit this about me section automatically in discord py for example every hours the about me section of the bot change what i tried i searched for a very long time some answers but didn t find anything relevant i saw that you can modify the about me with the developer portal but it s not automate i saw that some people said this will be able in discord py v but didn t find it it may be possible to resolve this probleme with http requests but it s only a supposition i m not very good in this topic show some code,0,32,142 having problem in reading data from multi level columns pivoted format to dataframe in python i have data in a google sheet with columns in below format i want to adjust row and in columns to create a dataframe original dataset i tried result will ignore first two rows looking something to bring first two rows in columns also output req below groupby with year,plotting multiple data sets as one average and adding error bars matplotlib i need to analyze some data taken in my lab but it goes beyond my limited programming skills i have multiple sets of similar data and i need to take the average of all of these and plot that with error bars the idea is to plot the area of an optical signal which is recorded by a photomultiplier tube versus the angle of the diffuser that emits the optical signal to collect the data the diffuser is rotated from to degrees and stops every degrees for the photomultiplier tube pmt to record the area optical waveform i have three individual sets of data that look like pmt angle area ignore the diode data that is used to normalize the area values for the pmt so essentially what is plotted is pmt angle normalizedarea instead of three individual graphs in one plot like the picture attached has i need to plot them all as one average of the three data sets combined and with error bars to show the deviation between data sets thank you in advance here is my code,0,68,198 how to use drop duplicates with a condition i have a dataframe consisting of two columns column a consists of strings column b consists of numbers column a has duplicates that i want to remove however i only want to retain those duplicates that have the highest number in column b this is an example of how my dataframe looks like what i want is this using drop duplicates,binary search but it doesn t search the upper part of the object list im trying to create a code that searches an item from an object list but it only checks the lower part of the list if i try to search for the items in the lower part of the list it gives good output but when i try the higher part it doesn t do the job code class desired output output any help will really do,0,67,78 square root of number of the form a b sqrt c how can we compute the square root of a number a b sqrt c in sympy for example we expect sqrt sqrt to be sqrt,typeerror pandas libs tslibs period periodmixin new periodarray i am getting the following error when trying to unpickle an arima model i had made the code i have written is,0,37,24 i accidentally deleted my python venv folder on vs code what should i do i accidentally deleted my python venv folder on vs code i had tried some tutorials i could find on the internet but none of them works anyone know how to restore or redownload the venv file thanks,how does the one hot encoding work in keras image data generator so i have classes for images cat cow and dog when i do i get this and when i do this i get this which i correct as i have cat dog and cow pictures however i don t understand why is for cat shown as or for dog shown as and for cow shown as can anyone please help with the logic,0,51,86 django rest framework trying to get similar products with serializer reversed i m new to drf and im trying to serialize similar product on product heres my code models py serializers py in serializers i have written this type of code which dont works code and heres my productlistserializer i want to get similar products of product but it dont works any ideas how to solve,runtime error using concurrent futures processpoolexecutor i have seen many youtube videos for basic tutorials for concurrent futures processpoolexecutor i have also seen posts in so here and here github and githubmemory yet no luck problem i m getting the following runtime error i admit it i do not fully understand this error since this is my very first attempt at multiprocessing in my python code here s my pseudocode module py classobject py my class file classobject py does not have the main guard things i have tried i haven t found a different solution from the link provided above any insights would be greatly appreciated i m using a macbook pro inch processor ghz core intel core i os big sur i don t think that matters but just declaring it if it does,0,64,125 table words and numerical values and generating text file i am trying to write a table in python but am unable to get the right outcome i am trying to get this output i am using the following code i am getting output also how can i link this to text file generation,explanation of dimension of input in a transformer model model architechture hey i was trying to code the transformer architecture from scratch as a part of my project i wanted to ask that what does the batch size refer to in the dimension of the of the input matrix of the encoder i have us the attached model architecture as my reference let me consider the example of an essay document the seq len refers to the maximum length of the sentence inside the document and the embedding size refers to the size of the word embedding of each word of the sentence in that case does batch size refer to the number of sentences in the document,0,53,115 selecting column with smallest value in pandas dataframe i have a pandas dataframe with this structure df test i would like to add a new column minimum difference containing the column name with the smallest absolute value for that specific row ignoring v like this,call python def function in nodejs i run a python script in nodejs it works but i want to stay open and then call the def function from nodejs several times how can i do that nodejs test py,0,43,40 we are trying from instagram importing instagramy from python but it s not working i want to scrape the data from instagram different public and private accounts but when i run the following code,convert datetime into standard time python i am trying to convert time data which is displayed in hours minutes and seconds into standard time i want to discard the seconds as well i m selecting datetime from mysql like this i then get only the time by doing this and i have tried various methods of converting the time into standard time minus the seconds such as but i just get the following error,0,33,73 how to access items from ndarray with dtype object how can i access data inside a numpy array with dtype object the following raises an indexerror,incompatible chromedriver and chrome versions except they are both i am using selenium python with chromedriver and i got the usual error about incompatible chromedriver and chrome versions i went and downloaded chromedriver but i keep getting that same error here is my output when i check the chromedriver version here is how i initialize the driver in my code edit after updating selenium to ver i now get a stacktrace with the same error,0,24,81 how to assign data from a file to a dictionary i am just starting my coding adventure my problem is that i have a file with structure and i would like the code to return a dictionary program rtkpost pos mode ppp static i was trying and got,how to extend lines in matplotlib i wrote an animator class that would accept multiple lines y coords which i want to extend dynamically according to fresh data the problem is even though i specified the line labels it doesn t seem to treat my lines as one instance instead it treats them as new lines therefore i get new line colors and legends every single time is there any way to fix this behavior aside from creating an internal database of colors within the class and reusing them according to line index but still i don t really like that it treats my lines as new instances every single time and i wonder if there is maybe a simple fix for this behavior,0,47,122 python jupyter crawling ebay website nested try except error im trying to get the price from pages in ebay but i have different of id tag to the price i v tried few options but i got indentationerror or when i got the output csv got a a column of empty cells,how do i fill values inside square boxes in row column format using python for a tictactoe game i want to build a tictactoe game but first i need to build a a x grid and then insert values in it like below i am unable to go beyond this,0,54,52 sales per month per product id i want to have a list of all product sales from until for sales of each id main product would it be better to first create some product groups e g id main product from etc as i think that the output would be a big table i have already tried out some things with groupby etc but i can t find the solution this is the dataset,in python is there a way to create a bar chart based on the first column in a two column groupby table i want to create a bar chart based on the first column in a two column groupby table i ve summed up my dataframe by applying groupby to create the table i want my groupby table currently only has two columns the first being the categories and the second being the count of those categories from my dataframe i d like to create a bar chart with plotly express using the first column as the x axis and then second column as the y axis however when i applied groupby to the dataframe it grouped my data how i want but that the first column doesn t have a label in order to create a bar chart i need to tell plotly what the x axis will be but there s no label in the groupby table this is what i currently have for my groupby table this is the output which is what i want as you can see the first column has no label so i can t reference it when trying to create a bar chart so i end up getting a bar chart with just numbers as labels when i d really just like to use the first column s categories as labels this is what i have this is the output can someone help me fix my x axis so it shows the categories like in my groupby table i m just not sure how to tell it to look for that first column since it has no label,0,73,262 using class variable for type hinting in init in python i have a list of allowed types in my class and in the constructor i would like to pass an argument that has to be in that list of allowed types so conceptually this is what i would like i m not sure how to tackle this how would you set something like this up maybe there s a better set up for this but i m not sure how thanks,building lambda function in yaml issue i m building a cloudformation deployment that includes a lambda function built out in python however when i build the function it will not allow me to keep the single quotes this hasn t been an issue for most of the script as i simply import json and the double quote work fine but one section requires the single quotes here is the code any section that includes f v vpcid requires the single quote inside the for the script to run properly since yaml requires the script to be encapsulated in single quotes for packaging how can i fix this example in yaml from another script i imagine i could re arrange the script to avoid this but i would like to use this opportunity to learn something new if possible,0,77,137 typeerror unhashable type numpy ndarray python image classification using tensorflow and keras i try this sample code for image classification the terminal pop this i try to check the data from the pred with output im not sure why because the data is from set of an array im new with this and im using python can someone help me,function within if statement not returning a value instead getting name error i am doing some fuzzy matching on addresses and am filtering on a high score if that score exists in my data set then i want to call another function that looks at the data and checks to see if there are sales calls associated with it i want to ultimately return a list of values that fit the criteria in that function while debugging i can see the sales and calls test function works i see the values getting appended to my lists however when i go to the next iteration i see my lists in my debug watch change from a value to a name error name call list sales list not defined can someone please look over my syntax and show me what im missing thanks here s my code,0,59,138 how do i fix a http error bad request in python i am trying to access checkpoint firewall by using it s api but for some reason i am getting http error bad request i have never had this before any ideas here is my code basically same thing is working fine with python this is python code,return populated fields from a join table in sqlalchemy flask userservice is a join table connecting users and services tables i have a query that returns all the tables that have a user id to the id passed in the route result holds a list that looks as such how could i then continue this query or add another query to get all the actual populated services service class instead of just the service id and return all of them in a list the for loop is my attempt at that but currently failing i am only getting back a list with one populated service and not the second,0,60,108 scrape data from graph generated with highcharts trying to scrape the price history of several games from a website highcharts js is used to generate a graph with two series from historical data a sample page is i can access the data with javascript using and however i would like to know if there is another method i could use to get the data without having to parse javascript code,how to convert the data from solana account info to readable txt or json with python i get the output image attached blxrjfggrq wzt l hj d actually longer than this image attached my guess is this is some base or something but i have no idea what it is or how to convert the data to readable format in python any help is much appreciated,0,70,63 how can i get the last name in a path next to the right of a character using re on python i have been trying to make a good regular expression that catches the last name of a file or folder for a given path meaning that for instance the following path c users resetstorex pictures can be reduced to pictures what i have achieved so far is the following re which reduces the previous path to x pictures any ideas,selenium succeeding python requests library failing despite same url and same request headers what s the difference when i run that code i get the headers selenium uses i copy these exact headers into a python dict and request as follows when i run this it just hangs indefinitely so there is some issue with the request apart from the headers what is the difference between the requests made by python and selenium how could i identify the issue and hopefully get this working with the python requests library update i updated the code to get the request headers instead but the python requests script has the same result when using these headers just hanging or timing out if i set a timeout parameter further update debug output is as follows,0,79,132 how to avoid circular references in a dict like object in js consider the following example in python the function dict is very useful bc we do a new object thus not using the same pointer and therefore avoiding circular references how to do the same in javascript node the following falls into circular ref thank you,plotly enabling text label in line graph for for the last value i am trying to build a graph where the line graph should show the value of only the last element in some beautiful formating line graph with no text at end now the current method of the text shows for all elements and is a straight text that creates a lot of collisions with different lines in the same graph and looks clumsy will be very nice to achieve something as mentioned in the below image desired line graph with text,0,56,94 opening anaconda prompt with python i want to create a script that will help me with installing packages for spyder therefore i want to use python and have the script first open anaconda prompt then execute the commands and then close that window however i can get it to open for example the calculator but it doesn t seem to open the command prompt for opening the calculator i used how can i get it to open the command prompt,converting rows to wide columns based on duplicated ids in another column in pandas my question is similar to this this and this questions but still cannot resolve it i have a dataframe with duplicated ids i want to make it wide but i do not know how many publication type will i have maybe maybe thus i do not know how many columns wide will i need the max size of wide columns for publication type must be not be more than the number of types for each id expected output for now i do not need to put the same publication type into the same column i do not need all articles in the same column thanks,0,79,121 why does my code not replace the repeatd letters in aardvark and baboon example why does my code not replace the repeated letters in aardvark and baboon example this an exercise for the hangman game,wrong output on python string to datetime so i want to read csv and make a plot for the data i use plotly candlestick to output stock data however some problems i met here very strange the output for dataframe that reading from excel is like this here i am using strptime to convert the data to datetime but the output is wrong you can see that was converted to why how can i get the correct result and i will need to use it on plotly candlestick function data sample if you need,0,36,98 django display a list of post s categories with a number of post hi i am trying to make a template in django that displays a post categories table and has a number of posts with it i can t seem to make it right using annotate when making queries on my model like this views py im receiving list of posts instead and has a posts count key with value of models py where did i miss thanks,how can i write a rule in spacy with pattern inside a pattern nested pattern i would like to write a pattern in spacy that matches a text and then optionally all the parenthesis at the right of the text if there is any for example for the following texts i give as input the left part of the arrow and expect as an output the right part of the arrow however we found that this example te as explained above other stuff this example te as explained above other stuff here is another example this example te some text here this example te some text here some random text and then this example te this example te then a final example this example this example these texts are not fixed and work as an example i would like to get as many starting parenthesis as ending possibly even no parenthesis pattern i tried the following but it does not work it matches only the first parenthesis since i operate on long texts i would also like to match a short phrase and not the entire document if there is a right parenthesis at the end i would like something like the following but it does not work thank you for your help,0,75,219 pygame screen not loading my error my code the code was working fine until i added the winning messages if you anyone has a fix please tell me,cannot get text in xpath lxml python i assumed getting the right path to get all the professors emails on the website but the output list is meaning nothing in the path really dunno why really appreciate your help thank the community so much,0,28,46 convert number to cardinal in python i want replace any number in string to cardinal num then print it i have one challenge the user may not draw any spaces between the number and the next character input output,is it possible that python takes very long to assign a name to a huge list gb i am working with a very long list of lists i m talking gb if you put it in a file a cleaned corpus in my script i assign it a name and then use it in another function that has to do with word vec spacy and semantic similarity calculate for each word in a list of words what is their semantic similarity i e how similar are the contexts in which these words appear i have many steps in my script and i ask it to print something after some of the steps all to an output file i am using bash to execute the script it s been hours and nothing is in my output file which i assume means that the list has not been assigned the name yet however when i run a py script with only the list in it also assigned to a name it takes very short also the model usually loads very quickly so that shouldn t be the problem either so am i doing something wrong here this is how i made the list that process worked i already have the list and the actual list is just a huge list of lists thanks for your help,0,39,221 how to extract acronyms and abbreviations from pandas dataframe i have a pandas dataframe a column with text data i want to extract all unique acronyms and abbreviations in that text column so far i have a function to extract all acronyms and abbreviations from a given text i want to apply extract all unique acronyms and abbreviations from the text column sample data desired output,i want to loop this and everytime it loops i want so it prints untill infinite but it prints what am i doing wrong i want to loop this and everytime it loops i want so it prints untill infinite but it prints what am i doing wrong code,0,65,76 pandas column fill n as with rolling mean i have a pandas dataframe i d like to replace nans in rate column with rolling mean of previous values expected output,why isn t my else in flask python not working when i press the start button it directs me to error html even if i choose my skin type,0,29,27 how to fit mixture of gaussian with custom made function i am familar with matlab and used to do mixed distribution fitting with my own function i wanted to learn the same thing with python but struggling to do i am not sure how to define the parameter constants and get the value of fitted parameters i e mu sigma mu sigma and probability any help will be appreciated,how to use different key name in mongodb while working with django i am working on developing a micro service using django where i use mongodb as backend folks who wrote the main code used java hence the data already present in the mongodb collections follows camelcase pattern for e g firstname is the key name now while working with python i like to name my variables and functions using snake casing like first name and get first name what i want is that inside the code i want to refer first name as first name everywhere but while saving updating the first name in db and while returning json response of the user data i want to return it as firstname is there any way to achieve this behaviour please help me,0,67,127 select first image of image foreign key in django template i want to select first image of an object property set i created a property model with a foreign key to an propertyimages model how do i access the first image of the property object set all in the template i don t want to do it in the view function since this should be in the base html file the code,how to print the first ten results of the code how could i print only the first results of my program i tried creating an empty list but could not store the results properly to then print them,0,68,39 is it better to make custom registration with editing django usercreationform class or make it on a new table and class i wanted to make a django authentication but i was confused about wichone is better is it is better to edit the venv lib site packages django contrib auth forms py file and make my custom form and edit db on venv lib site packages django contrib auth models py or it s better to make my authentication system with model and views and forms on my application,histogram with opaque bars if i make a histogram using plotly express then the colors cover each other however if i use ff create distplot then the colors are more transparent this shows transparent colors which is much nicer is there a way to get the colors to appear like that in px histogram,0,72,50 install error with typeerror object of type nonetype has no len i want to install pygrowup library from github when i download the file and run the setup py file in vsc error root internal python error in the inspect module below is the traceback from this internal error typeerror object of type nonetype has no len how can i fix this,neptune aws sortorder asc and desc don t give reverses of each other i am searching for with my table and i get all the tables i expect sorted by score though i am not sure if it s in the correct order since i don t know how to get the scores from elasticsearch when i reverse it i e from sortorder desc to asc i do not get the exact reverse what is the reason for this,0,61,74 python creating json object from string i m new to python and trying to generate a list of dictionaries in json format i get the data from selenium by iterating through an element i get the output as string here s my selenium snippet i get my data by using a for loop like this here are my results i would like to have my data in the following format so far i have been unsuccessful using the json module thanks,get values within keys with item loader scrapy i m trying to extract some values from keys in the response page of a webpage unfortunately when i do this it returns the keys only and i cannot seem to grab the values because each key is a long list and they re numbered i cannot seem to figoure out how to get the values for all of them for example here s my working code this returns a list of the keys instead i want the values corresponding to these keys,0,79,88 extrapolate category from a categorical variable and apply them to another variable in pandas starting from a cutted variable from a pd dataframe like this i would like to extrapolate the the category and apply them to another continous variable in order to obtain the variable y segmented with the same class of the variable x,extract white regions from binary images i am trying to select only the eyes that were segmented from some face images here is one example of one binary image the problem is that i want to get each eye of the image putting them centered in a fixed size squared image in this case there will be two images with the eye centered on a fixed nxn squared image i tried to check the following post how to extract white region in an image but it seems to work only in one big part of a binary image how to do that in my case,0,55,105 implementing asyncio with pysimplegui i am trying to implement asyncio with pysimplegui in python in this gui example two buttons button and button emulate a long task to accomplish goal expected result current result i thought that i applied async wait according to the rules did i miss something,how to verify collision between two sprites in the same pygame sprite group i have been trying to create an enemy moving system for my top down pygame d game but my two enemies always end up by getting over one another this is why i decided to create a method that will stop the enemies from overlaping one and other but i don t know how to check for a collision between an enemy in the group and the rest of the group because when i do so the enemy is always thinking he has collided with another enemy but he just collided with himself is there an easy way to fix this see the comment in the code below for more explanation,0,48,121 openpyxl merge cells with x y how to transform id to excel columns letters i m using openpyxl i need to merge cells in a dynamic way so here is my difficulty here is the code to merge cells with openpyxl because i need to do it dynamically in for loops i need to transform to a b to so to be more precise a b aac,check if values are within intervals in pyspark i have a large dataframe a with intervals like this and i have a dataframe b with sorted non overlapping closed intervals like this i want to check if values of dataframe a are contained in one of the intervals of dataframe b and if so save the id in a new column interval id my output dataframe should look like this is there a way to do this efficiently without udfs,0,72,77 is it possible to run threads in while loop i am trying to run a thread in while loop but i am getting the error runtimeerror threads can only be started once kindly suggest a way to fix this,transposing matrix twice using classes without numpy i need to implement a method transpose that returns a new matrix that has been transposed it also has to print out a string of that matrix it works when using matrix transpose but it doesn t work when using matrix transpose transpose because transpose returns a string i can t use numpy or add more input to the methods how would i go about this,0,39,68 plotly i have problem with buttons to change yaxis type when someone clicked on same button twice or more yaxis is scaling all the time i have problem with buttons to change yaxis type when someone clicked on same button twice or more yaxis is scaling all the time as a result my chart looks like this after few clicks on same button but i would like to have it like this correct version,how to crawl events from calendar with python and beautiful soup i want to extract links of all events from the calendar on this website and later to crawl info about each event this is the url this is the code that i wrote i m always getting for all links variable i guess that i m doing something wrong ihave looked on links that i found on network tab but i can not find any kind of link that can help me,0,72,82 discord py music bot stops playing hi im having a problem with my discord music bot whenever i play a song after mins it stops playing and goes cilent,django orm for loop to get queryset i am trying to use for loop to get list of author with the number of books writing and author with the title of book wrote here is my models py i have tried to loop through like this i get the authors as they are in db also i got the list of all books i use author list author objects order by book count which gave the number of author how can i loop through the db and get the author with number of books and authors with book title wrote,0,30,94 runtimeerror there is no current event loop in thread bot chat id dispatcher in python telegram bot i have a problem in python telgram bot runtimeerror there is no current event loop in thread bot chat id dispatcher i don t know what is this runtime error please help me my code is this but because of this code i have runtimeerror like this what should i do,how to calculate the mean and sd from multiple lists in a dictionary and sort them into a new dictionary i have a dictionary containing keys each key has values assigned to it in the form of a list i also have an empty dictionary that i have set up that i want to store the mean and standard deviation for each list in the original dictionary i have this code so far any help would be greatly appreciated,0,58,81 django model importerror attempted relative import with no known parent package i m making a small django app and i just want to make some tests over the queryset of my model however when running code outside the manage py runserver environment i get this error error as already said this works perfectly when making views i can import my article model and create articles from the admin dashboard my app structure looks like this,best way to concat merge list of pandas dataframes into one while preserving all values in a given column i have a list of pandas dataframes as below and would like to concat merge them so that the values in the shared column are exhaustive between all of the dataframes what is the best approach df df df desired outcome,0,74,61 dataflow python pickeling issue i have written a simple dataflow program that takes input from a pub sub topic and calculates the fibanacci number for that integer however my dofn is not able to pickle the custom function fibonacci which is giving me errors when running on dataflowrunner can someone help me in telling me what i am doing wrong below is my pipeline code,python mysql this use of cursors works but is it correct i have the code below which selects some data from one table finds related data in another table updates the data in the related table and deletes the data from first table the use of cursors below works but not sure it is best do i need to define a new cursor x db cursor each time like this,0,64,71 how can i store results from a loop in a dataframe i have the following loop creating kpi values for each of my subsets is there a way to store this in a nice table something like this with the sku value and sku scaled in the columns edit code used to create kpi function,aws s object filter to not match prefix in python script when iterating over s objects using python boto i see that there s a filter method but can you apply a not condition i want to just get the top level objects not objects in folders they have a prefix i am currently doing this and it works i see support for a filter like this i m asking is there a way to say prefix folder name,0,56,76 create a custom signal filter in python scipy i am trying to implement the following filter using python and scipy i already know how to implement basic filter like this however the filter at hand is much more complex and i don t know how to attack the problem thanks,pairing parameterisation and fixtures in pytest i have a python package that checks the formatting of data stored in excel files there are various different sheets to check with different formats and in my pytest setup i have some example files that are expected to throw different kinds of errors or pass because these files are reused across multiple tests i have them as a fixture in conftest py what i want to be able to do is to use this fixture in different tests but specify what the expected values are for a particular test as parameterisation to the test to keep the information for a test together with the test for a toy example as it stands that repeats each parameterisation for each fixture param value good with row good with row bad with row etc what i want to be able to do is to pair the fixture and parameterisation so that the first set of examples is checked using good and the second set using bad is there a simple way,0,50,177 how to skip some symbol characters when this character is used as a split column symbol in pandas split function i have a dataframe like below original data i want to be to be data,getting an error for pyspark when i try to run take i am new to learning py spark so forgive the very basic not detailed question i am trying to sc to read a tsv file and then parse that file however after reading the file when i try to do take on it it gives me the following error which i cannot understand i am running it on windows below is the code and here is the error i am getting any help will be appreciated thank you,0,35,89 is it possible to create a custom keyboard interrupt key in python i am writing a python script that has an infinite loop and for me to stop i use the usual keyboard interrupt key ctrl c but i was wondering if i can set one of my own like by pressing space once the program can stop i want it to have the same function as ctrl c so if it is possible how can i assign it,inserting a character after the last set of numbers in a pandas column i m interested in inserting a character comma in this case after the last set of numbers if they are present in values of a pandas column a sample of the original dataframe is as below expected df output is as below ideally a comma is inserted before the last set of numbers in the column value if the last set of characters is not a number like value the column is left as it is any thoughts around this,0,77,93 iterating list to create df i have a variable class list that comes from a post request api in graphql that looks like this how can i iterate thru this list and create a dataframe that looks like this i need to create the df like this because i will merge with another df also i m curious what s the need of this list organization like a list of lists list of dict thanks in advance,firefoxprofile not working if firefoxbinary is set as webdriver firefox firefox profile profile firefox binary binary i noticed if i use firefox binary within webdriver the firefox profile is not working im getting my standard useragent but if use driver webdriver firefox firefox profile profile i see the updated useragent but then normal firefox is opening with my standard ip what am i doing wrong my os is on windows and python i also see when im using the webdriver with firefox binary right of address bar not connected but the website for example is showing another ip always is that a problem if i use webdriver without firefox binary is see nothing right of the address bar,0,75,107 how to get the first and last date of the month with year and month in python in the below code from the month and year need st and last date of the month for ex month and year first date last date i tried with calendar but it simply returns,stop multiprocessing from going through entire list for function for bruteforcer i am trying to make a brute forcer for my ethical hacking class using multiprocessing i want it to iterate through the list of server ip s and try one login for each of them but it is printing every single ip before trying to make connections and then once all the ip s have been printed it will start trying to make connections then print a couple ip s then try to make another connection and so on i just want it to iterate through the list of ip s and try to connect to each one one process for each connection and try about processes at a time an example of the server txt file those are not real ip adresses,0,59,130 tstables attributeerror module pandas tseries has no attribute index background i have a dataframe which i am trying to write append to a tstable i am executing it using jupyter notebook python problem i am getting an error while trying to append dataframe structure code ref python for finance by yves hilpisch the error happens after the above command,increasing variables that are in use in pygame i am coding a space invaders game in pygame and wanted to make it so that when the player reaches points the game increases the number of invaders from to in the game the enemies respawn near the top half of the screen immediately after dying the game functions perfectly normally until you reach points at which it immediately crashes how do i make it so that the variable storing the number of enemies num of enemies increases while the game is still running in the code i have put here i removed my attempt to change the num of enemies variable but fyi i placed it just above pygame display update my crappy attempt to resolve the issue boiled down to if score value num of enemies i have also tried this code while assigning num of enemies a global value but it simply defects the game and messes up again code,0,58,158 scraping the shoe sizes with bs i am trying to scrape the shoes sizes of this shoe how can i scrape the value,heatmap of minimum median maximum values in python in the dataset below outputs i want to do the following create a heatmap based on the color shade hue my attempt desired output should look like the figure below but using the green yellow red hue thanks in advance,0,23,47 difference between secrets compare digest and hmac compare digest there are two strings comparison functions to prevent timing attacks secrets compare digest and hmac compare digest but it s not clear from the documentation how i should choose between them are they the same if so why is there such duplication,makemigrations can t detect change in django i know there are a lot of similar questions but i will describe my problem as simply as i can this is the app i want to migrate this is my setting py this is what happens when i type in makemigrations after i add a field in my model this is what happens when i type in showmigrations after i add a field in my model i have reinstall django using pip i have created new app i have created new project new venv i even have reinstall python itself all same story i suspect my django source code has been corrupted but when i install django using pip it use file that is downloaded before instead of download new file trust me i have tried all the way a newbie could possibly tried could someone tell me how to redownload django itself or someone who is way smarter than me know what s going on right now thx,0,42,161 only accept numbers with one decimal place the user should only be allowed to enter a number between and with one decimal place furthermore if is passed it should try again the input what i tried i don t want to use round number also i am not allowed to import any modules except math,can t download playwright python properly i tried to install playwright in my laptop i typed to command prompt however only the first lines running without error i got the error message for playwright install i ve added playwright into path but still getting the same error,0,57,46 unsingning a signed value django rest i am using web personal sign nonce web eth coinbase callback to sign nonce at the front end but i am trying to build the backend in django rest using this to unsign the signed nonce but getting an error error does anyone have any ideas about how to unsign this nonce,creating class object inside same class in python i m trying to create a class object inside the class itself something like this this works and runs correctly but if i use inheritance to create another class as a daughter of this one e g car motor the car function doesn t work properly because it s creating an object of type motor not car is there any other way i could do this thanks,0,53,69 creating relationship between models when in separate files flask sqlalchemy how can i properly establish a foreign key relationship between these two models when they are currently in separate folders the code above currently throws an err any recommendations or solutions would be greatly apprecieted,valueerror target size torch size must be the same as input size torch size i have a cnn network for classfication labels it consists of a number of conv d layers chained together in a list which is then executed in a for loop in my forward function the model is as follows after each sequential block we do a max pooling using this the output of the finallayer is then reshaped the dimensions after each sequential and max pooling layer call is shown below while calling criterion which internally calls binary cross entropy with logits of pytorch i am getting this dimension mismatch i have looked into similar questions where they have mentioned to use torch unsqueeze however i am not sure i can use unsqueeze to create rows also i have cross checked each output layer channel number after each call and have validated it any help is appreciated,0,45,149 heroku error while there s nothing here yet i have deployed simple flask app on heroku with docker and access using heroku simple flask prod herokuapp com however i get there s nothing here yet build something amazing error page as i know this happens with incorrect dns setting while using herokudns com but here i use herokuapp com link which should be accessible in any case so what is wrong here flask code my dockerfile my heroku yml,valueerror invalid color argument in my pygame code i wrote the code for my final project it s a code that makes a bouncing on the wall i wanted to make two balls so i created a class and created several functions but i think that my code is not working,0,69,50 groupby in pandas dataframe with multiindexing ps groupby with column as name i have tried creating dataframe with multiindexing resultant dataframe is now i want to use groupby with name i tried using level but not getting how to use column name could anyone help with this thanks,change value of the variable which previously assigned to another variable i know the title is confusing but it s a very simple question given this snippet how can i change the value of the variable board so that it also changes the value of sdata board to clarify my program calls sdata board a lot so i think it should be a good idea to assign state sdata get and only modify the value of state variable is it possible,0,48,78 python rearrange list based on another list i want to rearrange a list based on another list which have common elements between them above lists have common a b and c as common elements the expected outcome for is as below thanks in advance sky,is there a way to tell if a string in python has an explicit u in front of it i am working on python compatibility when working with str and byte types there is an issue i am coming across here is an example notice how the extra unicode u appears in the final representation of x in python i need to make my code return the same value in python and python my code can take in str bytes or unicode values i can coerce the python value to the python value by doing this makes the u hello case work correct but messes up the hello case this is what happens the problem is that in python u hello is the same as hello so if i include my code above the result for both u hello and hello end up returning the same result as u hello in python so i need some kind of way to tell if a python input string explicitly has specified the u in front of the string and only execute my code above if that case is satisfied,0,43,191 having trouble getting brownie in vs code i ve been trying to get brownie in my vs code but i keep getting errors i followed these steps and nothing has worked the pipx won t work so i tried pip install eth brownie this is the error i get below,useful design patterns for creating a neat python web app we decided to refactor our code as almost every new feature was implemented as a form of a hack would to get some tips on what design patterns would be useful to have in a web app things like factory or facade don t suit i feel those are more suited for libraries and not a web app the gist of the web app is that it is a sort of translator that understands a user s queries and creates large queries to our dbs it s a sort of search service we have a ton of features and configuration that keep stepping on each other s functionalities and we have to add ugly hacks to overcome them hoping to have a good base that lets creating long complex chain of rules easier to modify,0,47,141 how to handle duplicated or blank columns and add number in duplicated ones in python dataframe dataframe has columns with repeated dates and empty columns i tried objective to add any string value like a jan repeated column and blank columns renamed as a b so on output required in tabular form for further processing and storage,neural network input of layer sequential is incompatible with the layer expected shape none found shape none i am working with some data to make a trainable model suing neural network this is the code i am working on it gives me this error valueerror input of layer sequential is incompatible with the layer expected shape none found shape none please any one can help we solving this problem,0,57,71 how to generate all possible combinations in a dictionary in a dictionary so i have a dict in a dict like so and i need python code to give an output of i have no clue how to do this and any help is accepted,running airflow on docker locally import error module not found i m attempting to test a dag locally and have setup airflow locally in docker when i login using the web on localhost i can see all of the example dags however one dag i am trying to test appears at the top with the following error i have installed airflow locally using is there a reason i can t see this module in locally running airflow on docker my import statements are as follows only the snowflake one errors out,0,46,90 obj json dumps j unboundlocalerror local variable j referenced before assignment my goal is to pass the data coming in as a json to my script but i am getting this error that saying j referenced before assignment i saw many similar errors like this but no one could help me unboundlocalerror local variable j referenced before assignment here is the code i ve used,django createview doesn t save object and doesn t give error i m working on a new project and i m having difficulties adding new objects from the users page it can be added from admin dashboard this is the model i have this view product form html i tried a couple of times and i didn t work so i searched for solutions and tried the following and this within the form valid neither of them worked so i can open the form and fill the fields when i send it the object is not saved but it doesn t give any error it just reloads the form,0,63,100 how can i prevent from repeating until the next start time after is finished is executed and as soon as is executed starts immediately when is executed i want to restart when the next start time is reached not the current start time can i try break continue for i range etc,urban institute api max size i m trying to write a python wrapper for accessing data from the urban institute datasets link to the docs but the output caps at rows the docs don t mention anything about authentication or how to bypass this limit below my code this dataset caps at k but if you paste directly to the browser you can see that there are more than k,0,59,69 issue with object programming and files i was trying to write a code and check it with pytest i thought i did everything ok but i got a problem after writing this i want to check it with method of class person when i tried to use method id the function ends and i got the output my code example of line of people txt,it came out with the wrong sort it doesn t give the medal standings correctly i didn t understand where i made a mistake in the code in fact the athlete with the least time should get a gold medal while bronze gets a medal input spyridon louis gre kharilaos vasilakos gre gyula kellner hun output gold medal gyula kellner hun silver medal kharilaos vasilakos gre bronze medal spyridon louis gre,0,64,74 how we can compute the training time of deep neural networks i am currently working on a deep neural network but i am confused about how we can compute the training time of a deep neural network how i will know that my neural network takes less time compared to other deep neural networks i am looking forward to your help and any article recommendation,how to get the version number of the latest stable release of python via single http request i m working on a script that needs to download the latest binary version of the python interpreter from the python org website how do i get the version number of the latest stable release of python unfortunately the cpython repository on github is not using releases so i can t get the latest version via releases latest and the only option i currently see is parsing the python org website which isn t a good one since it depends on the future python org redesigns i d like to be able to get the version number via a single http request if it s possible,0,65,114 is it possible to shorten the code in pyqt by sticking lineedit in for i have lineedit blocks and i want the textchanged function to trigger when any of them change i decided to take the easy route and write them out in order but now i want to shorten my code i wanna shorted this like this or like this but it does not work thanks for your attention,scrape responsive table from site whose url doesnt change i want price history scraped from this site upon click of price history button the table gets loaded but the url remains same i want to scrape the table loaded,0,71,39 matplotlib bar plot looks cutoff i have a list of values representing distributions when i run this code it looks as it should but when i change from plot to bar they all look cutoff code results everything else is the same what is going on,get all unique pairs in a list including duplicates in python how can i obtain all unique pairs in a list allowing for repeats e g for the list i d like and and for i d like and i don t really mind what object is returned list tuple dict set etc as long as i can then iterate over each pair and extract both numbers,0,47,85 how can i do groupby without importing anything and in an expressive and oneliner kind of way i am wondering if it is possible to do grouping of lists in python in a simple way without importing any libraries and example of input could be and output i am thinking something like the implementation of itertools groupby but shorter,why does this miller rabin test implement the use of n instead of well i was learning miller rabin primality test algorithm through this tutorial video at instead of checking if pow a exp n in the last while loop he used if pow a exp n n why does it have to be n i did check it by writing it in c and turns out n is the only possible way of getting the right answer he did also try to explain why but it is just weird to me why is this the case it makes no sense to me it is supposed to be instead of n and n makes it work but doesn t make it work i really need someone to clarify this for me one more thing i did watch the first video where he explains how the algorithm works so i think i comprehended most of what he said,0,59,149 how can i loops throught all column in each row using pandas in python hello there to all you guy i got a dataframe like this how i can loop through columns in each row and get the result like this using pandas in python the result will be a list like this or separate list like this,separately save the model weight in pytorch i am using pytorch to train a deep learning model i wonder if it is possible for me to separately save the model weight for example i have the bert model as the base model and an additional linear layer on the top after i train this model can i save the weight for the bert model and this linear layer separately,0,58,69 value is not updated in the if statement i know this is a silly question but i would like to know why dictx is not being updated the functions returns dictx value ignoring the if block thanks,pandas create a new column based on percentage growth rates from another column i am pretty sure i am struggling with something very simple but i need some help i am trying o add in the column portfolio the total values of shares based on their daily price development i am using therefore the following function as you can see i am not able to aply the formula for a portfolio ion a day based on the day before is there someone who could help me please,0,37,87 replace multiple values of columns i have a data frame with different columns name asset new few value issue etc and i want to change some characters or symbols in the name of columns i can do it in this form but i think it should have a better and shorter way,mysql connector errors operationalerror mysql connection not available i get this error message on pythonanywhere when i reload the app a couple of times i need to reload the app from pythonanywhere to make it work error message file home sideproject virtualenvs myvirtualenv lib python site packages mysql connector connection cext py line in cursor raise errors operationalerror mysql connection not available mysql connector errors operationalerror mysql connection not available anyone please help me with this server js file code sql connection py file code,0,50,63 i m trying to use gpg with a pypass password store and am missing a file how do i point the python program to gpg id i m getting the error message when trying to use pypass a very intuitive password manager with the command,passing errors types into a custom error handling class python being a python novice i resolve problems in interesting ways this being one of them i m wanting to pass error messages into a error handling script a class so i can customise the error message for example when filenotfounderror is raised i want to display send a message like cant find xxx file check yyy directory or connectionreseterror message database connection restarted and so on about different messages so when an exception is raised i am passing the error to firstly how to capture e g filenotfounderror without pulling out of a string secondly what the professional way thirdly since i need a bunch of if elif to generate the unique message why bother with a special class just put e g except filenotfounderror as e with unique message and put under main and do times for each error type raised then main becomes messy thanks,0,42,155 how to create directory from script path when i run this code i get this error,not getting empty string when no input is provided about the problem the function was required to return names in the format name first name last name and return nothing when no input is provided for example would return an empty string issue the function should return an empty string wen no input is provided but giving name as an output code,0,16,61 why does this python code with threading have race conditions this code creates a race condition output python version i thought gil would prevent it and not allow two threads run together until they do something io related or call a c library at least this is what you may conclude from the docs then what does gil actually do and when do threads run in parallel,how to convert mxnet ndarray ndarray ndarray to a scalar i got a weird object that shows like this this is what it outputs i want to convert it to a scalar but no matter how i try it stays as array still outputs,0,66,41 how to say if elements in the same column are the same then calculate the average of corresponding values in pandas how can i calculate the average of average delay mins of each country my idea is to calculate the values corresponding to similar origin destination country s names and store them in another list where there are no duplicate country names,add integer column to timestamp column in pyspark dataframe suppose you have pyspark dataframe with an integer type column days and an datetype column start who looks like this what i want to become is a new column end who would look like this,0,57,44 how to find the closest date from a mysql query to a specific date i have a table in mysql which stores dates i also have a datetime variable called x i want to get the closest date from the table to the x variable i ve been trying to do something like but it doesn t seem to work any possible solution,how to render a ttf glyf to a image with fonttools i want to render a glyf of a tt font into an image numpy array this are the vertices how can i draw the glyf to an numpy array i found glyf draw but i don t found a tutorial or examples how to use it i also do not found any informations about the pen concept edit i found a way to render text with pillow that is a good start but i need more control of the final result there glyf shut be centered and in a size that does use the space in a more efficient way i am also interested in the gridlines f ex baseline and others edit i found some hints in this question how to get the font pixel height using pil s imagefont class there are two lines that mark to points on the y axis but as you can see there are characters going down one line and characters are overlapping in the x direction as you can see on the j and a i still need more control of the final result,0,61,184 tf an internal error occurred activity id fc eca fed ae a fc f c ea im trying to push files into git repo via azure api but getting activity id error i followed their documentation and trying to add simple file in my repo here is my code anyone knows how to solve this issue i have also added this issue on their developer community,convert dict type pandas rows into columns in pandas i have an intresting situtation my dataframe looks something like this i want to convert it into something as follows which looks like a pivot table in which old columns values also act as indexes i have tried to look into pandas pivot docs but nothing helpful was there,0,57,58 is there any way how to print changing variable in python tkinter canvas i ve got some variable in while loop is there any way how to print these variables in tkinter window in for example label even when it is while loop or is there any way how to print changing variable in tkinter label,python requests json showing errors the codes are showing me what is the problem and how can i solve that,0,56,20 how scipy dist rvs works is unclear from documentation i am currently sampling from a custom discrete distribution like so where p is a list of probabilities of length n i can t figure out when i look through the documentation what the computational complexity is as the only thing the documentation says about the rvs function is the following link to the documentation here how does the function work bonus question is there a faster way to do this,map counter object to dataframe to create new column i have a data set with played football games and i m trying to look more closely into the games played by each team at home therefore i am trying to create a column for every team with a counter that tracks the consecutive wins the following logic should apply i created a function that outputs a dictionary that can be mapped to the dataframe sorted by date to create the new counter column a new column should be created that indicates the consecutive score of the home team the expected result for a subset should look like this i tried to map the dict to the new dataframe when doing this i either get a map object displayed or the whole list that corresponds to the key in the dictionary how can i map the created dictionary to the dataframe so it displays only the corresponding value in the list and not the whole list,0,77,164 fast way to access elements of a matrix or pandas dataframe from a list of coordinates i would like to select non consecutive elements from a matrix or pandas dataframe where the row and column of each element is given in a list of coordinates output this code works but i asume there are more efficient ways avoiding for loops to solve this any suggestion,callback error on plotly dash dashboard when trying to add a dropdown to show pie charts i m quite new to dash but i m trying to put together a data dashboard of the things i want to have is a drop down that based on the input renders of two pie charts the logic to structure the pie chart is included in my callback function it is saying it is expecting output but it had two i ve had a look online and tried different suggestions i think i m pretty close to getting this to work there is just something dumb i m not doing i know people here are wizards so i was hoping someone might be able to help me also if anyone is dash savvy can you point me in the direction of good documentation to learn how to orient this so i can change the layout to make these plots fit better together in a dashboard rather than just a web page so much love thanks,0,65,169 how do i convert this json to dataframe i have a json that i am struggling to convert into a python dataframe the json takes the following form ultimately i want to achieve the following table i have tried pd read json but i always get an error mixing dicts with non series may lead to ambiguous ordering,issue when trying to apply format to date column pandas i am trying to set date format to a pandas dataframe column however i get this error why i cannot format this date column to day month year format,0,55,37 program to download pdf from google using google search i code a program which you give him the topic you want to download pdf of it but it s not working well so could anyone help me with that the error message is here,greedy implementation using dictionary in python with multiple trips this code is just to load a file in as a dictionary the dictionary has the format name weight my issue is with the greedy knapsack approach i am trying to implement mainly the fact that i want to make more than trip i would like to represent trips as a list of lists where the lists represent trips see my attempt below here is the error i got when run any help would be appreciated apologies for any ambiguities i m pretty new to this,0,43,95 adding a legend to pandas scatterplot i am using the pandas version of scatter not matplotlib how would i add a legend to this graph based on the colors,apply a function in dictionary composed of dataframes with different column names i ve been struggling trying to take a dictionary d composed of n dataframes and apply to them this which is a function to repeat index number of times the column of each dataframe something like this so the dictionary d has the dataframes that look like the before column i tried this way to apply the function i was able to do it this way when i select manually a column name but these dataframes have different column names on purpose but i can t apply this because iloc doesn t work on strings i found weird because it is not selecting the values of the dictionary instead is using the string of the dictionary if i want back the dictionary d with the function applied how can i solve this thanks edits,0,29,144 what happens after getting max value of map object in python hi i found out that when next nums is executed stopiteration is raised i thought only the max value of nums would be removed from nums after max nums was executed but are all the values of nums removed after max function is executed looking forward to help thanks,how to plot decision trees on a line graph using sklearn i m new to data analytics and i m currently dealing with decision tree if i wanted to represent the example below into a line graph how would i go about it,0,58,41 column bind in numpy array and matrix i have two arrays and a matrix i want to column bind them in order to have one matrix but when i do this python reports me how can i solve this error,how can i extract data from an excel file like this using python and pandas how can i extract data from an excel file like this using python and pandas it has got multiple tables at different positions here is the structure of the table i want the tables as different dataframes for this file i want these three tables as three different dataframes from which i can create separate excel or csv files how to do that,0,43,78 how to web scrape imdb movie rating i am trying to scrape the the movie rating from imdb website i am trying following code as but it gives error i e attributeerror nonetype object has no attribute text my code,ffmpeg probe not working when run from python on windows i am relatively new to python i am working on extracting some metadata from a video and i am trying to use ffmpeg probe or ffprobe because it provides all the data i need after many errors i went to the basic and tried the error that i get is i have been searching around and tried installing and uninstalling ffmpeg ffmpeg python installing it directly on windows adding the files to the path so that i can run it in the console then tried to do it on my own using the probe py as example the error returned is b ffprobe is not recognized as an internal or external command r n program or executable batch file r n but runs it is not the filenotfounderror when i run it in cmd there is no issue ffprobe show format show streams of json e archive peliculas clasicos casablanca avi provides the information with a couple of lines before the json but works i don t know if it is a windows thing i have tried both and already with no apparent difference or i am doing wrong,0,39,186 converts an abnormal character into a normal character e g an unicode character in python how to converts an abnormal character into a normal character e g an unicode character in other words decoding an abnormal characters string like aaa to reveal its contents output i would like to print the string without these characters aaa,get column index of max value in pandas row i want to find not just the max value in a dataframe row but also the specific column that has that value if there are multiple columns with the value then either returning the list of all columns or just one are both fine in this case i m specifically concerned with doing this for a single given row but if there is a solution that can apply to a dataframe that would be great as well below is a rough idea of what i mean row max returns the max value but my desired function row max col returns the name of the column that has the max value my current approach is this i m not familiar with how pandas optimizes everything so i apologize if i m wrong here but i assume that row index row eq grows in linear time proportional to the number of columns i m working with a small number of columns so it shouldn t be a huge issue but i m curious if there is a way to get the column name the same way that i can use max without having to do the extra work afterwards to look for equal values,0,53,199 dealing with in out string parameters in swig python maybe someone know how to rewrite getversion to get in python version and legacyversion as a result of function instead of passing them as in out parameters for now i create additional function in swig inteface file but current implementation returns only one parameter instead of two update now i use ignore and extend features but i guess there is more elegant way here is my working swig interface snippet,how to run python script as global command from any terminal instance similar to pip or howdoi command i have a python script called myscript py in a directory to run myscript py i have to open terminal in the same directory and do python myscript py or python path to the py file i can open a instance of terminal anywhere anytime and do myscript or myscript arguments options by doing this i should be able to run the script i want to implement something like pip command or the howdoi package when i enter myscript in terminal i should not get myscript the term myscript is not recognized as a name of a cmdlet function script file or executable program check the spelling of the name or if a path was included verify that the path is correct and try again if you have any confusion please ask in comments if the title needs improvement feel free to edit the question,0,77,156 how to insert something at the end of a entry in tkinter i am making a calculator and whenever i click the number buttons on the calculator it always inserts them at the beginning but i want to insert them to the end of the entry how do i insert them at the right instead of the left,create a new column that details if rows in one pyspark dataframe matches a a row in another column of a dataframe i want to create a function that creates a new column from a left join in pyspark that details if a value in one column matches or does not match the column of another dataframe row by row for example we have one pyspark dataframe d that has columns id and name and another pyspark dataframe d that has the same columns id and name i m trying to make a function that joins these two tables and creates a new column that shows true or false if the same id exists in both dataframes so far i have this i m new to pyspark can someone please help me thanks in advance,0,58,134 locally save a dataframe from a remote server in vscode i m running a python script in vscode on a remote server and i want to save a dataframe that is generated in that script locally is this somehow possible thanks,python merge based on a partial match improving performance of function i have the below script which aims to create a merge based on a partial match functionality since this is not possible with the normal merge funct to the best of my knowledge the below works returns the desired result but unfortunately it s incredibly slow to the point that it s almost unusable where i need it been looking around at other stack overflow posts that contain similar problems but haven t yet been able to find a faster solution any thoughts on how this could be accomplished would be appreciated,0,40,104 list of every integer except with list comprehensions is there a simpler way to achieve this with list comprehensions i m new to them and currently trying to improve my coding basically in list you have all the numbers from to except thanks,iterating in a python numpy matrix adding and subtracting to cell elements gone wrong input is a numpy matrix and the procedure is to find all entries above in the matrix when the program has found an entry with a value of or higher the program must subtract from that matrix position and distribute that one to the cell above one to the cell below one to the cell to the left and one to the cell to the right input is and i expect an output of instead i get the in the middle of the input matrix needs to be taken out and redistributed to the adjacent cell elements of the matrix one above one below one to the left and one to the right this does not happen i cannot make sense of it anyone please i added some constraints so that if an entry in the matrix does have an entry of or larger close to the boundary of the matrix this will make sure that you add one only to existing entries in the matrix,0,46,205 how pull a docker image and give it a diferente name i need pull a docker image of tensorflow i know that for pull a image i have to use this commmand but i dont want my image with this name how can i change this name in the moment that i pull it,what s python json serializable i have two ways to represent python object by json dumps first second then i tried p json dumps person the second way would say it s not json serializable so basically for python json dumps only work for built in object like dict object,0,55,44 syntaxerror f string expecting in python i dont know whats going on with my code anyone can help me please i just started to learn about classes in python and i found this error sytax i really happy if you can help me out thank you,arimax with multiple lags i am using statsmodels arima package to create some arimax models i am using a few different exogeneous variables in my prediction from the documentation though it seems like the model only uses the current value of the exogenous variables to predict my endogenous variable is there a good way of including exogenous variables with lags to a certain point old values in my prediction without adding the lagged exogenous series to the model manually to be clear the solution here is exactly what i want to avoid doing,0,46,93 adding a syntax style text to a plot in python using matplotlib i m wanting to incorporate a text box with code style highlight in a plot in matplotlib and i m wondering whether there s a method to do so thank you in advance for your consideration and suggestions,map object is not subscriptable how to extract a part of map typeerror map object is not subscriptable i want to know how to take part of edgelist which is a map into test list please help me with this,0,47,37 how to fill matplotlib polygon regardless of point order i am trying to make the area shown below all green so far i use this but not the whole four sided figure is coloured it would be possible to fix the rotation of x and y in this specific example but in other times it would not work is there a way to fill everything between the area between given points regardless of any order of the points,token authentication failed utf codec can t decode byte xe in position invalid continuation byte i m trying to send the json data from azure ml to eventhub this is the screenshot of output of the variable data output and getting following error anyone could help debug the error thanks,0,76,48 how to use scipy optimize minimize for function with variables i m trying to optimise this function by finding the best values for sigma s sigma y and epsilon strain and stress should be dimensional numpy arrays i ve tried but i get valueerror can only convert an array of size to a python scalar i m a bit confused how to use minimise this,log message not displaying on console below is the code i am trying to run but the log message is not getting displayed on the console i am running code on pycharm with python,0,61,34 how to add common tittle label and legend in matplotlib pyplot my following code can t add a common title common legend also a common x and y label when i add title legend in between the for loop it works but its not working for the whole figure i want to add a common title common legend and shared x and y label in this plot what is the best way to do that my code,how can i create a function that uses parameters one which is sort of like start stop step but with no lists involved i was just trying to create a loop within a function that performs a start stop step procedure with function parameters so for example if the function is called with numbers then the program will write i also want to write the results to a newly made text file this is what i have so far,0,75,86 make first row and first column as column header and row index respectively in a dataframe i ve a similar dataframe like the one below i m trying to make the first row and column as the headers of this dataframe i ve tried with this this generates the dataframe like below is there a way to remove the index header nan here,modulenotfounderror no module named pssh i am using python and i got the following error modulenotfounderror no module named pssh on trying to use the library as follows from pssh clients import parallelsshclient i tried installing pssh as follows pip install pssh inside a virtual environment but the error didn t go away which library has to be installed to make the above import work,0,60,65 django drf sending email with html template html template appears as plain text i m trying to send emails from django using a html template it does send the email but the html is sent as plain text how can i make the email appear as html to the receiver i m using django views py activate email html,removing any characters after a comma in a column python i have a column in a df like so i want to know how to remove the comma and following characters from elements in the column that have it so new one like this i know i can rename each element individually but i d like a way to do this at once for the whole column thanks,0,57,67 how to convert a string with comma separated values within a list in python hi i m relatively new to python and not quite getting a resolve for the mentioned issue i have an input list abc def asd trp faq expected output list abc def asd trp faq please help in achieving the same,typeerror get members takes positional arguments but were given i actually gave i am making a bot and it has a method in it called get members which takes args self and client i am supplying both arguments and still it says i am providing args also the client parameter shows a warning unexpected argument the stacktrace,0,46,60 jupyter console runtimewarning coroutine zmqsocketchannel msg ready was never awaited by running jupyter console any press of enter button show this error i have tried different computers with different linux distributions ubuntu mint manjaro kde manjaro xfce i tried different python versions different ipython verions and even with docker interesting that jupyter qtconsole jupyter notebook and ipython are working fine all answers i searched were about ipython or jupyter notebook but i need jupyter console,convert docx to pdf using python within google app engine i am trying to convert a docx file i have in my tmp directory to pdf using python within google app engine i have used docx pdf before but google app engine or linux doesnt support this module i have seen people use libreoffice to convert the file but i dont know how to install libreoffice within google app engine i could really use some help,0,68,75 trying to extract a string value between dots from a string column im trying to extract a default string value from a string column but without sucess this is the column with some string values what im trying to reach this is my unsucess code and the result could you guys help me i have a kinda difficult with regex and it just blow my mind when i have to deal with it,using gekko in python for a multi objective optimization problem do all objective functions have to be of the same unit as per gekko documentation multiple objective functions are summed and an overall objective value is solved for does this mean that all objective functions have to have the same dimension or unit m or usd or kg if so is there a way to have multiple objectives with differing units also side question is there an easy extract the optimal objective value for each objective function aside from the overall objective value given by the solver,0,73,96 how to add double quotes to sequence of char inside a string i have a string in python like that one and i need to add double quotes to non numerical string situated between a and a result should looks like this i m trying with regex since hours but turning crazy any help would be welcome in advance thank you,discord py invoking a command with args on command error when i get an quotation mark error i m trying to run the command again by fixing the quotation marks that are causing the error but i can t get to pass arguments correctly whether i used get command with and without callback or invoke i tried to pass arguments manually but it didn t work i receive no member argument error or there s no member m error depending on the method i use and the message that invokes the command i can t seem to pass arguments appropriately example verify user im a good member i want to be verified,0,61,105 iterate the arguments in shell script arguments sent as a list from python file i have tried below in my shell script i want to loop through the list that i passed but the above code prints param list not the hi life jam hello can someone help me with this requirement,word in string exists but not recognized i have a df that contains a column that has a description i used the following code to extract specific words and create as you can see the word exists but pandas applies otras instead of corona any advice,0,55,46 problem with assigning d array as a one slice of d array i try to load series of dicom files into d array i do this on bad way because i got an error something like this not fluent in python valueerror could not broadcast input array from shape into shape i don t understand why because i specify the shape as,prefect task scheduling i am new to prefect having worked mostly w airflow i have put together a workflow that executes fine but the tasks dont execute in the order i expect flow here however when i use flow visualise this flow the dag looks really odd my understanding is that the context operator with sets order using up stream in each task didn t help any help is appreciated,0,64,67 how to download files from python azure function with post method i am creating azure python function which will eventually create kml file with some information and now when i call the function url with post method it should download me the file i have written simple code but its downloading anything can anyone please answer this,edit dict in string i want to edit string data i want to replace with every id in and want output to be i tried with format but it is not working,0,59,33 i have list of list in that i want to make a list from list before empty list i want like that using python,how can i parse a string number to a float python from excel i have a number in the following type so i ve been trying strip replace among others but i couldn t get a float from my code result monto float m valueerror could not convert string to float,0,24,52 concat multiple csv s with the same column name im having trouble with concatting these pandas dataframes as i keep getting a error saying pandas errors invalidindexerror reindexing only valid with uniquely valued index objects i am also trying to make my code less clunky and run smoother i was also wondering if there was a way to get multiple pages on one csv using python any help would be great,how to add songs to my templates in views if i post a song from my admin panel i want the list of song to appear in the templates i already created a models that allow me to post it but i don t know how to create a views that allowed the song to appear in the templates please how can i do this this is my empty views views py this is my models py i created models py,0,68,78 using for loop to replace bad nucleotides from dna sequence i have a list of sequences for simplicity like the following one and i want to use for looping to replace every instance of a nucleotide other than a c g t with n my code so far problem is the nucleotides are not replaced and nothing changes in the original sequence and i can t figure out the reason,how to open a new window which is in another class in tkinter so basically i want to open a new window whose code is in another class from a button click this button is in class how can i accomplsh this the function is open main window an the button is sharingan i just want to open a new window when this button is clicked what code should i write in the function,0,66,72 selective columns not working showing error in csv file with python the following is my csv file with the name runs csv the following is my program written in jupyter notebook i am getting the following error i don t what problem is going on with my code i think that it s written correctly but still i m encountering an error please resolve this thanks in advance,why training accuracy and validation accuracy oscillate and increase very slowly i am working on a text classification problem i am facing problem of extremely slow increase in training and validation accuracy and also oscillations in it kindly help me to figure our the problem following is information of my data division and model x train x test x valid batch size epochs model model training,0,63,70 loop to match dictionary keys from list append dictionary with associated data in other columns i want to loop through my data and population my dictonairies with event value and their corresponding xcordadjusted and ycordadjusted dataframe my work output,how to remove unwanted data from a data column using pandas dataframe i m getting date two times using comma separation along with day in date column from the scraped data my goal is to remove this december mon portion and want to create a separate new column for days and i also wanted to remove the last one column meaning the volumn column,0,39,63 discord py channels emojis roles etc lists into real channels emojis roles etc i have a serverinfo command and i want to put a list of all text channels voice channels roles and emojis i tried with ctx guild textchannels voicechannels roles emojis but it returns a list i want to have actual discord channels roles and emotes i tried with maps and it didn t work,how do i filter rows that come before the row that contains certain value for each group in dataframe how do i get only the rows that come after the click in the column action type for each client id the toy data for the client with id everything that comes before the click at should be filtered for the client with id everything that comes before the click at should be filtered i ve tried this way but it only works for the client but doesn t work for the client,0,60,96 problem with slowing down ball in pong game i ve been making pong with pygame and i got the ball to bounce around the screen and on the paddles however the speed is too high and i want to decrease it this is what the code looks like for the ball object if i try to set the velocity as a float it stops the ball completely can someone help me,determining time complexity of a function i have a computer science project in which i am tasked to assess the time complexity of this specific function and also figure out a way to optimize it by using hash function data structures like sets and dictionaries for clarification group is supposed to be an empty list at first network is supposed to be a nested list in which the elements inside the inner lists are ints and current user is supposed to be an int edit typo,0,70,86 how to get without using the return statement class inside function variable value it is my code i can not even use the database i need get without using the return statement class inside function variable values erorr,not able to click on a button in selenium python bdd framework i am not able to click on a button save on selenium webdriver in bdd framework i am able to click in general script but when i execute same script through bdd framework it doesn t work please help me on this i have tried with below codes i have wasted more than two days on this button the same element works with normal script execution without using any frame work working script below thanks in advance,0,37,87 method not allowed error after deploying python app on heroku i have scrapped a website and after scrapping i have successfully deployed it on heroku but it gives me the error method not allowed i cannot understand the error please help me to solve this error this is link my python app deployed on heroku,discord py how to make the bot leave voice channel after the mp file is finished discord py how to make the bot leave voice channel after the mp file is finished,0,56,32 running a file via import from a function i am currently attempting to run another py file via the following script however it will not run the other file the file called talk currently simply contains the following i have done this before but since then i have completely forgotten,pyspark how can i get only the max and min values for each parameter code county name i m currently using pyspark in a google colab notebook and after doing some data cleaning i finished with a dataframe that has parameter code county name arithmetic mean for each day i need to have a table that gives for each parameter the name of the county with highest value and lowest value after doing this groupby i ended up getting what i wanted have for each parameter code and county name the value for the highest value but only for the max value i also need for the min value what i wanted to end up with would be a table with county name and values for each parameter code being highest value and lowest value but i am having a lot of trouble manipulating this because it always returns an object i have to make all the conditions in one go and have a show in the end,0,50,167 discord py handling user to mention roles when the user tried to use the command but mentioning a roles it will sends an errors to the users,how to implement dict like get method i have my own data structure and i want to implement mystructure get id the way it works in dict if no default argument is passed it should raise self notfound exception the problem is that i can t tell whether the default has been omitted or none has been passed if there is no object with id should raise notfound should return none do you know how to differentiate between the two the only thing that comes to my mind and is very dirty,0,27,87 plotly python plot histogram over other subplot the data is time series and i imagine several subplots with some overlaying the others in attempt to consolidate my favorite technical indicators in regards to the histogram i would like to achieve something like this how can i achieve this properly have tried,how do you de duplicate compatibility code in python where a group of functions can accept different input types i am working on a codebase where many functions expected either an integer or a list of integers as the input we d like to support both if possible this is leading to a lot of duplicated code and an occasional bug when that code is missing in the example above i could get the usernames by running get username or get username but running get devices results in an error later in the code because it s not being cast into a list is there any python feature that can make this code more dry,0,50,109 how to count the number of values for each index in python pandas dataframe i have the next dataframe i need to create the new column len x in dataframe and insert into it the amount of values in each cell i need the next result i will be grateful for help,modulenotfounderror no module named itemloaders whilst deploying to scraping hub i m trying to deploy my spider to scraping hub but i keep running into this error with one of my imports this works perfectly fine in development just not when i attempt to deploy to scraping hub import from item loaders py,0,50,52 i am having problems with skyfield python i want to find out the heliocentric position of jupiter and the corresponding zodiac but i am having basic problems the error i get if someone can help me solve the error problem and then suggest to me how to map jupiter to the constellation i would appreciate it,sklearn linear regression but setting certain coefficients before starting i d like to run a linear regression using sklearn on a dataset with say variables however i d like to set the coefficients for say of the variables before it starts training is that possible,0,56,45 scipy curve fit strange result matplotlib inbefore my code results in enter image description here changing xfit np arange to xfit np arange and results in enter image description here why thank you for your help,check if points lie on boundary of ball check uniqueness of a delaunay triangulation the wikipedia article about delaunay triangulations in d dimensions states as a prerequisite for uniqueness of a triangulation it is known that there exists a unique delaunay triangulation for p if p is a set of points in general position that is the affine hull of p is d dimensional and no set of d points in p lie on the boundary of a ball whose interior does not intersect p now that i ve written my own delaunay library i want to be able to verify the uniqueness of the triangulation given its points checking the dimensionality of the affine hull can be done easily by calculating the rank of the set the second part however is way more difficult how can i check if d points lie on the boundary of a ball not intersecting with the set and without some gigantic loop over each point or is there maybe an alternative way of checking the uniqueness i m using python with numpy however this is more of an theoretical question thus the language doesn t matter thanks,0,38,193 django filter and count in template tag i m trying to filter and count a specific queryset in the template with django template engine cant get it to work the film list is the context and film is the table and language is a field any tips on how to use filter and count at the same time in the template engine or should i solve it in another way view,i m trying to understand the shap values of a predictive model below please help me understand what s the o p of value explainer means o p o p array although with the summary plot i understood what is the contribution of each feature to the model please explain me what s this numbers in both the output means and array,0,69,63 pandas merge overwriting lists in column how do i prevent mutation in the list upon merge as later i want to concatenate the images on both columns many thanks,plot average of multiple line plots with different x values i have multiple dataframes that look similar to this where the x columns are my indices i want to plot the average line plot for these multiple datasets my idea was to concatenate the two dataframes so that i have a scatterplot and can do a best fit line but pandas is throwing an error reindexing only valid with uniquely valued index objects i ve read other questions for this error message and have renamed my index names and column names to x x and y and y but it is still complaining i believe because some of the x values are the same what am i doing wrong here,0,29,119 adding to set if part of tuple not exists i would like to use something similar to the add function to add tuples to a set however i want them not to be added if a part of that tuple already exists in the set for example this gives me a result as but i would like the a b combination to only appear once the first time it is added so that my result is,how can i set foreign key from post request in django i have this models i try to set foreign key in my post request into vehicle model and get this error valueerror cannot assign vehicle driver id must be a driver instance how to get rid off this error how i can create an instance of driver and post an id,0,74,61 pyspark deleted written csv after job finished i ve literally ran the below that generates a bunch of csvs for a dataframe i see the files being generated and updating whilst the script is running after some hours of the script running it converts the prefixed attempt folders to task and then all of a sudden they disappear real need to find these files any help would be much appreciated,permissionerror errno for os rename as quick action this question represents the latest issue encountered when solving another problem let me explain the current issue first and leave the initial difficult at the end this python command works when running the python script in automator using the the run button on the top right however when run as a quick action it throws the error all suggested solution tell me to grant various programmes full disk access however after having done so for terminal finder automator and bash i still see the error i even changed the permissions for the folder to be renamed in the get info box nothing has helped this problems seems to be isomorphic with a problem i had earlier with another commend not working as a quick action this command works in pycharm it works when i run the python code containing it in automator using the run button in the top right however it does not work when i run this workflow as a quick action triggered by a keyboard short cut the quick action clearly works as the little cog rotates but the file remains unchanged,0,69,192 we have findbys and findall in selenium java how to use same code to find locators in python we have findbys and findall in selenium java how to use same code to find locators in python please guide me someone,appending one list to another in recursion so the question was to find all paths from source to target the only change in the above two code snippets is line i ve added the print statement in line to show what validpath is holding my question is why appending just validpath results in a different output than when i append validpath copy in line,0,40,66 randomly select layer in tensorflow model i want to use different layers with specific probabilities in my network layers are the following classes and the network is like below each time i run the code below i get the same output but i expected different ones is there any way to implement this,can t upload file from python requests while curl is work fine i am trying to upload file to some api with this function and get client error unprocessable entity for url while curl command works fine what makes the difference,0,53,42 how can i prevent from repeating until the next start time after is finished is executed and as soon as is executed starts immediately when is executed i want to restart when the next start time is reached not the current start time can i try break continue for i range etc,yielding values from consecutive parallel parse functions via meta in scrapy in my scrapy code i m trying to yield the following figures from parliament s website where all the members of parliament mps are listed opening the links for each mp i m making parallel requests to get the figures i m trying to count i m intending to yield each three figures below in the company of the name and the party of the mp here are the figures i m trying to scrape in order to count and yield out how many bills has each member of parliament has their signature on i m trying to write a scraper on the members of parliament which works with layers what i want i want to yield the inquiries of a b c with the name and the party of the mp in the same raw problem when i get an output to csv it only creates fields of speech count name part it doesn t show me the fields of bill proposals and question proposals problem there are two empty values for each mp which i guess corresponds to the values i described above at problem problem what is the better way of restructuring my code to output the three values in the same line rather than printing each mp three times for each value that i m scraping,0,59,224 problem connecting to mongodb atlas using python i have a problem connecting to mongo would appreciate help thanks and error,pyparsing nestedexpr how to match some curly brackets used for nesting which are also part of literals i am trying to parse files that are formatted as below and some times same nestedexpr character is used within the literal that i need to extract as is input actual output expected output as can be seen i want my script to return path as is without parsing it into array below you can see the code i tried and any help is greatly appreciated,0,20,83 change variable attribute evaluate other attributes accordingly i am trying to find a way for getting all attributes to evaluate after one attribute change within the class without calling a function outside the class i have to call the function outside the class to to have the other attributes updated so my question is how to get the other attributes to evaluate if one attribute is changed without the need to manually call the function later,datetime as a parameter of stored procedure i have this code snippet with a stored procedure read records from to the stored procedure takes to parameters from datetime and to datetime i d like to assign it values taken from fromtoform how can i do this i tried according to this answer but it ended with error,0,76,51 modulenotfounderror no module named web on jupyter notebook i am trying to run the following code in jupyter notebook using anaconda i used pip to install web however i get this error stack anyone knows how to resolve this,how to sum a column of a pandas dataframe and keep only the result of the sum as the value of the column there is a dataframe the final result i would like to get is i use the method it doesn t achieve the results i want what method should i use to achieve my goal,0,39,58 how to save images from url into mongodb using python i have used wikipedia package to get a list of image urls from any wikipedia page now i want to save all the images from the images variable to a mongodb in a collection named images is there any way to do it as there are multiple images can they be saved in a list format,running telegram bot on heroku so currently i m trying to create a bot that messages every minutes using python telegram bot jobqueue the app is deployed on heroku and it seems to be working just fine but sometimes it doesn t message me after periods of inactivity ex not using start with the bot how do i solve this issue when i check the log it seems to be running fine thanks,0,66,72 dimension reduction using varimax rotation and method used is principal to find component score coefficient matrix here all my code which gives me rotated component matrix but i m looking for component score coefficient matrix dimension reduction using varimax rotation and method used is principal to find component score coefficient matrix,get score from aws neptune search i want to get the scores for each search result like you would be able to in elasticsearch how do you do this through neptune i m using this gremlin query but i m not sure how you would get the score out of it,0,52,49 is there a way to copy subfolder without copying recursively am trying to copy subdirectories from directory but i realize the first subfolder copied is copied recursively i would not like that i would like to copy the sub folder intactly when i run the code i have sub dir a sub dir b and dir b copied in new dir i however want dir a and dir b in new dir,how to add prefix to column names except some columns this is an adaptation of a question posed by scalaboy here and answered by timgeb the question is the same except it is about a prefix not suffix given pandas dataframe how can i add the prefix new to all columns except two columns id and name,0,63,57 python define function to get the weighted median i have the following dataframe i have defined the following function however when i call the function wmedian df i get an error keyerror close the outcome i am trying to get is what is missing in my function i don t understand why i m getting that error,change the element in a list of lists differently alternating every nth time i have a list of lists containing information about days in a month e g i would like to iterate through the list of lists setting the element id to a for the first five then b for the second five and continuing that alternation for as long as the list of lists might be i am struggling to get the syntax right using a for loop,0,54,79 converting an sql query to pandas i have the following sql left join query to be converted to pandas join i tried the following code in pandas but some where i am getting wrong is this equivalent one or any suggestions please suggest struck here,rename dict keys in a list of dicts recursively i would like to understand how i can rename keys in a list of dicts recursively without mutation of method parameters i have the following list of dicts this is what i expect to achieve any way i can get around with this thanks,0,44,54 dealing with in out string parameters in swig python maybe someone know how to rewrite getversion to get in python version and legacyversion as a result of function instead of passing them as in out parameters for now i create additional function in swig inteface file but current implementation returns only one parameter instead of two update now i use ignore and extend features but i guess there is more elegant way here is my working swig interface snippet,limiting number of concurrent asyncio tasks using semaphore not working objective i am trying to scrape multiple urls simultaneously i don t want to make too many requests at the same time so i am using this solution to limit it problem requests are being made for all tasks instead of for a limited number at a time stripped down code what am i doing wrong thanks,0,77,65 how can i generate a single qr code for multiple links by using python i am new to programming i am trying to generate a qr code by using python where i can access multiple sites using a single qrcode,how can i add a comma or separator when scrapping results using beautifulsoup i m trying to generate my scrapping result based on the following syntaks the result is when i add text the results i have is how can i convert it to,0,40,43 attempted relative import with no known parent package error wsgi contract test py i have the regular source files under the libs tral directory however the entry file for this test is located under test contract inject i do not want to move this test file into libs since this file should be nowhere near production code as it is a rather hazardous file security wise in node js this would of worked fine but there seems to be something with python imports i m not grasping,map counter object to dataframe to create new column i have a data set with played football games and i m trying to look more closely into the games played by each team at home therefore i am trying to create a column for every team with a counter that tracks the consecutive wins the following logic should apply i created a function that outputs a dictionary that can be mapped to the dataframe sorted by date to create the new counter column a new column should be created that indicates the consecutive score of the home team the expected result for a subset should look like this i tried to map the dict to the new dataframe when doing this i either get a map object displayed or the whole list that corresponds to the key in the dictionary how can i map the created dictionary to the dataframe so it displays only the corresponding value in the list and not the whole list,0,79,164 object of type inputmediadocument is not json serializable i tried to send file over telegram bot query edit message text inputmediadocument typeerror object of type inputmediadocument is not json serializable,how to instantiate and populate class variables using a list i would like to instantiate variables within a class using a list this is what i am trying to achieve is there any method to automatically instantiate variables using list which might not be known at the time i write the code for the class,0,26,55 count the number of days between two dates i am counting number of days between two dates for first testcase output is wrong expected output in first test case day is missing in output,how to access execution date in airflow for operators other than python or bash i am using bigquery to gcs operator in airflow i want to save the tables in folder with execution start date as name of folder since the tasks run overnight datetime today sometimes gives next day as execution start date how can i access dag execution start date in place of datetime today so that all tables get stored in folder with execution start date as folder name,0,36,78 python pandas how do i subset time intervals into smaller ones let s imagine i have a timeseries dataframe of temperature sensor data that goes by min intervals how do i basically subset each min interval into smaller min intervals while accounting for the difference of temperature drops between each interval i imagine that doing something like this could work min intervals min intervals,function binding in python i m trying to understand and keep track of all the changes in the binding of functions but cannot seem to grasp why the y parameter in the lambda function gets binded to h on being called the transition from step in this python tutor link to be precise,0,68,53 how to connect to azure data lake storage using presto on python so i need to use presto to connect to adls now i have read hive can connect to adls and presto can be used to connect to hive but i could not find a single article on how to connect to adls using hive using python thanks in advance,python upload image and save it at database sqlite i want to allow the user to upload a picture and save it in the database sqlite i tried the following but it doesn t work so can anyone help me i am stuck at this,0,61,43 creating an alarm system make sure member has a certain role i m trying to make a bot for my friend s server and he wants me to create an alarm system i cannot get this member in an if statement to actually work my code,log terminal output to a text file python is there a way to log python print statements to a file method i know about python file py data txt but this will log the crash error in case the script crashes or the last thing the was displayed and won t log anything while the program is running which in my case it will keep on running until i kill it method i can use subprocess from another file to check the output but this also doesn t work for me since i am planning on using a single compiled python exe elf in case of linux and not two py script or an exe with a py method i tried using script data txt but this seems to have the same effect as the first method note that the goal is to log everything in the terminal before executing the os system clear line and everything after the previous clear command,0,44,160 livelossplot keras plot per epoch i m trying to plot a cost function and accurancy function in keras however when i want to play with my times of epoch for instance times i will get plots in phyton which i have to delete the n epoch plot before the n epoch plot will be presented i would like to have one figure where i can see all the epoch times once my code,reporting closest value using np isclose in pandas dataframe i currently have two dataframes one which has a list of masses listed as column mass pos the other dataframe looks like this as you can see i used np isclose to see if there is a value in the second dataframe that is within a certain tolerance of the mass pos value in the first dataframe and then the boolean is appended to the first df this is how i did that i have come to realize that i need to calculate a ppm error which involves finding the error between the mass pos and mass values so the simple boolean output no longer suffices is there a way to either report the difference between these values or append the matched value from the second df to the first df that satisfies the boolean essentially i just need to report what value from the second df satisfied the boolean in the first,0,77,158 how do you attach a function to an instance of a class i used to program in scheme in scheme a functional style functions are values you can attach a function to a struct the scheme equivalent of a class in python can you do something similar with python classes or to put it differently can you pass a function to a constructor,python how to transpose the count of values in one pandas data frame to multiple columns in a second data frame i have data frames df and df i want to add columns to df named group a group b and group c where each counts the number of repetitions of each group in df according to the id column so the result of df should be likes this,0,63,68 what would be the time complexity of this backtracking algorithm for finding permutations i am trying to determine the time and space complexity of this algorithm i created to find all permutations of an array in python is the time complexity o sum k n p n k where p n k is a permutation with k factors,how to iterate through each column and convert to dictionary where one of the columns is a list dataframe i want to convert this into a nested dictionary that groups by the unique id or name like note i have a function which accomplishes most of this but run into an error as one of the column is a column of lists it would also help to know how to iterate through the column of lists and transform each row into a tuple a b to a b,0,51,88 missingpluginerror the atoti jupyterlab plugin is missing install it and try again i am pretty new to working with atoti while running the code session visualize exploration i am encountered with the error i have installed atoti by using pip install atoti jupyterlab but still continue to be encountered by this error,pandas conditional join i have a df like the one below i would like to merge the df on itself and create a new variable in sql i would achieve it by the following statement to achieve the following result when trying to do this in pandas i use the following statement however it throws the error below at me as it thinks that i want to concatenate the var rather than adding on to it how do i go about achieving this conditional join on a dataframe in pandas thanks,0,49,92 how to make a loop that keeps cheking if theres a certain class hello i m trying to make a loop that keeps searching for a class with buy and if it finds it needs to refresh until it can t find it anymore and then it runs the rest of the code i m using selenium and python help would be much appreciated thanks in advance,i want download files with python using wget ftp but error occured please help to download i want down load ice nc files in ftp so library adress and file list loop for download but error messege occured like this valueerror unknown url type ftp ftp jan hycom glby t ice nc could i get some help,0,64,48 why is this dictionary comprehension for list of dictionaries not returning values i am iterating over a list of dictionaries in a list formatted as follows each dictionary relates to one item of clothing i have only listed the first this is returning the reason for the if statement in there is that not every product has a value for uniq id so i was getting a key error on an earlier version of my code,trying to read and print netcdf variables in python i have imported a netcdf file into python and am now trying to access specific variables in the file of over variables this is the code i m using in order to just print and read each variables this returns me with the error any idea on how to overcome this error this is the only way i can find that is used to print each variable,0,75,76 runtime error when using pytorch convolutional model i m trying to develop a covid classification model the images dataset i used is of shape torch size when trying to run my model i m getting this runtime error message as shown in the image any help to understand and fix the issue please this is the code,converting a list of coordinates to point geometry my geopandas df looks like this as you can see the geometry column is a list containing longitude and latitude values is there an efficient way to convert them to points this works but is very inefficient when i put this in a loop i get typeerror len of unsized object basically i need the inverse of this question reproducible data here,0,56,70 two different graph ticks parameters on y axes from one table considering below table my question how can i modify the right side y axis ticks parameters to price red so that it represents the numbers of price column as well as the title,why do we need the index variable to move down a row in a list of list doesn t the for loop do that automatically can someone please help me bridge my gap in understanding why is the index variable necessary to move down a row in a list of lists i thought a for loop did that automatically,0,44,58 how to generate a environments yml file of a python virtual environment i want to generate a environments yml file of an existing python environment i tried the following command this throws the following error note this is not a conda environment,how can we split an xml with lxml i am looking for a good way to split the following xml into pieces in this occasion two and i am experimenting with the code below but it does not seem very elegant are there better ways to achieve this many thanks in advance for your help,0,40,55 what s a good way to handle shadowing variables what s a good way to handle variables in helper functions that would naturally take the same name as an outer variable like here where ive added the underscores of course it would work without the underscores but ive heard its bad hygiene to shadow variables like that the underscores are ugly and invite mistakes arguably moreso than the shadowing itself,function view throws an exception of unboundlocalerror at group share when a user tries share a post what could possibly be the course of this exception unboundlocalerror at group share when i try sharing post of another user in a group the exception trace seems to be on the the first line of the forloop new new post video add img here is my view for users to share post here is my model post,0,68,71 how to return multiple value from a pytest fixture with scope session i have created pytest fixture in conftest py for creating user and auto login now how to call the get post method using api client and how to access user in multiple test cases written in test views p,how to change value of variable passed as an argument in python i m trying to code a little game about planets in pygame i was trying to implement a way to stop the movement of the planets by stoping them from updating their position if a global variable paused was set to true this is what the code for the main looks like the part of the code that handles the events is in another file and imported as events just to organize it a little bit and the part of the function keydown that is supposed to change the variable paused looks like this note that this function does more than this it checks for k backspace and k escape and does different things at the same time so returning a value is something i m trying to avoid and doesn t work anyways tried it also the part of the code that prevents the planets from moving when paused true looks like this simplified before i moved the event checks to another file everything worked fine the issue now is that the variable paused doesn t change though the rest of the code related to the key events works just fine i did some testing and discovered this the code above will not change the value of myvar which doesn t make a lot of sense to me so is there a way i can invert the variable paused without having to explicitly write the code inside the function keydown inside the gameloop let me know if i made any spelling or grammar mistakes since english is my second language and also let me know if my code sucks which is pretty likely,0,49,280 is it better to make custom registration with editing django usercreationform class or make it on a new table and class i wanted to make a django authentication but i was confused about wichone is better is it is better to edit the venv lib site packages django contrib auth forms py file and make my custom form and edit db on venv lib site packages django contrib auth models py or it s better to make my authentication system with model and views and forms on my application,how to fix this error unable to convert string actl as to float error in python i am looking for support and advice on how to fix this error couldn t convert string actl as to float in python please give me a solution with example as i am new to python programming error after running the code will be added here soon thank you in advance,0,72,64 iloc for cutting data for a spare set of columns by index i want to select only columns indices but not the following works fine but instead of passing every specific column index i am looking for a way that i can pass i tried but it doesn t work what is the best solution,how to delete take certain channels and categories and delete them discord py i want that when a user writes a command the bot deletes certain channels with certain names but i can t succeed error code,0,59,35 detecting whether build ext is building a python extension with debug information i have a python package that has a cython extension in my setup py file how can i tell whether build ext or bdist wheel were supplied with the debug flag i want to link against different libraries based on the debug flag,what is the simplest way to access a deep list of lists in python i have a big list that its elements are also lists and their elements also lists for example so if i have only the grandfather list and i want to access the leaves elements which are the elements inside each child i will have to write you can notice the complexity of accessing the leaves elements actually the real list i have is much deeper than that so my question here is is there a simpler way to access the leaves directly,0,51,96 jsondecodeerror expecting value line column char when scaping sec edgar my codes are as follows i could run the exactly same codes last year but when i ran it yesterday the warning popped up jsondecodeerror expecting value line column char why how should i solve the problem thanks a lot,pandas dataframe color styling based on nan values i currently have a pandas dataframe that has four columns and is structured below accordingly as you can see this is a dataframe of transactions i want to color the transaction rows that are considered income as yellow and those that are expenses as green to do so if amount is nan then the row is an income row and otherwise it d be an expense i tried the following after reading up the pandas color styling documentation and other stack overflow posts then after displaying the dataframe it remains unchanged i m not sure why it s not working your help and guidance are appreciated,0,56,112 how to change the size of a plot with a legend my legend gets cut off if i change to it looks like this but i want that the plot stays the same size it just should go longer vertically so that the full legend will be shown what can i do,printing list of virtual machines i want to list down my vms on my azure this code is running correctly but the i am getting output in the form of object address how to convert this object address to readable information the ouput is azure mgmt compute v models virtual machine paged virtualmachinepaged object at x d c e,0,52,48 how do i reset the underscore in an interactive session i have overriden the underscore variable in the python interactive interpreter how can i make the underscore work again without restarting the interpreter,how to get the timeslots from the start time and end time in the pandas dataframe i have a pandas dataframe where it has start time end time and booking duration please find below example dataframe i am trying to get the timeslots from the above dataframe expected output what i have tried till now i can get the slots from start time and end time but i am missing the expected output can anyone give some hints please,0,34,75 music getelementsbyclass the code snippet is from a popular coursera course the error thrown is and when using this the error thrown is can you guide how to debug this,fsolve precision issue python i am experiencing precision issue with fsolve the result should be my code miss the first three solutions and the others are not accurate do you know how could i improve the precision of my results,0,30,43 nameerror name yt is not defined i wrote this code to make a python video downloader from pytube import after i run it it asks me to enter the link i want it to download as i want it to do and after i enter the link it shows me this error how do i fix it,click how to make argument mutex i m writing a cli using the beautiful click library the use case i want to implement is something like this but the list show only the available arg so my purpose is to make all arguments optional in this use case i m started from this request on the official repo and a previous similar question very similar but it works only on options i ve not found an elegant solution because arguments works differently in my real case i have a lot of arguments and options so is not possible to reduce all arguments into options,0,59,101 how do i increase number of order detail without refreshing i am beginner in django i create checkout page and when user on change input range number enter image description here it s send to server but it work for first one i think because i set same id for all input and i can t change it because it s in for tag how can i fix it django part ajax part html part,detect a hole or output in a delimited zone with opencv i m trying to detect when a zone has some holes and where they are located from a source image source images can be random and have more than hole i would like to find the red circle zones with my code but i don t where to start from i don t see any function to help me with that drawcontours won t be helpful there i think already has been usefull to get those zones does someone see a way to do that in python perhaps not using opencv i m open to any free library thanks,0,75,108 csv table row as label for previous several rows i have a question about tensorflow i have csv data like image attached and i want to map it green row is label for previous rows is it possible to do it inside map function dataset map and how,line numbers and go to line i have a quiz and on the final round i would like it to end if it gets an incorrect value i have an if loop but i would like my final else values to have a go to line line number code as it is a long code in order to use this function how could i view line numbers i use portable python scripter,0,51,72 is there a way to read an image from a url on opencv i am trying to read an image which is on a website i am passing image link to cv imgread for example but it returns a nonetype the error says typeerror cannot unpack non iterable nonetype object here s my code x is my url as a param,python elasticsearch aggregated query i am struggling to get an aggregated response based on a query for example in kibana visualization after creating a table with the aggregations and query i need i can view the request by going inside the visualization and inspect view requests request this gives me the entire request structured like this how can i obtain the same dataset that is displayed in kibana visualization with the api i tried translating the api request fields to the es search function like this but the data is not aggregated correctly like in the kibana visualization another strange behaviour is that if i completely remove the aggs from es search it gives me the same dataset note i am using elasticsearch module,0,58,126 numpy arrays addition i have different numpy arrays with values in each and i want to add all the elements at position of arrays together and store in another array at loc all the elements at location and store in location and same for all elements of arrays how should i do in python,why is same url scraped twice instead of two different start urls i have the following spider when i run it then the print output states that the first url of start urls has been scraped twice why is this happening as key bits of the pages load via javascript then it might be useful for me to include the selenium middleware i m using,0,64,62 tkinter pyautogui python he everyone i have one problem and i hope you will help me with that i am doing window with question and i want to get the text from entry when i am getting that i am using entryvalue entryname get it isn t giving error but when i want to print it with pyautogui typewrite entryvalue it isn t print that because there isn t any value in my variable that is my code,convert colormap to list if i run then i get however if i do then i get an error is there a way to convert a colormap to a list like i could do above when i passed as cmap false here s what i would like to end up with returning a list like the one above how can i write such a func,0,73,62 want to create a tab delimited file with autonumbers i would like to create a tab delimited file with python and add autonumbering to in first column and in second column i try to create variables and don t know how to add the leading zero s part also writing the variables gives a error message,how to splice a dataframe into smaller tables and save each table to an excel sheet here is a table i would like to create mini tables from this table and save each mini table as a sheet in excel file the first stage should contain columns age and eye second fortune food and the third job and kids this is what i ve attempted but it doesn t make much sense,0,68,73 can t upload file from python requests while curl is work fine i am trying to upload file to some api with this function and get client error unprocessable entity for url while curl command works fine what makes the difference,when i use set list a list b it returns a dictionary do sets naturally return dictionaries i m doing some beginner python exercises and one of them is to remove duplicates from a list i ve successfully done it but the strange thing is that it is returning a dictionary instead of a list this is my code thanks in advance,0,42,60 remove consecutive duplicates while keeping the max value i am trying to remove consecutive duplicates from column x while keeping the entry with the max value based on column y unfortunately with no success the data frame is as follow what i want to achieve is most of the solutions i found just remove the duplicates tout court without accounting for any repeating pattern please note that the duplicates might have the same value,returning the time stamps of youtube videos based on a list of video ids you can run my code in this google colab file so i wrote a script that takes a videoid of a youtube video like based on this videoid my script returns a list of dictionaries with the youtube transcript the video content like finally i wrote a function that takes an input from the user namely the word sentence that you want to search and the function returns the time stamp with the according hyperlink now comes my question how can i apply this to a list of video ids e g expected output so every mention within all the video ids not just a single video id,0,74,119 python requests from window state i tried to extract the location from this url but it seems that the returned information is different from if open that url in browser my simple code is can someone explain me why my only guess is this information is in window state and im not sure how to deal with it thanks a lot,plotly express order label with a pie chart let s take this sample dataframe i would like to use plotly express to visualize this dataframe through a pie chart i ve built the following function and when i use it i got the following pie chart days are not ordered as in the dataframe i saw that there is a parameter called category order with bar charts to deal with this issue but not available with pie charts how please could i logically order the days in the label,0,60,90 token second team not found and default index is not set error in torchtext function this is my code the function work well for train set but for test set returns this error runtimeerror token second team not found and default index is not set does anyone know what is wrong,how to make the program find an image with pyautogui in the code below as you can see i m trying to find an image in the screen with a png that i didn t add because i don t think it s the problem but it doesn t find anything,0,49,45 concat created nan values even after index reset i want to create a csv file that combines the train and test data and labels to use it for a project the problem is that in concat function even after using the index reset the labels continue being nan and i don t understand what is wrong the datasets are in this link,i installed brownie and after installation when i tried to see the version of it i ran into this error i am using macos if that matters importerror dlopen users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so symbol not found pygen send referenced from users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so expected in flat namespace in users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so i tried pip uninstall recordclass and re install it but couldn t fix the problem,0,62,57 append subresult list to result list i m trying to solve leetcode combinations sum problem and i ve did using recursion method pasting my approach here in my recursion function helper in base case when target i m appending my subres to finres i ve tried finres append subres but its not appending to finres it s actually appending and removing later later when i did subres copy its working fine so how can i add subres with just append,passing array of dict as parameter to ros launch i want to pass an array of dict as parameter to launch file and retrieve these arrays at the node how can i achieve this not finding any example or pseudo code regarding this newbie ros user regards,0,72,46 do python files need to be converted into an exe to run on users computers will a python file run on a random user s computer just fine or do i need to convert it into an exe first and then send the exe file to the user thank you,how can i make my code work if the input is a tuple so i wrote this code with the help of a few kind stack overflow users it s trying to analyze my tuple l and see whether for x in that tuple are their two pairs of the first character in the elements or not here is my code however this only works when the input is a list like however i want my code to work when the input h is a tuple like as cd ac ch ds and return true or false as well what changes should i make,0,49,103 how to code an if loop to create a new string itself i need to create a string every time the user calls a specific function is called up a new string needs to be created with the user s name as its name but the name consists of name so i need to separate the part after too can anyone write a function to do these things i d be really grateful,unable to play sound even after installing playsound in python downloaded the sound from and the syntax of the playsound was from the official site of it still there is no sound played and giving me the below mentioned output of execution output python u c users hp desktop python files hello py,0,73,48 priority queue in python using comparator is there any way exists that can do the java queue priority comparator comparingint method in python i want the node which has a higher priority come to the front of the queue edited for example,when i use set list a list b it returns a dictionary do sets naturally return dictionaries i m doing some beginner python exercises and one of them is to remove duplicates from a list i ve successfully done it but the strange thing is that it is returning a dictionary instead of a list this is my code thanks in advance,0,41,60 convert pandas core series series data from nan to none django i have a pandas core series series class when the field is empty i get nan as a value and like that it stores in database i want to convert that empty value to none so i can manipulate with none value what i tried is here but this isn t working can someone help me please,running python script in veins i already have sumo omnet and veins running on my machine but i am new to veins i would like to run python scripts using veins framework let us say in the python script we are given two objects object a and object b that contain data about the corresponding cars car a and car b i would like to enable some exchange of information between the object a and object b based on the scenario happening in veins could somebody explain to me how can i accomplish my goal or point me to the corresponding literature i found this repository where python and veins are combined but i cannot make sense of it thank you,0,61,115 custom resource cloudformation to tag event rules i am trying to create custom resource in cloudformation to tag event rule this is the lambda this is the cfn block while creating cloudformation it gave error create failed invalid physicalresourceid but somehow managed to create tags need help to understand why it gave the cloudformation error if it created the tags,python selenium unable to click on div span checkbox element here is the full element i m trying to click i have tried using both actionchains and element click to click on the parent element as well as each child element in the tree using webdriverwait for the element to be visible in the dom this element is a checkbox which appears near the top of the page so it shouldn t have to be scrolled to in order to test the various clicking methods i have a chrome instance left open on a debugging port which allows me to execute commands in selenium over and over again without having to close reopen the browser this is also necessary due to the nature of the website i am trying to automate this is within microsoft s dynamics if that s any help chrome window is opened with this console command and then i connect the driver to it in python with this line using actionchains driver move to element element click perform i get the error object htmldivelement has no size and location or htmlspanelement using click i just get element not interactable i have also tried using the below execute script commands in the latter example above the element selected is the span child element with class marked record checkbox checkmarktarget element driver find element by xpath span aria label select all rows however in both cases nothing happens and i get no error message i can see that this span element is the element which has the event listener as well so i m doubly confused as to why no click methods work on this element to be sure i am certainly able to manually click on this checkbox any help on this would be greatly appreciated and please let me know if i can provide any additional information here i m not terribly experienced with html selenium edit below is the styles i copied for the span element that should be relevant as mentioned it has the event listener i do see that it doesn t have a visibility style specified could that be the cause and if so how would i add visibility to the style sheet,0,60,343 how to correctly run this simulation i am trying to create a simulation but for some reason or other i get an list index out of range error i am not sure what i am doing wrong precisly it keeps returning the following at if capacity i indexerror list index out of range how can i fix this simulation to run correctly,calling attributes from class inside of a class method code error i m new to classes in any programming language however currently i am trying to create a program that will calculate a users tax position based on inputs the issue i m having is that when i call the attributes in method def get threshold the figures are not adding up i have declared the input as int but it appears to be generating a list when i run the method and the numbers don t add up is anybody able to kindly explain what i have done wrong the idea will be that the class will hold all of the user s income and pension contribution details calculate the tax position and the program will be able to print relevant tax information i have written the code without using classes however would like to move it into a class so that i can request information for additional clients if it s required,0,63,158 loop in pandas dataframe i have this problem looping through this dataframe its printing the same column for each value thanks,sh api access token so i have a code here written in python to generate an access token from the api using the secret key and consumer key provided by stubhub when executing in command prompt i keep getting an error in line saying traceback most recent call last file c users desktop python py line in access token token respoonse access token keyerror access token any suggestions thanks,0,21,63 change url formatting in jupyter python hey im trying to change parts of a string first is the last char second in the mid of the string nkw will be cat sport elec pgn there is loops because i want to run on the first cat n pages than go ahead to the next cat n pages thanks typeerror not all arguments converted during string formatting also tryied cat str count,why have been the selenium python api documentation taken down partially what happened to the selenium python api documentation is anybody aware why the selenium python api documentation has been taken down partially,0,77,33 pytest pass cmd line options to test scripts but not to test function my test sample py is like my question is how can i pass cmdopts to the test script not to the test c function,building a d boolean matrix from a d matrix with indices in numpy i have a d matrix of shape with indices ranging from to currently i use a for loop to build a d boolean array of shape that stores true at the position of each index for each row between and is there a way to achieve the same result without iteration perhaps using numpy functions,0,34,77 output not right on descending selection sort i am working on an assignment and i am really struggling to figure out what i am doing wrong i am new to python and honestly i barely understand the code i have cobbled together so far what i have currently is with the input of i get what i need is,typeerror nonetype object is not iterable while inserting tmdb data into the database i have a simple code that takes data from tmdb api and saves it into the database but while doing this sometimes it throws typeerror is there any way to solve this i am using the links csv file which is provided by the movielens dataset here is the link,0,59,63 azure ml studio container has crashed did your init method fail i am trying to deploy an ml model through the azure ml studio using the notebook itself the commands we are using can be found here we have registered the model as below but while running this command we are getting the error that container has crashed did your init method fail the logs are the init method is,partial itertools product in python i would like to create the following list of tuples in python based on a list of possible values to summarize what would be an efficient way to do it maybe there is a magic function to do it i was first thinking of using itertools product and then filtering or maybe by using pandas which looks a bit overkill though thanks,0,71,71 receive a message from mqtt whilst simultaneously using a timer the project needs to have the light come on and stay on minutes after the last on signal given by a motion sensor my main problem is the logic in receiving the on message while in a loop to restart the timer kinda new to python so here s what i ve got so far,clone the repository to use python with azure functions trying to figure out the issue with my cmd as it is getting stucked as i tried to run below commands to get the virtual env enabled this is working but when i try to clone the repo my cmd is getting stucked below are those commands also those repo is also a sample one here my task is to use pytorch any help would be appreciated thanks,0,64,77 is there a way to find the value for the last day of each month in a dataframe i have a dataframe which gives me the daily quantity levels of various articles i want to get a dataframe which gives me the quantity levels on the last day of every month of each article original df target df is there any way to obtain it i tried group by item and date with tail but it didn t work,how can i implement multithreading in this for loop consider this code snippet i m using minimax algorithm in main game with branching factor now since the third for loop has a time consuming function up to o in time complexity is there any way i can make it run faster i m thinking of parallelizing multithreading for example any suggestion,0,78,58 execute python function as on time depend execution i am new here so let me describe the concept first i am having a function the function should execute as above but the problem is if i set everything up the following error are occoured if i set the function to be execute after pm then i cant impliment the function before pm anyone having the concept,apply function based on column condition restarting instead of changing i have the following apply function where df week int is a column of integers starting from and increasing to if the row value for df week int week to be predicted in this case i want the function get raw data to be applied otherwise i want the function get initials to be applied my question is in regards to troubleshooting the apply function the reason is that after successfully applying the get raw data to all rows where week int instead of putting s for the remaining rows of df raw data else the loop restarts and it begins from the first row of the dataframe and starts applying the get raw data all over again seemingly stuck in an infinite loop what s more confounding is that it does not always do this the functions as written initially solved this same problem and have been working as intended for the past weeks but now all the sudden when i set week to be predicted to it is reverting to its old ways i m wondering if this has something to do with the apply function the conditions inside the apply function or both it s difficult for me to troubleshoot as the logic has worked in the past i m wondering if there is something about apply that makes this a less than optimal approach and if anybody knows what aspect might be causing the problem thank you in advance,0,68,238 how to get id from created object in django i have models group and members groups have many members but when a group is created currentuser automatically becomes a member i m doing everything in single request and i have problem with getting id createdgroup my models form view how can i get the newly created group s id i ve tried something like this when i console log request post i m getting only name description,highchart to display percent on each and every column of column chart how to set different colors to different datalabels of all columns in this bar chart in this code i just set with orange color for all data labels in this chart how can apply different colors to all datalabels on top of columns,0,70,55 python why is len always return for list not sure why len is returning just as output in python should be output,how to make a good key for a cache when given a list in python how do i make a good key for a cache when i want it to be a list i don t want to just turn the list into a string because that takes too long for example and are too slow also i can t just do because it doesn t work how do i make the key to the cache without any of these,0,26,77 xlsxwriter issue regarding exporting string as dates using python i have a list that includes dates in the following format this date i convert to string when i export this list to excel the excel sheet recognizes these string as date is there a way to make these dates recognizable by excel as string using python thank a lot,converting a list of strings to dictionary i got the following list i need to convert it to a dictionary like i have tried ast library and json loads but in vain,0,59,30 i have this list and my for loop that only show odd numbers of list but i want it show only first odd number and if there is not show all of them the code,how to fix protonvpn typeerror init got an unexpected keyword argument log dir path i am using linux manjaro kde plasma when trying to run protonvpn from the task manager it fails to start and does not give any errors when run using the command line it outputs the following i have tried restarting and rebuilding which has not changed anything,0,37,59 split part of string after character always same amount i am looking to get part of a string after an sign that will always be the same amount of characters after the ex i want to be able to get the and nothing else the total length of the string may change but the numbers i am looking to collect are always going to be numbers after the id,pandas generate column on groupby and value counts goal is to generate a column pct group by id where pct st value of pts group by id number of same consecutive id value where x and y both are nan for e g when id pct it will loop through whole dataframe sample df expected output i tried,0,73,66 token authentication failed utf codec can t decode byte xe in position invalid continuation byte i m trying to send the json data from azure ml to eventhub this is the screenshot of output of the variable data output and getting following error anyone could help debug the error thanks,pdfplumber memory hogging crash with large pdf files using pdfplumber to extract text from large pdf files crashes it,0,48,19 soql query using like and string list i analysing data from salesforce using python and am searching for records with usernames containing jack jones or jill in them the current non ideal solution that i have is i have an example here and have managed to get the following example to work however i am unable to pass a list of strings such as is there a way to pass the list into the soql query itself thanks t,how to accelerate my written python code function containing nested functions for classification of points by polygons i have written the following numpy code by python this code will be called frequently from another code with big data inputs so speeding up this code is essential i have tried to use jit decorator from jax and numba libraries to accelerate the code but i could not work with that properly to make the code better i have tested the code on colab for data sets with loops number of and for speed and the results were what this code does is finding some coordinates in a range and then performing some calculations on them i will be very appreciated for any answers that can speed up this code significantly i believe it could also i will be grateful for any experienced recommendations about speeding up the code by changing substituting the used numpy methods and or writing method for the math operations notes data sets for test small data set medium data set large data set,0,78,183 ros and python versions when launching nodes ros imu bno package works on noetic running ubuntu intel nuc but throws an error on kinetic running on raspberry pi ubiquity robotics image must be python vs python on the nuc python on the pi kinda stuck not sure where to geek from here process ros imu bno node started with pid,dynamically selecting columns in pandas based on a list of strings i currently have a dataframe like this how would i select the columns dynamically and append them to another list for example so that xx is the following something like this but on a much larger scale i keep getting the following error when i try i get,0,60,59 merge sort string and local variable issue i m quite unfamiliar with python and decided to practice some algorithms here is my implementation of the merge sort i m not too sure why i m getting this error,numpy array operations returning nan values despite no nan values in input i am running a linear regression using gradience descent analysis gda using imported data from a csv file data axis and data are exported dates and stock market prices respectively the code below returns nan nan nan nan nan nan as the theta value the square error also returns nan error messages overflow encountered in multiply invalid value encountered in add the code does successfully return and plot a linear regression for randomly generated inputs xdata np random rand ydata np array x x x x x x x x for x in x i checked that there are no nan values in the csv file i searched for the error message and read that some python numpy operations involving extremely small or extremely large numbers may output a nan value as the result could this be my issue or is there something else which may be fixed,0,35,152 loop to split a large dataframe to small dataframes df is a dataframe with columns a b c a b c a b c i want to split that df data frame into small dataframes df df df df to have a b c as columns df to have a b c as columns df to have a b c as columns the number in the name of the dataframe df should match with its columns a b c i tried getting the error is it possible to do this in a single loop,how to read or write an uploaded file from filefield model in django i m new in python and programming in general i have this project to create a simple library to add new authors and upload books i must also display the uploaded book details total words most common words different words etc when i open the book now to do this i know that i first must open the uploaded book in readmode but i don t know how to access the file that i uploaded this is my models this is my forms my views my details html i want it to be shown in details html thanks in advance,0,76,109 python and code cli not working after updating to macos monterey i updated to macos monterey and now python is not working but if i run i am able to run it but when running code for opening a project in vs code it gives the same error i am not sure what to do so that it runs commands like code successfully,reading json from url is reading weird floats i try to read an json file output give weird floats e e e e what i am doing wrong,0,65,34 trying to create mongodb collection using below two mongodb collection based on id using python trying to create mongodb collection using below two mongodb collection based on id using python mongo collecton abc mongodb collection def compare mongodb collection abc and def based on id and if matches get abc action from abc and other key value pairs from def result,tkinter fullscreen still available after root resizable false false i am trying to make a python application that requires disabling the window resize and fullscreen mode on a mac i used root resizable false false to do the work it does stop the window from resizing but for disabling the fullscreen mode only if you iconify it first and then deiconify it i wonder why and is there a workaround edit found out that adding the window icon caused this problem solution to this is adding root withdraw and root deiconify after putting the icon,0,60,87 how to recall random valuable from python when i check the if condition the valuable num doesn t work only else work why please help me i don t know what to do,i o operation on closed file when the file is not closed i have written a piece of code in python which needs to check a few arrays and ensure certain values are not in there these values are in the form of variables which i defined like so i have then attempted to check whether these values are already in existing text files that i have set up which i opened earlier the above code works perfectly fine however it is when i change it to the following that it does not work i am given the error valueerror i o operation on closed file which i do not understand because what i added has nothing to do with a file the spacetemp variable is the only new thing referenced i could even understand if the error was located on the line f close but it is not file line in gen if array in f or dashtemp in fa or dottemp in fo or spacetemp in fs or in spacetemp or o in spacetemp valueerror i o operation on closed file as i have mentioned all three files f fa fo and fs are all open and this works without the added or in spacetemp any ideas more context,0,31,211 boto get waiter does not stop and start instance correctly problem hello i m trying to stop and start instances in the same lambda function i m using waiters however the code above only stops the instance but doesn t start it back up as it does not wait for the stop please help me correct the code thank you code,how can i modify a label in tkinter i have been trying to figure out a way to modify the label to print element to in a line and repeat i have attached a picture to hopefully clarify what i am trying to accomplish my goal is to make the results look like the following a b c d a b c d,0,57,73 replacing a character in a string but it duplicate this is a line of code i create that will replace a with a character from a string output but when applying the same rules for the duplicate character o in word output i know what the error is but i m stuck at creating a solution for this type of problem this is some more output in the same situation output,django display several foreign key values in template i have tried dozens of solutions on her to solve this but nothing seems to be working as expected i m trying to show a list of facilites which are connected with several foreign keys to additonal models facilityaddress facilityinspectioninfo and facilitycomplaints i can show the facility names but i cannot show the data of the models within the foreign key models like facilityaddress for example model view template,0,71,76 why is lambda returning lambda takes positional arguments but was given when i gave a positional argument so this is the function command i am using for my tkinter project but for some reason whenever i click the dropdown menu i am always left with this error what is going on,how can i transform my input data to fit my desired pydantic model suppose i have the following input data regarding a pet owner petowner has an id a list of cats and a list of dogs but i think it makes more sense for an owner to have a list of pets each with a type attribute cat or dog hence i set up the following pydantic models given my input data how can i populate these pydantic models my end goal is to do something like which should output,0,52,91 how convert seconds in minutes and seconds mm ss is it possible to convert seconds into minutes and seconds with this format mm ss i try to use datetime timedelta seconds seconds but it returns hh mm ss format thanks in advance,automatic change of discord about me the problem in discord as you may know there is a about me section this section is as description of a profile that you can write yourself bots can have a about me section what i want is to edit this about me section automatically in discord py for example every hours the about me section of the bot change what i tried i searched for a very long time some answers but didn t find anything relevant i saw that you can modify the about me with the developer portal but it s not automate i saw that some people said this will be able in discord py v but didn t find it it may be possible to resolve this probleme with http requests but it s only a supposition i m not very good in this topic show some code,0,35,142 convert tradingview script into python i am looking for a converting from tv to python just a little code this is the code in tradingview for variable longcond and shortcond i have the right value i compared between plot but for others i have some differences i think because of last signal this is my code in python are there errors in my script in python,sarimax rolling window with exogen variables at the moment i am trying to build a sarimax model in python with exogen variables unfortunately i am getting this error cannot perform reduce with flexible type,0,70,34 latency in spark streaming job databricks which sources from an azure iot hub i have been using a spark streaming job using python on databricks to load sources from an azure iothub however i noticed when we have a large number of received frames the job comes long so we have latency knowing that when we look at the metrics the cpu and memory are not used at of their capacity,getting an error of team jaja needs to have a value for field id before this many to many relationship can be used i m trying to add team to the database but i get this error took a look at similar questions but none of them solved my issue i am new with django my code looks like forms py models py views py when i try to do it without forms like for example with only title field it is successfully adds it what am i doing wrong in here,0,72,86 i have a syntax error in python while trying to load the file here is the error i get,how can i add qradiobutton widget to qtableview in pyqt i am creating a tool that that will have a search option after searching i am creating a dataframe and displaying it in qtableview i need to show a radio button against each row in table view radio button will be the first column in table view i have found table view method setindexwidget but not sure how to implement it i have columns in tableview membernumber firstname lastname once i will select radio button against my st row and click on show data button it should show member number in msg box below is the code which i have written till now,0,19,114 why does pandas groupby keep the key i would like to perform the following operations on a dataframe i got the result below my question is why the id column is kept i expect the id column disappear after this operation what i want is,server always return service unavailable in slow request fastapi vue thank you guys for supporting me currently i m using a fastapi server in python and vuejs in client side i had an api to call for starting a virtual ec machine in aws this work took so much time so my request was slow and it always return code to client although in server side it still return ok do you guy have any idea about this stuff how can i config to wait such a slow query timeout,0,44,93 less strict mypy evaluation inside functions with the following contrived python script executing mypy something optional py results in exitcode and the output however if i put the offending code in a function running mypy returns with exitcode and outputs success no issues found in source file what is the reason for this behaviour i would assume mypy should be equally strict inside functions,except statement with a while statement i got this situation what i want is to continue the except while i len datelist not just the first time an error occurred there is an easy way to do it thank you so much,0,65,40 i just wanted to open a window doing nothing just a simple display but it immediately closes through python code and the screen opens and immediately closes like just in an instant but it transitions to the first pygame window,how do i make my code not generate new integers when the user gets the answer wrong what the code below does is that it generates random integers and multiplies them together after the user has placed an input and gets it corrects it will automatically generate another pair of random integers how could i make it so that when the user input is wrong it does not generate a number but waits till the user to finally calculate the correct answer and then it generates a new set of integers i ve been playing around with having a loop within the main loop but it hasn t solved my problem,0,40,110 python reading file not working through tkinter file chooser when i run the code and select a file it doesn t output anything putting the file location manually in the code still outputs nothing and the txt file definitely has content,multiprocessing hanging at join before anyone marks it as a duplicate question i have been looking at stackoverflow posts for days i haven t really found a good or satisfying answer i have a program that at some point will take individual strings also many other arguments and objects do some complicated processes on them and spit or more strings back because each string is processed separately using multiprocessing seems natural here especially since i work on machines with over cores the following is a minimal example which works with up to to cores if i try to give it more cores it hangs at p join i know it s hanging at join because i tried to add some debug prints before and after join and it would stop at some point between the two print commands minimal example the suspect is that the queue is getting full but also it s not that many strings when i give it cores it s hanging but that s about strings if the choice was always but is that many strings for the queue to get full assuming the queue is getting full i am not sure at which point i should check and empty it doing it inside return string seems to be a bad idea as some other processes will also have the queue and might be emptying it filling it at the same time do i use lock acquire and lock release then these strings will be added to a file so i can avoid using a queue and output the strings to a file however because starting a process means copying objects i cannot pass a io textiowrapper object which is an open file to append to but i need to open and close the file inside return string while syncing using lock acquire and lock release but this seems wasteful to keep opening and closing the output file to write to it some of the suggested solutions out there de queuing the queue before joining is one of the answers i found however i cannot anticipate how long each process will take and adding a sleep command after p start loop and before p join is bad at least for my code because if they finish fast and i end up waiting that s just a lot of time wasted and the whole idea is to have speed here add some kind of sentinal character e g none to know if one worker finished but didn t get this part if i run the target function times for cores i will have sentinels but the problems is that it s hanging and can t get to the queue to empty and check for sentinal any suggestions or ideas on what to do here,0,40,457 is there a easy way to do a group by in python to aggregate a single column i have a dataframe with fields as follow i would like aggregate field i e i usually create a new dataframe by doing a groupby on the dataframe with the field i want and then merge back the grouped dataframe to the original one is there an easier way to do this,what does r in smp symbols r theta theta cls smp function mean i am new to sympy and i am following a guide to using it for physics there s a line which says smp symbols r theta theta cls smp function what does the r before the theta theta means i have not been able to find anything so far i have noticed that removing it screenshot without the r using jupyter kind of messes with the variable name given that it has a for latex thanks for any insights you may provide,0,68,85 how do i fix a http error bad request in python i am trying to access checkpoint firewall by using it s api but for some reason i am getting http error bad request i have never had this before any ideas here is my code basically same thing is working fine with python this is python code,selenium python proxy i want to use proxy with selenium i watched the video from youtube how to do it but it doesn t work this is my code why proxy doesn t work please help me kind people,0,60,37 dynamically created classes with the same name i m trying to dynamically create subclasses in python with type and here s what i see in the output obviously this was not my intention two questions in that respect,sqlalchemy orm define custom function in model for selects how can i define custom filter function for model so i won t duplicate it across my app i mean if i have some model like this and i often use such select get row data for specific table and row i don t want to use activerecord mixin where i can get session inside model so i want to make some function which will get params and return object for session execute i didn t find anything useful in documentation,0,36,87 pandas split column of unequal length list into multiple columns in python i have a list of codes in one column his name course code that i would like to put each code is a new column can you guys please give me some guidance how to do that thanks,openpyxl number format not applied until manually applied code expected result i open up test xlsm and in column a all dates should already be in the format yyyy mm dd actual result while the yyyy mm dd format gets applied without any issues when i run the python code i then have to open up the excel file select each cell manually and hit return in the formula window for the yyyy mm dd format to be applied is there a way for my specified date format to be applied through the python code rather than having to manually apply it by opening up excel and selecting each cell going to the formula bar and hitting return every time thanks in advance,0,50,115 how to import other python files i have this file abc py in my main py file i want to import both asb and abc from abc py without using separate lines i assume it s going to be something like this,automatic change of discord about me the problem in discord as you may know there is a about me section this section is as description of a profile that you can write yourself bots can have a about me section what i want is to edit this about me section automatically in discord py for example every hours the about me section of the bot change what i tried i searched for a very long time some answers but didn t find anything relevant i saw that you can modify the about me with the developer portal but it s not automate i saw that some people said this will be able in discord py v but didn t find it it may be possible to resolve this probleme with http requests but it s only a supposition i m not very good in this topic show some code,0,38,142 heroku app not deploying error could not find a version that satisfies the requirement it s a flask python app the error is error could not find a version that satisfies the requirement ikp db from versions and in the requirement txt file i rewrote it to be ikp db but still the error is still i used the following commands,python login with requests i need to download a large number of photos off a certain site i however cannot download these photo s if i am not logged into the site itself my first approach was to use requests module to download the photos and just continuously change the url s using code this doesnt work because as mentioned previously i need to be logged into the website first how would i go about doing this using requests or any other python module,0,63,82 how to fix this issue typeerror object has no attribute value in connectivity i can t able to insert values in ssms geting error,couple of questions about how objects work in python when i say x node what exactly is x as in is it a pointer to where node is stored or does it create a separate identical copy of the linked list or is it neither i ask because if i were to add node is not altered but if i added instead node would be altered in that the first value in the linked list would now be also if i were to add i d get something like main node object at x fd is the x fd part the memory address of the object,0,24,104 string with backslashes to dictionary i have the following string when i print it i see the below output in my console i want to make a dictionary of the string by using ast literal eval this yields the following error valueerror malformed node or string ast name object at x fb b ab fa please explain what s going wrong how can i make a dictionary from the string thanks,create a function that can remove characters and multiply figures i need to build a function named format adjustment that can remove a character and multiply any value more than by also any negative values remain the same example dataset expected outcome for col would look like,0,62,49 adding to set if part of tuple not exists i would like to use something similar to the add function to add tuples to a set however i want them not to be added if a part of that tuple already exists in the set for example this gives me a result as but i would like the a b combination to only appear once the first time it is added so that my result is,why tensorflow cpu is not found by docker while creating an image i am building a docker image using this dockerfile this is the command i used and it is giving this error why it can t find tensorflow cpu when this tensorflow version is available what s wrong here is my requirements txt what is not working,0,74,55 when i am trying to use cryptography pbkdf hash in python but when i enter a wrong password it throws error this is the kdf setup this is my hash algorithm this is the error i am getting when input a wrong password and then try to re enter it libraries used sqlite hashlib tkinter customtkinter functools uuid pyperclip base cryptography,split input data and have one array output i would like to split an input data to an numpy array but i got a separated elements in array not as one array with all elements as the following,0,60,39 i want to find number of occurrences of substring in string without using count function but i am getting wrong results i am getting output true the output should be true,web bsc token send with python gas fee calculation valueerror code message insufficient funds for gas price value i want to write small python programme that if my acc have balance program will detect a positive balance and send it to my other wallet which acc using web bsc to create transactions i got error valueerror code message insufficient funds for gas price value i m not sure but probably trying to do something wrong with transaction my acc balance got tokens and bnb for gas fees,0,31,92 how can i make a square with a specified circumference and add margin i am trying to make a square path of a specified length i made a function and if i put then i get a x matrix how can i add a margin of s of eg fields thickness like this,converting a list of strings to dictionary i got the following list i need to convert it to a dictionary like i have tried ast library and json loads but in vain,0,56,30 python flask duplicate flash messages i m having a problem with get flashed messages returning two flash messages i have an html form that updates the row values of a table when submitted here is the flash message i have set for it here is get flashed messages in my template file when i run my flask application this is the output i get after i press update on the form how can i stop from getting two identical flash messages,problems with python oop i decided to study python s oop on my own in the car class i create the carhp function then i want to write the result of this function to the power variable but the compiler throws an error what could be the problem i wrote it without class everything works but then the meaning of oop is lost,0,77,62 integrate facial recognition model trained in python in advance java projects i want to develop a web based voting system in java the system has facial recognition and otp verification i have a a facial recognition code in python and the model is accurate how can i implement facial recognition in my web based voting system,split input data and have one array output i would like to split an input data to an numpy array but i got a separated elements in array not as one array with all elements as the following,0,56,39 python autoscroll in gtk textview widget i just have a new project i just want to learn more about gtk threads sockets and classes so i decided to develop a simple irc client i have some code but i can not find a solution for this how do i forbid horizontal scrolling in the textview widget of gtk and also automatically scroll the textview widget to the bottom thanks in advance,special kind of permutation i am working on some code to produce all possible permutations from a list such products are constrained exclusively to one specific size my code works for regular permutations but i do not know how to obtain permutations that follow this type of logic i m supposed to get all of the permutations that follow this sort of criss cross pattern where the first element is followed by another element and then repeated until the product reaches size z into one big array for example given an array like and z one should return something like of course the output would change based on z so if we had z the array would have subarrays that are of size like etc fundamentally you just need to alternate two elements in the original array so they form that type of a b a b a a b a b pattern so two elements at a time are taken this is my code for basic permutations with size z i don t want to use any library because i am studying recursion specifically and that would be sort of pointless learning wise thank you,0,71,187 django python manage py runserver won t run via vsc terminal mac trying to run this command via vsc terminal and get this error but when i run it via the mac terminal it works well i have verified and is it something with vcs setting i need to tweak thanks in advance,doubly linked list insert after a certain node ends in loop python trying to learn data structures in python implementing doubly linked list when i am trying to insert a new element after an element it is ending up in a continuous loop please try to explain where i am going wrong and why is it ending it continuous loop i am posting my entire code here but the issue is at insertat please help,0,51,74 django pillow image resize only if image is uploaded i m able to upload an image and resize it but if i submit the form without images i get this error the report image attribute has no file associated with it what should i do if no image is uploaded this is my models py,modulenotfounderror no module named pynput error on pycharm i keep getting the error modulenotfounderror no module named pynput i ve been at this for a while even had a go at online ide s such as online python com but threw the same error there are similar threads on stackoverflow but none seem to have a solid fix guide to solve this,0,52,58 how can i modify the syntax end to print on the next line of while loops i m writing a simple code to print the factor of a number from the user input however the next line of user input starts on the same line as the indexes of previous loop output,python how can i write a text file that pulls data from an excel file format as column header cell value i am trying to automate an output for an excel file so it is more easily readable i have an excel file with columns a through by my plan is to read each row with a date that matches user input then read each cell in the row and if the cell is not blank output the cell value after this the data will be written to a text file in the format name is one of the columns so i think the idea would be to make a dictionary of names with each name having a nested dictionary of each column header and the value i am using openpyxl to complete this task i am able to properly loop through all of the rows and cells that match my criteria however i am having trouble converting this to a text file in the format that i am interested in using can anyone provide some methods of printing the cell values and the accompanying column header using a for loop for all the columns as well as in the desired format happy to provide any more information that is needed thanks to anyone that can help this is also my first post so let me know how else i can help edit i added some of the code i used to loop through the columns and rows work date is a user input value that chooses only rows with the correct date value we want to work with go through each row of given date and print cells with value in them here we select only rows with correct date and print only relevant non empty cells and they are printed and formatted to a txt file,0,52,307 ssl connection error when trying to connect to aurora instance i m trying to run a python script through a cronjob inside my eks cluster when it tries to connect to my aurora instance it fails stating that i m using an unsupported ssl protocol unsupported protocol log trace any clue the aurora s mysql version is the python is and the mysql connector package is,python scipy confidence interval i am new to python and i wanted to programm a confidence intervall this is the code i used there is actually no problem with the code it works however i found it somewhere but i simply dont understand it i am using confidence interval therefore my alpha is why do i have to write alpha and why do i have to write in the len df what i also dont understand is the loc and scale,0,66,85 runtimewarning coroutine messageable send was never awaited python py i have a discord py python script but it dont send messages and it comes this error my code,regex not matching letter followed by digits i am trying to match strings that starts with a letter followed by digits anywhere in the line using the following regex the following regex matches r but not j can anyone provide guidance on how to fix this import re,0,25,49 why is my code repo warning me about using withcolumn in a for while loop i m noticing my code repo is warning me that using withcolumn in a for while loop is an antipattern why is this not recommended isn t this a normal use of the pyspark api,is there any way i can correct my username with telethon hello in python telethon is there any way i can correct or create new my username using telethon i looked through updateprofilerequest but there is no username,0,46,38 how to find out a specific text from a long text in python i have a long text how to get only brandshubs from below html output brandshubs,attributeerror relatedmanager object has no attribute reverse connection i m trying to implement reverse connection but i get this error admin i mobileinv imei invoice seller username attributeerror relatedmanager object has no attribute invoice this is my models py im trying to return seller name from imei model here is my views py is there something i ve missed please or should i change something please thank you for helping,0,29,63 h error in heroku after deploying the python app i have scrape website data using python beautifulsoup and after successfully deploying it on heroku it gives me the h error which is app creashed i did not understand this error my procfile has web run this thing i cannot understand the cause of error that where this error occurs,hover over button color in tkinter im working on this tkinter project im close to finishing but i cant seem to find a way to change the button color when i hover on it so can you help here is my code the buttons are submitbtn playbtn quitbtn i want the hover over buttons to be black there already red i just want them to be black when i hover over them thx,0,59,71 append string to empty pandas column in a for loop the code uses an ocr to read text from urls in the list url list i am trying to append the output in the form of a string txt into an empty pandas column url text however the code does not append anything to the column url text when,https data over socket using https proxy i am looking to send https data over https proxy connected via sockets i can send data over port in the connect through the proxy fine however when i send data over port in the connect i usually get http errors heres an example i fixed this by adding host in the headers rather than host however now i receive no matter what i do i can t seem to get the server to respond correctly am i missing a header i was reading some other stackoverflow posts and some people mention that i need to double wrap the socket however i am not too sure where to start any information would be delightful i appreciate your help thank you,0,56,130 freqtrade python sell sign i am trying to create a sales order using the freqtrade bot when the current price hits the entry price atr i don t know how i can retrieve the entry price the price i made the purchase this is my code what do i put in place of open rate,creating a linked list with digits of a given number i m currently self studying some programming and i have stumbled upon a problem that asks you to make a linked list which contains digits of a certain number from last to first this is the code that i wrote and i have no idea why it does t work i ve created simple node class and a number class that will hold my list set function is ment to create a list with given digits so should create a list but when i try to print it using and calling node printer n first i get as an output,0,54,110 how to change values of rows based on groupby i have the following df i wish to change the values x if the id s algo has a so in the above df only id and has a s algo hence the values should be x to achieve this i do desired results my question say i wish to iterate over the group of ids and make the adjustment there inside my for loop how should it be done,pandas merge with dtype list i have two dataframe df df i want to merge them based on a as below such that the result is however because the dtype of column d is list which is not hashable i can not do it could you please show me how to tackle this problem,0,79,53 how to find the centroid of multiple rectangles python i have to find the exact centroid of multiple rectangles the coordinates of each rectangle are as follows i have around rectangles how can i compute the centroid of them i already tried to implement it but the code did not work well my code,how to convert a string to a number where number is embed in further string hi i have a string like this and i am trying to convert it into something like this b and doing something like this and getting error valueerror invalid literal for int with base,0,56,52 python remove line if string appears in column i am loading an excel spreadsheet n lines x columns using and would like to apply a filter my goal is to have a list of strings such as the one below and keep the lines in the inputfile which either contains material or material potentially later more options in column of the inputfile many thanks,assign list of arrays to several columns in pandas dataframe performance optimized given the following df df pd dataframe data np random randint size columns list abcd dtype np int lets say i want to update the first two columns with a list of two numpy arrays having a specific dtype e g np int and np float update vals np arange dtype np int np ones dtype np float i can do the following that works df a b pd dataframe dict zip list ab update vals expected outcome of column dtypes is there maybe a faster way to do this,0,66,70 cannot unpack non iterable object i have a basic doubt about the following it gives the following error i know there are certain solutions related to the similar problem but i am still not able to resolve the problem please help me resolve this problem thank you,increase contour detection accuracy of chess board squares using opencv in python i wanted to detect contours of chess board black squares from the following image the following code is detecting only few black squares successfully how can we increase the accuracy gives threshold and contour are the unique cnts areas typical areas for desired black squares are here s a quick snippet for getting unique cnts areas highly appreciate any help,0,46,87 python requests verify ssl certificate without writing to local file i want requests to verify the server s ssl certificate but i m not willing to write it to the local file system and pass it the file path rather i prefer providing the base of the certificate or the stringio stream any suggestions on how to achieve this using the requests library,discord ext commands errors commandinvokeerror command raised an exception attributeerror nonetype object has no attribute qualified name i am making a custom help command for my bot and here is my code,0,63,27 vscode not output dataframe with html format currently i m having problems with when viewing dataframe on vscode i cannot see the dataframe format as on jupyter notebook my dataframe is displayed as follows output exceeds the size limit open the full output data in a text editor i tried the methods this view update i fixed editor accessibilitysupport off in settings json,pydantic initialize numpy ndarray how can i initialize a ndarray when using pydantic this code throws a valueerror the truth value of an array with more than one element is ambiguous use a any or a all,0,61,35 how do i make a leaderboard command discord py this is my event that configures levels for each member and stores the information in a json file i would like a leaderboard that lists the top people with the highest level but i am unsure how to go about doing this thanks in advance,nonlinear optimization with scipy optimize minimize using matrices and vectors as decision variables i have a nonlinear optimization problem which makes use of decision variables one of these variables is a single number t one is a vector with index i s i and one is a matrix q i j with indices i and j i m currently trying to use scipy optimize minimize to model and solve my problem but i can t get it to work because of the multiple indices constraints must often hold for all values of some index my actual model is very large so let s consider this example which we assume is nonlinear decision variable q i j objective minimize sum over all i and all j q i j constraint q i j for all i for all j current code i try to use based on the user guide i found that for each constraint one must make a definition such that it can be entered into the solver which i try above but it does not work how can i model this such that i don t have to make a definition for each possible i and j value in constraint such that i don t end up with constraints as i j or are there any other packages with good documentation examples which are easier to use in the case of using vectors and matrices with constraints for their indices,0,54,230 how do i fix a http error bad request in python i am trying to access checkpoint firewall by using it s api but for some reason i am getting http error bad request i have never had this before any ideas here is my code basically same thing is working fine with python this is python code,how do we write data from a dictionary to a new row in google sheets i wrote some code to gather the local business names postcodes addresses and phone numbers now i want to write them to the next row in my google spreadsheet in the order i want them to i m new to this use of the gsheets api can anyone explain how we could do this i have a list of dictionaries where each dictionary will be written to the next row in the google sheet for example lets say we have this list i ve only used one dictionary for simplicity but in real code i ll have more than one dictionary update im getting this error when using gspread method as seen below attributeerror str object has no attribute module here is the whole script,0,60,137 how to print following pattern getting issue with spaces i am trying to write the code but not getting how to achieve expected output causing issue with space and not able to make proper judgement how to get exact spaces after every iteration my code output of above code is not as expected output expected output,adding labels to some datapoints in seaborn regression plot given condition here is a table i ve created a regression scatter plot scatterplot with best fit line i would like to add labels to datapoints in the plot where values are in either columns not sure how to do this,0,58,51 package libffi was not found in the pkg config search path docker i would like to install some django packages including django rest auth and django allauth these packages are able to be installed in my local venv but when building and running docker containers they give exit code with the errors package libffi was not found in the pkg config search path,updating a dataframe column using logical comparison based on the suggestions below i have merged the dataframes into a single df hence changed the title as well following is a screen capture of my merged dataframe i now need to compare adj close with the rest of the columns to exactly know where it lies e g is it between pp and r r and r r and r etc based on this i need to create a new status column which would have the relevant statuses i wrote function as below this gives an error as below next i tried with np where the code snippet is below however i get the same error what options do i have to get the status column updated as above i have a large df so performance could be a consideration,0,59,142 how to get every value of a key of a json file with multiple dicts how to get every value of a key of a json file with multiple dicts i want to extract every value of username key data json this is what my code so far but it gave me this error keyerror username main py,making subplots in plotly anyone has solution on how to make make the histogram graph a subplot to the ohlc graph with same y axis but different x axises thanks a lot,0,56,30 access vault credentials using api i am trying to access vault credentials using python api i am doing something wrong as i always get access denied i have used the following code,no output when executing the script python vscode i m developing a simple reactive programming script example to download images from a web but when i execute the script in vscode i do not get any type of output i already tried creating a virtualenv in the terminal i get this output ps c users ernes desktop paradigmas c users ernes appdata local programs python python python exe c users ernes desktop paradigmas jose py ps c users ernes desktop paradigmas,0,32,59 how can i filter time by using django filters input start time result start time enter a valid time,pairing parameterisation and fixtures in pytest i have a python package that checks the formatting of data stored in excel files there are various different sheets to check with different formats and in my pytest setup i have some example files that are expected to throw different kinds of errors or pass because these files are reused across multiple tests i have them as a fixture in conftest py what i want to be able to do is to use this fixture in different tests but specify what the expected values are for a particular test as parameterisation to the test to keep the information for a test together with the test for a toy example as it stands that repeats each parameterisation for each fixture param value good with row good with row bad with row etc what i want to be able to do is to pair the fixture and parameterisation so that the first set of examples is checked using good and the second set using bad is there a simple way,0,22,177 json serialization of dictionary with complex objects i am trying to serialize the dictionary playerselo for saving loading it as from json but as it s not a serializable object and i can t find a way to do it,convert list using zip to dictionary when i convert lists to the dictionary only one element is stored in the dictionary and i don t know why this is my code i used beautifulsoup in web scraping and store in lists finally i want to clean them and store them in json file,0,36,52 why does my code not replace the repeatd letters in aardvark and baboon example why does my code not replace the repeated letters in aardvark and baboon example this an exercise for the hangman game,variational autoencoder typeerror i am trying to implement a vae for mnist using convolutional layers using tensorflow and python the code i have is the loss function is defined as follows which gives the error typeerror traceback most recent call last appdata local temp ipykernel py in train autoencoder training hist model fit x x train y x train batch size batch size shuffle true validation data x test x test anaconda envs tf cpu lib site packages tensorflow python keras engine training py in fit self x y batch size epochs verbose callbacks validation split validation data shuffle class weight sample weight initial epoch steps per epoch validation steps validation batch size validation freq max queue size workers use multiprocessing r callbacks on train batch begin step tmp logs self train function iterator if data handler should sync context async wait anaconda envs tf cpu lib site packages tensorflow python eager def function py in call self args kwds with optionalxlacontext self jit compile result self call args kwds new tracing count self experimental get tracing count anaconda envs tf cpu lib site packages tensorflow python eager def function py in call self args kwds this is the first call of call so we have to initialize initializers self initialize args kwds add initializers to initializers finally at this point we know that the initialization is complete or less anaconda envs tf cpu lib site packages tensorflow python eager def function py in initialize self args kwds add initializers to self graph deleter functiondeleter self lifted initializer graph self concrete stateful fn self stateful fn get concrete function internal garbage collected anaconda envs tf cpu lib site packages tensorflow python eager function py in get concrete function internal garbage collected self args kwargs args kwargs none none with self lock graph function self maybe define function args kwargs return graph function anaconda envs tf cpu lib site packages tensorflow python eager function py in maybe define function self args kwargs self function cache missed add call context key graph function self create graph function args kwargs self function cache primary cache key graph function anaconda envs tf cpu lib site packages tensorflow python eager function py in create graph function self args kwargs override flat arg shapes arg names base arg names missing arg names graph function concretefunction func graph module func graph from py func self name self python function anaconda envs tf cpu lib site packages tensorflow python framework func graph py in func graph from py func name python func args kwargs signature func graph autograph autograph options add control dependencies arg names op return value collections capture by value override flat arg shapes acd record initial resource uses original func tf decorator unwrap python func func outputs python func func args func kwargs invariant func outputs contains only tensors compositetensors anaconda envs tf cpu lib site packages tensorflow python eager def function py in wrapped fn args kwds the function a weak reference to itself to avoid a reference cycle with optionalxlacontext compile with xla out weak wrapped fn wrapped args kwds return out anaconda envs tf cpu lib site packages tensorflow python framework func graph py in wrapper args kwargs except exception as e pylint disable broad except if hasattr e ag error metadata raise e ag error metadata to exception e else raise typeerror in user code train function return step function self iterator c users arjun anaconda envs tf cpu lib site packages tensorflow python keras engine training py step function outputs model distribute strategy run run step args data c users arjun anaconda envs tf cpu lib site packages tensorflow python distribute distribute lib py run return self extended call for each replica fn args args kwargs kwargs c users arjun anaconda envs tf cpu lib site packages tensorflow python distribute distribute lib py call for each replica return self call for each replica fn args kwargs c users arjun anaconda envs tf cpu lib site packages tensorflow python distribute distribute lib py call for each replica return fn args kwargs c users arjun anaconda envs tf cpu lib site packages tensorflow python keras engine training py run step outputs model train step data c users arjun anaconda envs tf cpu lib site packages tensorflow python keras engine training py train step loss self compiled loss c users arjun anaconda envs tf cpu lib site packages tensorflow python keras engine compile utils py call self loss metric update state c users arjun anaconda envs tf cpu lib site packages tensorflow python keras utils metrics utils py decorated update op update state fn args kwargs c users arjun anaconda envs tf cpu lib site packages tensorflow python keras metrics py update state fn return ag update state args kwargs c users arjun anaconda envs tf cpu lib site packages tensorflow python keras metrics py update state sample weight weights broadcast ops broadcast weights c users arjun anaconda envs tf cpu lib site packages tensorflow python ops weights broadcast ops py broadcast weights values ops convert to tensor values name values c users arjun anaconda envs tf cpu lib site packages tensorflow python profiler trace py wrapped return func args kwargs c users arjun anaconda envs tf cpu lib site packages tensorflow python framework ops py convert to tensor ret conversion func value dtype dtype name name as ref as ref c users arjun anaconda envs tf cpu lib site packages tensorflow python framework constant op py constant tensor conversion function return constant v dtype dtype name name c users arjun anaconda envs tf cpu lib site packages tensorflow python framework constant op py constant return constant impl value dtype shape name verify shape false c users arjun anaconda envs tf cpu lib site packages tensorflow python framework constant op py constant impl tensor util make tensor proto c users arjun anaconda envs tf cpu lib site packages tensorflow python framework tensor util py make tensor proto values np asarray values c users arjun anaconda envs tf cpu lib site packages tensorflow python keras engine keras tensor py array raise typeerror value to a numpy call which is not supported or you may be trying to pass keras symbolic inputs outputs to a tf api that does not register dispatching preventing keras from automatically converting the api call to a lambda layer in the f unctional model,0,36,503 how can i customise error messages shown by pyinputplus how can i customise error messages shown by pyinputplus in python i have tried many method but unable to do it i want to print error message as please enter a valid digit phone number is there any way to so it i try to use allowregexes and blockregexes but unable to understand it,saving colorbar plot as image file i am trying to save a matplotlib colorbar plot as an image file jpg or png i have tried the two ways written in the code below using clb savefig results in the error attributeerror colorbar object has no attribute savefig using plt savefig saves in a blank image without the plot is there something i m missing how to save a colorbar plot as an image,0,64,69 how to loop dataframe by year in pandas i want to loop dataframe by year for example my df is to length and columns a h columns index is datatime in this time df a like that df a is one of the answer i want but df a df a df a is all of them but i don t know how to loop by year by year because we cannot write df a i so please rent me your knowledge,my python if else statement only returns the else portion i am trying to write an if else statement that calculates the degree class for a given set of marks most of my code works fine but this portion does not i am expecting to get the result lower second class degree but it prints fail which is the else portion of my statement i don t get any error messages i have looked at lots of similar questions on this site and i can t seem to find my error thanks for reading here is my code which outputs the correct average value but gives fail,0,74,103 function is not modifying the argument alright this function s supposed purpose is to simply modify the object matrix accordingly with the dictionary comprehension however i don t want it to return anything i just need the modifications to stick is that possible,extract euler rotation from matrix using maya i am trying to extract the rotation of an object based on these values i am not quite sure how to do that properly i found a few solutions online but none worked for me since all values used on those examples were a bit different from the one above does anyone know how to extract that using python openmaya i would appreciate any help thanks in advance,0,41,74 rear diagonal sum in the matrix i want a matrix amount that can be in any size for example x or x etc but reverse my problem with for loops along with if not working well would appreciate help for example the result is the function gets an initialized matrix with values and size,counting the occurrence of words in a dataframe column using a list of strings i have a list of strings and a dataframe with a text column in the text column i have lines of text i want to count how many times each word in the list of strings occurs in the text column i am aiming to add two columns to the dataframe one column with the word and the other column having the number of occurrences if there is a better solution i am open to it it would be great to learn different ways to accomplish this i would ideally like one dataframe in the end current dataframe dataframe in code attempting to get a dataframe like this,0,61,122 when using rembg in python to remove image background how can i turn on the alpha matting here is shown how to do it using curl here is my code also from the same website blockquote,string formatting using a list i have a list of keywords from which i want to create a certain query named kdws i have a query suffix prefix and i want to return a string that starts with prefix and is followed by every keyword from kwds something like this i expect the returned string to look like this,0,36,59 how to get the status of button in tkinter i want the function checktime to be called when my button is pressed but how to get the status of my button and compare it i want to use the function only if the button is pressed as a test that the user agree with his inputs,fast way to generate large scale random ndarray i want to generate a random matrix of shape e but i find numpy random rand becomes very slow at this scale is there a quicker way,0,57,33 how to pass a variable as an argument of another function in python i have a list chart list and i want to call them one by one and plot the chart but i face an error how can i deal with this problem i know that they are strings but i don t know how to give it to the tickerdf,implementing an unbounded min priority queue using a singly linked list in python i am doing a class project and i have to implement an unbounded singly linked list using python i need to implement a given insert that has to consider the following cases insert into an empty queue insert at the front of the queue insert after some existing node this is the class given in python and i need to implement the insert function given at the bottom i am new to this so any help would be greatly appreciated,0,60,93 how to save pandas to csv from left to right pandas to csv function saves my table from right to left like in hebrew even thought the dataframe is in english i have the indexes on the right and columns going right to left how can i do the opposite,python dataframe to mysql typeerror not enough arguments for format string been playing with this for hours i am a beginner data is pulled from one database table to search on yahoo for all the data on that ticker and then its meant to upload it i orginally had it as panda df but got ambiguous error so i have now put it as again new error i rack my brains however it does work if i leave it blank errors,0,48,84 how can i find time complexity for while loop and power statement i m trying to find the time complexity of two python statements here is an example of a program statement,changing none output in a dictionary basically i have a dictionary for books and the genre its in i am letting the user input the book and it output the genre i need to make it so it outputs none as book not found i found a solution but i believe it s not the right way to go about targeting my problem could i have some guidance on how i can go and make it so none outputs book not found,0,31,81 how do i access a postgresql db that was setup with docker compose i use the following docker compose yml file i bring it up with docker compose up d build now when i try to access it from python say with psycopg the following errors show up could you help me to resolve that,store json data to json file and save them in the csv file i tried this way but did not work but this problem occurs i want to convert from json to csv an example of what i want please tell me if this is possible,0,51,47 how do i stop the background music in the arcade library i need the music to play until the game is over at which point i d like it to stop but nothing i try seems to work below is the shortened version of the code i m working with if anything the sound should stop playing immediately because self game is set to false in the update right away but no matter what i try the music keeps playing,passing list to adf i have a python function that returns a list of items as a string as part of an adf pipeline using when adf picks this up it is littered with escape characters how can i get this list out,0,77,43 when i try to validate username field in django form with clean method i get a nameerror here is my forms py file i got a nameerror name username is not defined on this row def clean username self trying to submit this form but afaik there are nothing wrong with it here is my view where i use this form and here is my full traceback,how to use a variable to find a matching key in a dictionary and return the value i am trying to get the value from the key in my dictionary i am trying to match known fingerprints of host devices and return the associated value i believe it is not properly interperting the variable since there is a slash in it the code is below the first print statements work as expected and the output of host fingprint is aaaa ccc how can i properly use the variable to print the value in the dictionary when trying with subprocess check output i am getting what finally ended up working was to add a couple pieces to the end of the subprocess and then strip the newline charachter,0,63,124 can t install ta lib on amazon sagemaker i can t manage to install ta lib on amazon sage maker the error is very weird,make negative values of numpy array positive i have i want to make the negative values positive e g is there an easy way to do this thank you so much in advance,0,21,40 does anybody know why this error occurs in the folloving code valueerror invalid literal for int with base n int input enter any number i wrote the following code but every time i submit it to hackerank com a mistake is popping out what should i do to solve this issue valueerror invalid literal for int with base n int input enter any number,python not enough arguments error when insert into mysql i m trying to insert multiple csv files into an existing mysql database here s my code the problem is when i execute the code i get this error mysqldb exceptions programmingerror not enough arguments for format string i ve counted right and i have the same number of s and columns so i don t know why this error is popping out thanks in advance for the help i m starting to go crazy i can t found anything lol,0,62,84 is it possible to have different commands for different prefixes in discord py is it possible to have different commands for each prefix for example one command for and another command for for example someone does foo the bot responds with foo but another person does foo the bot responds with bar,python speech recognition if speech not recognised i am a portuguese high schooler so sorry if i dont make myself very clear but i will try my best to explain my problem so for this project i need to make a program that recognises speech and do what is told to do but if the speech is not recognisable i want the program to try until it finally catches what is being said however i dont really know how to do that since this error keeps appearing error here is the code if anyone wants to help,0,53,96 drf from django conf urls import url in django i ve a project in django and i ve updated pip install r requirements txt to version new release and i ve currently the below error when i run the server in a virtual environment i use drf can t import from rest framework import routers in urls py from django conf urls import url importerror cannot import name url from django conf urls,web scraping requests python good morning everyone i m trying to access the html code of a web page i ve got the login working through python but only that once i print the page the html code is not as complete as if i opened it in a browser a this is the answer,0,65,53 retrieve dns query information from a cloudflare zone using graphql i have the following graphql query which returns me the information from cloudflare s analytics dashboard like cachedbytes cachedrequests does anybody know how to retrieve dns query information from a cloudflare zone,how is rosparam calculating the of leading zero integers could someone explain how ros s rosparam command converts input and output values specifically i am surprised by the following set of commands caused by leading zeros this isn t the conversion from binary so what is happening here,0,41,45 if statement with buttons so i have a problem im trying to make a program with buttons so you could choose something with buttons im running python i made the buttons customized them everything is good with the buttons now i want to add an if statement something like i tried adding that it just doesn t work all help is apreciated,can t change an inputbox content in kivymd i m trying to make a inputbox that starts a date picker and when you select a date it will appear in the box so i tyied like this and this is the code in the kv file when it starts everything is okay the inputbox starts empty as i expected but when i click ok button i get this error i have no idea why i m getting this error i tryied replacing the self root ids input box date text self birthday with self root ids input box date text string but nothing changes what sould i do,0,63,94 how to initialize one parent at a time in multiple inheritance suppose i have the following class inheriting from classes a and b how do i initialize b only after initializing a using super c self init doesn t let me use attributes of a into b,how to print each possible permutation of several arrays of strings on python let s say i have the following arrays of strings i want to print a list that contains all possible permutations of each element mentioned in the arrays above following the order in which these arrays were set i e it starts checking on background then goes to check body then eyes then color then hands and finishes on extra the first permutation should be the second permutation should be and so on it can be assumed that the item none is the same as empty how could i do that,0,43,102 mfi indicator from talib python library doesn t return any value im using binance websocket stream to get kline data im trying to get data or values from mfi money flow index to automate some trades i tried other indicators such as rsi and it worked,no python at error after installing different version and changing the path variable i use windows i was trying to pip install vectorbt but the installation could not have been finished because there was an error when numba and llvmlite were suppose to be installed i was using python and read that there is a compatibility problem with it so i uninstalled it and installed python afterwards i made sure that the system variable is set on the proper python path i closed everything and even restarted the system but in the command line or the powershell terminal in vsc i get the error no python at and the directory of the previous installation the variable is set corectly was set as an admin any ideas maybe something with the registry thanks,0,44,136 does it matter in which order you use prefetch related and filter in django the title says it all let s take a look at this code for example when using prefetch related first does django fetch all the manytoone manytomany relations without taking into consideration filter and after everything is fetched the filter is applied imo that doesn t matter since there s still one query executed at the end thanks in advance,python data transformation i have a dataset with two columns how to convert into the format given below using python,0,68,20 what data types can be exported as attributes when exporting to graphml with networkx i have a networkx graph with some list and dict attributes that the function nx write graphml doesn t accept as valid type for the export i couldn t find a function that would automatically ignore those attributes so i decided to create one myself i know that int float and string are accepted but i don t know if there are others and if so which ones,extract element within string into nested list i am working on a routing project the route looks like this cnshg b pamit r coctg b ushou r coctg b usmsy and i want to break it into a nested list also a route contains multiple segments for example cnshg pamit is one segment transported using b and then pamit coctg transported using r i e rail and so on input the output should be like this i have tried using regex and the below codes but it didn t work thanks a lot,0,77,79 python turtle remove turtle arrow i am trying to make a basic pong and i don t understand why the arrow turtle in the middle of the screen displays the paddle on the screen consists of x turtle objects stored in self paddle i know the problem has something to do with the p paddle but i don t understand where the arrow object is since it seems to not be in the list mentioned above print self paddle can someone enlighten me,how should i construct like queries using multiple values i have a question about searching a product table just by one or more letters and come up the columns that i want name description and type but i have a problem on using the keyword i know it should be a string but i can t figure out a way to do it right now i have this and i also wanted to know if i could do a way to basically execute the program but doing it for example using the letter c to search a product like coke or something in other words i want it for the name and type to search by the first letter and the description by the middle of the sentence,0,78,127 how to access the iframe by xpath for web scraping using selenium with python i only find this possible xpath because the ids change when refreshing the page it is body that gets an error when executing the code iframe image,brownie how do i handle exceptions i ve been watching a brownie tutorial video by patrick fantastic lad still i seem to be getting an error when running a particular function but the rest of the functions run perfectly i don t know where i went wrong i ve attached the code snippet and the error message this the error message and below is the code snippet that includes the imports and the particular function these are the imports and the particular function is below,0,41,83 how can i parse a string number to a float python from excel i have a number in the following type so i ve been trying strip replace among others but i couldn t get a float from my code result monto float m valueerror could not convert string to float,why is the python module requests downloading the html page instead of a file i have an xlsx file that i want to download with python if i click on the following url it automatically downloads it with no problems however the following code outputs true and downloads the html page instead of the xlsx file what is even more frustrating is that the same code worked perfectly fine before but for some reason changed its behaviour in the last h this thread and this thread discuss similar problems however in both cases there is a login barrier which in my case is not present edit after executing the code above and typing head this is a test xlsx in my terminal this is the output i get edit okay so apparently the code downloads the excel file when executed once but changes the behaviour when executed a second time downloading it manually by clicking on the link still works so i guess there might still be a workaround for it,0,52,170 explanation for this no flux boundary code needed im completely incompetent in programming can anyone help me understand what this code does exactly according to the notes it should impose a no flux boundary condition but im completely baffled at what the terms indicate can anyone explain this to me,iterate through list of dictionaries that don t contain the same keys i am struggling when trying to iterate through a large list of dictionaries for the most part they contain the same keys but there are a few that are missing some keys obviously this causes error and i m unable to successfully run below is a sample of the list we are missing away in the second dictionary so when i run the following code i obviously get the error keyerror away since away is nowhere to be found in the second dictionary is there a way to ignore the missing keys and just put a null in place of the variables for the dictionaries where away is missing thank you in advance finally if this has already been asked i apologize as i cannot seem to find it anywhere i see multiple questions regarding iterating through dictionaries but none regarding different keys,0,49,153 checking if in a table in mysql are two rows with the same elements let s say we have the tables table and table in both table and table we store a name age and date how can i check if an entry from table and an entry from table have the same name and age,custom function for annotate i am trying to extract records with my django orm model the model is represented by goal my goal is to process user level in the query in order to transform those ids in text i have a dict key value with those ids for that i was thinking of writing a function custom level to process the pairing job i am using annotate but i am not really sure of its correct use how would you process the pairing between ids and text in order to get a single text line any clue thank you,0,55,97 cannot use make function in cygwin it just says no module found called numpy i already installed numpy and i have anaconda but for some reason it doesnt get recognized by cygwin error cygwin log,how to use bulk load in apache airflow i have apache airflow and postgres database i need to insert multiple rows at a time so i am going to use bulk load method of postgreshook but get error everytime the error i get i couldn t even find some examples of bulk load usage would appriciate any clue thank you,0,36,57 using discord py to send a message everyday at a specified time i m trying to make a discord bot that will send a message at a channel at a given time i found previous codes but they don t seem to work for me since they give indention errors i m not an experienced programmer and any answer would be very helpful,django orm and condition for same key with multiple options ihave a model webdocuments with multiple objects of different document type and i want to apply and condition i want to return true or false wheather both document type exist of not i have both document type in my db still it returning empty because it filtering both type on save object is there is any way to do it with and operator or i have to loop queryset with all doc types here is my model,0,59,88 check if values are within intervals in pyspark i have a large dataframe a with intervals like this and i have a dataframe b with sorted non overlapping closed intervals like this i want to check if values of dataframe a are contained in one of the intervals of dataframe b and if so save the id in a new column interval id my output dataframe should look like this is there a way to do this efficiently without udfs,ffmpeg probe not working when run from python on windows i am relatively new to python i am working on extracting some metadata from a video and i am trying to use ffmpeg probe or ffprobe because it provides all the data i need after many errors i went to the basic and tried the error that i get is i have been searching around and tried installing and uninstalling ffmpeg ffmpeg python installing it directly on windows adding the files to the path so that i can run it in the console then tried to do it on my own using the probe py as example the error returned is b ffprobe is not recognized as an internal or external command r n program or executable batch file r n but runs it is not the filenotfounderror when i run it in cmd there is no issue ffprobe show format show streams of json e archive peliculas clasicos casablanca avi provides the information with a couple of lines before the json but works i don t know if it is a windows thing i have tried both and already with no apparent difference or i am doing wrong,0,77,186 i have a syntax error in python while trying to load the file here is the error i get,read multiple parquet files with selected columns into one pandas dataframe i am trying to read multiple parquet files with selected columns into one pandas dataframe this means that the parquet files don t share all the columns i tried to add a filter argument into the pd read parquet but it seems that it doesn t work in the multiple file reading how can i make this work,0,19,65 is not a valid xpath expression i am trying to dowload a image in my web page with the xpath expression part of code part of page source i m trying to dowload error,converting python dataframe to a particular json structute hi i want to convert my dataframe to a specific json structure my dataframe look something like this and the json structure in which i want to convert my datafram is below i tried implementing this with below code with different orient variables but i didn t get what i wanted so if any can help in achiveing this thanks,0,33,69 how can i save scrapy logs in gzip after scrapping without using scripts in bash are there any ways to compress logs i need to store them for some time for later debugging and it would be cool to find a way to reduce their size if there is no such a method then how to organize the compression process more efficiently,not null constraint failed orders order user id i am new to django and i am building an ecommerce website when i try to make a new order in my website i got this error not null constraint failed orders order user id each user can have multiple orders and i want to show the orders in the users profile but i am having problem with placing orders models py forms py views py template,0,62,64 numpy use sets as rows and columns of matrix i have arrays has countries has dates the other has a data structure like so country date otherfield i need to make a matrix with countries as rows dates as columns and otherfield as the corresponding value for each row and column and i was wondering if there is a cool way to use numpy to do this expected output should be something like this,python pandas how to read csv file by block i m trying to read a csv file block by block csv looks like blocks start with no and data rows follow many thanks for help,0,78,34 count number of items of an array exist in another array suppose we have an array a and a set of arrays in b what s the fast way to find how many items in a exist in each row of b for example if i have so i should get c,find the top countries having the highest gdp per capita in each year produce the following table this is how my data looks like i want the output as follows this is just the sample output here is the image of the ouput i have tried this so far i don t know how to replace columns with the country name,0,55,60 is there a function for extraction not a principal root there is a function from math module named sqrt which returns a principal square root of a number for example math sqrt yields as an answer my question is is there a function which can return not only one root but also the second one consider the following code func yields since,tsql rows increase after each column insert i am inserting data into a tsql table however my rows increase after each column insert so that after inserting values into column a and values into column b i end up with rows in my table it should only be rows and two column all my column have equal length but after insert them into the table i end up with x rows when i check the data in sql server i end up with rows and columns,0,69,96 fill pandas dataframe from multiple dicts please advise how optimal solve the following task i have pandas dataframe df shape is st column values from to nd rd and dicts with different key values the question is how to replace values in dataframe by keys from dicts something like that but for all columns,how is rosparam calculating the of leading zero integers could someone explain how ros s rosparam command converts input and output values specifically i am surprised by the following set of commands caused by leading zeros this isn t the conversion from binary so what is happening here,0,58,45 how to modify a selected text widget in tkinter when pressing a button i have a program that uses text and button widgets i want it to insert a string in the text widget when i press the button but i have no idea of how to do that could anyone help me,i have to sort an array using insertion sort and using recursion without loops i have to sort an array using insertion sort and using recursion without using loops i have tried but it is not sorting anything here is my code output is same as the given array expected output is can anyone help me to find where the problem is,0,53,78 viewing the source code behind python modules such as pandas and random i would like to see how to view the code behind these modules such as how randint from random works etc for example,how do i restart the function i m trying to print random integers each time the button is clicked and the function is executed however i only get the same result unless i restart the program here s my code so how do i do this,0,35,44 change inherit field to required in a serializer i have a serializer like that i want to inherit this class but changing field to required true who can i do that i know that i can redefine the field like this but i dont like to do this,why does pandas ask for freq or x when doing seasonal decomposition i ran but the result is you must specify a freq or x must be a pandas object with a timeseries index with a freq not set to none the data contains only date and tmax temperature max,0,46,50 replacing all but one type of character in a string python the desired output of this code would have been l ll but it was l ll an l ll an lilli n lillia sorry about this i m not the best at code but i d appreciate a solution thanks,what does a mean in python array what is the meaning of in a python array the code below is what it was written like please help me,0,43,31 how to check if an element from a list exists in mysql query i have this list and this query but it doesn t really work any solutions notice date in the table is a datetime date object,pandas sum values from minutes to hour time data values with pandas i have a question i want to sum time data values with pandas i have data in minutes step and i want to sum the values for one hour for example my data i want to have this data is called test my soulution i would be happy if somebody can help me thank you,0,36,68 subprocess contradiction between two programs i know this may seem weird but i m trying to understand why the following happens i m editing a python program at work and when i run the following python function i get in the output that type c is bytes and sys stdout write c runs regularly and prints one byte at a time but when i run this function from a standalone program i get the following error how is that possible,how to split train data and validation data properly in k fold cross validation first as a non english speaker i am using a translator to solve my problem i ask for your understanding if the sentence is awkward and difficult to read i try to learn data through kfold cross validation however continuous errors occur in the process of dividing train data for kfold following code is my data set and every time i try to split train data and validation data error occurs i m not sure this will help but when i use this code trainx trainy x train ix y train ix this error message occurs keyerror none of int index n n n n n dtype int length are in the columns so i switched that code like this and this time model val acc evaluate model trainx trainy valx valy this code gets the error indexerror index is out of bounds for axis with size so i tried this code as well i sliced df use with train test split same index error occurs i want to split and put the data in the right way so that the kfold cross validation model recognizes my data and can run the model it would be very helpful if someone helped,0,74,221 select string after string with regex in python imagine that we have a string like i need to get a list of ips between routing for networks and routing information sources like below what i have done till now is but it is not working as expected update my code is as bellow,how to create a function that checks if values in columns of a pyspark dataframe matches values in the same columns of another dataframe how would you create a function that checks if values in two pyspark columns of a dataframe matches values in the same two columns of another pysark dataframe i want to make a new column that shows validation if those values in the two columns exists in the other dataframe the dataframes don t have identical columns except for the two columns to join on i m new to pyspark the code below shows a function that identifies validations when matching on one column the function above can show whether a value in one column of a pyspark df is existant in another df in the same column i want to modify this code to allow the function to match values in two columns in df to two columns in df and let the user know if the values in the two columns in df exist in the two columns in df for example,0,53,178 mysql connector errors operationalerror mysql connection not available i get this error message on pythonanywhere when i reload the app a couple of times i need to reload the app from pythonanywhere to make it work error message file home sideproject virtualenvs myvirtualenv lib python site packages mysql connector connection cext py line in cursor raise errors operationalerror mysql connection not available mysql connector errors operationalerror mysql connection not available anyone please help me with this server js file code sql connection py file code,how to compare two lists in python with the if loc condition i have two lists and i need to compare those two lists in below manner output getting expected output,0,63,31 how to call a complex sql query in python i have the following sql code this sql code has been tested and runs perfectly on sql server management studio now i have the following code for python which is to communicate with an ms sql server instance when i run it i get the following error where it points to the first semicolon in my code could you show me how i may get this python code to run,applying multiple filter on pandas pivot table how can we apply multiple filter on piviot table i have a dataframe as df i m able to apply one filter on it by the above code is working correct with one filter brand but how do apply one or more filter to this in the below code if you see i have tried to add but i was getting an error which didn t work maybe i m not giving the second filter correctly does anyone know how do i do this,0,79,87 how to return last comment i have probably a small problem namely how can i extract a last comment when i use post comments all views if i tried use or last this dont work,is it possible to customize e g a django app model field with html css i have this model field that holds the description image from django admin but when i print it out on the page it looks like the following description model field printed on page so is it possible to edit the description field so it looks better and is more readable using html css etc,0,34,64 saving images in a loop faster than multithreading multiprocessing here s a timed example of multiple image arrays of different sizes being saved in a loop as well as concurrently using threads processes and i get these durations on my i mbp aren t threads processes expected to require less time to achieve the same thing and why not in this case,python merge two columns based on condition i have the following dataframe with two columns department and project i want to replace the department entry by the project entry if the project entry is not empty so the dataframe looks like that how can i do this,0,63,47 how to merge json files with a common key i would like to merge json files tests json with empty value some of them nested values json with the value this code works fine but i need to make it more compatible as i understood i need to check recursively whether file json has values parameter and empty value parameter inside that block moreover i couldn t touch source tests json but only create another one file to save all changes,discord py depositing all money even though sending a integer i made a economy bot with the following code now when i say a dep or a number it deposits all the money i dont know why it happens please help i tried many times but it doesnt works example,0,79,49 why does playwright not change url once button is clicked on uber eats essantially i want to enter an address into uber eats and go on to the next page however i have noticed that the url isn t actually changing once the button is clicked i have tried doing the same thing by specifically targeting the find food button on the landing page for some reason this doesn t actually change the page help would be appreciated thank you,in python i d like to eliminate some dictionary items n in a list of dictionaries d is the list of dictionaries the items i want to remove from the list are here s my failed attempt please help,0,78,51 cards in bokeh python application i am creating a bokeh application in python and was just wondering if there are any equivalence to shiny dashboard info cards for bokeh applications dashboards i can see that there are cards from the dashboard example top of the dashboard on bokeh site but i can t seem to find the code for this anywhere any ideas on how to create cards using python for bokeh applications would be highly appreciated,why does my ide keep saying that my variable can be undefined i am writing a program to calculate the sum of the first n natural numbers but i am having a hard time coding the first part of the program in which i ask for the input from the user about how many successive natural numbers to add it s a very long code for such a simple task because i want the program to be able to ask to try again in case the input isn t a natural number accept mathematical expressions that are equal to a natural number e g to get back to the point why does my ide keep telling me that n can be undefined and if you d be willing to take the time to tell me how to shorten my code that seems a little repetitive i d really appreciate it thank you for your time,0,78,153 shuffling with seed does not give same result hi i have a problem with the use of the shuffle function of numpy i ve written the following code which gives me the following output now if i set the seed shouldn t every shuffle give me the same result i can t find my mistake please help me thanks in advance,error microsoft visual c is required while installing pdftotext i am trying to install the pdftotext library on a miniconda environment after using pip install pdftotext i am getting an error microsoft visual c is required i already have visual studio build tools installed but i still get the same error after restarting and trying the command again i tried to use the command conda install c conda forge poppler as described here i also tried the following command pip install upgrade setuptools as described in that post you can read the full log of the error here i m open to any suggestion in order to fix this any help is welcome,0,58,120 systemd service taking a long time to run i am having service running as background service in ec instance but it taking a long time to start a new one or restart a service refer to image i reboot ec and a service restart at but at the a service print the first log here is my service config file in etc systemd system please help,need help getting pandas to recognize my timeseries dataframe is in min intervals i have this dataset i m trying to set the data to a frequency i ve got pandas to recognize the datetime to the index i ve tried doing this but i get the following error,0,68,46 create multiple dataframes with for loop in python i need to compile grades from files named quiz quiz quiz i have the following transformation the code for one dataframe is the following i want to iterate the same transformations for all the quizzes from quiz to quiz i have tried a for loop but it did not worked thanks by advance,changing keys after loading json file dictionary okay so i am having this issue with json keys and strings i m using a json dump in python to save my game dictionaries and it does work the issue is when i load the dictionaries the game i m making uses int values as keys in the world directory but json stores keys as strings here s a random generation i did so when i use the load function i get key errors due to the int s being converted to strings i attempted a for loop to iterate over the keys and change them back but i get this error about the dictionary changing here s an example of me trying to load a different and also random world its set to print after each loop showing that it works i m not exactly sure what s wrong with it but sadly i ll also have to do this for each location within a region any and all help is appreciated as i ve looked all over so and google but to no avail,0,63,175 python define function to get the weighted median i have the following dataframe i have defined the following function however when i call the function wmedian df i get an error keyerror close the outcome i am trying to get is what is missing in my function i don t understand why i m getting that error,unable to install beautifulsoup package for python using pip on ubuntu i was trying to install beautifulsoup in order to learn web scraping i was using pip to install bs package for python but i am unable to install it any help to resolve the below traceback error note i am using wsl ubuntu,0,54,58 pandas group by to json format i ve a pandas dataframe with columns region country etc i want to get below json format from the df post group by i m getting below df output of above group by how can i achieve the json format above thank you in advance,how to sort a list of integers by frequncy using comparators in python i have written a program that sorts a given list of integers according to frequency of elements that is elements that have higher frequency come first if frequencies of two elements are same then smaller number comes first but my code doesn t print output correctly i have made use of comparators and imported the functools library and made use of the sub function cmp to key to generate the final result here is my code i suspect the error in my comparator logic can someone please me fix this here are some contstraints,0,50,104 kruskal wallis test for multiple comparison using python i am planning on conducting kruskal wallis test for multiple variables between groups e g disease differences in out out and out in ordinal level and getting the sorted variables e g out out out based on the decreasing kw test results however getting the error message valueerror if using all scalar values you must pass an index so how to fix it,operations on specific elements of a dataframe in python i m trying to convert kilometer values in one column of a dataframe to mile values i ve tried various things and this is what i have now the dataset i m working with looks something like this with my code above i m trying to loop through all the dist values and if those values are in the right column data dist and greater than divide those values by the number of feet in a kilometer more generally i d like to find a way to operate on specific elements of dataframes i m sure this is at least a somewhat common question i just haven t been able to find an answer for it if someone could point me towards somewhere with an answer i would be just as happy,0,67,135 getting separate means line in a single plot i m working on this figure and wondering if it s possible to get a mean line like the black line in the figure but for each concentration group sorry i can t share the data with you ideas how it is right now how i want it to be red arrows are just to catch your attention,how to take a pickletype data and convert to csv files in a folder using python i am trying to take a pickletype data from sqlalchemy and converted it to csv files in a folder here is a snip of my class with the pickletype data here is my function that i am trying to get that data in pickletype and convert it to csv files in a folder,0,63,69 remove specific endline breaks in python i have a long fasta file and i need to format the lines i tried many things but since i m not much familiar python i couldn t solve exactly i want them to look like i ve tried this but the result not showing lines and also merging all other lines hope you can help me about it thank you,how to get text from handwriting image in python the image the image is handwritten line of text this is extracting the text some what but not the expect same in the image and the code is the output buttered off before there twinkling like new yar sytemy hung cuter of tempting uwitationx they beaged hi to contre the extera,0,65,60 concatenate variable in athena sql query from python lambda function i have a python lambda function that creates a sql table in athena how do i properly concatenate variables in my query when i set the location value i receive the error response below the function runs successfully if i hard code the location value error response lambda function thank you,how do i count numbers of elements that belong to a product id and save them element wise in a list in python i tried this and many more things count for count elle in enumerate product ids,0,61,34 valueerror input of layer sequential is incompatible with the layer expected shape none found shape none hi i have the following error i don t know how fix the next error the error happens only in the last part when i want to predict the next day my full code is this,for loop not loading all images in pygame and can t blit them onto screen i m trying to make a blackjack game and i m having trouble loading the images for the cards in the for loop the way that i have named the images is like d png is the image for the card of diamonds and qd png is the image for the queen of diamonds etc my issue is that only the last card types and numbers are being loaded in when i check the length of the cards list it returns only instead of the cards that will be used additionally for the cards that i have loaded i wish for the computer to deal out these cards at random i m using a button module i found online to detect when a button has been clicked so what i m trying to do is allow the player to click on the hit button and be given a card however the card only appears on screen for half a second then disappears,0,55,172 how can i add unscrollable image to a frame canvas in tkinter canvas how can i place a image on a canvas frame that has scrollbar attached to it but on scrolling the scrollbar the image shouldn t scroll rather the other contents like label should move while scrolling making image unscrollable and below label,python large float arithmetic for el gamal decryption the decryption math formula for the el gamal method is the following specifically in python i want to compute the following equivalent the issue in the above python code is that the numbers inserted would overflow or result in due to precision consider the following example the expected answer for the above example is i ve tried to research a strategy to deal with this problem and found that using python s default pow x y z which differs from math pow can help pow x y z is equivalent to x y z however i cannot use pow x y z i tried to use pow but i cannot multiply the result of pow by to then as a final step mod by in other words instead of x y z i am trying to perform x y a z but there is clearly a parameter limit or number of operations from pow x y z what can i do to compute the math formula in python,0,51,170 how to change values of rows based on groupby i have the following df i wish to change the values x if the id s algo has a so in the above df only id and has a s algo hence the values should be x to achieve this i do desired results my question say i wish to iterate over the group of ids and make the adjustment there inside my for loop how should it be done,how can i make my class more robust to operator function overloading i am writing a class for which objects are initialised with two parameters a b the intention is to assign instances of this class to variables so that i can have an equation written symbolically in python code but have operator overloading perform unique operations on a and b in running the above example code i encountered the following output through guesswork i was able to see that a complaint about no callable exp method probably meant i needed to define a new method in my class which ended up working just fine but now i will have to write another method for np expm and so on as i require thankfully i only need np exp and np log to work but i also tried math exp on my object and i started getting a type error so now my question is the custom exp method in the class seemed to work for overloading the numpy function but how am i supposed to handle math exp not working it must be possible because somehow when calling math exp on a numpy array numpy understands that a element array can be turned into a scalar and then passed to math exp without issue i mean i guess this technically is about overloading a function but before i realised defining a new exp was the fix to my first problem i had no idea why a method like rpow wasn t being called,0,79,245 how do i import cookies from any browser preferably ie to selenium chrome driver i want to add my cookies from ie from a particular website to selenium browser by way of import imports i currently have if they are any help to you thanks in advance,method not allowed post i m trying to make a simple one paged shop i made a listview of the items and it renders no problem the shopping cart will be in a modal i made the buy button but whenever i press it it says here are my views this is the form the form in html i cannot continue making the logic for adding it to the future cart because of it print buy buy is just for testing in the url file it s only the main page with itemlistview as view i tried putting the abuy function in it and out same problem remains,0,47,103 join dataframes matching a column with a range determined by two columns in the other one with pyspark i have a df on the left like this one and another one on the right like this one and i need to join the rows when the id of the first table is between the range of start end of the second table the output should look like this how can i achive this result with pyspark,kivy numeric keyboard on text of the text field i am trying to add numeric keyboard in ui which will be display as clicked on the text on filed but some how numeric keyboard not show in the ui i use numeric json file to open the numeric keyboard as per the kivy documentation json file and link is here is my code below,0,76,64 append items in front to every list inside list of lists not to the back i have the following list of lists i would like to append item name to the front of the list such that it looks like this here is the python code i wrote to do this the code appends the items to the back of the list what i want is append to the front of the list i am using python,how to retrieve aws s objects url using python i need to write a lambda function that retrieves s object url for object preview i came across this solution but i have a question about it in my case i would like to retrieve url of any object in my s bucket hence there is no keyname how can i retriece url of any future objects stored in my s bucket,0,77,70 how can i make a variable for each person in my discord server with python i am making a game for my discord server and i need every member of the discord server to have their own number of coins therefore i need every member of my discord server to have their own variable for their coins if anyone knows how i could do this that would be a huge help thanks,how to cache a function that takes a database connection as an input using streamlit i have a database connection subsequently i have a function this is part of an app in streamlit that i m working on i need streamlit to cache the output of my load data function i thought it worked like this but this gives me the following error the error is much longer and if it helps i will post it the error also contains a link to the streamlit documentation i read it and reformulated my code to look like this but this gives me a nameerror i ve run out of idea s to try any help would be highly appreciated it is very possible that i misunderstood the documentation as it assumes a lot of prior knowledge about the process of hashing and caching,0,72,138 tkinter attributeerror button object has no attribute get when trying to access file from filedialog askopenfilename so i have something like this what i m trying to do is to store the dataframe created in open file to use it in get info i m getting attributeerror button object has no attribute get how could i access the dataframe created in open button,pathos error has occured during the function import when i try to execute this code i m getting this error is it because i am generating a network object inside of the function ideally i d like to run the simulation times with different error rate etc i tried to run with multiprocessing but couldn t pickle the function hence why i am trying with pathos edit i am using signal from the blinker module the code works when executed normally i ve done iterations without any problem but it takes forever edit i am using the signal as such edit so i removed the use of signal now i get this error np is numpy weird,0,57,117 dataframe merge for on specific columns i have a basic question on dataframe merge after i merge two dataframe is there a way to pick only few columns in the result for example result pd merge left right on key key result is there a way i can chose only column c from right dataframe and a column from left dataframe for example i would like my result to be like,python defining business days and working hours i am looking for guidance on how to create a variable business time which contains only business days not weekends and where i can set working hours am pm gmt the reason for this is because i m trying to calculate some sla s how long employees have to complete a task however if the end time falls outside of these business days hours then i can set it to a specific time many thanks,0,70,79 how to use jit on a numerical simulation i m trying to write a physical simulation using python which requires a lot of simple math computation i believed that numba s jit will help me run it faster the code is mainly calculations and i m not sure what s wrong i tried putting jit over each function i tried to specify jit nopython true and still its very slow,convert multiple nested json to pandas dataframe here s the response i get from my stock data api provider i need the results to be a simple pandas dataframe with the following columns date company open high low close volume,0,64,39 parsing xml in python by using xml etree elementtree i get an xml file using the request module then i want to use the xml etree elementtree module to get the output of the element core usg but i m already confused how to do it im stuck i tried writing this simple code to get the sysname element but i get an empty output python code xml file,python hexidecimal byte interconversion oddity i must be missing something yet the following doesn t convert back anyone know the error here,0,63,21 elif statement unreached in python script in the following code the if statement is reached and runs fine the elif statement however seems to have no effect when the script is run when the conditions for the elif statement are met nothing happens and when i press return button twice the script just keeps going skipping the elif statement altogether my code,wondering about pixel perfect mousepointer collision in the case of a button i ve got a pretty simple code up right now that just moves between two menu screens once the button for each is pressed i know that you can mask images in pygame to get pixel perfect collision but not sure how i d go about doing it for the buttons in this code it s just pretty annoying that you can click slightly off and have it still transfer you to the other menu a follow up question i had was on how i could do fade transitions between the screens i ve seen some tutorials but they ve all seemed overcomplicated,0,62,110 virtual assistant only takes voice input one time i am coding a virtual assistant everything is fine it listens to my audio input and responses correctly but when i run the programme it only takes my command one time and the programme ends i can t figure out where should i use the while loop so that the programme continues until i ask it to end i tries addding while loops in different function but none seem to work,sum value of a column in a pandas dataframe sorted by another column upto a value n suppose i have a column like so based on some sort applied on b column now i have to find out the sum up to but the order of the rows in dataframe cannot change it needs to be sorted by column b values can omit a row though while calculating sum so in this case row sum over column a basically conditional summation over a column expected output df whose column a additions of rows n here note i can skip only those rows whose value of a total left have to always consider those rows in that order only prioritized by b for eg there can be millions of rows in the dataframe and i have to definitely consider rows whose value is total left total sum till now i cannot leave these rows so for example i have something like this i cannot take th row first because it has less value i need to take row row row therefore sorting on column a isn t possible,0,78,190 django pip freeze requirements txt not getting the exact packages installed in the virtual env django pip freeze requirements txt not getting the exact packages installed in the virtual env rather it s getting all the packages i have ever installed and it s kinda not what i exactly wants let me show some image of whats happening there are still more packages below please what can i do,how do i implement dynamic dependent change of dropdown select options using python flask and sqlite good day i m really new to programming month s and i m trying to add last feature for my course final project in my html page i have select containers first container has data from tuple object in my app py and rest options data is coming fom sqlite database query i want this options to be dependent of each other no matter what option will be selected first by user to give you more of an idea what i am talking about all options are tied to weapon type this is a web app for managing inventory for an online game this type column is present in each table used in query and represented as for ranged weapons for melee weapons and for both types so how i understand it i need to make a json request after one option is being selected and return it with new query result back to html in order to process new data with javascript but what next when new option will be selected and reduce variants i m totally lost here since my javascript experience is only with bootstrap copy paste i hope i explained everything clearly and would really appreciate some example how to do it thank you for your time my python code my html code,0,67,232 how to print following pattern getting issue with spaces i am trying to write the code but not getting how to achieve expected output causing issue with space and not able to make proper judgement how to get exact spaces after every iteration my code output of above code is not as expected output expected output,how can i search in django for multiple values like the werkstoffbezeichnung and the werkstoffnummer this cod i made only works for one values when i try to add other one it stops working how can i fix it,0,58,41 need values to unpack in for loop got in django after updating my project from django to django i am facing this issue need values to unpack in for loop got let us consider my views py as how could i solve my issue,how to send keys with python selenium after an element has loaded my code here i made an attempt of using the webdriverwait function to allow time for the text box to be loaded before sending the keys but it errored and returned this the selector id is correct being identifierid but since it isn t loaded properly the code could not find and input text how should i correct the function used for waiting the element to load in order for this to work,0,51,84 how can i test aws cognito protected apis in python i m trying to test out some aws apis that are protected by cognito i found the first part on how to get the json token but i can t figure out how to use the token correctly so i can authenticate on the api here s my code i m getting the following error message,python rotatingfilehandler is logging also to archived file how to log multiple processes to single file this is my logging config and i have about different files which each of them has this exactly same logging setup so far so good now the problem after restarting my application all logging records are correctly sent to last file lan runtime and exception log but sometime later few hours few days i dont know exactly trigger and time i observe that also second last file lan runtime and exception log is incrementing by some records from one of those files that have logging set i was not able to find why this is happening my goal is to have all the time only latest file incrementing any ideas,0,64,122 how to import install dependencies packages from a global system environment to a virtual environment i have installed my needed packages dependencies in the global system environment instead of my virtual environment virtualenv because i have used the command pip install package name outside of the virtual environment so i want to know how can i make a list out of them and install them in any of my virtualenvs,is there a way to override busday count method in numpy i want to override np busday count to include custom off days how do i do it,0,69,25 webdriverexception message msedgedriver exe executable may have wrong permissions in google collab i used google collab and browser edge and i tried this code with selenuim and i had this error but i have already downloaded last version edge driver by wget before and i have no idea how can i fixed it because all solutions on stack overflow were for chrome driver and they didn t work for me,taking the unique values to a dataframe pandas python i have a dataframe in the following format i want to derive a dataframe as follows from the above dataset this is more like a combination problem but in pandas,0,68,39 get element range in list and swap i want to swap element list by range in python my code is and my output is but what i want is swapped by list index range,how to properly use assignment operator with mod operator in an if statement i am trying to use the walrus operator in python with different if statements and the code that i am trying to replace looks like this and the expected output should look like this now if try to replace my code with walrus operator concept it does give me either true or in the results if i tried the following output or output now i know my logic inside the if statement is wrong and if i did not use comprehension this would probably work as intended but is there any way we can make it work like this,0,34,112 spyder nameerror name variable is not defined with vars but gobals works i am creating dynamic variables with when running i get the error nameerror name df is not defined i can debug and see the variable does exist under spyder variable explorer as below it works for global but not vars what am i doing wrong please,binary tree in python control over the height i want to implement a binary tree in python i sumit my code what i would like to do is to set the height of the binary tree with the variable l but when i implement the code it seems that the code has created a binary tree that is greater than i expected i arrive to this conclusion because when i set the height as and i do print node right right right i still get,0,59,83 return previous row value based on id column to find differences between current row and previous row i am new to python i am having a problem trying to look up previous row values based on id and timestamp in a python dataframe can anyone please advise how i should derive the solution below is a simple example for example id timestamp sapstock laststockdate laststockvalue,create a multidimensional array in python without additional library i have written above code this will create a n dimensional array with aliasing when i am mutating the list it will mutate everything e g aliasing problem click here,0,75,36 give variable to callback function with yield in scrapy i have two function at first parse is called and parse each is called in parse now i want to pass some additional parameter to parse each so what i want to do is like this i am afraid it might be impossible but is there any good way to pass the additional data to callback function,confusion when importing django generic class based views while exploring the reference documentation and some tutorials i have seen the import for django s generic class based views used in multiple ways or i have tried experimenting with both tactis and they both seem to work yet the first option seems less correct do all the generic cbvs also exist within the generic module a well as the submodules can python import classes from submodules by only importing a higher module what is actually happening here any help would be greatly appreciated,0,64,91 numpy array of array vs numpy array of list i have this two numpy arrays why when i m checking if the internal array list is none i m getting different results both have the same shape what is the way in numpy to check that each element in arr is none,python unit test passes locally but fails in jenkins when comparing dates the following test passes locally because locally it s est but fails when running in a jenkins pipeline because jenkins server is running on utc time but the method get local ts is returning the local time and so this error happens self assertequal dt dt assertionerror also this will only fail when running it after pm est when utc rolls over to next day how can i get this to pass locally and in jenkins at any time thanks,0,49,91 django redirects to non existing url two days ago i created a django project and it worked all right but now when i am working on another django project still when i run server it s redirecting me to the older project i am using different virtual environment for both of them even after deleting the old one the issue is not resolved thanks in advance,how to display that the shopping cart is empty flask i am creating a webshop using flask for the moment i am trying to display a message when the shopping cart is empty i have already managed to display the message when the amount of of a product is added to the cart using an if test but i fail to display a message when no amount of the product is added to the cart the bold piece of code between is where the error message appears this is my route function in python this is my html file of the cart cart html thank you in advance,0,65,108 how to replace in python missing positional args with some predefined variable i want to make this code runable with one or two positional args host and port when you don t define port number it will replace with predefined number it works ok if you run code as myurl py localhost but i would like to run like myurl py localhost or myurl py localhost how to avoid error message typeerror url missing required positional argument port,am having a matrix multiplication issue with cvxpy updated code when i hit this line i get this error the original source code is from here,0,76,28 how to convert date time to timestampe in python i have a dataset that has a column of that date written in the following format how can i convert them to timestamp,identical lists as pandas rows i have a dataframe in pandas as mentioned below where list elements in column info is same as unique file in column id all i want to get list elements as row for each file like,0,32,41 conda activate in script to run a python program i take run the following manually can i run both of these in a shell script,bucket policy with minio please note i am not using aws as the s provider but something called cegedim s following operation is not working with minio client but with boto it s working when i am trying to setup the following policy with minio client it works for the bucket level operations but not for object the level operations minio connection after setting up this policy i can t perform get put or any other operation on objects is there any workaround for this with minio client,0,25,85 modify pandas dataframes inside a loop i want to modify some pandas dataframes inside a for loop the problem is that after the loop runs the dataframes are not updated with the modifications what is happening my code,how to add round brackets to strings in column i have a data frame with strings in column a row anna row mark row emy i would like to get something like row anna row mark row emy i have found some examples on how to remove the brackets however have not found anything on how to add them hence any clue would be much appreciated,0,38,58 how do i get him to stay awake until i say goodbye building my own voice assistant after each command is given and response returned i have to wake him again i want him to be awake for all queries stuck please help sorry if it seems vague,creating requirements txt in gitlab probably a silly question but i am trying to set up a project in gitlab that is going to be used for deployment of an ml model for which i will use fastapi i m very new to this and will try to provide as much info as possible i created the project in gitlab which right now only contains a readme md file the actual python code is stored in a folder on my computer myproject which contains two folders each of which containing some data py scripts and a notebook to set up requirements txt i tried to create a virtual environment in windows now when i open the myproject folder it contains those two folders with code and the virtual enviroment which also contains lib scripts pyvenv cfg the latter contains i also cloned the gitlab repo but on my computer it is saved somewhere else in c users me i know that i need to do but i don t understand how to actually add this requirements file all of the packages and libraries that i needed for my ml model were installed a long time ago with anaconda before i created this virtual environment have i done anything wrong,0,48,201 adding line numbers to text widget using tkinter i have text box my text on gui at location i want to add lines numbers to this text box using bryan oakley code here my code code is not displaying line number it is displaying just text how to display linenumbers in text box thanks in advance,pandas styler does not maintain rounding i would like to round off pandas dataframe and then add a title to it but pandas style set caption command ruins the rounding example result how can i add a title while maintaing rouding,0,55,39 django database error while connecting sqllite,adding to set if part of tuple not exists i would like to use something similar to the add function to add tuples to a set however i want them not to be added if a part of that tuple already exists in the set for example this gives me a result as but i would like the a b combination to only appear once the first time it is added so that my result is,0,6,74 backend youtube dl py line in fetch basic self dislikes self ydl info dislike count keyerror dislike count i have the below code that has been used to download youtube videos i automatically detect if it s a playlist or single video however all the sudden it is giving the above error what can be the problem,openpyxl number format not applied until manually applied code expected result i open up test xlsm and in column a all dates should already be in the format yyyy mm dd actual result while the yyyy mm dd format gets applied without any issues when i run the python code i then have to open up the excel file select each cell manually and hit return in the formula window for the yyyy mm dd format to be applied is there a way for my specified date format to be applied through the python code rather than having to manually apply it by opening up excel and selecting each cell going to the formula bar and hitting return every time thanks in advance,0,48,115 i want to transform a list or concatenate this same list i have a list like here that i coded in python and i would like to transform it to be able to integrate it into a dataframe more easily,unable to use joblib parallel with cpu for n number of iterations along with gpu for training models i am developing a custom cross validation function in python which runs for given number of iterations where in each iteration following steps are executed at the end average of mse from all iterations is calculated for iterations it s taking around hours in order to speed up this process i would like to utilize multiple cpu cores physical cpus threads each available on my windows machine with a single gpu attached nvidia quadro gb i found that joblib parallel can be used for executing tasks in a for loop on multiple cpu cores in parallel and used the function as follows regarding limiting the memory growth on gpu i added following code but even for iterations i am getting the following error please let me know if there s solution alternative to use joblib parallel for parallel processing the iterations via cpu along with gpu for training machine learning models thanks in advance surya,0,40,174 how to efficiently filter create mask of numpy array based on list of tuples i try to create mask of numpy array based on list of tuples here is my solution that produces expected result output mask problem is that with bigger data array and increasing number of tuples in filter vals it is getting slower it there any better solution i tried to use np isin data filter vals but it does not provide result i need,how can i align properly the words into a txt files good evening everyone i am david tzu a years old and i really need help with this problem about the alignment of the word properly i tried the print only but it doesn t fit that much sample txt consist of here s my code the current result of the code above is like this expected result i am really sorry for my terrible english hope you all understand what i am trying to convey additional code len of words,0,70,89 how can i create link button in nextcord this is the link button i want this is my code error,leetcode smallest string with swaps time limit exceeded problem using python the problem is to use unionfind to solve the problem below is the correct solution i kept getting the time limit exceeded error if my find in unionfind class is either or there are total test cases for this problem using the two find methods above will only get passed so what s the difference between the correct find and the two above thanks,0,20,77 what s the difference between priority queue heap and sorting queue reconstruction by height the best answer to the above problem is this the above method is a priority queue method on the other hand the method using sorting is this big o is similar but i don t know why we should use a more complex priority queue what are the advantages of priority queue over sorting,use two bpf filter in pyshark can i use two bpf filter in pyshark for e g is it possible or is there any way to use filter simultaneously,0,65,29 print row and column header if column row is not nan pandas it s a weird question but can y all think of a good way to just print the rows or a list of the rows and their corresponding column headers if the dataframe cell is not nan imagine a dataframe like this result should look something like this thanks in advance,save sensor data in a django database im doing a django app that tries to show data taken from an ultrasonic sensor what i want is to take the distance from the sensor and save it in its django table normally this is done with a form but i want it to be done in the backend for each sensor object this is the code that i have for the moment ultrasonicsensor py models py views py,0,61,74 update label text periodically from within function the code below opens a tkinter window with a label showing and when the button is pressed after seconds the label shows instead i am trying to make the label update periodically displaying the numbers through every seconds instead of just and thank you in advance,regex to capture word with at least one number in it i m almost done with all my regex stuff but i encounter another problem i have this regex it captures all stuff i need as and it works but sometimes it has a strange behaviour as far as i understood regex i m noob p my regex is supposed to capture things that contains at least one digit but on this string the output will be i don t understand why buffing and machine are captured o if someone could help me understand this thanks,0,61,100 how to use python variables in a cypher statement when using py neo i want to get some path by using py neo but i didn t find the right way so i choose to use graph run when i run the statements below it will show error like this so how can i use the python variables in a cypher statement or is there a way to get paths using py neo statements,send lists and dictionaries in python requests get i built a test fastapi instance with a get operation as follows after running the api i would like to try to launch a request via requests get with the parameters d a b c and l i would like to understand how to write the url in r requests get,0,70,66 how to access specific values inside a list that are stored in a idx variable python i obtain by a certain process an index idx array so now i would like to access those elements in the a list in r this is pretty straightforward but i can t find an easy solution in python without using for loops this below is the code how can i solve this simple task thanks,django admin drop down with very long description text just like the pic in admin panel when creating some post that basically one of dropdown menu options it is so long is there any idea on how i can change it to be multi line or maybe change the drop down menu to a select table the admin in this case need to read the description so it is unwise for it to be formatted like that i have a code example models py admin py any idea,0,70,84 raspberry pi google assistant i need help on where i have gone wrong i followed the program asks me to input a request but it doesn t output the answer through the speakers i have attached when happens when i talk to the microphone send a request,python regex with brackets i m trying to get a subset of strings like bellow i need to first capture contents between and and then put each of some content in the separate index of an array what i have till now is but it does not work as expected my expected result is something like bellow any help is appreciated update please consider the following as an input string expected output,0,47,73 how to make a dictionary of inputs these are the inputs and i tried to make dictionaries of each line separated by for example name signalsandsystems this is my code but the code makes dictionaries only from the first line of the inputs the answer that i m looking for is,take a screen shot of a specif area and save as variable i want to make a program taking a cropped screenshot like windows shift s and save it as variable not as a file how do i programmatically open this win shift s window how to directly get the output without saving this as a picture i m using python,0,50,56 convert pst to us pacific for use with pytz i m trying to create http endpoints for example if the user made posts in sept november but none in december then jan onward it wouldn t return december but it takes the time zone in pst format because it does a sql query unfortunately pytz the library i m using for getting all posts from a month only accepts time zone in the format us pacific,how to write read serial port with multithreading using pyserial i m currently running into a problem with trying to write to a serial device using pyserial i want to be able to continuously update my terminal by reading the port and handle serial device writing on a seperate thread meanwhile also be able to send a command via user input on the main thread everything runs as expected except for that when i send one of the commands cmda or cmdb the serial s output that i m reading does not change this is expected behaviour as the commands being sent alter the state of the device which in turn changes the device s output that the serial port is reading with all that said it seems that the device is not receiving the command i am sending even though the code continues to run with no exception and all functions seem to be executing as written here is my current code a serialmonitor class that can read the serial port and print out a specific amount of bytes once finding a set of syncbytes and the main thread,0,70,185 datetime transformation for column in data frame python i wanted to transform different date formats to one another however when using the print command i still get the old data format what is it that i m doing wrong here,updating filtered data frame in pandas can t find why updating filtered data frames are not working the code is also not returning any error message i d be grateful for hints help so the problem comes when i want to update the dataframe but only to given selection given update function on data frame objects updates the data based on index from data set based on another but it does not do anything when applied to filtered dataframe sample data df df code returns df while below code does not apply any updates to given data frame return df looking for help on solving and why is this happening like so thanks,0,39,111 how to make an array of row values from same column in pandas here i have the following table having columns s no test and key i want to join those rows from column key in form of array in which the values of column test are equal like in table resultant table table table resultant can someone please help me in how to do this right now i just got the duplicated entries thanks,what is the best generic type hint for a dataclass in python i have started using dataclasses and i have some specific one lets say for example i then have an abstract class like an interface what is a good generic type hint i can use in the abstract class as placeholder for both the person and the animal classes,0,72,60 how to find inverse of mod when there is an unknown number i have a formula like x mod how can i find x in python trial and error is not allowed,issues adding variable to getwindowswithtitle so i am having issues with getwindowswithtitle function from pygetwindow when i ask for input before the getwindowswithtitle call i get the following error if i comment out my input call the getwindowswithtitle works just fine the following is my code so far i am trying to get input to choose which window to select but even putting target in the getwindowswithtitle it gives me the same error does anyone know why i am getting this error after putting in my input,0,41,87 is there a pandas function to create a df of an dict object inside a df so now i have a csv file which is a df to csv stuff and it looks like this i want to ask if there s someway to merge that dict stuff into the df you can find the whole csv file here here is my code,pandas dataframe custom indexing of nested dictionaris and lists i have a dictionary like this which is showing market orders of some cryptocurrency pairs and each list of bids and asks has a fixed number of elements and each element has two values which respectively are showing order price and order amount i m really an amateur in pandas and numpy so what i want to do is to create a dataframe of this dictionary let s name it df and get the first bid or ask of all of the pairs in a single line like this i ve tried a lot of ways but none of them worked as i wanted them to addition as far as possible i want to avoid using loops,0,60,125 issue while working with django orm or raw sql query list edit drivers html this is html file for showing data at front end urls py ajax call driverviewset url and html render list edit drivers url views py serializers py i need to this sql query implement for change logic i don t need to change existing field name and all only change logic based on below sql query raw query or orm both okay sql query output ex models py,filter data from multiple files at once i have multiple folders each containing several thousand files i need to filter each file in each folder based on date once all the files in a folder are filtered i need to create a zip file of each folder containing all the filtered data csvs the below function creates a zip file of the individual files which is not really what i want one solution that works is creating a new file for every file in a new folder with the filtered data then creating a zip of the new folder i don t want to do this as the data files will be repeated across multiple folders i ll run out of disk space additionally it s massively time consuming given i am dealing with several terabytes of data is there a way i can filter out data from all files at ones into it s own csv in memory zip it all up,0,74,164 is there any way to boost matrix multiplication using multiple gpus i want to multiply two huge matrices size is more than rows and columns i run the task on a server that has several gpus let s say rtx gpus their ram size is gb apparently the matrix cannot fit in it so i cannot use cupy array directly here is my idea here are my questions note,pybind conflict with getmodulefilename i am using pybind to let python call an existing c module library the connection is through however in the c library getmodulefilename visual studio is called to to determine the physical path of the loaded module as it is run in c but when i call the library from python jupyter notebook through pybind the physical path of python exe is returned how can i configure or change to make sure the physical path of the c library is obtained the c code is like this lib h lib cpp the pybind interface code direct cpp the pybind setup file setup py to build python setup py build the python code calling this library py run app py after the run python py run app py in the logging txt the loaded module is c python exe what i want to see is the physical location of the module,0,70,139 python cv draw contours and fill black is ignoring perimeter iam trying to remove objects from the image using the following method however as can be seen from outcome image there is a residual fine colored line around each object although i have dilated my image the lines are still present is there a way to remove those lines original image outcome image,no output when executing the script python vscode i m developing a simple reactive programming script example to download images from a web but when i execute the script in vscode i do not get any type of output i already tried creating a virtualenv in the terminal i get this output ps c users ernes desktop paradigmas c users ernes appdata local programs python python python exe c users ernes desktop paradigmas jose py ps c users ernes desktop paradigmas,0,63,59 replacing all but one type of character in a string python the desired output of this code would have been l ll but it was l ll an l ll an lilli n lillia sorry about this i m not the best at code but i d appreciate a solution thanks,subtract one column by itself based on a condition set by another column i have the following data frame where time stamp is already sorted in the ascending order i want to create a new column in the above data frame that shows the time difference between each row s time stamp value and the first time stamp value above that row where indicator is not nan immediately above row where indicator is not nan below is how the output should look like time diff is a timedelta value but i ll just show subtraction by indices to better illustrate for example df time stamp df time stamp we can use a for loop that keeps track of the last nan entry but i m looking for a solution that does not use a for loop,0,43,133 python data transformation using pandas my dataset looks like this and going on with random index while the output i want is please note names and indexes are random with no relation between them how can i do it using python pandas,python urllib request urlopen is not working properly i don t know why this code does not work when i print the list videos and search results to see what is happening they are both empty this is why the if statement is never reached as you can see in the screenshot gui output,0,42,51 how to only show the final result after adding or multiplying all natural numbers it has been a week since i started to self study python and i tried making a program that adds or multiplies all natural numbers and the problem is i want to only show the final result of all the sum or product of all natural numbers how do i do it,how to import method from one package to another for the directory structure below below is the directory structure where i am having trouble importing modules let s say there s a method foo in b c b py which is to be imported into a a py however when i try importing foo as shown below i get an error saying an alternative way that i tried was using relative imports like this but again i get an error saying how exactly should i import foo from b c b py into a a py,0,65,87 python selenium proxy doesn t change ip address i m trying to change my ip address in order to bypass crawl social data using this code but it doesn t works my ip address remain the same any sugesstion thanks a ton,plotting dates seems to give the wrong labels i am trying to plot dates on the x axis as i have points i can t plot them all so i tried the following i have made a toy example so it is reproducible this gives as you can see the dates are all wrong ideally i would like as many dates as fit on the x axis and for them to be sloped so you can fit them in,0,39,77 user join server doesn t work discord py i m making a bot that welcomes people to my server and its not working at all the bot just does nothing when a user joined pls help i gave it the permission server members intent and this is my code for it i also enabled it on the dev portal,increasing a value each time a function passes through a for loop i am trying to make a for loop that returns response json i from an api with i increasing by each time through the loop example my goal is for get url to run times each time printing the response associated with the increasing i value sorry if this is worded poorly i am a total beginner and self taught thanks in advance,0,56,75 how to download all the href pdf inside a class with python beautiful soup i have around pages and each page contains buttons each button has pdf i want to download all the pdf s the program should browse to all the pages and download the pdfs one by one code only searching for pdf but my href does not have pdf page no to this is the website and below is the link,get score from aws neptune search i want to get the scores for each search result like you would be able to in elasticsearch how do you do this through neptune i m using this gremlin query but i m not sure how you would get the score out of it,0,77,49 bot object has no attribute wait for reaction error bot has no attribute called wait for reaction here s the code btw bot command bot,pybind conflict with getmodulefilename i am using pybind to let python call an existing c module library the connection is through however in the c library getmodulefilename visual studio is called to to determine the physical path of the loaded module as it is run in c but when i call the library from python jupyter notebook through pybind the physical path of python exe is returned how can i configure or change to make sure the physical path of the c library is obtained the c code is like this lib h lib cpp the pybind interface code direct cpp the pybind setup file setup py to build python setup py build the python code calling this library py run app py after the run python py run app py in the logging txt the loaded module is c python exe what i want to see is the physical location of the module,0,20,139 plotly parallel category linked brushing cross filter with dash in python i want to create a parallel category in plotly that have linked brushing as the documentation from plotly however inside it only show how to do it without plotly dash how to combine go pract and dash can someone help me with this,tuples to dictionary with two occurances my question is how to turn two tuples in a dictionary and have it so that if there are two strings that are the same in the first tuple it returns the first element from the second tuple e g however this outputs however i would like it to be apologies if this is too simple a question to be stuck on i know i have to add more to my code which is why its returning the wrong output i want i ve had a look at other resources however it doesnt answer my specific question i ve thought about putting an if statement and do x count k however i didnt know where to go from there,0,52,120 python cassandra driver connect to docker container on server cassandra unresolvablecontactpoints i am runnning cassandra in a docker container on a custom server i start cassandra docker like this when i want to conect to the server via the python cassandra driver from datastax like this the exception is thrown after hours of searching through docker network permissions i found the simple solution so maybe this will help you too,parametric pdf estimation histogram vs likelihood given a sample from a distribution and assuming it is gaussian normal distribution with unknown mu sigma the task is to find the parameters mean and standard deviation that describe it best what is the mathematical difference and why does it yield different results and if it is different why and when to use which method i think both are parametric and can be used in the same cases,0,71,75 output not right on descending selection sort i am working on an assignment and i am really struggling to figure out what i am doing wrong i am new to python and honestly i barely understand the code i have cobbled together so far what i have currently is with the input of i get what i need is,question about returning the right thing from recursive function leetcode i am doing leet code question subtree of another tree given the roots of two binary trees root and subroot return true if there is a subtree of root with the same structure and node values of subroot and false otherwise a subtree of a binary tree tree is a tree that consists of a node in tree and all of this node s descendants the tree tree could also be considered as a subtree of itself i had a working solution however when trying a slightly different approach i ran into a problem with my recursive dfs function the structure of my code is this basically issubtree explores all the nodes in the tree once it finds a node with the same value as subroot it compares the sub tree rooted at that node with the sub tree rooted at subroot with dfs i intended that when the dfs function returns true issubtree will also return true if i ve explored all the nodes in the tree issubtree reaches the end and dfs hasn t returned true at all issubtree will return false however my code always returns false seemingly because of the last line where it returns false i ve tested it and can verify that the return true part in if dfs was reached also i m pretty sure my dfs function is correct my question is is there an elegant way to have my code do what i want it to do,0,59,252 how do i write data from python line by line to csv file i m just learning python i want to improve myself with examples sorry for my english i m in the process of learning a new language the program pulls data from an e commerce site when i want to save it as a csv file each new data overwrites the previous data i tried several examples but it didn t work thanks for your help,sending python object throughth socket i have a problem that then sending a list throughth socket it have to be bytes like object and okay i can convert it string and then do encode utf but the problem here it that it is string and it is hard to rebuild it list from string and literal eval from ast library didn t work then i have something like that and that is problem i had to have those objects and my question is how to send python object without need to convert it into a string or like some kind of object notation like json this can be tested on basic socket server from python socket documentation literal eval that fails error,0,75,118 removing rows in df based on counting filtered data pandas i have a dataframe that contains id month of transaction i want to keep only the stores that have transactions in months i tried first to filter by unique as follows i got from the code the store id and the number of months the problem is not all stores ids appeared so i couldn t get them to drop sample of data enter image description here,http server simplehttpserver serve file html instead of dir using cmd is it possible to serve not a index of a directory but rather an html file using python simplehttpserver on path having directory with one file login html serves a directory index on path i want a content of login html on is that possible,0,79,55 when i am fetching the data of students by city in tkinter it s only show last value as i mention i want to print data of student who s belong from city but in label it only shows one data and terminal shows all the data i am using for loop to print data here is text file expected outcome if selected surat then,typeerror missing required positional argument s in airflow i currenlt have a piece of code which i m trying to get into airflow the code takes data from a table and preforms the functions in the def map manufacturer model and outputs it into bigquery table i know the code works on my pc but when i m moving it to airflow i get the error typeerror missing required positional argument s can anyone offer any guidance on this as i m pretty stuck now thanks,0,63,83 sci hub response error on python request i created request to sci hub se by requests on python server response error actually bot request successful after deployment but in hours more request got error i use this link could you help me how to solve it this is my code,can t parse selenium python flashscore i m sorry guys my brain is buffering in this problem since a lot of time i m trying to get all match summary deatails results and date i m parsing it filtering the score now what i want is to get the match if in the last match team last match team and h h btw them there is minimum goal if there is one result match i don t get anything for now i m stacked here how to put the if condition inside the for i tried everything but nothing worked for now thank yuou a lot guys i mean i want to get first matches with results of team team and h h btw them and if there is a in the score i won t get it this is example page of flashscore overall enter image description here enter image description here,0,52,155 django filter and count in template tag i m trying to filter and count a specific queryset in the template with django template engine cant get it to work the film list is the context and film is the table and language is a field any tips on how to use filter and count at the same time in the template engine or should i solve it in another way view,programatically added widget not shown a programatically added widget is not shown dear community as i need to add some plain text i will elaborate i try to add a widget to a floatlayout in kivy and i would expect it to show up on top of the existing label but it s not shown what i m doing wrong python file test kv file thx martin following the hint of furas i changed the kv to still no luck hi is not lurking hidden somwhere,0,69,84 what is the difference between numpy array with dimension of size and without that dimension i m might be a bit confused but i wonder what is the difference between say x and y same array but have extra dimension with size are they the same or there is difference between them,pyinstaller executable saves files to temp folder i am having a problem where i can t save files in the executable directory specifically it saves it to c users hp appdata local temp mei screenie png pyinstaller command pyinstaller onefile main py code import pyautogui import os dir os path dirname os path abspath file print taking screenshot pyautogui screenshot save dir screenie png print f saved to dir screenie png npress enter to open the file input os system dir screenie png,0,53,59 why i m getting this typeerror i am trying to create a getprefix command which changes the server prefix i m using an sql database to store prefixes i am getting the following error when i send any message in a server not only bot commands my code my database code the first time i ve tried this it worked perfectly with the same code i was able to update custom prefixes for servers in the database without any errors,is there a easy way to do a group by in python to aggregate a single column i have a dataframe with fields as follow i would like aggregate field i e i usually create a new dataframe by doing a groupby on the dataframe with the field i want and then merge back the grouped dataframe to the original one is there an easier way to do this,0,77,68 systemd service taking a long time to run i am having service running as background service in ec instance but it taking a long time to start a new one or restart a service refer to image i reboot ec and a service restart at but at the a service print the first log here is my service config file in etc systemd system please help,fast search of doubled numbers in array i m trying to search doubled occurrences of numbers in a list but for big arrays like items this taking quite a long time is there any method for speeding it up,0,68,39 how to split strings with double letters python i have been thinking about it for a while now and decided to ask for your help for instance i have a string abcdefggarfse or abcdeefgh my problem is that i would like to split these string at that point where the letters are doubled abcdefggarfse abcdefg and garfse abcdeefgh abcde and efgh thanks a lot,i keep getting unicodedecodeerror utf codec can t decode byte x in position invalid start byte i m trying to read monthly csv file but for some reason i keep getting this error this is my code below what do i do,0,68,41 sum two columns if other columns are equal i m trying to use pandas to add columns amount and amount only if account is in account input expected output my code,combine dataframes when the dataframes have different size i have df one is i want the result as follows the column of the new df is the same as the column of the df depending on the value of the df,0,30,45 how to convert duplicate column names python dataframe to json how to convert dataframe to json df required format,combine multiple data frames with while loop screenshot of results from updated code from suggestion dlist is a list of provider id that is in a dataframe i tried to use a while loop for dlist but it only returns the value of the last provider id in the array in this case it is i used the append function but it didn t do anything the additional rows from provider id are not showing how do i combine everything so it shows the values of both numbers from dlist to equal rows missing values result of the current code,0,19,103 converting modifying non standard string into datetime for python dataframe so i have a set of data for sales by month not in order but the string format for the data column comes out as month day year hour minute for example and it is a string object how am i able to convert this into datetime where i only take the month and day also how can i simply take only the month and convert it to an integer,make a value appear in an input text with flask i basically have this layout user input button output with the following flask code and here s the html code all i want is to take the text the user put in user input which i do successfully turn it all to uppercase and then feed back the uppercase version to the input text output set to readonly so it can t be edited everything is working fine except for displaying the uppercase text into the input text output,0,77,85 extract an element from the class with beautiful soup how would you extract the from data dat,pyqtgraph stacked bar graph i have this set of data i want to draw a stacked bar chart in pyqtgraph similar to this one drawn in matplolib i have checked pyqtgraph bargraphitem documentation but i didn t find any information regarding stacking bar,0,17,41 how to rename the same value in a column using pandas my dataframe is how can i display rows with the same data in the hospital column in this way via pandas,how to create a sorted dictionary in python by key alphabetically as of python dictionaries are ordered where iteration is based on insertion order i would like a dictionary in python where iteration is based on the alphabetical order of the keys i e the dictionary is sorted alphabetically by key that is the following dictionary will result in the following output is there some built in python class for sorted dictionaries similar to how we have ordereddict for insertion order note i do not believe that this is a duplicate of any existing questions which seem to only mention i have done many google searches and couldn t find an answer,0,33,110 remove n character in a list without breaking apart every letter i am trying to remove n from the end of each element in a list imported from a txt file here is the file i am importing here is the code i am running here is the output here is the desired output when variable newlist is printed,in telethon how can i verify if chataction was only from my group channel when i am not sure if my group channel is private or public for now i am assuming e chat takes a specific url of my group channel either it s public or private and works as a filter and if any event like a user joined or left in my group channel it will print in the console,0,59,67 how nested loops to append objects into a list works in a single line for loops i don t understand what does this block of code do example sudoku x y dimension for x in range dimension for y in range dimension dimension is a variable that user inputs sudoku is a class constructor could someone explain me or restructure this code to multi line version thanks,how to define pytorch fullyconnect model more simple and convenient i am a beginner of pytorch and i want to build a fully connect model using pytorch the model is very simple like but when i want to add some layers or adjust the hidden layers i found i have to write lots of redundant code like besides if i want to change some layer s feature nums i have to change the layer adjacent so i want to know a way which is more grace maybe more pythonic and more easy to adjust hyper parameter i tried to write code like but i found this way doesn t work the model can t be built so could any bro tell me how to define a fullyconnect model like above so i can adjust the model layers only by adjust the list named hidden num,0,69,141 pandas filter using combinations of boolean series i have boolean series of equal length i need to combine them with a logical and and so that i tried two solutions and i am not happy with neither the first one uses reduce and it is quite slow the second one constructs dataframes that is also slow how would you handle this situation many thanks for your help,mock context manager inside a class i have the below context manager inside a class method which i would like to mock for unit testing how could i achieve it edit as chepner suggested i can t accept his her answer since it was via comment the best way to go seems to be by using the unittest s mock open functionality this way i can simply go,0,69,64 unable to access context object in html page rendered in django the below view function send news object to html page but html page gives no result blank page below is the model html page,problem with exception handling using python requests module the following part of my code is supposed to do exception handling during http requests app py to simulate different exceptions i have come up with the following function which produces fake http response with a desired status code then inside the class the method request get is replaced with the fake http response and we can test how the exception handling for different status codes work test py given the status code i get properly the following http error in terminal as expected meaning my code works well my problem is the code does not exception handling for other cases e g too many redirects timeout etc for example if i make a fake http response with the status code i expect to get the exception handling message for too many redirects but this does not happen at all what is your suggestion,0,34,151 python result from console error string format i have a problem with my console program a total of four initial results are expected from me the interesting thing is that two of them work correctly the other two make the following mistake also since i m a beginner i want to ask how to create a variable that can read both text and number,how to copy every repository folder from one jfrog artifactory to another jfrog artifactory using python there is a package called dohq artifactory in python which copies file from one to another artifactory but not folders repositories i have tried to copy folder with same package but it didn t work please let me know how to accomplish this with python or suggest if there is any better way to accomplish this,0,62,68 splitting value from one row to other rows in the same column in pandas i have a question regarding to pandas i have got a dataframe df now i want to split the from the first row into equal amounts where the taskid and userid is the same this is what i would like to receive i couldn t find anything here on stackoverflow thank you,how to display only couple of values in a dictionary i have a dictionary with keys and value i only want to print the keys and first values in dictionary dictionary example output should be,0,71,38 plot confidence interval of a duration series i measured the duration of requests i got now an array of elements each element represents the duration of a connection request in milliseconds i want to plot the confidence interval in python and in a clearly arranged manner do you have any idea how i should plot them,how to add multiple dictionary to a json file in python how can i add multiple dictionary in a json file i want to add or dictionaries once and after a while to add or or dictionaries in same json file exemple i want to add it to a test json file and after a while i want to add the dictionary and after a while i want to add this for example edit this is first output than i append dict to list and this is the output it create a second list and put dict in it how can i change the code to put dict in my first list,0,59,121 how can i random choice a question without the answer for a discord robot quiz game i just started learning how to code in python and i was wondering how can i randomly ask questions for a quiz without the answer that follows for example i d want the robot to ask what s the capital of france but without it saying paris questions what s the capital of france paris who painted the mona lisa da vinci ty,delete element from a list if it occurs in another list i posted my problem a little ago and i though i got the answer but still everything i saw didn t help so i have two lists and i want that if an element from list is present in element of list delete the element from list but till now i didn t find how to achieve this so for example i have those two lists so i want to check if list elements contains list elements if so delete it so here for example i would like this output for a result lst i tried to do like this but it won t work as the index will move after deleting element if someone could help thanks,0,79,132 trying to get selenium to scrape table and click button i hacked together the code below to try to scrape data from an html table to a data frame and then click a button to move to the next page but it s giving me an error tat says invalid selector i see the table but i can t reference it any idea what s wrong here,apparently empty groups generated with itertools groupby i have some troubles with groupby from itertools output is it works as expected itertools grouper objects seems to be readable only once maybe iterators but list li it seems empty i don t understand why this one works join grp for k grp in groupby aahfffddssssnnb aa h fff dd ssss nn b i am using version question already asked to newsgroup comp lang python without any answsers,0,64,74 selenium attributeerror type object by has no attribute name while fetching input not sure why this error is showing up i ve asked various questions relating to this issue already webdriver for some reason just cannot find the type field i m looking for giving me attribute not found errors as well as nosuchelementexception errors error message line of code html,how to pass more arguments to scheduler i am studying the example in this link but i am not sure how the scheduler function is receiving both the epoch and learning rate lr how are they being passed and how can i pass more arguments i tried following this example and i received an error that says scheduler received an extra argument lr so i am not sure how to fix that,0,59,72 solidity typeerror object of type set is not json serializable i ran the code in vscode and got a typeerror object of type set is not json serializable i just start to learn to code really don t get it and googled it also didn t know what does json serializable means the full error information is below,python selenium check all checkboxes on page i m trying to tick all checkboxes on a page there are about of them and this code seems to work but only ticks what is visible on the screen it doesn t scroll down the table and tick the remaining boxes i m thinking it s only finding those on the screen as the rest are still loading i need to wait until all checkboxes have loaded but i m not sure about how to go about this any help is appreciated below is the table row,0,56,91 scraping the shoe sizes with bs i am trying to scrape the shoes sizes of this shoe how can i scrape the value,how to refresh scrapy request i am coding my first python project with scrapy i want to make a script that monitors a website and alerts me when a button on the webpage has changed for example a disabled button becoming enabled if i use a loop in the parse function the code will loop over the initial response giving me the same outcome every time how do i get scrapy to generate a new request with every loop inside the scrapy shell i can use fetch to do so is there a similar command i can use in the crawler,0,23,101 how to remove specific strings from a list in pyspark dataframe column i have the below python list lst name age country spark dataframe is below i have to compare the list with spark dataframe string column and remove the values from list from the column expected output is,what is the best way to work with whitelisted ip s on a mysql db when using docker i have a server which contains a python file that connects to two external mysql db s one of those db s can be easily reached while the other server requires that ip s be whitelisted in order to have access to that db that server s ip is already whitelisted and works as intended when ran the problem arises however when i attempt to run the docker ized variation of the application the first db runs just as it does before but the second db no longer works when inside the container i can ping the second db and it works but whenever i try to access it via the code hosted on the server it doesn t return data within any of the functions that utilize it i noticed that the container has a separate ip and may be causing issues since that docker container s ip would not have been whitelisted and may be where the problem begins i am fairly new to docker so any documentation links that would assist me would be extremely helpful,0,46,189 first and last methods used excluded items i used last to get last item of queryset after exclude some items as below but in output print item that not exists in output i test some other codes as below my holiday model and other model is i test that by first and problem was there too what is problem my code is wrong or bug from django orm using django and postgresql,how to create byte orc file can i create byte orc file i d like to test is there any way to create orc file with spark python hive or in command line i appreciate your help in advance,0,73,38 how to group by the mean of specific columns in python in the dataframe below i want to do the following find the average of each unique series per aic trx for each grwth time grwth time grwth time grwth time export all the outputs as one xlsx file refer to the figure below the desired outputs look like the figure below note the numbers in this output are not the actual average values they were randomly generated my attempt thanks in advance,python requests response forbidden so i am trying to scrape this website i was able to scrape data from it without any problems but today it gives me response i tried using proxies passing more information to headers but unfortunately nothing seems to work i could not find any solution on the internet i tried different methods the code that worked before without any problems,0,77,68 how to check if the user interact with any widgets and execute a function in tkinter i m not a beginner but i don t know how to check if the user interacts with any widgets and execute a function in tkinter what i expected is like edit i got the answer,raising typeerror when type is not correct i d like to call function foo a b c where arguments can be int or float those arguments user inputs using space as a separator for example in the same time user can input not only digits bit make some typo like k in this case i should raise typeerror and type the number of incorrect element in my code i have the next error i can t write k into int variable how can i raise the typeerror when user input k and how to be in situation if user inputs k h i that case i need to raise the typeerror with message the type of element is incorrect,0,51,124 optimizing looping in python in list operation i am using the following code for the iteration but if the length is high then this will become time consuming is there any other optimal way to get this done thanks in advance,reverse for account not found account is not a valid view function or pattern name enter image description here enter image description here enter image description here hello can you help me django gives me this error reverse for account not found account is not a valid view function or pattern name inside the photo is a complete explanation,0,40,59 change variable itself with function i want try to change variable itself with using function like some list reverse i want a print result how do i do sorry i uploaded wrong picture,error with pyxspec cannot read response file i m trying to load my first spectrum file with xspec command within python aka pyxspec but pyxspec tell me that it cannot read the response file file rmf my basic code is the follow it is wired because if i load the same file in the standard interactive xspec mode it works wihtout errors something like this,0,31,63 communication between electron frontend and python backend after developing a python cli app i realized that it s time for it to have an electron frontend how can the electron app communicate with the python app in response to a user action on the ui update is it typical for the python cli app to be converted into a long running server using like asyncio and is kafka for ipc an overkill,calling one python script inside another with command line arguments i have two independent python scripts that work independently by supplying relevant arguments now i need to call python py in python py and pass the relevant parameters that are accepted by python py is this the right approach note both scripts should keep working independently as they are now,0,70,56 how cap get cv cap prop pos msec works i have a video with this information my question is why when i use the return it shouldnt be something close to mls,find os generated port before using socket connect in python i would like to ask if there any way to to create a socket in python using and then extract the port which going to be generated by the os before using i e my goal is to find the source port of the first syn packet which will be sent to the server as part of the way handshake before actually executing the way handshake note i figured out that finding out the generated port is possible using but unfortunately the value of generated port is set just after using sock connect any help will be much appreciated,0,29,105 get cookies from website using python safari i try to get cookies from a website reading a bit on this topic on other stackoverflow posts i came up with this code because other code pieces did not work either unfortunately it returns an empty dictionary i already tried it with browser cookie but it either did not work or it is not supporting safari am i missing something important,how to find the reverse of power mod a b c when using power mod a b c we get a b c returning x i have a c and x but am having a difficult time reversing the c is there a function that already exists to reverse this or would i need to implement euclidean algorithm to find what b is and return that,0,68,57 takes positional argument but were given error for dict how to add two dict in cs list i want to add two dictionaries to the cs list in the addcoursess function but it gives an error text error takes positional argument but were given mainlist here is the class in which it is error addcoursess function here,partially initialized module json has no attribute loads not naming problem i m getting attributeerror partially initialized module json has no attribute loads most likely due to a circular import i searched a lot on google an nothing worked i don t have any module called json or something like that so that s not the problem my system is macos and i try to run qgis modules with pycharm this is the full error any ideas i think it psycopg thing but couldn t find a solution,0,61,86 d plot surface with custom data sample data like this and custom plot like this and wireframe like this when i try this to get surface color error like this valueerror rgba sequence should have length or i can t figure out why this is fail i need this custom plot to replace meshgrid truly need this plot as my output can anyone solve this problem ty,i m doing a hash verification project and after i store the hash and want to verify it it returns false after i check it against the new hash i create a hash and store it in a txt file will encrypt it later but when i create a new hash and check against the stored one it returns false even though the hashes are the exact same help relevant code here s the code to store the hash and here s the code to get the stored hash note it returns no errors but does not return true either complete code can be found here password hashverify,0,71,108 how to send a message in an async def on raw reaction add discord py i want to send a message in the discord channel but i am not able to in an async def on raw reaction add does anyone know how to,ffmpeg combining audio and video error could not find codec parameters i have downloaded two files using pytube from youtube one is audio file webm extension while the is adaptive stream k video with mp extension i have to combine audio with videos more than p resolution generally for this i use following ffmpeg code this worked for many mp videos i have downloaded why it gives error could not find codec parameters for k i dont know much about ffmpeg if i am doing something wrong please fix this code for the k video the stream output for k video is the stream output for webm audio is the following are the codec i was able to join successfully with same audio the other video i was able to merge has the following stream the question is why ffmpeg giving error and how can this be fixed the code to download video and audio is note i am using python to run ffmpeg,0,37,164 is there any vectorized way of check string of column is substring in pandas i have a series of pandas and i want filter it by checking if strings in columns are substring of another string for example and then i want to get series which is series of substring hello world as below maybe there are some ways like apply or something but it doesn t look like vectorized things how can i make it,plotly express order label with a pie chart let s take this sample dataframe i would like to use plotly express to visualize this dataframe through a pie chart i ve built the following function and when i use it i got the following pie chart days are not ordered as in the dataframe i saw that there is a parameter called category order with bar charts to deal with this issue but not available with pie charts how please could i logically order the days in the label,0,74,90 remove a set of words from a list of text i am trying to remove a list of words from a list of text but output seems like its not getting removed please help me in the removing the text from the list expected output,split the prices from string and place it in another column in pandas i have below dataframe what i m trying to do is to split charge amounts separately to different column tried to use regex and df prices df charges str split expand true with no success any suggestions,0,45,45 calculating standard error does not give expected result i want calculate standard error of vector and i don t understand why it doesn t work let s consider vector calculating standard error of mean is just to calculate standard deviation and divide it by square root of length of vector however when i calculate this by function i obtain completely something different could you please explain to me why i don t unsterstand why this difference occurs,azure python function underscore are not working in routes hello i am creating an azure python function with an post get route in the unc path like i create therefore the following code function json in the previous version i used indicator alpa based on but with the alfa datatype the underscores are not working after searching on the internet i found the stackoverflow post underscore in url not working with attribute routing it was based on c but the code was still working but still result in a page not found init py my question is what do i need to change so the so underscores can support in the route of the endpoints manny thanks erik,0,73,117 why do we need to move if statement i don t understand why moving under end text works but it doesn t work in the position shown below the full code,vscode doesn t recognize py solc x doesnt library i m trying to compile a sol with py solc x i downloaded the library with pip install py solc x but still vscode doesn t recognize it please help me fix this the massage after pip install the code,0,28,40 split these strings while inside a list so i have this list and i need help finding a good way to split the list items at every n split wont work because i m assuming that it doesn t register the n as part of the string,custom resource cloudformation to tag event rules i am trying to create custom resource in cloudformation to tag event rule this is the lambda this is the cfn block while creating cloudformation it gave error create failed invalid physicalresourceid but somehow managed to create tags need help to understand why it gave the cloudformation error if it created the tags,0,45,60 count the values per key in tuples i have an input data like this i would like to identify the counts for each key i have tried multiple ways as below but it did not work the desired output should be,convert matlab system identification to python i have a piece of code in matlab that i want to convert to python the matlab code is using the system identification toolbox which is provided here to provide more explanation about the code i have data where i encapsulate it as iddata and split it to train and validation data these splits will be used in order to estimate the best order to identify a linear arx model once identified i want to detect nonlinearity in the system with these orders then i want to construct the arx model find the initial states and convert it to a steady state model finally i want to detect any abnormal behavior to identify if the system was unstable i started the conversion to python and found a package called sippy for linear arx mdeoling here is the code i wrote in python this code will read the data no need for iddata encapsulation and output the best arx model for a given range of orders this means it will perform as arxstruc z z struc nn selstruc v aic and sys arx z nn however when testing both on the same data to compare the output i found that the best orders given by matlab were while python returns when i investigated the reason i found that the loss value is different from matlab than python and since the output would be the order that achieves the minimum loss it is logical to have different orders so can anyone help me with that problem what is the loss function used in matlab and is there a package that simulates the system identification in matlab and provide the same results in python,0,41,286 add list as keys for another list and convert to dictionary i have a list of columns and records that i get by using data api rds execute statement using boto as the way the api responds it difficult to get the data out in a psycopg realdictcursor format to insert into another database what i want to do is illustrated below i want to convert this to a dictionary that represents it like,how to join two dictionaries using simple code i would like to join two dictionaries using python given i would like to join using the elements in the list of the value of dict keys with dict values and generate this i would also like to join using the elements in the list of the value of dict keys with dict value and generate this the code i wrote is simple however i think this implementation is not very python so i changed it using comprehension the problem of this implementation is that it needs to iterate through the dict keys twice but this is the farest i can get can someone let me know if there are simpler and cleaner way to achieve this using just one iteration on dict keys,0,72,126 best way to get first single value of list what is the fastest and best way to get first value from list there are multiple techniques but what is the best memory and speed and why examples below i would be grateful for other techniques as well,matplotlib tight layout with annotation causes figure to get smaller and smaller i have a figurecanvasqtagg that creates plots with the user selecting what data to plot and the canvas updates the plots by calling self fig clear and creating the new plot this has worked fine but i ran into a problem i have designed a certain plot with an annotation under the axes but every time the figure is updated the plot gets smaller and smaller this code replicates the problem in this example fiddling with the xycoords argument sometimes solves it for example using xycoords axes points or data seems to work but this does not solve the issue in my actual application disabling tight layout also seems to solve it but i need tight layout for various reasons the fact that the axes get smaller and smaller each time suggests that self fig clear does not actually clear everything something is being remembered between iterations of the plot is there a way i can completely purge the fig object and start a new one or would it be best to close the actual canvas and create a new one each time,0,47,190 while true loop doesn t break after calling return i m trying to write a function that would take an integer divide it into digits sum them up and if the sum is loop through the process until i get a single digit sum could anyone tell me why my while true loop isn t breaking i m not really looking for an optimal solution i just want to know why this doesn t work,counting consecutive words within a string i am given string and supposed to count three consecutive words so hello hello hello is true hello hello hello is false and hello hello hello hello is true i cannot find way to reset my counter when number showing up in second example i return true because of this i using is alpha by the way and am using python can anyone help with counting the words the right way,0,70,79 kivy numeric keyboard on text of the text field i am trying to add numeric keyboard in ui which will be display as clicked on the text on filed but some how numeric keyboard not show in the ui i use numeric json file to open the numeric keyboard as per the kivy documentation json file and link is here is my code below,how can i copy ml model s training results to specific folders i have created a machine learning model that classify cats and dogs from a dogs vs cats database it s a huge database i apply this code and it gives me output as a photo and a text like this there isn t any problem till this point as an another different example it can show like this so my problem is i would like to copy these photos to the files if it is bigger than percent for example if it says like this i want to copy this to cat folder this folder doesn t exist before if it say like this i want to copy this to dog folder this folder doesn t exists before as well i am really stuck at this point any ideas thanks for all of your comments,0,64,143 send private direct message with bot i m going to send someone a message from a bot the following code snippet is what i wrote to do that when i type sendpm it will ask for an id and then for a message to send when i do this i get this error attributeerror bot object has no attribute get user info,displaying list values in a dictionary i want to create a dictionary where the key is the athletes first and last name stored as a tuple and the value is a list containing the athletes country and finishing time in hours minutes and seconds in a tuple as shown below i managed to display the name and surname since it is in a tuple by creating a simple for loop but i have no idea how can i display the list part is there a similar way to print list of items in a dictionary,0,59,95 selectively sum elements of list in python editediteditediteditediteditedit,how can i make code run as the gui remains open i m writing a code to process images and i am trying to make a gui with pysimplegui i want my code to run in the background while the gui still remains open but the code wouldn t continue unless i close the gui then the code carries on i tried to put the processing code before adding the break function but i m giving an error code that break is outside the loop is there anyway i can do this any help would be appreciated,0,8,95 how to grab all the name keys once i wanted to grab all the name keys at one time but all the first dict key aren t the same meaning e g etc how to grab name from all of the above keys once,how to implement a modified cross entropy loss function i am currently working on a change detection project for my university course and i was stuck at writing a custom loss function i know i have to use function closure to be able to use data from layers of the model but i don t know enough tensorflow keras knowledge to write effecient code the loss function equation this is the modified cross entropy loss equation that i m trying to turn into code the loss needs the matrix w which i have to calculate using the inputs to the model that is x and x so at the moment i have this it would be great help if you could guide me on how to develop a loss function that makes use of data from other layers and also call multiple functions in its computation,0,43,141 creating cartesian product of sub dictionary key val pairs i have this dictionary i want a dictionary with the cartesian product of the key val pairs inside i need to create the below dictionary out of it,pandas return dataframe rows that are not numbers between and i have a dataframe in value column i have strings that may contain a number as string n a or any other string i need a code that will return me any values that are not in this range x like this i tried something like this but it works only when there are only numbers and string numbers it fails when converting nodata to float i thought that i could first filter out all rows with strings that are non convertible to float then perform the above operation then concat it like this but is this pythonic is there such a function edit for wilian thats my data before and after output line and are missing at the same time from line or n a from are catched the problem is clearly with in excel is and is just but the point is that i can t trust that data and there might more more sources in the future so it must all happen here,0,36,188 latency in spark streaming job databricks which sources from an azure iot hub i have been using a spark streaming job using python on databricks to load sources from an azure iothub however i noticed when we have a large number of received frames the job comes long so we have latency knowing that when we look at the metrics the cpu and memory are not used at of their capacity,from mega py import mega modulenotfounderror no module named mega i have a problem for my project i need to move files from the directory to the mega cloud but when trying to run the code it gives an error also when trying to pip install mega py it turns out the following the limit of k characters does not allow you to write further i searched the whole internet please help,0,72,70 what is the usual approach for things like this python multithreading i have the following code do task is basically a method which process some i o operations and i want to to execute it in parallel for each obj in self objs list i want self do final task to be executed only once all the threads finished their job my code works however it is very ugly and immature it seems is there a more elegant way of doing so,detailview in django keyword slug i recently started learning django i want to display one news item but when i open on the link i get an error message views py urls py models py what am i doing wrong,0,75,37 random number function python that include but not include i need to generate a number from to that include but not include the random uniform function include but not include how is it possible to do that,numpy array operations returning nan values despite no nan values in input i am running a linear regression using gradience descent analysis gda using imported data from a csv file data axis and data are exported dates and stock market prices respectively the code below returns nan nan nan nan nan nan as the theta value the square error also returns nan error messages overflow encountered in multiply invalid value encountered in add the code does successfully return and plot a linear regression for randomly generated inputs xdata np random rand ydata np array x x x x x x x x for x in x i checked that there are no nan values in the csv file i searched for the error message and read that some python numpy operations involving extremely small or extremely large numbers may output a nan value as the result could this be my issue or is there something else which may be fixed,0,44,152 how to send a message in an async def on raw reaction add discord py i want to send a message in the discord channel but i am not able to in an async def on raw reaction add does anyone know how to,have text appear under picture in smaller mobile view i have a site that works great on the desktop mode but when i shrink the page the font stays over the picture and makes it so i cant see the picture and words how would i adjust the html or css or both to make it so that the font goes below the picture when the site is viewed on a smaller device here s my html and css code here s the css,0,37,82 concat created nan values even after index reset i want to create a csv file that combines the train and test data and labels to use it for a project the problem is that in concat function even after using the index reset the labels continue being nan and i don t understand what is wrong the datasets are in this link,why loop through series in list comprehension gives different result from looping through list can anyone help me understand why list comprehension generates different results when i just changed series to list but if i change to loop through list inside list comprehension i get the result i want why series generates wrong answer thanks in advance,0,62,57 how to only show the final result after adding or multiplying all natural numbers it has been a week since i started to self study python and i tried making a program that adds or multiplies all natural numbers and the problem is i want to only show the final result of all the sum or product of all natural numbers how do i do it,calculating the difference between dates with certain parameters from data frame i am interested in calculating the time difference in days of time between orders from the same provider source data frame the ordernumber and catid are not interesting i want to calc the difference between date in same customerid target dateframe the ordernumber and catid not interesting original data,0,65,60 why settingwithcopywarning is raised using loc i have checked similar questions on so with the settingwithcopywarning error raised using loc but i still don t understand why i have the error in the following example it appears line i succeed to make it disappear with copy but i would like to understand why loc didn t work specifically here does making a conditional slice creates a view even if it s loc edit pandas version is,for loop evaluation order i was looking into the all and any functions to see their guarantees about order for example the documentation states that the any function is equivalent to however when running the following code i would expect the second expression to not be evaluated and thus would return true instead the second line throws typeerror int object is not subscriptable i initially believed that this was some inconsistency in the documentation but indeed when running with the for loop version the result is the same my question is how does it throw the exception if it should not evaluate the second expression by returning true early i thought that python only checked those errors when running the expressions changing to also evaluates the print in both versions can anyone shine some light on this thanks in advance note using python and interaction was performed in the python shell,0,77,152 launch multiple times the same instance amazon sagemaker studio on amazon sagemaker studio i would like to be able to launch multiple time the same instance so far i can start only one ml t medium instance for example i would like to launch two separate instance of ml t medium in the same jupyterlab is it possible thanks,how to prevent rows combining in pd read csv google sheets i m seeing an odd behaviour where the first rows in my google sheet are combining to one row in my dataframe this is the output from df columns values even though the business name is in the first row as a header its combining with the cells below it i also didn t have this behavior a few days ago anyone know why,0,55,70 replace color in numpy image with another color i have two colors a and b i want to swap a and b with eachother in the image so far what i have written is however nothing is changed in the images saved to disk what am i doing wrong,question regarding negative indices in tuples and lists in python in this program why is the output and not this is the case with lists also i noticed print t doesn t give the output as but instead gives what is going on here why can t we go backwards please help me i ve just started python i have no background in programming,0,49,64 make sphinx build latex pdf in nonstopmode i am using sphinx to build my latex document but everytime i run the make latexpdf command latex stops the build and asks for user input latex is not running with nonstopmode in the past i was able to put the nonstopmode in a makefile and use use make with latexmk to compile everything did some digging on sphinx and can t really find what i am looking for,how to create bytes list in python i am facing a challenge to create a bytes list in python i just want to convert the int list into bytes list as mentioned in expected result the problem statement is that i want to send the expected output to the serial device connected to the com port and with current output the serial device is not encouraging the as a separator please suggest me the correct way to handle the in a list of bytes current output b x xc x x x x x x x x x a x x x expected output b x xc x x x x x x x x x a x x x thank you,0,75,97 proper c type for nested list of arbitrary and variable depth i m trying to port some code from python to c the python code has a function foo that can take nested lists of ints with variable list depth for example these are legitimate function calls to foo what should the method signature s be for a c method that can accept this kind of argument,list resets after for loop a list is defined at the beginning of a function then appended to in a for loop and printed at the end of the function which returns an empty list the code the commented out print statement under the append returns the following which is what is expected the print and return statements at the end of the for loop both return an empty list how can i fix this,0,65,75 xarray assigning individual values to one variable dataarray ends up assigning to all variables dataarray i have a script where i create a big xarray dataset full of np nan and then assign individual values in a loop with loc i also tried with positional indexing doc i get something quite weird here is my minimal reproducible example i get my scalar assigned to all dataarrays although this simpler code works correctly,how can i scrape json value from key i am trying to scrape odds from betting site i am pretty new to python and i need some help some kind of odd id is stored in key b so basically for every match in this json file if match contains key b with value i want to scrape value of key g and store it in my list gg in key g value is odd that i want to scrape but if match doesn t contains key b with value for that match i want to append only one time to list gg with this command i can scrape odds but i don t how to append to gg if match doesn t have b oddid,0,72,126 how to check file arrived in javascript and httpresponse object in django my code is working fine but i can t figure out how to catch a file arrives message in javascript i m working with django template views,python list copy point to same address i was trying to create a list matrix in python in a easy way but turns out it was wrong method instead of copy the list rows it actually just copy the list address can anyone shed some light to explain this in depth what i trying to achieve is method but i don t understand why method don t work thanks,0,38,69 how to store after groupby how am i able to use the column after using groupby let s say would give i would like to store the top most income s industry name to some variable and use it for other queries so here it would be telecommunications but doing x would give also pls recommend a better wording for this question don t know the right terminologies,effeciently remove single letter substrings from a string so i ve been trying to attack this problem for a while but have no idea how to do it efficiently i m given a substring of n n characters and the substring contains solely of the characters a and b i have to efficiently find a way to count all the substrings possible which have only one a or only one b with the same order given for example ababa for three letters the substrings would be aba bab aba for this all three count because all three of them contain only one b or only one a for four letters the substrings would be abab baba none of these count because they both don t have only one a or b for five letters ababa this doesn t count because it doesn t have only one a or b if the string was bigger then all substring combinations would be checked i need to implement this is o n or even o nlogn time but the best i ve been able to do was o n time where i loop from to the string s length for the length of the substrings use a nested for loop to check each substring then use indexof and lastindexof and seeing for each substring if they match and don t equal meaning that there is only of the character for both a and b any ideas how to implement o n or o nlogn time thanks,0,66,245 pandas groupby with multiple conditions i m trying to create a summary of call logs there are cases what i tried is looping on the groups but it is terribly slow when dealing with huge amount of data i think i need to use pandas methods instead of looping how to use pandas methods to achieve the same with multiple conditions thanks it should produce an output,tkinter button does not appear sorry guys i know that a thread already exists the button it does not appear any tips guys the screenshot func works fine but not the button i have to close it on my own error,0,67,41 losing microseconds when inserting date to database i have this code snippet in a view time from datetime strptime req post time from y m d h m s f it prints this sql statement microseconds are missing they are zeros but i need them in a database how can i correct this,function to filter dataframe with multiple if and conditions look at a dataframe and a variable and return a set of clients which are in both the infolist and dataframe and any client in infolist with membership fee larger than offer price any client in infolist who feedback is or higher example dataframe infolist expected outcome code tried so far not sure why this isn t working after tons of research,0,43,71 sqlite return true if duplicate values are found in table i want to know how you can find duplicate values in a table and make it return true i have seen alot of questions about this but none of them helped thanks here s my example to those wondering no this will not be used in a production environment it is unsafe and can be easily exploited haven t even salted the hashes,what does the f value do i was solving roman to integer problem and i came across it this is the code the second line doesn t make much sense to me can anyone please help,0,73,34 random number function python that include but not include i need to generate a number from to that include but not include the random uniform function include but not include how is it possible to do that,how to search for a value in two different type of field or index or heading of mongodb using python i am new to any kind of programming this is an issue i encountered when using mongodb below is the collection structure of the document i imported from two different csv files the first two entries are from a csv and the next two entries from another csv file now i am creating a user interface where users can search for a telephone number how to write the query to search the telephone number value in both the index telephone number and telephone number using find in the above case if not possible is there a way to change the index s to a desired format while importing csv to db or is there a way where i create two different collection and then import csv to each collections and then perform a collective search of both the collections or can we create a compound index and then search the compound index instead i am using pymongo for all the operations thankyou,0,44,181 in telethon how can i verify if chataction was only from my group channel when i am not sure if my group channel is private or public for now i am assuming e chat takes a specific url of my group channel either it s public or private and works as a filter and if any event like a user joined or left in my group channel it will print in the console,create tables similar to existing using python s sqlalchemy and singlestore sql i have a set of existing tables in a singlestore database many of which are columnstore tables i want to build a python script that will migrate my development tables to production tables the dev tables are already built analyzed and compared with existing tables but instead of hardcoding sql scripts to replace existing prod tables with dev i want a robust python way of performing this operation below is the code i have thus far this is where i get stuck how can i create the new prod table with the same structure and datatypes as the dev table while retaining the columnstore feature some of these datasets will be a millions of records and i have business constraints against the default rowstore for tables that large,0,67,139 how to save all element index after removing element in python i did many attempt but stil having problem i know this is because python automatically updating the elements index but dont know how to control it any suggestion will help me,how to find a substring of text with a known starting point but unknown ending point in python i have a long string of text i want to condense that string at a certain point using a key word to indicate the start of my new string in python for example my string is hello my name john i am twenty five years old i live in new york city i work on wall street i want the text from new york to the end of the text i e i need code to pull the substring new york city i work on wall street any help would be much appreciated,0,42,109 new to python and i m trying to add an item to individual lists in a nested list i m trying to create a code that will add milk to each list in a shopping cart nested list but if there is already milk in that list milk should not be added to it,kivy change color of widget at runtime i have the following widget and i add a couple of them to a list which i then draw on the canvas now i want to change the color of a specific key but when i do something like self keys i col nothing changes any ideas on how to fix this full code edit made the code a bit clearer and fixed a bug,0,52,71 pause and resume for tkinter pomodoro clock i ve been working on a python tkinter pomodoro clock about everything else works perfectly except for the resume button this is my code the pause function has some issues i can get it the stopwatch to pause but when resumes the stopwatch starts increasing and decreasing randomly help would be greatly appreciated,how to accept urls without a protocol the following is a subclass of pydantic s basemodel when i send a request with a body like this the second url is invalid how to accept urls without a protocol,0,59,37 attributeerror list object has no attribute numpy i was trying to convert a list to array with this code but an unexpected error occurs attributeerror list object has no attribute numpy if anyone could help me it would be greatful,how to modify unicode code as it is a string i have a list of partial unicode codes for cuneiform characters for example i have which python couldn t render to which is what i wanted then i realized that adding u in front of these partial codes creates results that i want the problem is i can t modify unicode u format doesn t work clearly adding string to unicode is not possible i don t want to hand merge characters can anyone help me with this,0,40,86 question from pandas of resample from quantile function about question from pandas combine quantile function it only show one result from this method could python have a quick coding to show the result together of quantile at same time thanks give me a help,get variable annotations from python class variables now i would like to check if the annotation contains some string ex exposed how can i achieve this,0,46,26 python selenium i can t acess to a linked page on a page with iframe i want to go from this page to this to this page by clicking on regional feminin u i have tried many solutions but the best i had is not working systematically please coul you help me,handing error index is out of bounds for axis with size within a function gives what i am trying to do is searching within the df with certain criteria to find the country but i got this error returned from the function if values are not in the df if non existing name or grade passed to the function this will throw i tried to return none if the con is not true but i did not work how can i avoid this error if non existing values passed to the getcon function,0,53,96 plotly python plot histogram over other subplot the data is time series and i imagine several subplots with some overlaying the others in attempt to consolidate my favorite technical indicators in regards to the histogram i would like to achieve something like this how can i achieve this properly have tried,solving system of linear equation using cramer s method in python i am trying to solve the following system of linear equations by using cramer s method implementing a function by scratch by using the above function on the system i get the following result i have solved the system using the numpy function np linalg solve and i get another result i cannot spot the formula error in the function i have witten what should i adjust in the fuction in order to make it working properly,0,50,84 can i integrate a for loop into a if statement that checks if a number exists in an array im writing a simple code that performs a linear search on the array numbers to see if a number entered by a user exists in it but i keep getting syntax errors have i written the if statement correctly or have i made a mistake,indentationerror unindent does not match any outer indentation level in python code,0,64,12 pandas how can i replace rows in a dataframe i am new in python and try to replace rows i have a dataframe such as i have two question how can i replace nd row with th such as how can i put th row above rd row such as,my python innterpreter works weird the full code is here,0,51,14 replace cell in dataframe if it contains a string i need to replace every cell in a python dataframe if it contains the string p to make it look like i tried it with which didnt work can someone tell me why it didnt,psql sqlalchemy paginate jsonb array i have a model which includes jsonb column result structure is following i have the following query this query returns all rows inside result and i need to include pagination here how can i do this,0,44,41 flask join children in my problem let s say there is person which can have many addresses and each address can have one location is it possible to get a query where persons contain addresses which are joined with their location so when i loop persons i can access data from both addresses and location as one,unable to read wav file in python i am using speech recognition to read a wav file using the following code however i get the following error file does not start with riff id i tried the following solutions and use the below code but i end up with new errors solution code error error opening c users biswankar das downloads sample wav wav file contains data in an unknown format solution code error file format b xff xe x xc not understood only riff and rifx supported i tried analyzing this file online the format is mpeg following are the details analysis details i tried using ffmpeg as well using the below code but i get an error while trying the same error the system cannot find the file specified altho i can read the same file location,0,56,134 installing pip in raspberry pi sorry i am newbie when i try to install pip using following command i get following error please help me out,pandas fillna for all columns except two i wonder how can we fill the nans from all columns of a dataframe except some for example i have a dataframe with columns i want to fill the nan for all except two columns in my case nan are replaced by the mean i tried this but i don t think it s the best way to achieve this also i want to avoid the inplace true arg thank s,0,26,76 stripe subscription free trial with no card i am trying to implement stripe subscription with stripe checkout all plans of my application have days free trial i can implement free trial by setting trial end in create checkout session api but it required card information by default i need to implement free trial with no card customer will attach card information after trial period end how can i do this,using entry get in a list count in python i try to use the id entry from the gui to count the similar ids in the excel column i always get a in the if loop and red color shows but there are similar ids in the column can anyone give an advice on how to fix it,0,70,57 extracting pmid nct id and publication type from pubmed xml in python from xml file like this i try to extract pmid nct id and publication type four sample files are here one has nct id ideally i want to have a pd dataframe expected output but if somebody can tell at least how to extract for file i would greatly appreciate it too i will figure it out how to put it into a dataframe,condition if element exist still continues even if the element is not existing in selenium python i have this code that if the element exists it will print the innerhtml value when i proceed and run the program i get an error of i was hoping that if the element span class a e d b bd c does not exist it should just skip all together why is it still trying to continue to do the code even under an if block am i missing anything here,0,74,82 this connection is using tls version which is now using mysql connector,i am making a physics simulator with pygame python i have a menu issue my physicssim program is the main menu from which i import all the other modules after the specific buttons on the menu have been clicked my issue is that when i click the button and launch the program and then close it via the close window button i cannot reopen the program all my modules have booleans for the while running loops here is my code for physicssim main menu pendulum module code,0,10,86 fill lines on a dataset i m working with a dataset that is like this i want to fill the lines and of the column offers with the values of the price column of these lines how can i make it,pandas group by sort and plot i have a grouped data frame how to plot this data frame using bar plot that on x axis will be day of week and on y axis values how to sort this data frame by day of week from monday to sunday,0,43,50 i have a small problem with engine runandwait i have a program that s detects and recognizes faces but thats not the point while im trying to include voice follower it is actually does saying and then after a few seconds the whole program is just crashes could you please help me thank you in advance,edit columns based on duplicate values found in pandas i have below dataframe if data in no is duplicate i want to keep only one fee and remove others should look like below i actually have no idea where to start so please guide here thanks,0,54,46 avoid type casting when selecting a row i ve got a dataframe with enforced data types which are quite important to my application correctly yields however when i pick one row using iloc pandas suddently casts everything into float presumably because it turns it into a series which wants a data type yields that causes downstream problems as i need the data in the correct types how can i pull out a single row while maintaining the correct types,how to make a multiple if statements more pythonic and condensed i am writing a piece of software that checks the input to a function before passing it to a database to do this i need to check the type of data before i send it right now i am using different if else statements how can i condense this and make it easier to read thank you,0,79,68 how to one hot encode df column with list separated by pipe i have a df column containing lists separated by pipes and including extraneous information i m having trouble one hot encoding the list for example i want to encode as i ve tried but it seems to one not encode by individual characters,is there a way to override busday count method in numpy i want to override np busday count to include custom off days how do i do it,0,47,25 how to remove specific strings from a list in pyspark dataframe column i have the below python list lst name age country spark dataframe is below i have to compare the list with spark dataframe string column and remove the values from list from the column expected output is,add data to request in the route handler using python quart we are working on developing an api using python quart we have multiple routes set up and a global error handling method we need a way to tag each request by adding a random hash to the request object so it can be accessed anywhere by tapping into the request object for instance the error handler should be able to access the random hash that s tagged with each request what is the cleanest way to achieve this using the quart api framework we wish to achieve this without any unexpected side effects,0,46,102 how to create a comparision matrix using python i have list in python how can i generate a matrix by subtracting the list element by each othe and create a comaprision matrix and save it into csv,what is the latest way to set up headless selenium sorry but i m quite new to python i have checked online and found that there are many videos with ways to create headless google selenium however upon trying those methods i realized that they are all deprecated can anyone update me with the latest method to enable headless selenium for google chrome so the sequence of the program follows updated i have tried adding the suggested answer to my code this is my new code however i get this stacktrace error while running headless chrome if i were to use the normal headful chrome it works perfectly fine,0,37,108 how to add two values from the same columns so i am looking to add values from a dataframe column and write the result in a second column column is given column will be my result what i want to do is column column column column column column,change the element in a list of lists differently alternating every nth time i have a list of lists containing information about days in a month e g i would like to iterate through the list of lists setting the element id to a for the first five then b for the second five and continuing that alternation for as long as the list of lists might be i am struggling to get the syntax right using a for loop,0,54,79 writing a unittest with pytest i have a column in my data frame and t should have a yes values but my unit test code has an error here is my code the error is,python can t evaluate derivatives at a point i use jupyter notebook how come this does not work when i want to evaluate the partial derivative at the point p when i type f p p i get the answer when i type f x x y i get the derivative of f wrt x then when i type f x p p i get this error,0,34,59 is it possible to add this kind of default value to caesar cypher python here is a basic function call i would like to do as you can see below in the signature i would like to have the default value in s be the length of the string passed in for convenience is it possible to do this in python or some version of this,tkinter frame not filling out parent container for each page i want the frame to fill out the entire window but when i run my program my page does not fill out the whole window i ve tried setting the weight of both the root self and the containers that are holding my frames but to no avail i am unsure as of what to do next in each page i ran the self configure method in order to check whether the frame has filled out the entire window but it has not,0,66,91 finding impulse response of the block diagram i have the following block diagram and each subsystem i need to find the overall impulse response for n the individual impulse response for each subsystem was found as shown then i performed the following convolution and addition to find overall impulse response but i got the following error not certain how i should incorporate the range of n values considered,getting this problem from firefox or chrome blocked loading mixed active content using fastapi with jinja traefik letsencrypt ok first i think i know about this issue where my css file is using something http instead of https in the href but that is generated by something like this in my index html note that i am using traefik for reverse proxy and having letsencrypt to handle https cert i am following this guide while i change the codes inside for fastapi for my own but the rest such as traefik and docker etc is same as for my main py so currently after the rendering i found out that my css file is loading from http instead of https is there any way to fix this to make it https instead of http also for my file structure is something like this my traefik configuration traefik toml and my compose my docker file and i have a prestart script,0,68,158 how can i remove a nested data if a specific key found similar in big json data the simple way to filter is to loop them all but trust me as i have very massive data looping is very time consuming and maybe not be very efficient way what do i want to accomplish i just want to delete the dict if targeted idis same,how to make time series forecasting with independent variable and one target variable in a problem i am working on i have to make time series forecast to predict a dependent variable a with different independent variable b b b b in python will the linear regression work i am new to predictive modeling,0,64,52 how to ask for infinite inputs until user replies with desired input totalbill my code should iterate to the else statement since totalbill is however there is no output at all i have written a code similar to this previously where i used the concept of appending lists i tried getting inspiration from that code but it did not work the code that i got inspiration from,how can i download an embeded pdf with playwright python i m trying to download an embeded pdf file or get its raw content to store it in a variable using playwright with python i m getting the following output for page content i can t locate download button nor print button,0,70,49 passing a value to a python variable from batch script i have the below python script which takes a user input that is eventually used by the program to read a particular file i want to execute the python program from batch script and pass the file name in the batch script can someone please help,python remove strings from list that doesn t contain specific string but not exact match i have a list of strings e g and i have a string e g i want to be able to remove anything from the list that doesn t contain my string in this case bank rates but i don t want to remove it as an exact match so after cleaning the list it would look something like this i tried using but this only looks for the exact match of bank rates and in the following example this code will remove strings like bank cd rates bank of america mortgage rates and bank exchange rates so it will leave the list as what would be the best way of achieving what i want,0,55,125 how to get h over below h when ordering having this dataframe what i would is to have the rows that have the start time with xx xx at the top descending for example ps start time comes from df start dt time,how to update column value in postgres table from python based on condition i have postgres table alpha with following values alpha my connection string i want to update the active status to expired based on two conditions expected output how could the update query written from python for postgres,0,36,49 why is there a difference in how the in operator behaves this works perfectly but when i apply the in operator to an array like this it fails,pyomo typeerror unhashable type orderedscalarset dears i am new on python and pyomo as well i m creating an abstract model below there are the sets parameters and variables related to my error sets scuc up set scuc zone set from dat file set up g g g g g g set zone z z z parameters scuc pmi param scuc up scuc zonal up param scuc up scuc zone from dat file param pmi g g g g g g param zonal up g z g z g z g z g z g z g z g z g z g z g z g z g z g z g z g z g z g z variables scuc up gz var scuc zone scuc dpg g var scuc up within reals i m trying to type three constraints where i need to multiply a vector of variables parameters with a vector of parameters to obtain a scalar value here the constraint formulation but when i lunch the instance construction it appears the following error typeerror unhashable type orderedscalarset it also tried to transpose the vectors with numpy but it didn t work i hope someone could help me,0,28,214 scrapy image pipeline object has no attribute spiderinfo error i just met an issue with scrupy image pipeline the background is i just want to download some pics for testing purpose with scrupy image pipeline but after the code composed i met an error when i run the script error message command to run the script scrapy crawl picspider scrupy version scrapy here s the code below,import csv adding a header with pandas i m importing a csv without a header and i m trying to tweak my script so that a header is included during load in addition to including the header can i define the field types the layout of the file i m importing header and types any ideas for implementation,0,67,55 how to create pie chart using html and css and send to in email in django templates i want to create pie chart using highcharts js and attach to email but when i send email charts not render can anybody help me to render chart in email attachements,how to replace multiple values with other conditional strings or int values in a pandas dataframe series i m dealing with a huge excel sheet about k rows of raw data and i need to replace multiple values from one column with conditionals from another column something like if column a has written word in any row then replace str str in column b of the same row i ve done another replacements with replace function using lists this has worked perfectly but now i need to do multiple replacements for example current df excpected output in the example i would need to replace the column b with another value with the condition of the objects str or int of column a a a so the condition would be value value value the resulting value in the b could be anything i ve also tried this for loop but it replaces other values i don t want i have tried with subsetting also but didn t work,0,47,161 how to do exponential curve fitting in python i ve tried to resolve this code i do not understand why the generated red lines are not located in their respective dot graphs i have an exponential function evaluated for each one who can help me solve this code i would like to generate a correct regression for each graph with its regression points and lines respectively thank you all,how can i make a variable for each person in my discord server with python i am making a game for my discord server and i need every member of the discord server to have their own number of coins therefore i need every member of my discord server to have their own variable for their coins if anyone knows how i could do this that would be a huge help thanks,0,68,72 how to use tkinter canvas to create multiple text one time for example the main window get stuck when run this part how can i avoid it when loading the text,how do i constantly get the value of a tkinter entry box without a button i want to be able to get the value of an entry box in tkinter repeatedly without a button for example if a type in the entry box another variable can be saved of these values constantly being updated by whatever is being typed in that entry box,0,31,64 keep getting none at every input statement i was just making a rock paper and scissor game in python version but whenever i try to run there is none written at every input statement my whole program works fine but i am really annoyed with none is there anything i am doing something wrong in my code i will really appreciate your help here is my code and here is the none written in every input statement,webscraper python beautifulsoup i know what i m trying to do is the simplest but it blows my mind i d like pull data from html page using beautifulsoup to do that i need to use the find function i guess ain t know what to do no more appreciate every form of help here s the html i m working with enter image description here import requests from bs import beautifulsoup url res requests get url html page res content soup beautifulsoup html page html parser text soup find div class col md output blacklist style head meta col md col md for t in text if t parent name not in blacklist output format t sheet html body text body html file object open record html w file object write sheet file object close enter image description here,0,77,130 python tkinter grid not working with classes how do i change the position of the buttons with the grid system i had it working without classes when i run the program it ignores the grid settings i want to use the grid system but it doesn t work this is how it looks now but i want something like this thanks in advance,different upload and download urls for django models s image field i need a way to have different upload and download urls for imagefield i want to upload the image to aws s and while accessing the image i want the image to route through cdn in my case fastly just like i am specifying upload path in imagefield i would like a way to do something similar for accessing image it also seems that i cannot modify avatar url once it is created is there any way around if there is any way i can override the model s behaviour to modify the url while accessing,0,63,104 how can we persist changes in a docker container i am using a python program to scrape and save data in a sqlite db file there is no mention of sqlite in the dockerfile what should i do to save changes in the data db file this is my dockerfile can you please guide me step by step thanks,is there any way to replicate realtime streaming from azure blob storage to to azure my sql we can basically use databricks as intermediate but i m stuck on the python script to replicate data from blob storage to azure my sql every second we are using csv file here the script needs to store the csv s in current timestamps,0,57,59 send post request with javascript i have this working api in python how can i re build the same thing in javascript if it s not possible how can i send this post request from the font end,dict key selected set value selected are different when code is executed in shell and via script python default sep gcc on linux above snippet when executed in a python shell is giving output as and when same is executed as a script eg python example py why there is a difference is compiler doing some optimisation,0,35,62 an error occurs when installing pylibmc via pip opensuse tumbleweed distribution hello when i attempt to install pylibmc on opensuse tumbleweed using pip i get the following error the distribution has just been installed,matplotlib logscale colorbar with for loop for loading data and plotting i am trying to load data from multiple text files that contains two columns at least the two first columns are plotted in regular d plot but the color of each line is mapped to a third variable c is the code below in my best attempt the colorbar ticks are compressed because c is in logscale and i don t know how to increment the color value in the loop also there is some rendering issue where the lines have some sort of aliasing caused by the loop as seen in the attached image i am also interested in solutions using pandas thanks in advance figure,0,34,118 how to filter list of dictionaries in python i have a list of dictionaries which is as follow how can i get a list of the latest vehicles for each vehicletype based on their creationdate i expect something like this i tried separating out each dictionary based on their vehicletype into different lists and then picking up the latest one i believe there might be a more optimal way to do this,when to use api vs smtp in django can api be used to replace smtp for mail sending in django especially for things like reset password and mail confirmation i will really love if i can get clarification on a topic in django i am a newbie to django and when it comes to sending mail i register for mailgun and used the api since i have used requests before but picking up django to work with i am trying to do user registration using dj rest auth and django allauth and there is thing about configuring email backend using smtp my question is i know i can send mails using django but things like reset password that has a uuid attached to it how can i go about it using api s,0,72,129 scapy error scapy exception can t attach the bpf filter i found a wifi scanner written in python on youtube direct github script link but i m having an issue with bpf filter as scapy error scapy exception can t attach the bpf filter script output i installed scapy and am running this code by python on m mac any ideas,how to keep dpi of sliced image the same as the original image in python cv is there any parameter to specify the dpi of sliced image i want to keep the original dpi instead of changing the dpi,0,57,39 how to replace single value in pandas dataframe by index below is an example of what i want to do basically i know the index and the column of the value i want to replace and just want to replace a specific cell no conditional statements,yolov can i add more epochs on the model already done custom training i m trying to make image detection model with images i just tried epochs which took about hours of training the question is if i want to simply add more epochs on the same model how can i do that is there a way that i can load custom trained model since it takes so long i wish i can continue training from epochs already done training i m using colab and i experienced a few times loosing connection during the training so i m afraid of giving more epochs from the start of training,0,46,110 start and end indices of the matched strings after comparison i am trying to create two lists containing the start and end indices of a string in this case two strings are of equal lengths for example here matched lengths are gg cg cg i want the following kind of outputs now my chunk of codes looks like the following one but i want the indices to locate the matched sequences,want to create a python function from a data frame in pandas i have a data frame that has various columns one of them being sex which has different value types and the other is employment types how do i create a function that takes in two strings representing the the column names of interest e g function sex employment and say i want to assign values in the data frame whose sex column value is male female nan other f and for employment employed unemployed then make the function return the total of the two values above e g function male employed,0,71,110 moving specific values into same values column pandas i am trying to separate the values and sort them into another df with numerical values if any values appear in the id it will appear as in the new df and if the value is not present,vscode doesn t recognize py solc x doesnt library i m trying to compile a sol with py solc x i downloaded the library with pip install py solc x but still vscode doesn t recognize it please help me fix this the massage after pip install the code,0,48,40 import information to classes from a txt file my issue is that information in the txt file is has columns and the space between columns is not the same here is the sample i need to somehow import info into the class i created here is the class i tried strip split didnt work if anyone has sugesstions i would be extremely grateful,format string with special character i have some string with special characters and i want to remove these characters it works but when i have special characters like future core just breaks so i tryied other way and works but now have a joined string i wanted something like future core lapix carry me away extended mix with spaces like the first attempt someone can help me i need these returns from code sabai with lve nevve falling for you official music video and future core lapix carry me away extended mix,0,65,93 how to speed up this python loop any suggestions please threading or something like that outputs here downloadtime downloadtime downloadtime,how do i make a function to change every appearance of a letter to a different letter i have a name let s say john i want to create a function that changes the o to an a this is what i came up with this works fine and returns jahn but what if i want to change a name like johonas for example it returns jahonas so i tried to make an if statement like so however this return none and i quite honestly don t know how to fix this any help is appreciable,0,24,94 calculating standard error does not give expected result i want calculate standard error of vector and i don t understand why it doesn t work let s consider vector calculating standard error of mean is just to calculate standard deviation and divide it by square root of length of vector however when i calculate this by function i obtain completely something different could you please explain to me why i don t unsterstand why this difference occurs,commanderror d python project resume already exists i am creating a django project i can successfully create virtual environment and pip install django but when i try to create project using there is an error that showed i tried uninstalling django twice but it only allowed me to uninstall once so it is likely not about duplicate django i also checked the lib site packages there are no duplicated folders or folders either however i do have two versions of python right now one installed along with anaconda one is separated from anaconda and directly downloaded from python org right now i am just using the separate python i even checked the python version and the pip version so it should be fine still i could be wrong since i am not that experienced what should i do,0,73,132 how to dynamically slice array without eval i am in a situation where i need to dynamically slice an array of variable shape dimension so i assemble a string to access it this works fine when accessing the data but the limitations of eval prevent me from assigning using this approach is there a way i can slice without eval,python requests json showing errors the codes are showing me what is the problem and how can i solve that,0,60,20 dynamically slice tensor of arbitrary dims i m writing a definition that needs to take slices of a tensor with an arbitrary number of dimensions the slice will always be on the batch dimension of here is a simple example of what i want i want to be able to feed it various sized tensors and get the indexed slices out as a batch such as thanks in advance,v syntaxerror unicode error unicodeescape codec can t decode bytes in position i have tried putting r before my code as well as changed the code with back slash front slash but don t seem to be able to upload my csv file into python is there a particular reason for this error please help me fix this,0,69,57 trying to figure this error attributeerror int object has no attribute keys i am trying to convert python s ordereddict to a normal dictionary and then parse it to a csv file i am encountering challenges with int object has no attribute keys full error traceback,how to get de duplicated openie clause extraction results i ve exhausted all the configuration options i m aware of but the results still contain non merged duplicating variations whereas i m only looking for the maximal clause extraction results can someone help me out on this please,0,45,43 python create file from list add empty line to the end i have to create the cvs file from the list here is the code i can understand n breaks the line but when i open the file i see last line is empty this is how content looks like is there any way i can remove last empty line found the way to fix this but wanted to check if this is the right way,how to use canny correctly i have an image with a resolution of x i am applying the canny operator to it but the result i am getting doesnt suit me i want all the edges to stand out however when i apply this algorithm to images of lower resolution everything works correctly how can i solve the problem original image result,0,76,62 how to get the rank of one numpy array based on intervals from another array i have two numpy arrays required ranks,why am i receiving an error when importing modules housed in a package built in a virtual environment when i run my code in a virtual environment i am getting a different output than if i run the code in a container outside of a virtual environment same file structure same code in ab py and same import statements in the init py and ab py files see the image for more details very basic but i would just like to no why python does not recognize one of my modules when the parent container is located in a virtual environment thank you running ab py in container returns running ab py in virtual environment returns,0,22,111 how to replace a file which ws opened using sys stdout in python i am using sys stdout method to print the logs for test run now i am having a test case which will run every hour and my goal is to replace the log file with the latest one everytime it runs but using the following code the log is getting accululated in the same file every hour how to achieve this goal,multiple inputs in while loops how can i add all the lines of the input to the list this way it adds only the last line like,0,73,27 iterating list to create df i have a variable class list that comes from a post request api in graphql that looks like this how can i iterate thru this list and create a dataframe that looks like this i need to create the df like this because i will merge with another df also i m curious what s the need of this list organization like a list of lists list of dict thanks in advance,check if a value exist in a column and change in another pandas i have the following information let s say i have the following list my dataframe is as follows df i would like to check if one of the value from the list my list exist in the column col if it exist change the value in value column to hot in the corresponding row i would like to see something like below i am just looking for a simple script that can iterate and check in every row and change a value in another column the corresponding row can any one help on this,0,75,105 pandas dataframe multiply with a column of another dataframe is there a way to multiply each element of a row of a dataframe by an element of the same row from a particular column of another dataframe for example such that df and df results in so basically such that df i df i j df i,comparing timestamp of the same dataframe in pandas i am working with a dataframe similar to the one below i have to compare the timestamp of rows if the timestamp of the rows is within hour then get the name from the row which has a value and populate it in other rows which don t have current data expected data but i can not find logic to this problem any idea,0,55,72 error catching incorrect number of arguments requested when calling the function i get an interesting problem let s take such a function for example how we can handling this error in this case and in this case of course i mean handling this bug in the function body my attempt to intercept a typeerror is unfortunately invalid,using a function to create a string from numbers i am trying to create a function in python that returns the top ids by a given column as a string that will be the value of a new column for example if the top ids are the output should be when i apply the function i have it just returns blank values for context here is what my dataset hf looks like here is my current function and here is how i am trying to create the new column any help would be great thanks,0,59,108 python data transformation i have a dataset with two columns how to convert into the format given below using python,getting days difference from dates in same column in a groupby in pandas i have a pandas dataframe like this in the code columns the values are always form a specified list here n n n etc i want a dataframe that displays the days it takes to progress from code n x to the next one in sequence for each user i am thinking something like this your help will be much appreciated,0,20,71 psycopg partial identifier result select from prefix prefixed table name what i want select from prefix prefixed table name or select from prefix prefixed table name how can i achieve this as a request from klin why wouldn t work one may simply enter which would result in,super object has no attribute getattr in kivymd i wrote a kiwi app that has two pages the first page contains only one button to go to the next page the second page is a list of icons and titles it worked well when the app had a page but i get an error adding the first page as a menu how can i solve it the error is for line that i specified error super object has no attribute getattr,0,41,82 how to get maximum points scored by which player in each year i have a data set like this now i want to see which player scored the maximum point in each year i tried this and got the result year but i want player name too how to do this,how do you iterate through files in a list i have a list of file pathnames and i want to iterate through this list opening each file and extracting certain data points from it however when i run the code it doesn t open the file it just takes the nth character from the file pathname and adds it to the target list instead of the value from the file that i want what have i missed to make it so that it doesn t actually open the files,0,54,87 discord py on message nothin happens when i type the message in the first client event when i use the command given there prefix hey nothing happens it doesnt give the desired reply attributeerror client object has no attribute reply thats the error i get,how to put the dates in chronological order in python csv so i am working on processing some data and after running my file everything is fine except that the date are not in order i used the code below to try putting them in order but didnt work by the way updated at is the column i am trying to put in chronological please let me know how i can make this work i have attached a picture to for better understanding of my question updated at column pic,0,43,88 python how to link a filename to a memory file the memory file will be an input of another program not python so a file name is needed,how to add hoverdata to the argument of fig add scatter in plotly how to add hover data to the argument of fig add scatter in plotly it belongs to fig px scatter but i used this for a point to provide name argument thank you here is the data here is the code,0,28,50 how can i find time complexity for while loop and power statement i m trying to find the time complexity of two python statements here is an example of a program statement,turn a float type number into percentage by row on a data frame python hope you are doing ok i have the following dataframe and i want to turn the investments salary row numbers into a percentage like this i have tried the following but it hasn t worked any ideas,0,31,50 dm ing on reaction discord py this is what i have so far i would like to make it so on the last if statement it would dm the user but due to on raw reaction add not taking the user parameter i appear to be clueless on the matter any form of support would be appreciated,how can i do groupby without importing anything and in an expressive and oneliner kind of way i am wondering if it is possible to do grouping of lists in python in a simple way without importing any libraries and example of input could be and output i am thinking something like the implementation of itertools groupby but shorter,0,52,59 i am running this code for a discord bot and while there is no error it is not sending the desires message even after logging in client run your token here as mentioned above i believe the issues come with the second async function or below i tried testing it but there was no hello back thank you,flat indexing of all but first dimension with numpy is there some way to use flat indexing for the remaining dimensions with numpy i m trying to translate the following matlab function to python but i can t wrap my head around what the numpy equivalent of matlab s weights ix would be that is linear indexing only in the remaining dimensions i was hoping that the syntax could be directly translated but suppose that values is a by array then weights becomes a by by array in matlab weights ix is then a by array whereas in python weights ix is a by array i think that i have handled everything else in the function below do you have any suggestions perhaps i m just thinking about the problem all wrong i have also tried to write the code as simply as possible as i intend to use numba to speed it up later,0,56,149 a method to modify a list in python i m new to python and i don t have the right method for the for loop i have a list that looks like this i would like to have something like that out then i will integrate this list in a dataframe ps forgive me for asking the wrong question i m just starting out i don t yet have the best practices,how do i count the number of duplicate groups of data after using groupby in pandas with python here is what i did now i have an object where i have id associated with a column dataframe here is my code so i printed out in a for loop and it gives id with a column dataframe for each loop i want to figure out which of these resulting grouped dataframes are duplicates how many duplicates exist and the id s of the duplicates the entire dataframe associated with a given id has to be identical to another dataframe with a different id so i would like to return a which tells me id and are identical there are three of them and we call this group a,0,69,139 why python multiprocessing always generate same random values i am using pool map to process my function there is a random value added in the function but i find the result from each process is the same how can i generate different random values for each process this is an example i want to have different values,ssl problems using twilio i m trying to use twilio to send sms i m using their templates to send my first test message i ve manually replaced the sid and the token with their respective values as per twilio s console the os environ function doesn t work the thing is this error appearas as i try to run the code i ve never used an api before i could really use somebody s guidance thanks in advance,0,57,71 remove group if contains record with status i would like to group records by id from df and delete group if any of records has status output i would like to get i tried dfnew df groupby id filter lambda x x status but i got the error typeerror filter function returned a series but expected a scalar bool,how to add a new py file using tkinter python i want to create a button in a gui and attach a function to it the function should include some code that duplicates a python file and pass some arguments to it also i want all of the created python files after clicking the button to be displayed in one window and arrange them using the built in grid tkinter function is this possible,0,60,74 how to match a pandas dataframe column consisting of a list i have a pandas dataframe whose column is consisted of a list for example i want to select those rows that are a but if i run this code i get an error valueerror lengths must match to compare same to code df df col a what proper code should i use to achieve this,save sensor data in a django database im doing a django app that tries to show data taken from an ultrasonic sensor what i want is to take the distance from the sensor and save it in its django table normally this is done with a form but i want it to be done in the backend for each sensor object this is the code that i have for the moment ultrasonicsensor py models py views py,0,67,74 add a for loop if x i m trying to create a function to translate words to numbers one of the parameters is depth if depth is then the function will know ok i m translating a word if depth is the function will know now i m translating a list of words etc in python exist a form to do this,i have a syntax error in python while trying to load the file here is the error i get,0,63,19 why do i get an error when trying to access the first two columns in an html table output,why am i getting only hashes per second i was trying to crack a character long password but even after minutes it showed no progress so i decided to find how many hashes am i finding per second the following code need to crack the password which is zzzz h is the hash given by crypt while s is the salt and hashing algorithm used this is hashes but the time taken to crack the password is minutes and seconds which is extremely slow i know that single threading isn t ideal but isn t it still very low,0,19,103 object supporting the buffer api required sha error i want to hash some digit numbers but it gives me object supporting the buffer api required error here s my code and the output is,error pg config executable not found when install psycopg in centos i am install psycopg in the centos using this command but shows error like this i have already install postgresql devel using command dnf install postgresql devel y and install successs why still could not install the psycopg,0,34,48 how can i programmatically get an element from the drop down menu on this web page i retrieved this html with a web scraper i want to extract the element for the second option a class c menuitem link href lists members import id import contacts a how can i do this i have this code so far but it doesn t work,allocator ran out of memory how to clear gpu memory from tensorflow dataset assuming a numpy array x train of shape the following code works fine exactly once when i re run it after slight modifications to x train it then triggers an internalerror due to an out of memory gpu it seems that the first time it finds free gpu memory so all works fine but the subsequent times the gpu memory is already almost full and hence the error from what i understand it seems that simply clearing gpu memory from the old train dataset would be sufficient to solve the problem but i couldn t find any way to achieve this in tensorflow currently the only way to re assign the dataset is to kill the python kernel and re run everything from start is there a way to avoid re starting the python kernel from scratch and instead free the gpu memory so that the new dataset can be loaded into it the dataset doesn t need full gpu memory so i would consider switching to a tfrecord solution as a non ideal solution here as it comes with additional complications,0,53,190 how do i delete unnamed columns in my excel document i m trying to edit an excel document but when i use it creates or unnamed columns even when desabiling the index here s the complete code,check if values are within intervals in pyspark i have a large dataframe a with intervals like this and i have a dataframe b with sorted non overlapping closed intervals like this i want to check if values of dataframe a are contained in one of the intervals of dataframe b and if so save the id in a new column interval id my output dataframe should look like this is there a way to do this efficiently without udfs,0,37,77 iterate on xml tags and get elements xpath in python i want to iterate on every p tags in a xml document and be able to get the current element s xpath but i don t find anything that does it the kind of code i tried here is a sample xml file that i try to parse i would like my code to output,counting objects in a noised image i have this original image and my task is to count those peppercorns i managed to remove the noise and the grid but at counting those corns im stuck there are pairs that are so close to each other that my program cant count them can u help me with it thats my attempt in the last i tried to erode open those corns with that code but those marked corns make problems the one in the bottom i think i solved with enough erosions but the other if i erode more some corns will vanish edit the no grid image,0,63,109 python how to link a filename to a memory file the memory file will be an input of another program not python so a file name is needed,navigate through as using python i want to automate some tasks within as i think it s referred to as ibm i i managed to get some stuff done using autohotkey and directly navigating through the interface this works alright but is far from optimal i wish to do some more advanced stuff now using python the problem is i don t know where to begin my first goal would be to be able to navigate the as window through python once i am there i feel confident that i can work out the rest i tried to look into some resources but i don t really understand them like,0,28,108 flask not running when trying to run my hello py file it says it can t be imported was working previously but just stopped can t work out why,loading pandas dataframe from parquet lists are deserialized as numpy s ndarrays output is there any way in which i can read the parquet file and get the list values as pythonic lists just like at creation preferably using pandas but willing to try alternatives the problem i m facing is that i have no prior knowledge which columns hold lists so i check types similarly to what i do in the code assuming i m not interested in adding numpy currently as a dependency is there any way to check if a variable is array like without explicitly importing and specifying np ndarray,0,27,100 change a column containing list of dict to columns in a dataframe i have the following dataframe which contains a column that is a list of dict items and i want to transform it to a simple dataframe like so,python posgresql ormar truncate table i am currently using ormar in python for postgresql stuff and i am learning as well by using this docker git with fastapi postgress and traefik as template to start my project i found out the example is using ormar inside and so i try to use it as well by converting my codes into it for this case i would like to truncate the table first before adding another new set of data with this my id as primary key for each row will be reset instead of incrementing everytime i delete and reinsert the data for now i am using this command for delete with that code above i able to delete each row and re insert the data but my id is increasing instead of resetting what can i do to make my id reset each time i re insert the data into the table,0,40,153 finding the length of a portion of a csv file in python i m trying to get the average of part of a column in a csv file but i haven t been able to find the length i noticed that when i run len it s counting the amount of characters and not the length from len should be note this is for a class and will not be using pandas,pyqtgraph how to get mouse click position correctly i prepared correct onmouse moved function and it shows correctly coordinates of my mouse but when i clicked somewhere python prints coordinates of my window not of my plot i tried to make it the same like for the onmousemoved but it doesn t work i also tried to use mouseclickevent scenepos instead od mouseclickevent but it also doesn t work,0,71,66 how to get without using the return statement class inside function variable value it is my code i can not even use the database i need get without using the return statement class inside function variable values erorr,pip install fails in dockerfile but is possible in container i have a rpi with bit base image for now i need to use bit so armv l architecture i want to run jupyterlab on it and do some data science i am also new to docker so please guide me gently for that i created a dockerfile jupyterlab and some other packages after i created a container from the image i cannot use matplotlib and pandas it misses libjpeg and some other dependencies i couldn t install after reinstalling matplotlib and pandas i finally can import them so why i cannot write this into my dockerfile but can run it inside the container in console this in this line i get an error here is are the build logs of docker i will also provide a pip freeze of the container with matplotlib and panday additionally installed afterwards maybe this helps these are some cmds i issued to partially solve the problem thank you for the time and effort,0,37,168 how to schedule code to run at a specific time every day need help to run code that automatically starts at pm every day on python visual studio code i don t want to print anything i just want to execute my commands like pg keyup enter for example only works with printing text,is there any way to make this filter query smaller these are my tables this query seems very long to me i thought select related should help with this but it follows foreign keys and return all results not the result that is related to this instance of salary follow up on willem van onsem s answer i added a couple more rows to my tables and i m using this query in the save function and suddenly i m getting this error get returned more than one which is a popular error i made the query a tad smaller too i checked to see what sql query django is running behind the scenes and i found the culprit i think where blog salary id is null is the culprit and i don t understand why and i don t know how to fix this searched a lot and went through docs a lot as well,0,51,148 python tkinter grid not working with classes how do i change the position of the buttons with the grid system i had it working without classes when i run the program it ignores the grid settings i want to use the grid system but it doesn t work this is how it looks now but i want something like this thanks in advance,interpreting multiindex datetime i have the following code what can i do to interpret the multiindex dates as the x axis in more readable year and month format such as in a format like strftime y m a similar question was asked here renaming months from number to name in pandas but i am unable to see how i can use this to rename the x axis any help would be appreciated,0,63,71 for loop in python why does this return not does anyone know why does this return and not but when i do not indent the return statement it gives me this is my code,selenium in python not finding any elements i have written numerous scripts to scrape websites i am looking to scrape games and odds from here i am not able to find any elements at all i have looked for almost all the div items but tried root and it didn t work the code i am able to find the root item but i am unable to find other elements for example the games are contained in a div with the classes ae aj im s h i j ak l m al o am q an added this line of code but the events variable is empty,0,39,108 pandas how to convert list of list into series of list i have a dictionary in python each key has a value of nested lists like following and i want to convert the dictionary key into dataframe column names in pandas and the nested lists into series of list like following is there any way to do so,how should we write a code in oop that has to read a file and several libraries i have requirement to write my code in oop format for this i saw few videos on what is oop all the examples i could find through those examples i am not able to lean how to convert my code into oop all i could make out was i have to create a class suppose class interpolate and then def somehow actual forward fill backward fill linear and cubic but i dont know what exactly i have to write in it say,0,58,99 getting none while reversing list in python the code is quite easy but its returning none i do not know why can someone please correct my code,how can i do lprun work on nested function in python in jupyter notebook i am trying to use lprun on nested functions but i do not sucess the following code in a notebook cell outputs the messages hello world and goodbye but after i have this error usageerror could not find function outerfoo innerfoo attributeerror nonetype object has no attribute innerfoo and this one does not print messages and gives this error usageerror could not find function innerfoo nameerror name innerfoo is not defined how is it possible to profile innerfoo,0,27,94 change the values in a column using pandas i have this csv i want to reset all the values in the table count to to change the values is there a way to do it without mentioning to replace and setting the value directly,scapy module not working on rpi with error no such file or directory b liblibc a when i run anyu python using scapy fully updated it does this i tired to fix by doing based on this solution but it dons t work how can i fix this problem,0,44,46 how to send scrapy command line argument to scrapyd client i want to schedule a spider from scrapyd client by giving the command line arguments as well e g scrapy crawl spider name a person john a location porto o local csv above command works well when running spider directly from scrapy but it does not work when running it from rest api using scrapyd client basically the question is how to send scrapy s command line arguments like a o in scrapyd client,knapsack problem variant maximizing weight and value up to limit i m trying to work out an algorithm likely using or tools in python for solving a problem that seems to be related to the knapsack problem if i m trying to plan my first trip from location a to location b how can i select the items such that a contrived example the easy solution is to make trips but the smarter solution is to make only trips i ve worked with the or tools linear solver but only with maximizing one value while having multiple constraints how can i maximize multiple values loaded weight and loaded value with multiple constraints,0,74,112 flask mail how to add multiple files to message i want to add several files like attachment but i can not understand how my code now looking like,ignore catch a warning for a specific line of a unit test pytest i am trying to write a unit test that calls a function repeatedly and testing what happens if it gets run multiple times with the same inputs a by product of the function is that there are some warnings that are emitted whenever it is run this results in code like this gets really verbose when i use pytest mark parametrize which then now results in multiple if pytest warns type code can i specify to just ignore all warnings that are emitted in line for just a specific line in the unit test e g something like this i am aware of can pytest ignore a specific warning and in general ways to ignore warnings but those ignore across files and functions i would like to just ignore warnings in a specific line of the unit test,0,27,146 how to kill terminal in vscode using a python code i understand that using import os os exit will pause the code but i would like to kill terminal completely as if i were clicking on the button shaped like a trash can is there any way to do this so i can put it inside my python code,after windows reset lost my user folder where my pycharm projects folder was and can t recover files i just did a reset on windows and deleted all the files but did not wipe my drive clean when i realized that i didn t put my pycharm projects folder into onedrive i started try to recover this folder with all my code in it i found the user folder that held my pycharm projects folder in windows old and when i went into the project folder it had all the logs from messing around with the code and the project foler iml file but did not have any of the actual py files from my coding projects is there anyway to recover these files i tried to look everywhere and have done everything i can to recover these files but nothing is doing the trick,0,58,142 when i run the sportsipy nba teams teams function i am getting notified that the requested page returned a valid response but no data could be found the code that i am running straight from sportsipy documentation returns the following the requested page returned a valid response but no data could be found has the season begun and is the data available on does anyone have any tips on moving forward with getting this information from the api,how to install python statsmodels on apple m i cannot figure out how to install statsmodels on my m machine after following the instructions in similar threads about scipy and numpy issues with m i am able to install these but cannot install statsmodels statsmodels issues were also raised here but unresolved python version python pip version pip the command pip install statsmodels leads to the error message error could not find a version that satisfies the requirement statsmodels has anyone managed to install it thank you,0,76,90 creating a variable through a function heres the idea i create a function that makes a variable and stores some data inside of it how would i do that e g something along those lines would anyone know if this is possible,getting duplicate links for images in scraping with beautifulsoup i am scraping a prestashop website where i want to get a list urls for all images of a product however i am getting duplicate values all links repeat themselves i have tried creating a dictionary to remove duplicates but it does not seem to work also i can t seem to remove the span tags from the reference number unwrap does not work it keeps returning none attribute which is confusing because all products have a reference number i have tried turning the result into a string but it does not let me here is the code,0,41,107 dimension reduction using varimax rotation and method used is principal to find component score coefficient matrix here all my code which gives me rotated component matrix but i m looking for component score coefficient matrix dimension reduction using varimax rotation and method used is principal to find component score coefficient matrix,how to save pandas to csv from left to right pandas to csv function saves my table from right to left like in hebrew even thought the dataframe is in english i have the indexes on the right and columns going right to left how can i do the opposite,0,52,48 how to extract elements based on condition they contains a specific element i d like to extract all href from item list that also contains class list item pay count every item is encapsulated in a div with class box information and has an a some of the items has lists with class list item pay count at the bottom of class list score only these items href i try to scrape,how to create new dataframe with all non nan values from other dataframes in one column i have two dataframes df and df and they both contain mostly nan values they have non nan values at the same locations in the data set based on these two dataframes i would like to create df with a column for all values from df and one column for df so that i have value pairs from both dataframes here i created a simple example for reproducibility thanks a lot for your suggestions,0,61,88 how do i append something to a list after an element not at the end of the list i have a list i m trying to work on a json beautifier without using libraries,how do i update tkinter label i m trying to update the tkinter label on click of the button doesn t work when i click the button here s the code what am i doing wrong thanks for help,0,33,37 how do you make a ban unban kick command with nextcord i want to make a ban kick and unban command with my discord bot i also want it to be compatible with slash commands if you need the code here it currently is,how to get audiocards models and names in python on windows i need to get audiocards models and names in python on windows but i didn t find anything about it on internet,0,42,32 pdfplumber memory hogging crash with large pdf files using pdfplumber to extract text from large pdf files crashes it,passing a variable from a dag to an external function i have the following two files one with the dag and two tasks dummyoperator and taskgroup the second file is a method that creates and returns the taskgroup called and in the first file my problem is the following in the first file i pass a variable input text to the method that creates the taskgroup and this in turn passes input text to a pythonoperator that simply prints it i don t know why the variable is not passed from the dag to the method when i print it i have am i forgetting something basic about the dag lifecycle is there another way to pass a variable to the method that creates the taskgroup thanks in advance update when i tried to write a snippet of code to replicate my problem the base problem was private code work i change the name of one variable and that rename was exactly the origin of my problem and that s why the snippet i put here worked for l d nicolas may that was the mess it seems that i cannot use a key name in op kwargs as templates dict maybe because that is a pythonoperator parameter sorry the mess,0,19,205 updating numbers pandas python but also keep all the data i got two dataframes df df i am using the update function to update the two dataframes result is it possible to get the other numbers too something like this,facing issue with dataproccreateclusteroperator airflow i m trying to migrate from airflow to airflow which has a change of name for some operators which includes dataprocclustercreateoperator here is an extract of the code i am ruuning into below error on debugging i see this issue is due to the param metadata does anyone has idea what is wrong with this param or a way to fix it,0,40,70 how can i take a triangular matrix like this from the user as an input with python i want to take a matrix exactly like this from the user where the first row has an empty column and the second row has column and so on elements in column row,syntax error in random number generator in python x heres my code im getting a syntax error on the question raw input not sure why im using a mobile python app that i think runs on x because of the raw input main works fine im not sure what the questions problem is im still learning python so if anyone could explain thatd be great,0,54,64 valueerror received a null pointer i m writing a code to convert geotiff files to png pillow didn t work for me hence i am using gdal am i missing something in the code the code is as below,nameerror for pyspark model in this code i am getting nameerror name agg is not defined,0,37,16 how to keep dpi of sliced image the same as the original image in python cv is there any parameter to specify the dpi of sliced image i want to keep the original dpi instead of changing the dpi,django says too many values to unpack expected i m using django in the upload book function i generate a digit code for each book and i identify and distinguish two books from one another by their code rather than their primary key however i get an error in the generate code function here is the generate code function with required imports i did the extra bit over there to prevent two books being of the same code however low the probability of that might be with possible combinations and here s my upload book function and my book model in models py the error is at this line of the upload book function which leads to this line in the generate code function here s the error with its traceback i don t know why this is happening in another question the accepted answer mentioned that this happens when split is used and that returns more than two elements i m joining the elements of the list which is generated by random choices string ascii letters string digits k max length into a string when i print join random choices string ascii letters string digits k max length in the python idle shell it returns a string all right so what s the issue here,0,39,192 discord py client get user returns none with user id i keep getting a attributeerror nonetype object has no attribute send exception when i run this code i have tried the similar questions and they did not work,pandas create session number from log data i have a log data with timestamp userid action i would like to create a session id based on the following rule if no action was done for minutes by the user it should start a new session id for next action so for the following data frame to the following for user a new sessionid is created because when the action was taken it has been more than minutes since last record but for user there is no such gap thank in advance,0,35,96 table words and numerical values and generating text file i am trying to write a table in python but am unable to get the right outcome i am trying to get this output i am using the following code i am getting output also how can i link this to text file generation,converting integer to a letter encoded string i have seen websites generate short urls where they convert ids for items into a letter string here s an example this is for a website called letterboxd and the link takes you to a movie page i m guessing behind the scenes the movie has an integer id that is then converted into this letter string or maybe its stored as that letter value to begin with how is this accomplished,0,53,82 discord py musicbot gives nonetype error i tryed to make a music bot for discord it runs but after using the commands he gives me and error error code is down below import discord from discord ext import commands from discord import ffmpegpcmaudio import youtube dl class music commands cog def init self client self client client def setup client client add cog music client,tuple object has no attribute meta why is my queryset throwing this error whenever i make a search to the backend of account object below the post have added the traceback account model py friendlist models py this is the traceback below,0,53,41 plotly subplots issue with specs value error i am trying to plot subplots with secondary y axis with plotly subplots but no matter what i am trying still getting this type of error valueerror the specs argument to make subplots must be a d list of dictionaries with dimensions x received value of type class list secondary y true secondary y true secondary y true thank you for help,how do i make turtles stop at certain line so i ve created a simple race game with turtle graphics and i have one issue there are racers they all start from y and when the first one hits the finish line y i want of them to stop and declare the winner i haven t written that part yet afterwards this code doesn t do what i wanted it to do though sometimes they all stop after of them passing the finish line sometimes none of them passes the line and they all stop i m relatively new to python and discovered turtle days ago can anyone tell me where did i do wrong i want to finish this asap and move on to better modules,0,68,126 is there a function for extraction not a principal root there is a function from math module named sqrt which returns a principal square root of a number for example math sqrt yields as an answer my question is is there a function which can return not only one root but also the second one consider the following code func yields since,how to combine variables from a column in only one variable i m working with a dataset from which i had faced the following situation my goal is to combine the simmilar variables from this column e g round and round oval and oval in only one variable how can i combine they,0,69,51 how to count the number of values for each index in python pandas dataframe i have the next dataframe i need to create the new column len x in dataframe and insert into it the amount of values in each cell i need the next result i will be grateful for help,objects being created from a txt file with the wrong attribute types i have a txt file that is formatted p part or ap assembledpart p p which is being read line by line each line being created as an object it all seems to work fine but all the attributes are being set to str and i need some of them to be float or int i can t figure out why this is happening for reference the class init can anyone point out where i m going wrong,0,50,92 even if i send various methods to my django api server by postman my django api server always receives them only as get even if i send it with a method other than get my django api server always receives it as get what s wrong with this,how to get the canvas create text text value in tkinter python,0,47,10 function within function to change a variable value why doesn t the variable url change test and yes it needs to be a function within a function that way the rest of my code is more simple thanks for your help,grc throttle block inclusion causes error the top embedded python block in this grc application is the stock block the bottom one is a lpf the code for which is below without the throttle block the application works with the throttle block the error gr log error thread body wrapper error thread thread per block block embedded python block valueerror could not broadcast input array from shape into shape is generated there is no such problem when the throttle block is in the path of the stock block i learning grc and would like to understand why the introduction of the throttle block is causing the problem,0,40,105 store json data to json file and save them in the csv file i tried this way but did not work but this problem occurs i want to convert from json to csv an example of what i want please tell me if this is possible,how to convert string from variable in table for csv export i am an absolute beginner with python the title probably says it already i usually look for the answers with googling but here i don t even know what term to look for i have a long string in a variable which i suppose will be easily converted to a table only i can t figure out how to do it myself this is my example this is the output now how can i convert this to export it to a csv or what keywords do i have to search for,0,47,98 dataframe object has no attribute value to plot a chart i need to plot a chart but it raises the following error code dataframe,response error when sending post request i am trying to get the table contents of website trading statistics to analyze it so i used python requests library in order to send a post request as the web page is a form using mozila s inspect feature i get post data and headers request data and request url but i get an internal error from server and contents which are in the format of a json file is not shown here i included the code and the error i don t know the reason i get this error and how to change my code to get the true contents,0,24,107 how to import install dependencies packages from a global system environment to a virtual environment i have installed my needed packages dependencies in the global system environment instead of my virtual environment virtualenv because i have used the command pip install package name outside of the virtual environment so i want to know how can i make a list out of them and install them in any of my virtualenvs,what does sys executable do in jupyter notebook i bought a book which comes with jupyter notebook in the first chapter it asks me to install required libraries it use sys executable m i never see it before what does sys executable and m do also why use user at the end typically i just use pip install numpy anyone can help me understand it thank you,0,69,65 selenium common exceptions webdriverexception message in python selenium the following codes run with python selenium without an issue but after upgrading selenium package from to code above doesn t work anymore the complete exception messages nothing is specified after selenium common exceptions webdriverexception message i couldn t figure out what goes wrong chrome version and chromedriver version is as follows any help would be appreciated,how to display a graph using tkinter how can i click on the gui button to display the graph that i have coded based on the code above there are buttons display in the graphical user interface i would like to press on the training button to display my graph below,0,61,53 error proxy next proxy pool stopiteration i am trying to run a script and it has a standard url for proxies which allows the script to run fine once i add my own proxy url i am getting the error error proxy next proxy pool stopiteration my url is in another file and i can also link that if needed code is below if anyone can help that would be great,add hours to workday in python i need the following script to compute the working hours from am to pm so that if i add hours it will be added from am the next day example if it is now pm and i add hours and the working day ends at pm the output would be hours and hs so far the script computes hours regardless of the labor restriction,0,69,89 concat multiple csv s with the same column name im having trouble with concatting these pandas dataframes as i keep getting a error saying pandas errors invalidindexerror reindexing only valid with uniquely valued index objects i am also trying to make my code less clunky and run smoother i was also wondering if there was a way to get multiple pages on one csv using python any help would be great,how to compile c code and run the compile code with pexpect i have c code and i want to compile and then run it with pexpect how can i do it but this command is not working,0,68,38 is it correct in scrapy to have multiple parse methods in one spider is it correct in scrapy to have multiple parse methods in one spider something looking like,python nameerror name raw input is not defined here is part of a script that causes the error below is the original code written by the script author,0,30,27 influxdb client query returns empty list even though there is a data i m using the query above in python with influxdb client but it gives me empty list in influxdb ui there are a lot of data what is missing in my code here,how do i populate update an excel workbook with data from a django model i populated a django model with a pandas dataframe in order to do this is had i used the to dict function in order for jsonfield django model to accept the data this works well now what i am trying to do is to update an excel file with these data so i am accessing the data in the django model and trying to use openpyxl to populate an excel with the new data data however i am running into problems as i am getting the error saying that it cannot convert to excel is there anyway around this my model function thats trying to populate excel any ideas why i am getting the error basically what i m trying to do is i have step and but cannot get step,0,43,146 savgol filter from scipy signal library get the resulting polinormial function savgol filter gives me the series i want to get the underlying polynormial function the function of the red line in a below picture so that i can extrapolate a point beyond the given x range or i can find the slope of the function at the two extreme data points,converting python dataframe to a particular json structute hi i want to convert my dataframe to a specific json structure my dataframe look something like this and the json structure in which i want to convert my datafram is below i tried implementing this with below code with different orient variables but i didn t get what i wanted so if any can help in achiveing this thanks,0,59,69 python if else on one line with continue statement similar to suggestions listed here is it possible to do the same with the continue statement something like this thanks for the help,scrapy notimplementederror scraperrspider parse callback is not defined i am new to scrapy i was seeing a tutorial and implementing a spider but this error always keeps up coming please help i have tried everywhere but i can t fix it this is the error i think this is my code,0,31,50 crop image borders dynamically how can i crop images that looks like this and save as different images the issue is that images are different in size and non proportional so i want to make a code that dynamically cuts black borders but not the black part which is inside the picture here is the desired outcome below is the sample code i ve made which works only for one specific image,facing issue with dataproccreateclusteroperator airflow i m trying to migrate from airflow to airflow which has a change of name for some operators which includes dataprocclustercreateoperator here is an extract of the code i am ruuning into below error on debugging i see this issue is due to the param metadata does anyone has idea what is wrong with this param or a way to fix it,0,71,70 drop rows based on column values in dask i am using dask to read a large csv file i wanted to drop a few rows based on one column value if for that particular column the row value is empty i want to remove the entire row i tried using dropna however i got this error so i used drop instead but then got this error i don t understand what should i use to execute the desired operation help,how to write row only if value is not null i am converting my json data that i made an api request to to csv however some keys in the object have null values how can i only write rows that have non null values,0,79,45 how to make an array of row values from same column in pandas here i have the following table having columns s no test and key i want to join those rows from column key in form of array in which the values of column test are equal like in table resultant table table table resultant can someone please help me in how to do this right now i just got the duplicated entries thanks,what is the best generic type hint for a dataclass in python i have started using dataclasses and i have some specific one lets say for example i then have an abstract class like an interface what is a good generic type hint i can use in the abstract class as placeholder for both the person and the animal classes,0,72,60 when run pip compile requirements in in macos monterey using venv python pg config not found os monterey macosv python venv requirements in after i turn on venv then i type pip compile requirements in then i get a bunch of errors about pg config not found this is my asciinema i have tried env ldflags l usr local lib l usr local opt openssl lib l usr local opt readline lib pip compile requirements in but same please advise,sort the list of tuples in python i have tuples like this these are the coins and its expiries the date is in string format so the arrangement is wrong so i have changed the format to date and tried to arrange i have tried the below code and the result is as expected as sorted now when i want back in older format which i mentioned in string its not in the same order it goes into unsorted way need help in making in sorted way in string format at the end,0,59,93 what is the difference between rdkit s molecule fingerprints fingerprints fingerprintmols and chem rdkfingerprint can anyone tell me when i should use fingerprintmols fingerprintmol instead of chem rdkfingerprintwhen making molecule fingerprints these are the two options is fingerprintmols fingerprintmol more efficient,how to normalize a json file into a pandas dataframe i have a json file named stocks json that looks as follows note the lack of square brackets in the source file i would like to transform this data into a pandas dataframe that looks as follows my attempt is unfortunately i get the following when calling stock data normalized any assistance would be most appreciated thanks,0,35,64 how to dynamically slice array without eval i am in a situation where i need to dynamically slice an array of variable shape dimension so i assemble a string to access it this works fine when accessing the data but the limitations of eval prevent me from assigning using this approach is there a way i can slice without eval,python requests json showing errors the codes are showing me what is the problem and how can i solve that,0,60,20 pydantic custom data type for phone number value error missing mysql schema for user my pydantic model is i want to create a custom datatype for phone number so i can use it at multiple places i am trying like below via postman i am sending i see error in postman any inputs on what i am doing wrong above,python cannot install tensorflow my pc is bit and python version is i installed tensorflow as following does anyone know how to solve it let me know if further information is needed edit i also tried anaconda as follow but the problem is that in anaconda prompt i can import tensorflow i use python in visual studio when i open python file in vs it seems different with anaconda prompt do you know how to make it also work in vs,0,58,85 how do i reset the underscore in an interactive session i have overriden the underscore variable in the python interactive interpreter how can i make the underscore work again without restarting the interpreter,filling up none values in pandas dataframe with values from previous column i am calling an api which returns a json file when i parse the json file to a pandas dataframe it returns the following table as you can see there are three levels of categories i would like to replace the none values in the columns with the value from the column before the dataframe should be looking like this i already experimented with some loops and with the following code but this does not work how can i achieve this thank you,0,34,94 python converting html hyperlinks to formatted plain text how do i convert html hyperlinks into plain text with python that looks like this my current code looks like this but this package doesn t seem to do the job themselves as they just convert primary html text elements to plain text without the link would really help out if a solution is found,python text adventure movement i am in the process of writing this text adventure and i am having trouble with something i am trying to get it so the input allows me to write go direction but whenever i put the word go into my movements or my conditional it doesn t accept the command i m kinda confused and don t need help with the whole thing just this one part i have tried changing the input allowance the directions in the dictionary and the condition in the while loop but to no avail here is my current code the commented out part is my storyline it s commented out because it reads slowly every time i go to run the file edit i figured it out i ended up splitting the input and it accepted the second part of the input idk if that s the best way but it worked,0,63,149 stack geotiff images while retaining individual bands i have two images with and bands respectively how do i retain each image s individual bands after merging the code above will result in merge image with bands i want it to be bands that is image bands image bands bands,split the prices from string and place it in another column in pandas i have below dataframe what i m trying to do is to split charge amounts separately to different column tried to use regex and df prices df charges str split expand true with no success any suggestions,0,57,45 question from pandas of resample from quantile function about question from pandas combine quantile function it only show one result from this method could python have a quick coding to show the result together of quantile at same time thanks give me a help,how to set the data dimension for gridsearchcv how dimension changes when using gridsearchcv,0,46,14 how to remove an element from an unevenly shaped array i want to get rid of the s in labels and get the correspondingly matching index elements from pred for eg the output should be i tried to use np where labels but it only works for arrays with lists of same lengths but as you can see the arrays in labels have different lengths and that is a problem,data cleaning dictionary inside dictionary inside lists in csv i m a newbie learning data science i ve been trying to clean a data set but i ve had some hurdles on the way the first issue i had was to explode a dictionary inside a table into individual columns link below thanks to user parfait i could do it using literal eval then i had a problem trying to apply the same solution until i found literal eval has issues with null values i got rid of nulls and some bad uses of quotes now i got this it seems that a column which is a dictionary has not one but two values which are dictionaries themselves i ve tried to pop and del those values but it seems the data is not considered a dictionary so i couldn t afford it when running df creator map eval i get the message appended below look to the avatar and api columns these two columns are not necessary for what i want so i could drop them but i have not find a way to do it to be clear i just want to extract id and name columns as cre id and cre name add them to the main df with prefix and deleting the rest of the column thank you for your help edit added first ten rows of the dataset,0,68,220 scrapy selenium extracts first link then throws error i m working on a scaper that collects property information the original code works perfectly using a list of all parcels it adjusts the url to go to the next page broken code there is a link to a pdf that is embedded in a javascript button the pdf contains more information that i want to scrape it will retrieve the first link but then throws errors error,python output not aligned using space and tab my code is here when i enter as input here is the output why last lines are not aligned edit i forgot to say that i know there are better solutions like using format but i just wanted to understand why there is problem with tabs and spaces edit the visualization of tabstops in jason yang s answer satisfied me,0,75,69 how to use gridsearchcv with a pipeline and multiple classifiers i built a modelpipeline which runs multiple classifiers and returns pipeline and scores of each classifier as a dataframe how to use gridsearchcv in the below modelpipeline is it possible to use gridsearchcv with multiple classifiers in pipeline,how to retrieve pandas dataframe from its string representation the pandas dataframe object has a to string method that is called on the repr magic method thus when i say x f df x is gonna be the string representation of the dataframe df how can i retrieve reconstruct the dataframe only having x so i would like a method called get dataframe from string df str pd dataframe that gets the string and returns the dataframe the method should be generic so it should work with multiindices as well,0,48,85 percentage of occurrences in a column using groupby in python pandas enter image description here suppose i have multiple entries in a column search term i want to calculate the percentage of occurrence of the brand i know how to get the count of each brand but can someone suggest a way to get these in percentage,applying qpe on a large matrix on amazon braket i m running a qpe algorithm on the amazon braket but it can only apply on a or matrix when i want to expand it into a or more it will come an error as i know there is no theoretical limitation on the size of matrix qpe can solve here is the main part of the code and when it comes to a matrix the error report is like so i m wondering if it s the packages problem or the program problem or any other had met the similar problem as i thanks in advance,0,57,105 how to pass variable to html emails sent from python i have this python script i want to pass a variable like first name age links from this python script to html template test html access and format them into html something like,python atributeerror io textiowrapper object has no attribute encode i m writing a code that sends emails to a list of mails from an xlsx file i want the body of the email to be imported from a separate html file but i m getting an encode error when it reaches line htmlpart mimetext f html io textiowrapper object has no attribute encode here is my code,0,41,64 sum two columns if other columns are equal i m trying to use pandas to add columns amount and amount only if account is in account input expected output my code,i m making a discord py bot that triggers a while loop and starts censoring bad words so i want to create a boolean variable that would normally be false when i say aimby initiate censor protocol it should make the variable true thus also triggering the while loop but for some reason the censorprotocol variable does not change states true or false and the bot doesn t read the text in the while loop plus i don t think it works,0,30,79 root after in tkinter stops after first iteration consider the following code instead of calling the function do something every milliseconds it stops after the first iteration is my understanding of root after wrong or am i making a mistake any help will be appreciated,what does this n method do what does n method do in this traingen n in train and evaluate model function this is the whole code i m trying to learn thank you for your help it keeps asking me to put more since i post mostly code so this sentence is just a filler thank you and my deepest apology for wasting seconds of your time to read this whole sentence,0,43,67 remove filter on a dataframe i would like to updating some cells after applying a filter to my dataframe to be more precise here is an example for the customer the total in pns brut psso is then i would like this result when i launch my code it applies factu in all the cells before after enter image description here do you know how to proceed,due to mdlable id does not have get attribute how to override on this as i m new learner on kivy language with python here is my code in my code i get a error like this self root ids timeday text self day n self date n self time file kivy properties pyx line in kivy properties observabledict getattr attributeerror super object has no attribute getattr if i remove this line then code is running and but time and date not updated i also trying with object property but still not get same error i also try parents widgets but not use with this error super is substituted with the real value because well it doesn t have getattr to keep my answer brief here s the minimalistic object that extends scatter object super gives you an access to a class you inherit from i suspect not sure that if you use string as the value for id you ll end up with weakref weakproxy pointing to a string,0,74,149 extract the first dimention of numpy array based on condtion on the rd dimention suppose that i have numpy array with dimension x y z and i would like to extract the x and y dimension on a condition on the z dimension for example if z how could i do that,using multiple conditional expressions within list comprehension i am writing a program to evaluate range which should return divisible by and even if a number is divisible by and even if the the number is even and not divisible by then it should return even otherwise it should return odd i need to use list comprehension to evaluate multiple conditional expressions my program looks as below output i am not able to understand why program is giving even and divisible by this is because x else odd is evaluated first which should return odd,0,52,102 this code is about selection sorting but when i run the code it is not working as expected the program only works when the no of elements is if it is more than it doesn t work output output,create dataframe from existing one by counting the rows according to the values in a specific column i have this dataframe what i want is another dataframe with the count of the rows wherever it is q in customername and count of the rows with the rest of the items in customername as given below where test represents q and test represents rest of the items pecentage column is total request count of coustomername which in this case is and,0,40,81 create a new column in a dataframe based on a date im new in python and i would like to add a column based on a date with several condition my data came from a sheet currently my code looks like this and i have this error message typeerror not supported between instances of timestamp and str i understand the error but i dont know how to resolve it,python bool compare vs string compare which is faster i need to process a very large csv file during the process the first line needs some special attention so the obvious code would be to check for the value in the csv line but that means a string compare for every line around another option would be to set a boolean and let the boolean compare come first in an or expression both options are below i ve checked that in an or expression the second part is not evaluated when the first part is true the boolean is initialized just above the for loop and set in the if statement when the extra processing is done the question is is the second option with the bool compare significantly faster no need to convert to so different question than,0,72,135 how to use selenium with firefox proxy in selenium x i need to pass through options as profiles are deprecated i am trying to use ff to proxy to a secure browser however i ran into a problem which is described below my code my output,trying to solve the collatz sequence project at the end of ch from automate the boring stuff with python at first i didn t include a while loop and i would have to rerun the program with the value from the previous time ie it wouldn t recycle the results back through the loop so i added the while loop to try and correct that now when i run it it gets stuck in an infinite loop brand new trying to figure this stuff out thanks in advance the instructions for the project are at the bottom of this link,0,46,100 django typeerror expected str bytes or os pathlike object not nonetype i am writing a webpage that can run a python script by clicking a button on html here is what i have views py urls py home html directory screenshot the problem is with this line of code out run sys executable test py inp shell false stdout pipe from views py how can i fix this thanks,knapsack with constraint same value i am solving a multiple knapsacks problem in python the problem is to pack a subset of the items into five bins each of which has a maximum capacity of so that the total packed value is a maximum the data includes the following weights a vector containing the weights of the items values a vector containing the values of the items capacities a vector containing the capacities of the bins the following code declares the mip solver the following code creates the variables for the problem the following code defines the constraints for the problem i try to add another contraint which consist that all items in the same bag should have the same weight but i struggle to do it in python can you help me to code it thanks,0,55,140 create multiple dataframes with for loop in python i need to compile grades from files named quiz quiz quiz i have the following transformation the code for one dataframe is the following i want to iterate the same transformations for all the quizzes from quiz to quiz i have tried a for loop but it did not worked thanks by advance,psycopg partial identifier result select from prefix prefixed table name what i want select from prefix prefixed table name or select from prefix prefixed table name how can i achieve this as a request from klin why wouldn t work one may simply enter which would result in,0,63,41 cannot retrieve many to many all objects in django when i try to retrieve all cart items from order model then click to open cartitem model edit page but i got first cart item only so what is wrong my code admin model order model,unit test optimization program pyomo i am implementing several optimization programs with pyomo so far i have written some integration tests with unittest on optimal objective value and optimal variable values i would like to write unit tests for each objective and constraints to make sure they are correctly implemented what s the correct way to do it,0,45,58 import databricks notebook dynamic content using workspace api import method i want to import databricks notebook using workspace api import method content of notebook should be dynamic i am trying using below code but it gives error malfunctioned request request contains invalid json body i have tried converting content to base encoded data and pass it in payload still it gives same error main thing i want to achieve is i want to generate content of notebook dynamically,google translate web gives two different translations chrome browser vs selenium chromedriver i m having a similar issue to this question but with german when i use a chrome browser on my pc i get one translation from but with selenium in headless mode i get a different translation as an example the following text gives two different results using chrome browser using selenium why does german murmeln get translated as murmur by the translation using chrome browser but as marbles when accessing the same page using selenium,0,78,87 good looking sphere in matplotlib i ve been trying to plot a d sphere with some curves on it using matplotlib but so far the my results are disappointing i ve tried with several rgb colors opacities and colormaps but the output is similar how could i do something like this bloch sphere that s just what i m looking for thanks in advance,how to get the cumulative distribution function with pymc i am trying to recreate the models in john kruschke s doing bayesian data analysis and am currently trying to model ordinal data chapter in the book this is the jags model that i m trying to recreate this model involves using the cumulative normal function pnorm in r i tried to do it as follows using scipy s norm cdf however when i run this i get an error typeerror unsupported dtype for tensortype object it occurs at the line i use norm cdf perhaps stats scipy norm cannot work with pymc objects so i was wondering how to use the cumulative normal function in a pymc model or how to make norm cdf work here,0,59,119 new column which is min of two other columns if condition is true if df freq i want to transform all values in freq new to the minimun between df freq cell and i try this and it didnt work,overriding aws auto scaling policy with lambda function i am working on aws autoscaling policy and is completely working fine with desired max and min as count of instances i also have one lambda function which starts my ec instances at am and stop my ec instances at pm this lambda function has applied on ec instances which is not a part of autoscaling configuration what i want this time i want to apply lambda function on ec instances which we have launched using autoscaling what is currently happening when i am applying lambda function to ec instances in autoscaling it stops those ec instances but with in a short moment it starts those instances due to autoscaling config rules so is there anyway by which i can override autoscaling policy thanks in advance,0,37,137 hide python login api process i execute broker module to get live price stock when i receive data the command shell show all process how can i print only what i want to print how can i hide login process and just show price line,improvements in the v pokemon battle game i m trying to create a mini pokemon battle game with some pokemons their movesets and their stats it was going smooth until a weird error occured in creating the pokemon s typechart line no to here s the code can anyone please help also i ll be glad to have some suggestions and improvements in this code,0,46,70 creating a new column using string match and based on if else condition i have a data frame with a column url text containing text output from an ocr i am trying to create a new column blocked where the rows equal if a condition is met and otherwise i have tried to insert the above code in the following function however when i apply the function to my data frame i get the following error,how can i simplify search results from whapi wikihow api i m using an unofficial api and when i use search i get long annoying code this is the code this is what i get back from the console,0,76,38 how do i fix a http error bad request in python i am trying to access checkpoint firewall by using it s api but for some reason i am getting http error bad request i have never had this before any ideas here is my code basically same thing is working fine with python this is python code,how do we write data from a dictionary to a new row in google sheets i wrote some code to gather the local business names postcodes addresses and phone numbers now i want to write them to the next row in my google spreadsheet in the order i want them to i m new to this use of the gsheets api can anyone explain how we could do this i have a list of dictionaries where each dictionary will be written to the next row in the google sheet for example lets say we have this list i ve only used one dictionary for simplicity but in real code i ll have more than one dictionary update im getting this error when using gspread method as seen below attributeerror str object has no attribute module here is the whole script,0,60,137 beautifulsoup extract text from head and head i m trying to extract text from source code on a page in the tag and i d like to extract this d fgdrsql is a dynamic data and i need to scrap precisely this key every day my script start like this but i don t know how can i do that,i want a new line when i iterate the same json while using it in lambda python but getting error i want a new line when i iterate the same json while using it in lambda python but getting error below is the code sample and this is the output but i want the json to have new like something like this,0,58,67 trying to automate to click on search button in selenium python module but it is not working i need help to automate to click the search button in this webpage the code works so far until i reach the search button below are the elements for this button the value named search is unique for this button below is the code,why can i run my pytorch dataset file from a python file but not a notebook i ve written a custom dataset class in pytorch in a file dataset py and tried to test it by running the following code in my notebook with the following code after some unsuccessful troubleshooting i tried running the exact same code in a file test py which worked without issues why can t i run this from my notebook for me the problem is usually the pathing somehow but in this case all of the files both py ipynb and data directory are in the same directory myproject i ve tried with both absolute paths as in the example and with relative paths but it s the same result in both cases i m using vscode if that gives any insight furthermore the error message in the notebook is list indices must be integers or slices not str unfortunately the prompt tells me the wrong lines there s a comment on the line where the error s supposed to be but if this is really an error then it should not work in a python file either right any help or suggestions are welcome,0,61,191 modin attributeerror when importing from sparse matrix i am trying to use modin package to import a sparse matrix created with scipy specifically a scipy sparse csr matrix invoking the method i am getting the following attributeerror while using the original pandas api it works anyone with a similar problem thanks for the support,drawing with mouse on tkinter canvas i found the following piece of code here it lets you draw on a tkinter canvas by dragging your mouse around it works just fine when i move my mouse very very slowly but the moment i move it a bit faster the lines end up broken here s what i mean screenshot of the tkinter window the line on the top was drawn slowly the one on the bottom rather quickly as you can see the bottom one is missing points in many places how do i fix this,0,51,95 how can i display error messages for the logging funtion in django i am a new django developer and i have some trouble with the login function my problem is that my system does not show error messages even though it is invalid i try to enter the wrong username and password and i expect there are some error messages displayed however it does not work here is my code login register html view py form py urls py,loop through different dataframes and perform actions using a function i have dataframes that have the same structure same number of rows and columns and i am trying to find an efficient way of performing several actions such as renaming columns with a for loop i have tried putting them in a list such as but it doesn t work another issue occurs if i try to use a function and then loop such as no changes are happening to the dataframes i have searched similar old questions but nothing have worked what is the best way to loop through many dataframes when you want to perform the same changes to each of them,0,74,114 how to download files from python azure function with post method i am creating azure python function which will eventually create kml file with some information and now when i call the function url with post method it should download me the file i have written simple code but its downloading anything can anyone please answer this,edit dict in string i want to edit string data i want to replace with every id in and want output to be i tried with format but it is not working,0,59,33 execute df grep w not parsing output correctly i am trying to run the shell command df h grep w using python to watch the root partition usage and wanted to avoid shell true option for security the code i tried as follows the output i get is expected output is,how to read multiple text file at once and find particular text between two text this code works fine if i operate with one text file at a time but if i uncomment last three lines and comment print statement to operate this code with multiple files at once then this code is not working it does not gives any error but also does not give any output this are my temporary text files with the values i want in it this is the output if i use the code for one file at a time and this is the output when i use this code for multiple files note this code are not completely written by me someone helped me on my last question on stack overflow i have also another code which i got from geeksforgeeks but it is also not working,0,54,144 python running error on macbook pro m max running on tensorflow i am trying to run this code from github binary bot on my new macbook pro max m chip metal device set to and i am getting the following error any suggestions,how to get ride of equal column in our panda data frame i have three data frames with sizes of df df df in my columns despite the different columns name there are similar data values all the columns in each three are equal but when i using for example although it must create the same output column but it convert the df df df how i can get ride of this,0,42,78 how to check the result of a function i have three functions i want to check if the port is open and if it is open perform function number two otherwise perform function number three i wrote the following code but it doesn t work,add value to column data of dataframe in pandas i have a dataframe like this i want to add to the value just before so the new dataframe will be like this i know we can for loop the column section then split the string by then add to the former value then reformat the string and assign to the cell assuming it might have hundred thousand rows i am wondering if there is more efficient method to do it,0,44,84 how to write the words one under the other when i enter this code it just seems like this code but it should be word by word for each line not letter by letter i can t solve it so here is my code,tensorrt object detection with typeerror only integer scalar arrays can be converted to a scalar index i have written the following code to optimize a tensorflow object detection model with tensorrt and then run inference on a jetson nano however it runs the inference but returns typeerror only integer scalar arrays can be converted to a scalar index without displaying the identified objects on the image here is my code here is a snippet of the error how can i solve this thanks,0,43,84 rolling sum based on all previous dates not previous rows sorted by date given the following dataframe i need to get the rolling sum of all previous dates as follows using gets me which isn t quite correct how would i get the sum of all previous dates rather than all previous rows,get the right data at the right place i have a json file and was able to extract some values from it and sum them up i want to be able to put the result to the right key but can t figure it out below is my code so this is what i wanted to do the result which is a will be placed a dictionary this way region a constituency a party d party c party b party a when vote for constituency b in region a is also calculated the result will be added to region a with constituency b as the key,0,52,108 how to add index to a csv file that doesn t have an index using pandas in stack overflow i see a lot of questions about removing index from dataframes made be to csv however what i want to do is add an index to an already made csv file with no index here is my file how do we add an index to this csv with pandas,how do i get bar labels in plotly graph objects to display in the same format as the axis i have created a simple bar chart using python plotly graph objects but i have not been able to find how to get the bar labels to match what is on the y axis here is my code this results in this visualisation the axis is correctly displaying as percentages but how can i get the bar labels to so for example instead of i would like the blue bar to read and so on,0,66,95 combine two columns with comma delimited strings into one column with joined unique lets say i have a dataframe as following i need an output as,python argparse with two defaults when the argument is and is not specified for the argument f i want it,0,26,20 convert pt to pth i ve been trying to compile my custom trained yolov model using sagemaker neo the compilation gives an error the weights are a pt file is there a way to convert the pt file to pth,how to return manytomanyfield as object in django restframework api i tried to create an api with django restframework so i created models note and task and have a manytomanyfield in note model so i can put many task in a note but the api i created don t return full object feature but just the id here is my code here is my models and i want the out put can looks like but it actually be like this so what i can do to have the out put like that,0,40,92 how can we create object in desire database in rest framework i m creating project but that project is saving in the default database i want to create that project in other database i m using creatapiview i don t get it how can i use that using otherdataname in get serializer,adding to set if part of tuple not exists i would like to use something similar to the add function to add tuples to a set however i want them not to be added if a part of that tuple already exists in the set for example this gives me a result as but i would like the a b combination to only appear once the first time it is added so that my result is,0,47,74 error while builder loading in kivy invalid indentation must be a multiple of n spaces so i ve been working on a kivy app and was having some trouble with builder loading some kv language the code crashes when i run it error message code what am i doing wrong can someone help me to fix this error,how does a method of a class class run if you haven t instantiated an object for that class referring to python s testcase class i am fairly new to python and programming in general so this may be a noob question but i was of the understanding that in python when you create a class and you create x methods within it that if you want to leverage those methods you need to instantiate the class or create an instance of the class i am reviewing the testcase module testing goat for tdd and i notice that we can run the program performs all the logic within the methods of the classes without actually creating any instance objects to call those methods directly so my question is how is it running ex when i run python manage py test this will run even though i haven t created an instance of addstuff i don t get it,0,57,151 issues running a face recogition file using editors and cmd when i run the code below in jupyter it is excellent i get the results i want but when i copy and paste the same code to an editor atom the one i am using and then run it using command prompt i get an error as shown below i activated the environment in which i was running the cmd can someone advise me where i maybe going wrong,writing pandas dataframe groupby results to s bucket i have a large dataframe i am trying to break into smaller piece and write to a csv file in s for testing purposes i have the groupby size set very low but the concept is the same here is the code i have the chunks are working correctly and the files are all being created as intended but they are all empty not sure what i am missing my understanding is that the g to csv data should be writing the csv body to the bytesio object which is then what i m using to write to the file maybe i m misunderstanding that,0,77,107 keras preprocessing number of samples i have been utilizing the keras preprocessing method keras preprocessing image dataset from directory here is my x and y train batches i wanted to know if there was a way to collect an equal sample size for each class below you can see the number of sample images per class in the target directory,valueerror received a null pointer i m writing a code to convert geotiff files to png pillow didn t work for me hence i am using gdal am i missing something in the code the code is as below,0,55,37 problems with putting the apply method the error i am getting is the following int object is not iterable i think i am applying the apply function correctly but still getting an error,why converting numpy array into csv file show no attributes name but rather put the first row values as the attribute names i have a dataset that i handled its missing values using numpy the result was numpy array then i converted the array into a csv file but the dataset appears without the names of the attributes but rather they put the first row values as the attribute name how can i add the attribute names again example of the dataset after conversion,0,33,84 how to get the status of button in tkinter i want the function checktime to be called when my button is pressed but how to get the status of my button and compare it i want to use the function only if the button is pressed as a test that the user agree with his inputs,pandas return dataframe rows that are not numbers between and i have a dataframe in value column i have strings that may contain a number as string n a or any other string i need a code that will return me any values that are not in this range x like this i tried something like this but it works only when there are only numbers and string numbers it fails when converting nodata to float i thought that i could first filter out all rows with strings that are non convertible to float then perform the above operation then concat it like this but is this pythonic is there such a function edit for wilian thats my data before and after output line and are missing at the same time from line or n a from are catched the problem is clearly with in excel is and is just but the point is that i can t trust that data and there might more more sources in the future so it must all happen here,0,57,188 locally save a dataframe from a remote server in vscode i m running a python script in vscode on a remote server and i want to save a dataframe that is generated in that script locally is this somehow possible thanks,python merge based on a partial match improving performance of function i have the below script which aims to create a merge based on a partial match functionality since this is not possible with the normal merge funct to the best of my knowledge the below works returns the desired result but unfortunately it s incredibly slow to the point that it s almost unusable where i need it been looking around at other stack overflow posts that contain similar problems but haven t yet been able to find a faster solution any thoughts on how this could be accomplished would be appreciated,0,40,104 add a new column with matching values in a list in pandas i have a dataframe such as and i would like to add a new col column where if within col i have a match with a value in the list i add in that column the matching element of the list expected result,pandas get top n columns based on a row values having a dataframe with a single row i need to filter it into a smaller one with filtered columns based on a value in a row what s the most effective way for example top features,0,54,45 can t convert tab delimited values from string to float data in my dat file are arranged like i am trying to plot with matplotlib here is the code for reading the data but it shows the error valueerror could not convert string to float what can i do,why tf matmul running on cpu i encountered some problems while training my model specifically the training speed is sometimes fast and sometimes slow fluctuating between iters per second after i used tensorboard to check the network operation i found that the tf matmul node was running on cpu device as follow this makes me quite confused i try to use tf device gpu to enforce that node running on gpu i also tried to lower the tensorflow version but none of these work below is my code by the way the tensorflow version is gpu is rtx,0,49,95 scraping tabbed table from aws pricing i am trying to builder scraper to scrape tabs which are tables in this page i am only interested in the data thats training processing and few others but it looks like i have to use some sort of a dynamic mechanism to get the tabbed switch assume we clicked on training tab my goal is to build a file that stores scraped data,mocking methods called within multiprocessing doesn t work on mac i encountered a very weird bug in my project i have unit tests where i mock some methods download methods for instance that are called within a multiprocessing operation those unit tests work fine on my ci but when i try to run them locally on mac osx the mock isn t taken into account i implemented the following minimal reproducible example that i launch with if i launch those tests within the docker image python buster with pytest installed they are all successful but if i launch the same tests directly on my host machine mac osx within a virtualenv with only pytest installed i have the following output,0,71,117 how to predict with affinity propagation in python i am trying to train and predict with an affinity propagation model for the first time here is my code however when i run this i get the following error am i misunderstanding how affinity propagation works with prediction i want to be able to feed my trained model new data does the number of dimensions i e length of each sub list need to be the same as the trained data,exporting d points to blender via the ply format creates an empty object while it works in meshlab i made a python script to create a ply file using the image and the cloud of points of a scan d stored as a numpy array i can open the resulting file ply in meshlab it works well but when i import it in blender there is no point the resulting object is empty do you have an idea on how to solve that thanks,0,78,83 having problem with the usage of driver find element by selenium i am trying to make a bot that auto logins to a website in order to write the username i m trying to use when i m looking that spesific variable from website on inspect the varible is two word like matinput formcontrolname on any other website if that varible is one word like id i simply write id after by and it works what can i do in this situation,how to save a entry widget tkinter as a variable im trying to make a application that takes in a url and in return returns that url back to be proccessed with tkinter but i have tried everything and its not working how would i do this i am trying to save the txtfld entry variable i tried passing that variable through but it wouldnt work thanks,0,79,67 problem connecting to mongodb atlas using python i have a problem connecting to mongo would appreciate help thanks and error,python function template for time series data i want to process some array list timeseries data and want to use many different filters for this this led to two problems i don t want to copy paste the function every time especially if i change something also with different dependencies there might be a dependency on the previous or n th previous element or n th following element the array that is looped over can go out of bounds if i don t adjust the ranges the conditions for the filters could be arbitrarily complex but always involve relative position in the data here is a minimal example my idea was to somehow compress the conditions they are more complicated in the real example use a converter function to make the real condition out of them pass it as a string to a template function and then use the condition like this any ideas,0,20,146 how to pass a variable as an argument of another function in python i have a list chart list and i want to call them one by one and plot the chart but i face an error how can i deal with this problem i know that they are strings but i don t know how to give it to the tickerdf,implementing an unbounded min priority queue using a singly linked list in python i am doing a class project and i have to implement an unbounded singly linked list using python i need to implement a given insert that has to consider the following cases insert into an empty queue insert at the front of the queue insert after some existing node this is the class given in python and i need to implement the insert function given at the bottom i am new to this so any help would be greatly appreciated,0,60,93 store formatted strings pass in values later i have a dictionary with a lot of strings is it possible to store a formatted string with placeholders and pass in a actual values later i m thinking of something like this the above code obviously doesn t work but i m looking for something similar,dictionary entries are all the same i am using nested loops to fill the entries in a dictionary each entry in the dictionary contains a numpy array each numpy array contains three values each dictionary entry is supposed to contain a unique numpy array but when the script is run all of the dictionary entries are being filled with the exact same numpy array each one should be different after trying to debug i realized that the repeated entry is actually the correct value for entry the very last one i m not why this is happening because the command print ic sub units is outputting the correct values in the i o console but when i try to store them in the dictionary all entries turn out the same i m guessing the issue is in the last piece of code ic units i ic sub units i ve been trying to solve this for hours on end it s probably something really simple any ideas printing ic units produces the following output for dictionary entries through the value shown below is the correct value for entry but for some reason it s appearing in every dictionary entry,0,51,191 removing rows in df based on counting filtered data pandas i have a dataframe that contains id month of transaction i want to keep only the stores that have transactions in months i tried first to filter by unique as follows i got from the code the store id and the number of months the problem is not all stores ids appeared so i couldn t get them to drop sample of data enter image description here,http server simplehttpserver serve file html instead of dir using cmd is it possible to serve not a index of a directory but rather an html file using python simplehttpserver on path having directory with one file login html serves a directory index on path i want a content of login html on is that possible,0,79,55 svgwrite only works in idle inexperienced in programming svgwrite scripts only work in idle for me let s say you have this what would you need to add to make it run normally thanks for any help,solve two simultaneous equations one contains a python function on the below map i have two known points a and b with their coordinates longitude latitude i need to derive the coordinates of a point c which is on the line and is kilometres away from a first i created a function to calculate the distances between two points in kilometres then using the slope and the distance the coordinates of point c should be the solution to the below equations then i try to solve these two equations in python the error is typeerror can t convert expression to float i may understand the error because the get distance function is expecting inputs as floats while my x and y in eq are sympy core symbol symbol i tried to add np float x but the same error remains is there a way to solve equations like these or do you have better ways to achieve what is needed many thanks,0,36,156 django manytoone reference multiple tables right now i have the following model that i d like to be used in different models i want to store the day of the week and time in different models from the docs i d have to create a foreignkey field in the above model to accommodate the manytoone reference example this doesn t sound right to me should i create different daytime model instead thanks in advance,python pandas plot data to line chart error i have mssql stored procedure that returns the needed values i have been able to connect and reference this dataset through pycharm however i am struggling to create a line graph from this information here is the dataset of the sql code here is my code when i go back to review the dataset that it returns i get the following i thought maybe it was a datatype error and converted each column to an integer like this it worked at first however i ran it again later and it started to error out i reviewed some other questions and tried to apply the solutions to this issue but to no success any idea s on how i can correct this issue update i figured out that the hour index is causing the nan data issues and have adjusted my code to the following now that code is returning the following graph the data within the hour column is considered an object data type and should be the x axis on this chart however when adding that to the index it errors out any suggestions thanks again for all the help,0,71,197 how to set field value expiration time i have model user like this i set in the field myfield value foo after i want to set in the field myfield value bar for day and after this period expires the value becomes foo again automatically how can i set that expiration time is there any native django instruments for this,vertex ai viewing pipeline output i have followed this tutorial to create my first scheduled vertex ai pipeline to run every minute the only thing it does is prints hello any greet string and also returns this same string i can see that it is running because the last run time updates and the last run result is success every time my question is very simple where can i see this string printed and the output of my pipeline,0,61,78 what am i doing wrong in this reverse traversion of lists in python i ve written this code that should iterate through the list data backwards and delete any outliers outside the max and min values code this is supposed to remove the values and however it doesn t happen in my output output output of code this isn t removing the number from my list what am i doing wrong,pygame tetris filling entire column okay so i m using pygame to make tetris and my problem is that when the piece hits the bottom the program draws the blocks to the entire column instead of only the rows it is meant to i am using a board object with a dimensional list of block objects i think the problem should be here it seems like the program is filling the entire column with blocks with exists true but i cannot figure out why my logic for if when the piece hits the bottom the reason i have that weird math for index row index col is because the board is a pygame rect object with dimensions so that is simply the algorithm to convert the pixel value to the index of the list it is probably helpful to have an idea of the piece class also this is the function that actually draws the blocks i do not think this is the problem but i should probably still include it example of problem,0,73,173 pdfplumber memory hogging crash with large pdf files using pdfplumber to extract text from large pdf files crashes it,finding min max and avg of every n values in a list i have just started learning python for data analytics and i found a simple but unsolvable for me problem i want to find min max and average of every n numbers in a list and i am stuck on the best and fastest way to do it do i have to split the list on sublists and then join the output or is there a faster way for example i have a list of and i want to find the min max and avg of every numbers and append them on seperatily lists like,0,19,105 automatic counter as a subclass of integer is it possible to create a class of integer where an instance of a certain class say automaticcounter will increase itself by some number say each time it is called this is what i have tried so far,select sets to create a complete list i want to create a complete list with given sets i have several sets in my solution like the goal is to select sets to create a list with all numbers from to if it is not possible create maximum coverage for example above is an example i need to write an algorithm to find the best sets because i will have at least different sets could you help to find a solution thanks,0,46,84 extended unpacking not creating separate items in list i am executing the below code i am getting output as tho please help me understand why the output is not t h o as we are using the operator on lhs so the output should be t h o and not tho,can a function and local variable have the same name here s an example of what i mean the code doesn t produce any errors and runs perfectly this contradicts the idea that variables and functions shouldn t have the same name unless you overwrite them why does it work and when applied to real code should i use different function local variable names or is this perfectly fine,0,53,65 is it possible to run threads in while loop i am trying to run a thread in while loop but i am getting the error runtimeerror threads can only be started once kindly suggest a way to fix this,python negative timedelta object i m writing a python program that needs to do nothing between and depending on the time zone of the proxy it uses proxy time is so the timedelta future astimezone proxy timezone proxy time returns should be hour and minutes but instead i get a timedelta of day and and a half hours,0,39,60 triangle mesh generation of d objects using python hey everyone i m pretty new to graphics programming and i want some guidance or working samples i want to make any d objects but for starters i want to make a d cube using triangle mesh with given coordinates via python and export all the mesh in an obj file so i can load the mesh and view it in meshlab i would really love some guidance on this thanks,save copied data to different excel files i m trying to save different parts of copied data from one excel file to the correspond new excel file but i m getting everything on one new file what am i doing wrong for example in the picture i want to have new excel files with the names aaa bbb ccc and ddd the separation is every time a blank row appears the data to be copied will be from that row until the next blank row all columns thanks,0,78,87 plotly dash python the value property is a number and may be specified as an int or float i am having a problem with a plotly graph objs i am trying to make a dash to visualize data while specifing values the value property is a number and may be specified as an int or float i get this error and i dont know why could someone please help me find out what is the problem,python hexadecimal convertor i have the following hex string i am close to fully converting with using i get the following i am clearly missing a step in the decoding if i insert the data into this site i get something far more readable albeit not perfect,0,78,48 verification for successful or failed login i would like to check if after the request i successfully connected to the site or not i tried several methods that i know but nothing works can someone help me please,flask sqlalchemy create views with postgres i am using a flask sqlalchemy postgres database model with the following style my goal now would be to create a view which holds all tracks completed by users in plain postgressql it would look like this the user model would look something like this i can not any way to create views with the flask sqlalchemy module there is a sqlalchemy views module which i can not get to run in my flask app anybody got a good idea on how to model something like this any help ist appreciated,0,38,93 javascript await and python await are they same concept from a user point of view when we think of for loop we could say for loop in javascript or python are the same thing conceptually can we say await in both languages are conceptually same i smell this can be a bad question but albeit interesting question for me,building a dynamic regex string in python x i m attempting to dynamically build a regex string for a match check it will use part of users input the problem i m facing is when i build the string which uses numerical digits d for example it ends up with an additional backslash to escape the initial one so the re match never works i initially thought this was a simple problem to solve but after lots of googling and failed attempts at arr what if i must be missing something any pointers or insight would be appreciated,0,59,95 adding numpy arrays to specific indices of a list i have a list of numpy arrays and want to add two more arrays as the first and last indices of the list these are my list and arrays then i want to have a complete arr which is i tried the following method but it did not give me what i want i very much appreciate if anyone help me to do it in python,unable to create environments file path not writable mac m chip python modules hi i m trying to install tensorflow for mac m chip os post installing the application and trying to install numpy and jupiter notebook using the below command i get the error i went to the folder and changed the permissions of the file manually it did not work i ran the command conda from the terminal it did not work i removed all the folders for anaconda and miniforge multiple times i get the same error any suggestions how to get this to work regards ren,0,76,101 nattype object has no attribute dt error when comparing null and not null stack overflow i am trying to create a column using the defined function below the goal is to count the number of days between dates based on the condition of columns however i am getting an error nattype object has no attribute dt i have also tried isnull notnull thanks for your help you are awesome,numpy is double transposition necessary in this specific case i have an array and i would like to reshape it to obtain i can achieve it via but it has to be transposed twice which seems unnecessary to me so could somebody confirm that this is the only way of doing it or provide more readable solution otherwise thanks,0,71,59 calculating the difference between dates with certain parameters from data frame i am interested in calculating the time difference in days of time between orders from the same provider source data frame the ordernumber and catid are not interesting i want to calc the difference between date in same customerid target dateframe the ordernumber and catid not interesting original data,module not found error with python in docker my directory structure i can build this and run it fine but when i add another py file to my project like this and i try to import a function from handler py in main py like this then main py gives me a nomoduelfound error for handler py can someone explain how to fix this and maybe also explain why this error is happening,0,60,70 using for loop to replace bad nucleotides from dna sequence i have a list of sequences for simplicity like the following one and i want to use for looping to replace every instance of a nucleotide other than a c g t with n my code so far problem is the nucleotides are not replaced and nothing changes in the original sequence and i can t figure out the reason,how to open a new window which is in another class in tkinter so basically i want to open a new window whose code is in another class from a button click this button is in class how can i accomplsh this the function is open main window an the button is sharingan i just want to open a new window when this button is clicked what code should i write in the function,0,66,72 remove group if contains record with status i would like to group records by id from df and delete group if any of records has status output i would like to get i tried dfnew df groupby id filter lambda x x status but i got the error typeerror filter function returned a series but expected a scalar bool,how to add a new py file using tkinter python i want to create a button in a gui and attach a function to it the function should include some code that duplicates a python file and pass some arguments to it also i want all of the created python files after clicking the button to be displayed in one window and arrange them using the built in grid tkinter function is this possible,0,60,74 give variable to callback function with yield in scrapy i have two function at first parse is called and parse each is called in parse now i want to pass some additional parameter to parse each so what i want to do is like this i am afraid it might be impossible but is there any good way to pass the additional data to callback function,confusion when importing django generic class based views while exploring the reference documentation and some tutorials i have seen the import for django s generic class based views used in multiple ways or i have tried experimenting with both tactis and they both seem to work yet the first option seems less correct do all the generic cbvs also exist within the generic module a well as the submodules can python import classes from submodules by only importing a higher module what is actually happening here any help would be greatly appreciated,0,64,91 use domain in act window odoo i worked with stock picking model i added a button in the form view when i click in this button i want to create a new record in helpdesk ticket model with domain of field product id same of list of products in stock move lines here is my code i tried it with domain but doesn t work any help please thanks,why is x y nonetype i m having problem with my code jupyter ordered pattern vacuum cleaner with obstacles i am loading an array from a file see picture if needed then i have a function and then i use the code in i get the type error cannot unpack non iterable nonetype object in the last line as you can tell from the code i am new to python so maybe you are able to help with a simple explanation thank you,0,66,80 how to keep special characters together in word tokenize i have nlp problem that involves some coding assignments such as fn point extract isolate r and when i use word tokenize the assignment is split like this fn point extract isolate r i did the following how to keep as one word since it is an assignment operator in c programming language,how to add a new py file using tkinter python i want to create a button in a gui and attach a function to it the function should include some code that duplicates a python file and pass some arguments to it also i want all of the created python files after clicking the button to be displayed in one window and arrange them using the built in grid tkinter function is this possible,0,56,74 function is not modifying the argument alright this function s supposed purpose is to simply modify the object matrix accordingly with the dictionary comprehension however i don t want it to return anything i just need the modifications to stick is that possible,building a grid out of flowbox gtk what i m aiming to do is build a x grid from within python gtk using the flowbox widget the screenshot shows i m doing the x perfectly the problem is that i wanted the buttons to look like smaller squares and not fill up the whole screen i realize i might have to do this with the grid layout but i m just hoping that this wouldve been accomplishable using flowbox for simplicity any ideas update i made some tweaks but now i get this issue where my window height expands from what i originally set it and i tried everything to eliminate the xtra space the window also expands when i add like an character or more label to the button,0,41,128 value is getting changed after assign it to dictionary in python i have created a inputjson variable and then replacing to a and creating a dictionary and assigning to json key but the output of newjson variable and dictionary key value is different in dictionary output is replaced by can anyone help me with the reason behind this issue how can i acheive below output in python,how to use python to click on an email link to download data i am trying to read a specific email from my mailbox and i want to click on click here hyperlink to start downloading the excel file on my laptop i am trying below code import smtplib import time import imaplib import email import traceback org email gmail com from email myemail org email from pwd password smtp server imap gmail com smtp port def read email from gmail try mail imaplib imap ssl smtp server mail login from email from pwd mail select inbox data mail search none all mail ids data id list mail ids split first email id int id list latest email id int id list for i in range latest email id first email id data mail fetch str i rfc for response part in data arr response part if isinstance arr tuple msg email message from string str arr unicode escape email subject msg somesubject email from msg igotemailfrom something com print from email from n print subject email subject n except exception as e traceback print exc print str e read email from gmail can someone please help on how can i just click on the link click here to download data from email i am fetching,0,70,173 python defining business days and working hours i am looking for guidance on how to create a variable business time which contains only business days not weekends and where i can set working hours am pm gmt the reason for this is because i m trying to calculate some sla s how long employees have to complete a task however if the end time falls outside of these business days hours then i can set it to a specific time many thanks,what is the equivalent of side effect for a property mock in unit test i want to mock a property to return different values in order like when you use side effect on a magic mock right now i m doing this any idea how to mock it properly,0,79,47 starting multiple discord tokens discord py how would i be able to start multiple token with discord py discord python with fetching the tokens from and external and then run each one how would i be to give them a random status,python coverage specify the working directory i have a django application called edison with multiple django apps in it i run tests on them using coverage my repo structure is in my tests files i import stuff from internal packages directory and when i run the coverage commands i get the error modulenotfounderror no module named internal packages my question is how do i change the working directory of coverage to be the root directory so it will recognise all modules,0,40,80 no such file or directory discord py filenotfound is not working i m trying to make a discord bot with sound functions like a soundboard the command should play a sound which the user types in the command if the sound doesn t exist it should send a message that it doesn t exist but if the error lib media sounds foo mp no such file or directory occurs it doesn t react and doesn t send a message i hope thats enough information,how to hide ignore task in flower dashboard for celery i used this tutorial to create a rate limit for my celery tasks that works over multiple queues workers it uses the concept of a token bucket a function creates tokens in a queue in a specified interval the actual task can not run if there is no token available in the bucket pretty cool here is the task that creates the tokens i also use flower to monitor celery tasks the problem is that the tasks that is creating the tokens is polluting the whole dashboard if for instance i have one queue that can handle tasks a minute i will also see completed token tasks in my dashboard is it possible to ignore one specific task in flower i have searched the docs and tried to manipulate the task with format task in flowerconfig py but without success so far,0,75,151 tkinter center label in the gui above is my code for a tkinter gui but i want the have the label at the center of the root window how do i do that currently its sitting on top of the buttons everything else is fine the button events and such works,python dynamic keys in nested dictionary i am using the django shell to try to create such a dictionary but this pieces of code dict section category x change the price element one in two like the result below how can you keep all the elements,0,50,45 how to get max avg in collections dict list in python i have collections defaultdict list created using collections library this inside some for loop iterates and generates the dict list now i need for all keys the max value and average value i searched and couldnt able to get answers,networkx edges do not connect with node borders but instead edges start and end in node center my networkx visualization edges do not connect with the node borders but instead edges start and end in node center the edges do connect with the node borders by setting arrows true however i do not want arrows when i set arrows false the edges do not connect with the node borders but instead edges start and end in node center as shown in screenshot without arrows edges start and end in node center with arrows edges start and end on node border there are a handful of other similar questions but the answers are not helping one suggests defining nodes a second time which doesn t fix this for me another one suggests using zborders and it doesn t seem suited to my situation there must be a simple fix for this it seems such a basic feature as code indicates i have dynamic node size and edge weight which may be part of my issue,0,47,170 search json tree with python i have a json file that looks something like this the letter i need to check if the json file is a and in the json is a v or an r how can i proof this i am like this now in python but i want to know what letter stands on the position from v thanks for the help,using radiobutton functions and submit button to change boolean value i posted an earlier question and since then i have added user interface to my program and i got stuck what i m trying to do is ask a series of questions with radio buttons yes and no as the answer with a submit at the bottom of it but i have no idea how to change boolean value inside a certain question for example and then i have set up boolean values for each question but i don t know how to change it to true with the yes answer and false to the no answer here is this part of the code from my program sorry for the repetitive code i m still learning how to code and how to manage it,0,66,131 how can i find time complexity for while loop and power statement i m trying to find the time complexity of two python statements here is an example of a program statement,translator on python not working coming with error saying baseblob translate got an unexpected keyword argument the code basically asks user to input a number and converts it into the spelling for the number i need to make a translator for the output on the gui it has a combo dropdown box and the user can select what language it needs to be translated to however the code does not work what should i do whenever i change the language an error saying baseblob translate got an unexpected keyword argument comes up i made it so a message box shows an error,0,31,99 how to communicate between two raspberry pi via bluetooth and send sensor data from one pi to another i m working for some school project i want to send temperature sensor data from one raspberry pi to another pi via bluetooth i searched a lot for tutorial but i didn t find any related tutorial please anyone help with this or any suggestions would be very helpful,change y m d to y m csv manipulation taking data from a csv file trying to change the dates to the right format ie change from to this is the code right now it says the file has unconverted data and i don t know how to fix it,0,67,48 pass input value to dialog and send to screen i have the following code where i would like to be able to click on the navigation drawer select status under users input the name and then be sent to a given screen with the current user now populated main py navigation drawer py questions you can toggle commenting on the two on release below to see the issue,how to post a list of pydantic objects that contain datetime property by using aiohttp to fastapi endpoint i have a small web server and a python file that posts to the endpoint it works i can get an output like if i set data as no dict it doesn t work because item is not json serializable my goal is to post list of items to the fastapi endpoint this working example doesn t work if i extend item as this created at is a datetime and even i em using items dict it is not json serializable funny thing is that if i create an item as its json is perfect but as aiohttp session post json uses non pydantic json encoder item is not json serializable i tried to create a new pydantic object end set it as again pydantic is clever enough to produce proper json but i am not sure how to send such json using aiohttp post my question is how to by using aiohttp post a list of pydantic objects that contain datetime property to fastapi endpoint i would be satisfied with sending receiving list of itmes item item item,0,63,191 how to open a new window which is in another class in tkinter so basically i want to open a new window whose code is in another class from a button click this button is in class how can i accomplsh this the function is open main window an the button is sharingan i just want to open a new window when this button is clicked what code should i write in the function,how to transform pandas df containing boolean columns into a heatmap compatible table i have a table something like this where each cell is containing whether the row is connected to the specified column i want to transform this into a table like this where each cell contains the number of rows from the original table that has both connected to the specific column and row name in the second table for example the in the second table means that there are rows in the original table that is connected to the b and c columns the goal is to plot a heatmap from the second table using plotly,0,72,111 how to aggregate predefined intervals on a pandas series is there a way to aggregate e g sum mean intervals along a pandas series i did it the long and non elegant way but i feel like there has to be a built in way to do this since people do a lot of time series analysis with pandas this isn t time series btw maybe with use of the pd interval object,python how to delete first line of word file and font bold not working i am writing a python program that open a docx file and writing text into it using aspose words and i have two problems evaluation only created with aspose words copyright aspose pty ltd and i want to delete that line after i creating the file i can delete it manually so it s deletable here is my code,0,68,70 unsingning a signed value django rest i am using web personal sign nonce web eth coinbase callback to sign nonce at the front end but i am trying to build the backend in django rest using this to unsign the signed nonce but getting an error error does anyone have any ideas about how to unsign this nonce,detect changes in virtualbox guest click on it using python if we have a virtualbox guest running android is it possible for python maybe via vboxapi or a similar library to the clicking at a particular screen coordinates can be done using console mouse putmouseeventabsolute but how can we detect changes to the virtualbox guest display,0,53,55 how to avoid circular references in a dict like object in js consider the following example in python the function dict is very useful bc we do a new object thus not using the same pointer and therefore avoiding circular references how to do the same in javascript node the following falls into circular ref thank you,attributeerror nonetype discord py code error file main py line in on ready await member edit suppress false attributeerror none type object has no attribute edit i ve already enabled the privileged gateway intents and i don t know why i still have this error reason,0,56,39 how to grab all the name keys once i wanted to grab all the name keys at one time but all the first dict key aren t the same meaning e g etc how to grab name from all of the above keys once,how to make invisible telegram python mention i need to make sure that the mention of users is not visible it seems like this is done somehow through links but i don t know,0,43,34 how to use guizero slider to change global variable python i m quite new to programming and i am trying to control a dc motor with a raspberry pi i m trying to use a guizero slider to change a global variable motorspeed however if i run the code the motor will only run on the initial variable set thank you ever so much,i am trying to get the api from another module everything is corrects i dont know why i am getting this error,0,62,22 regex must match a word not to replace and a pattern to replace in a line with regex can be pcre or sed but can also python please specify i want to remove all occurrences of the lines that contain a single letter comma g and with the word labels so for example in these lines to what i ve tried,no such table users customuser in django i am trying to create an extended custom user model that adds a level field of to the user model which is not displayed on the form but when i try to do this i get the error no such table users customuser i am new to django how can i implement what i described earlier and what i am doing wrong just in case i have done migrations here is a structure of the project models py forms py views py settings py,0,59,86 pandas merge with left option is losing rows in left data frame i have dataframes the first left dataframe has rows second has only rows when i try to merge these dataframes with left option i get only rows here i get raws reopen the first dataframe here i get raws with marks how can i avoid reloading the first dataframe or fix this problem,signing payload in js frontend using ec and validating in python i have a python backend that generates public private keys generates a payload then needs to get that payload signed by the client reactjs or pure js which is later verified the implementation in python looks like this imports generate keys sign verify what i need now is to load or even generate the pem keys on the client side then upon request sign a json payload that can later be verified from the python backend i tried looking into the usage of web cryptography and cryptojs but had no luck i m okay using another algorithm that is more compatible but at the very least i need the signing functionality fully working i also tried compiling python to js using brython and pyodide but both could not support all the required packages in simple terms i am looking for the following generate payload python sign payload js verify signature python any help advice would be greatly appreciated,0,71,167 hide turtle problems am trying to create a opening screen for a pong video game however am struggling to hide the turtle pen when it s going down from the center,two identical tables yields different dp results i was solving a hackerrank problem that is just a plain implementation of longest common subsequence this kept giving me the wrong answers even though i know i was implementing the algorithm correctly on a whim i then decided to try initializing my table differently i found the following d array initialization len s for i in range len s the only difference is instead of multiplying the outer brackets by len s i do the row expansion via a for loop pressing submit and voila it accepts the answer curious i tossed the two tbl initializations in the python console this is surely strange behavior even printing the table contents to the terminal proves identical structure does anyone have any idea as to what would be causing this disparity in output thinking this maybe had to do with how it was compiling i tested the function locally with the hr given test case inputs s shinchan s noharaaa and yielded an incorrect lcs of with my broken table init and the correct lcs of with the one i found online,0,30,188 error catching incorrect number of arguments requested when calling the function i get an interesting problem let s take such a function for example how we can handling this error in this case and in this case of course i mean handling this bug in the function body my attempt to intercept a typeerror is unfortunately invalid,using a function to create a string from numbers i am trying to create a function in python that returns the top ids by a given column as a string that will be the value of a new column for example if the top ids are the output should be when i apply the function i have it just returns blank values for context here is what my dataset hf looks like here is my current function and here is how i am trying to create the new column any help would be great thanks,0,59,108 cluster values within two columns in groups in pandas i have a dataframe like this and i would like to cluster into groups the val and val values for instance and i should then get here is the dataframe if it can help,question about python string q how can i fix this i m taking a python intro course and couldn t solve this problem make this string correct and store it in a variable named q any help would be much appreciated,0,44,49 how can i test aws cognito protected apis in python i m trying to test out some aws apis that are protected by cognito i found the first part on how to get the json token but i can t figure out how to use the token correctly so i can authenticate on the api here s my code i m getting the following error message,how to link hdf files generated with pandas assume we have a folder with hdf files generated by pandas to hdf i would like to create one master h file that contains external links to all the dataframes according to the documentation of h py the standard way to do this is but files generated by pandas to hdf contain not just datasets but h py groups how exactly would you then set up the external link to work,0,64,70 redis get stuck indefinitely i am trying to connect to remote redis server using python for that i am using version redis but when i print redis get it is stuck indefinitely below s the code snippet this is working now had to add ssl true for my remote connections,filter time in a dataframe using python i have a column where there is only time after reading that csv file i have converted that column to datetime datatype as it was object when i read it in jupyter notebook when i try to filter i am getting error like below code sample data here i am trying display the rows whose appointment time is between to datatype info could anyone help thanks in advance,0,47,75 scapy error scapy exception can t attach the bpf filter i found a wifi scanner written in python on youtube direct github script link but i m having an issue with bpf filter as scapy error scapy exception can t attach the bpf filter script output i installed scapy and am running this code by python on m mac any ideas,how to keep dpi of sliced image the same as the original image in python cv is there any parameter to specify the dpi of sliced image i want to keep the original dpi instead of changing the dpi,0,57,39 weird at top of csv file while using pandas with dictionary i want to print a dictionary into a csv file dictionary is containing a subject code as a key and a mark that one student got as a value here is my py code code prints the dict here is csv file i don t know what is causing the at the top any help update printing the data frame brings this,read image byte by byte doesn t work python i have this function that writes image to a file byte by byte the function stores in the first bytes the amount of the rows in the image the next bytes it stores the amount of columns in the image and then in every byte the pixels rows by rows then i have this function that reads an image byte by byte but when i show the image it shows white picture anyone knows why also i could not figure out why this while loop while byte f read looped infinite times so i added this line if i and j break i run this with these lines,0,74,122 how to rank the column values based on a dictionary and retain the highest value lets say i have a dataframe as following and the dictionary is the output dataframe must be,how do i merge items from a dataframe into a query i have a dataframe like this and want to combine these column into a query like this in python sel crd from t union select deb from t union select lon from t thank you,0,34,48 how to send raw data in a post request python body i m trying to send this is my code right now if i run this in postman though it works just fine postman screenshot,how to set amount of hue levels in seaborn with the following code i can use seaborn s scatterplot to plot data with certain colors assigned to data values how can i set the amount of colors that get used in this example e g if i want to have only two colors used or more than the shown in the example,0,34,61 how to regex match list of patterns in python i have list of patterns and i need to return that pattern if that is present in the given string else return none i tried with the below code using re module but i am getting only null in matches when i tried to print matches completely new to corepython and regex kindly help,need help finding the correct config for pytesseract be able to recognize this text so i m doing this script where i need to be able to recognize text from this type of pictures namely the text curse of binding and looting i i m new to pytesseract and c v so i really don t know how i should edit the pictures the following code doesn t get me the result i want thanks in advance edit the lang mc is a custom font for the one in the pictures from the game minecraft,0,62,97 backend youtube dl py line in fetch basic self dislikes self ydl info dislike count keyerror dislike count i have the below code that has been used to download youtube videos i automatically detect if it s a playlist or single video however all the sudden it is giving the above error what can be the problem,openpyxl number format not applied until manually applied code expected result i open up test xlsm and in column a all dates should already be in the format yyyy mm dd actual result while the yyyy mm dd format gets applied without any issues when i run the python code i then have to open up the excel file select each cell manually and hit return in the formula window for the yyyy mm dd format to be applied is there a way for my specified date format to be applied through the python code rather than having to manually apply it by opening up excel and selecting each cell going to the formula bar and hitting return every time thanks in advance,0,48,115 selenium python unable to scroll and click on load more stories button i am new to selenium and would appreciate advice i am trying to click on the load more stories button on npr s website my code seems good but when i run it more stories are never loaded i don t get an error at the same time the code just doesn t behave as expected,extract data from api and store the records in a pandas dataframe i am looking at the following website and they have the following example for extracting data using their api this produces the following out of which i want to extract only the records bit out of the output and into a more readable format ideally i want this data in a pandas data frame records bunker type marine gas oil bunker sales id month bunker type marine diesel oil bunker sales id month bunker type marine fuel oil cst bunker sales id month bunker type marine fuel oil cst bunker sales id month bunker type marine fuel oil cst bunker sales id month in the format as below how could i go about extracting this data,0,66,138 python freeopcua server how to know number of connected clients i have successfully set up a freeopcua server and it communicates well with clients but now i would like to know how many clients are connected to my server is there a method or workaround to know how many clients are connected to a freeopcua server,how insert image that is located in my documents folder in a mail i m trying to send an email within the body an image that i located in this folder users experiment documents opera terza gestionale opera iii foto concerto jpg i m using python and pycharm and this is the code all works fine but the image is not loaded it every time looks like this in the body of my mail it doesn t work also if i put the image in the same directory of my main py file obviously calling opera iii foto concerto jpg and not the previous path here is my code,0,55,93 an error occurs when installing pylibmc via pip opensuse tumbleweed distribution hello when i attempt to install pylibmc on opensuse tumbleweed using pip i get the following error the distribution has just been installed,trying to make a blackjack game kind of summarize the problem i am trying to make a simple blackjack program that picks two numbers for the dealer and two numbers for the player also i want to make a loop that checks if the player is hitting or staying based on what they input hit or stay if they hit i want it to add a card to the player deck and give them the option to hit or stay again if they stay i want the dealer to check a set of rules and those rules are does the dealer have less than and does it have less than the player a if it does have less than and less than the player it will draw a new number and add it to the dealer hand b it will then run through the loop of checking if it has the following conditions does the dealer have and does it have more than the player a if it has any number and it has more than the player then it will print a win message does the dealer have over a if it has over then it will print a house busted message does the dealer have more than the player a if the dealer has more than the player but less than because of the previous check then it will print a house wins message so that is what i am trying to accomplish with the stay command and so far i haven t found any issues with it my hit command however will not register even if i don t type stay i m trying to debug it by having it print a message and end the loop when i type hit but it still runs through the stay commands regardless i think it could be an issue with my input converting to a string don t be too harsh on me lol i only taught myself how to code last week and started with python here is my code where i am having issues,0,34,359 how can i define certain value to its key with equal sigma index i want to set the transition of start state s value with the key of sigma in dfa dictionary if the certain indexes of sigma equals with the value of transitions for example i want to set if sigma weach is the value of a in transitions then set the values of zero in a as value for key sigma,how to resave a csv file using pandas in python i have read a csv file using pandas and i need to resave the csv file using code instead of opening the csv file and manually saving it is it possible,0,75,41 drf serializers orderitem set all i was following serializer tutorial and came across some code that i did not understand its function what does the order item function do the snippet was from the serializer class below,allocator ran out of memory how to clear gpu memory from tensorflow dataset assuming a numpy array x train of shape the following code works fine exactly once when i re run it after slight modifications to x train it then triggers an internalerror due to an out of memory gpu it seems that the first time it finds free gpu memory so all works fine but the subsequent times the gpu memory is already almost full and hence the error from what i understand it seems that simply clearing gpu memory from the old train dataset would be sufficient to solve the problem but i couldn t find any way to achieve this in tensorflow currently the only way to re assign the dataset is to kill the python kernel and re run everything from start is there a way to avoid re starting the python kernel from scratch and instead free the gpu memory so that the new dataset can be loaded into it the dataset doesn t need full gpu memory so i would consider switching to a tfrecord solution as a non ideal solution here as it comes with additional complications,0,35,190 how can i efficiently decode vectors to numpy operations i am trying to generate an encoding that maps vectors to operations between numpy arrays and do so efficiently for example if i have two operations np add np foo and i encode np add as and np foo as what is the fastest way to go from a vector np array to np add essentially a more efficient way to do,import rest framework swagger views could not be resolved i wanted to implement swagger in django rest framework for that i install django rest swagger and register in setting py but while importing in url py it show error how can i use rest framework swagger,0,68,37 probleme when trying to login in django admin hello i have a legacy database wiche use unix time and i have override an absractbaseuser here is my model what i have done to insert unix time in my last login is to change behavior of django signal user logged in like this the get current unix timestamp is a sample function that convert to unix timestamp the get current unix timestamp function when i try to login in django admin i get this error,dictionary entries are all the same i am using nested loops to fill the entries in a dictionary each entry in the dictionary contains a numpy array each numpy array contains three values each dictionary entry is supposed to contain a unique numpy array but when the script is run all of the dictionary entries are being filled with the exact same numpy array each one should be different after trying to debug i realized that the repeated entry is actually the correct value for entry the very last one i m not why this is happening because the command print ic sub units is outputting the correct values in the i o console but when i try to store them in the dictionary all entries turn out the same i m guessing the issue is in the last piece of code ic units i ic sub units i ve been trying to solve this for hours on end it s probably something really simple any ideas printing ic units produces the following output for dictionary entries through the value shown below is the correct value for entry but for some reason it s appearing in every dictionary entry,0,77,191 mac m pip how to solve error building wheel for h py i am getting this error when trying to install h py on my mac error command usr bin clang failed with exit code error failed building wheel for h py python and hdf were installed with homebrew some more info,collatz conjecture and plotting hep hi i am trying to plot multiple lines whilst excluding past numbers however my code dosnt work please help i have a working prototype for one line instead of multiple lines this works however i feel like this is not enough,0,48,411 how to set time zone for historical price quotes retrieved using ccxt the python example below from ccxt will fetch historical price quotes the code does not show how to set the time zone how can i set the fetched price quote timestamp to asian hk singapore time zone i am using python,how to add a counter for faces detected in this code i followed a tutorial about making a face detection program with opencv with python but now i want to add a counter in the top left with how many faces are detected by cam this is the used code advanced thanks,0,54,53 rock paper scissors python while loop i have been trying to make this rock paper scissors game loop all day but each time i put the code in a while loop it keeps giving errors so how do i loop through the game without any issues ps i just started learning python,python nested data objects type validation with dacite i have a question regrading nested data objects as suggested in other post creating nested dataclass objects in python we can use dacite package to create nested data objects this works on handling the data that we nested dictionary structure however i have a data type check function and type conversion function associate with the dataclass a in the example where i use inspect signature a parameters to get the expected type of the dataclass and check if data are in the expected type can we also call the signature of class a from class b or is there any work around on this thanks the type current type check code is something like this,0,53,121 name of exception corresponding to no such file or directory i would like to ask if there is an exception name in try except for the error no such file or directory for example or is there a way to get an error code from subprocess run and to check it from there,python create file from list add empty line to the end i have to create the cvs file from the list here is the code i can understand n breaks the line but when i open the file i see last line is empty this is how content looks like is there any way i can remove last empty line found the way to fix this but wanted to check if this is the right way,0,52,76 how can i repeat an input in order to get a proper answer i m making a little game this is what i ve done so far in short i really like to know how i can repeat the input when it is not x or y i really appreciate any kind of help,is there a way to set the expiration date of a bigquery table to none using the python client library the bigquery table created before my billing has been set to expire i don t want the tables to be automatically deleted so i m looking for a way to set the expiration date of these tables to none however i have more than tables so i am looking for a convenient way to do this therefore i m not looking for a way to set them one by one in the console the sample code i wrote is as follows and here s the error message i got any advice would be appreciated,0,52,111 how do i import cookies from any browser preferably ie to selenium chrome driver i want to add my cookies from ie from a particular website to selenium browser by way of import imports i currently have if they are any help to you thanks in advance,how to retrieve function of the button in html website in order to work with python coding selenium i am wondering if anyway to retrieve function of the button after click in order to code in python using the selenium the website i m working with is the website relates to data analytic the gui is full of buttons to click in order to query sql base database and allow user to download csv after done querying in python ide import selenium i can code in order to automate cursor to click on those buttons but i don t know how can i retrieve the code functions embed for those buttons for example in the gui there is a button query to press which i know this is to trigger database querying after i have done selecting preconditions but how do i know what is the info for this button ex which server database tables are being pulled or how sql command is generated and sent to which destination when i use inspect from the browser the only information i can get from this button is below button xxx nbbutton type button status primary class xxx aria disabled false tabindex query button thank you,0,47,195 dynamically slice tensor of arbitrary dims i m writing a definition that needs to take slices of a tensor with an arbitrary number of dimensions the slice will always be on the batch dimension of here is a simple example of what i want i want to be able to feed it various sized tensors and get the indexed slices out as a batch such as thanks in advance,rare misspelled words messes my fasttext word embedding classfiers i m currently trying to make a sentiment analysis on the imdb review dataset as a part of homework assignment for my college i m required to firstly do some preprocessing e g tokenization stop words removal stemming lemmatization then use different ways to convert this data to vectors to be classfied by different classfiers gensim fasttext library was one of the required models to obtain word embeddings on the data i got from text pre processing step the problem i faced with gensim is that i firstly tried to train on my data using vectors of feature size but yet they always fail at some point i tried later to use many pre trained gensim data vectors but none of them worked to find word embeddings for all of the words they d rather fail at some point with error the ones i ve tried so far are conceptnet numberbatch doesn t contain glass word vec google news ram insufficient in google colab glove twitter doesn t contain crawl d m doesn t contain waltons wiki news d m doesn t contain waltons glove wiki gigaword doesn t contain riget got their names from these sources here and here by inspecting the failing words i found that even the largest libraries would usually fail because of the misspelled words that has no meaning like riget waltons etc is their a way to classify and neglect this strange words before trying to inject them to gensim and receiving this error or am i using gensim very wrong and there s another way to use it any snippet of code or some sort of lead on what to do would be appreciated my code so far,0,69,279 how do i append an array a value of if it s a power of or otherwise in python given an array of integers determine whether each is a power of where powers of are how do i append an array a value of if it s a power of or otherwise,numpy pandas nested condition in two columns introduction i have a pandas dataframe columns df opendate high low open close volume is eligible in which problem statement i want to add one more column end date which will be calculated based on below if is eligible is true then its end time will be that closestopendate which row has high value that of the is eligible true example let say row no has is eligible true high low open close then we have to find out next immediate row which has the high value my approach i tried the following solution vectorised approach but not working,0,59,106 python result from console error string format i have a problem with my console program a total of four initial results are expected from me the interesting thing is that two of them work correctly the other two make the following mistake also since i m a beginner i want to ask how to create a variable that can read both text and number,pandas groupby plotting two lines for each group on one plot i ve been struggling to plot the results of the groupby on three columns i have the data on the different absences absencetype of employees employee over years monthyear i would like to plot in one plot how many absences of a particular type an employee had in each month year i have only two employees in the example but there are more in the data as well as more month year values create data then i map each of the codes of the absencetype into two categories sick or injury what i want to achieve is the following groupby but when i try to plot it it does not fully show what i want so far i managed to get to the stage test plot however employee s id are shown on the x axis and not in the legend what i want to have is something like this desired plot i would like to have time on the x axis and the count for each absence type sick or injury on the y axis there should be two different types of lines e g solid and dashed for each absence type and different colors for each employee e g black and red,0,62,210 db object not iterable in flask i m searching for a record in users db and then looping through all the records the code is something like below the above code throws error users object not iterable how can i loop through the records,python function to translate text am new to python programming and am trying to work on an assignment to translate english text to french using a function in ibm language translator i get no output when i return the function please any help here is my code below,0,43,48 how to store the contents of a dictionary in a table using pandas there is a dictionary with the following format how to use pandas in python the format of this dictionary when put into an excel sheet looks like this,select first image of image foreign key in django template i want to select first image of an object property set i created a property model with a foreign key to an propertyimages model how do i access the first image of the property object set all in the template i don t want to do it in the view function since this should be in the base html file the code,0,41,68 python import module with arguments i have a module that defines some functions and i want this module to import different package based on arguments for example i now have a file called my module py when i import my module from another file i expect to somehow add an argument cuda such than when it s true then my module imports cupy and then prints out cupy otherwise import numpy and prints numpy for example this is my main py,matrix powers in tensorflow given an integer k and a symmetric matrix a as tf variable how to compute the k th power of a most efficiently in tensorflow,0,75,27 how to embed contourf into tkinter we have some discussions about embedding a matplotlib with slider in tkinter python embed a matplotlib plot with slider in tkinter properly the key part is the following codes my question focuses on contourf the above is what i tried to do however an error popped out is there any way for contourf like canvas such that we can embed contourf into tkinter,i get this error when i try to ban someone from auditlog action member descriptor object has no attribute ban,0,69,19 django ignoring updates to urls py the urls py file in my dango project is being ignored for example i tried commenting out the admin urls from the project and i could still use the admin i tried adding a name space and django says it doesn t exist mysite urls py wallet urls py please help,flask with dash app why wgsi can t import modules i m trying to add dash instance to a flask app but struggle with wgsi import wgsi doesn t want to import the dash module while it s installed and works well when i run directly the file flask app py the var www pythonanywhere com wsgi py the home mysite flask app py the error edit in fact it seems wgsi won t import any module tried with pandas,0,50,64 error proxy next proxy pool stopiteration i am trying to run a script and it has a standard url for proxies which allows the script to run fine once i add my own proxy url i am getting the error error proxy next proxy pool stopiteration my url is in another file and i can also link that if needed code is below if anyone can help that would be great,add hours to workday in python i need the following script to compute the working hours from am to pm so that if i add hours it will be added from am the next day example if it is now pm and i add hours and the working day ends at pm the output would be hours and hs so far the script computes hours regardless of the labor restriction,0,69,89 when why use types from typing module for type hints what is exactly the right way for type hinting my ide and resulting code works fine for type hints using either of below options but some types can be imported from the typing module is there a preference for using the import from the typing module over builtins like list or dict examples and,how to add action to button i added classes button to they do action in my game but i don t khow how to realize them what should i do to my program will work correctly without errors,0,63,37 best way to extract the first name and last name from sentence python persian text i have over first and last name and i want to check the sentence if in that sentence is any first name or last name of my dataset this is my dataset this is the sentence sample the english version the dataset this is the sentence in english version i want my out put be like this,django display a list of post s categories with a number of post hi i am trying to make a template in django that displays a post categories table and has a number of posts with it i can t seem to make it right using annotate when making queries on my model like this views py im receiving list of posts instead and has a posts count key with value of models py where did i miss thanks,0,69,75 nested for loop pandas dataframe does not create a new column i have this nested loop the loop does not give any error but i cannot understand why at the end the dataframe ex does not have other two columns called date vert and date vert,using tuntapdevice in python with sendp doesn t fire the correct callback i m using python pytun to create two tun interfaces tun and tun my goal is to create packet receivers on both interfaces so when packets come in destined for their network they ll create the appropriate response i m using icmp frames as an initial test the tun network is and the tun network is when i run the code i m using sendp to send a packet from tun to tun the weird thing is the tun receiver callback fires and i end up seeing this output new packet with the program still running since there s an infinite loop i can send a ping to that interface using another terminal from that terminal i issue this command ping i which i think generates the same packet as the python code just did regardless when i do that my python program looks like it s firing the correct receiver callback as shown here new packet any thoughts here s the code for reference thanks for any input,0,44,184 python import module with arguments i have a module that defines some functions and i want this module to import different package based on arguments for example i now have a file called my module py when i import my module from another file i expect to somehow add an argument cuda such than when it s true then my module imports cupy and then prints out cupy otherwise import numpy and prints numpy for example this is my main py,issue with pyqt signals when used with decorators when using the pyqt signals of the ui elements such as buttons with decorated methods the signal doesn t seem to work please find below the minimum reproducible code in the above code if the button is clicked the call to the button action function fails with the following message typeerror button action takes positional argument but were given but the code works alright when i don t use the decorator ui decorator even though it still takes only positional argument thanks,0,75,88 how to extract acronyms and abbreviations from pandas dataframe i have a pandas dataframe a column with text data i want to extract all unique acronyms and abbreviations in that text column so far i have a function to extract all acronyms and abbreviations from a given text i want to apply extract all unique acronyms and abbreviations from the text column sample data desired output,why do i get the same value when i am iterating through my file with beautifulsoup i wanted to split some multivalued attributes inside an xml file here is the content of newest report and here is the content of my python script with this syntax i received the same value so it keeps printing out the value for baryk only and none for the rest is there anything i can fix so that it moves to the next data,0,65,81 keep getting none at every input statement i was just making a rock paper and scissor game in python version but whenever i try to run there is none written at every input statement my whole program works fine but i am really annoyed with none is there anything i am doing something wrong in my code i will really appreciate your help here is my code and here is the none written in every input statement,how do i include common lines of code in a python module where i am assigning a number of variables copycode i am fairly new to python i am trying to modularize my program but i need each module to have common knowledge re displacement within my rows file layout i want to maintain flexibility here is an example i would like to be able to include a common code segment similar to the above in many of my modules such that i can change it in one place and all of the modules will automatically include it at run time e g include fdb copycode py,0,77,104 how to merge multiple lists into but only those elements that were in all of the initial lists i need to merge lists of which any list can be empty that way so that only items that were in all initial lists are included in the newly formed list so now i need to make a list filtered with merged data from all filtered lists how should i do that,why do i get type error on one line but not the others so i have this piece of code which is used to add subtract from the x and y value in a list with dictionaries the thing is the code must account for the fact that the dictionary can be given like a string with quotes around it so for that reason i use ast literal eval point to turn the string into a dictionary however for some reason with this line that has been changed following commands don t work like they do with the others commands in question point x offset x and point y offset y i am very confused both with the issue in question and the code in general as it was translated from js the error goes as following,0,74,130 how to convert date time to timestampe in python i have a dataset that has a column of that date written in the following format how can i convert them to timestamp,how to parallelize this algorithm there is an algorithm for finding the pythagorean triplets how to parallelize this algorithm,0,32,19 http server simplehttpserver serve file html instead of dir using cmd is it possible to serve not a index of a directory but rather an html file using python simplehttpserver on path having directory with one file login html serves a directory index on path i want a content of login html on is that possible,regex having optional groups with non capturing groups i have an regex with multiple optional and non capturing groups all of these groups can occur but don t have to the regex should use non capturing groups to return the whole string when i set the last group also as optional the regex will have several grouped results when i set the first group as not optional the regex matches why is that the input will be something like input text xyz t vx n expected output t vx n thanks in advance,0,55,89 rearange rows in a pandas dataframe based on multiindex values the pandas way i really want to know how this could be done in an elegant way with pandas i have this dataframe where the index is a multiindex with the two values representing a year and a catagory i want it to look like this i have no idea how pandas can help me here this is the mwe do produce the sample data,printing specific columns for those that satisfy a condition in pandas data frame code works just need help to reduce it to one line of code here s a quick explanation of the original data frame named df taken from a csv what i tried i need to print a new data frame that only selects those who are female and print their average sleep time and average wake time i managed to achieve this will multiples lines of code the indexing was done since the normal data frame df had no index running the last line of code after running the ones above printed my target data frame successfully now my question is this how can i do the same with just one line of code,0,74,126 pandas group by cumsum with a flag condition assuming i have the following data frame i want to create a cumulative sum of the nums grouped by user only if flag so i will get this so far i was able to cumsum by flag disregarding the group by user or cumsum by user disregarding the flag i need help making them work together,scraping data from a container i m new to scraping and would like to scrape this the historical data table from this url i have tried to use bs but nothing seems to work for me as it just returns an empty list as far as i understand what i need to do is to find all tr in the container or what i don t have that much code but i think it make sense to show it to you so there is something to work with my code,0,66,90 groupby on column which contain bytearray object using pandas dataframe i have pandas dataframe and want to do groupby on customer id now the problem is pseudo customer id which look like this below is snapshot when i did value count on of pseudo customer id i check the single value i got below value note i want to do groupby on pseudo customer id and do rank by db created dt column,iterating over a pandas dataframe super fast i am trying to create labels for my dataset which is just a csv file with lines of text i ve used the following method but it takes about minutes to create all the results the desired outcome is this was a really crappy product generated label with confidence score,0,67,55 python cv draw contours and fill black is ignoring perimeter iam trying to remove objects from the image using the following method however as can be seen from outcome image there is a residual fine colored line around each object although i have dilated my image the lines are still present is there a way to remove those lines original image outcome image,no output when executing the script python vscode i m developing a simple reactive programming script example to download images from a web but when i execute the script in vscode i do not get any type of output i already tried creating a virtualenv in the terminal i get this output ps c users ernes desktop paradigmas c users ernes appdata local programs python python python exe c users ernes desktop paradigmas jose py ps c users ernes desktop paradigmas,0,63,59 why is plotly connecting my line graph from top to bottom i am trying to graph the frequency of tweets containing a certain keyword throughout the month of january however plotly connects the points on the time series graph from top to bottom rather than left to right how do i fix this,what is alternative for in lower python version for this for loop can we shorter this code without using because my python version is lower than with it s okay if solution be with numpy or,0,53,40 how to set up hydra config to accept a custom enum how do i set up a my hydra config to accept a custom enum specifically i followed the structured config schema tutorial i have a dataclass config with the custom enum error from running python my app py where my app py is just and the config in data config yaml is just,python selenium can t find element by xpath within shadow root open using selenium and python i was browsing on this website i tried to click the button alle bestatigen with the following script but that didn t work and it received the error how can i solve that problem so it finds the element,0,58,53 django startproject fails no module named zoneinfo i am creating a new project in django my set up is on running django admin startproject myproject i recieve the following error any clues on how to resolve this issue,how to verify collision between two sprites in the same pygame sprite group i have been trying to create an enemy moving system for my top down pygame d game but my two enemies always end up by getting over one another this is why i decided to create a method that will stop the enemies from overlaping one and other but i don t know how to check for a collision between an enemy in the group and the rest of the group because when i do so the enemy is always thinking he has collided with another enemy but he just collided with himself is there an easy way to fix this see the comment in the code below for more explanation,0,37,121 problem with finding th prime number off the answer is supposed to be but for some reason my brute force program gets more does anyone know why it is one off,signing payload in js frontend using ec and validating in python i have a python backend that generates public private keys generates a payload then needs to get that payload signed by the client reactjs or pure js which is later verified the implementation in python looks like this imports generate keys sign verify what i need now is to load or even generate the pem keys on the client side then upon request sign a json payload that can later be verified from the python backend i tried looking into the usage of web cryptography and cryptojs but had no luck i m okay using another algorithm that is more compatible but at the very least i need the signing functionality fully working i also tried compiling python to js using brython and pyodide but both could not support all the required packages in simple terms i am looking for the following generate payload python sign payload js verify signature python any help advice would be greatly appreciated,0,35,167 real tme keras rl dqn predictions hello everyone i followed that tutorial to train a dqn agent everything works now rather than make a random choice i want to use the dqn without having to do something like dqn predict but i did not find that in their documentation can you help please,grouping the same value based on a column increment using python pandas what i am trying to do is group values of in a certain period of time using a python dataframe for example i have and the output what i m expecting is,0,53,44 split a csv file in appropriate columns i m trying to analyse data from a csv file in python but i get the data as you can see in the image below could you help me to figure out how can i split the data in appropriate columns thank you in advance,python flask inserting into tables with a foreign key needing help with database relations i have two tables funding source and allocation summary and of the attributes are the same between the two i m using a foreign key since there s a one to many relationship between the two tables a funding source can have many allocations but an allocation can only have one funding source these are my two tables in my allocation summary webpage i have a button to insert a new allocation requiring you to fill out the table fields here is my code to insert the new allocation with the required form fields my question is how do i include the attributes complete agency funding source and bill to allocationsummary and add commit it to the database if i need those attributes from the fundingsource table i guess i m not understanding what funding source id db column db integer db foreignkey funding source id nullable false is suppose to be doing to get the common attributes essentially i need my alloc allocationsummary complete agency funding source bill state eligible applicant recipient amount but i can t access those attributes since they re in the fundingsource table so how can i push them to the database when inserting sorry if all of this is confusing i am new to this stuff,0,50,210 how can i get the dispatch service name using nameko i have a green event that can be dispatched by two different services how can i get the variable with the service name,automatic change of discord about me the problem in discord as you may know there is a about me section this section is as description of a profile that you can write yourself bots can have a about me section what i want is to edit this about me section automatically in discord py for example every hours the about me section of the bot change what i tried i searched for a very long time some answers but didn t find anything relevant i saw that you can modify the about me with the developer portal but it s not automate i saw that some people said this will be able in discord py v but didn t find it it may be possible to resolve this probleme with http requests but it s only a supposition i m not very good in this topic show some code,0,32,142 how to select columns from multiindex pandas table in a custom order how to select columns from multiindex pandas table in a custom order in this case how can i have quantity to come before price without the use of ascending false as well as the size to be in the order medium large small desired output creation of dataframe i have tried to use dataframe loc however i have realized loc does not maintain the specific order,heroku connection timed out connection timed out hello everyone i want to someone till me if what i am doing is correct or not what i am trying to do is deploying spring boot in heroku and getting date from python flask framework which i am running it locally in my device everything is woking fine locally in my device but when try to run spring boot in heroku i am getting this error at error code h desc request timeout method get path hi host java be herokuapp com request id eaa f b e c e d bf b c a fwd dyno web connect ms service ms status bytes protocol http and this error shows in heroku logs my spring boot code and here s my flask code also when i run heroku server locally it s working fine as well,0,78,119 retrieve dns query information from a cloudflare zone using graphql i have the following graphql query which returns me the information from cloudflare s analytics dashboard like cachedbytes cachedrequests does anybody know how to retrieve dns query information from a cloudflare zone,how to read and append multiple cells from different excel files in python in a simpler way edit from the code given by oh my lawdy thanks i got the result seen in picture it s like joining lists in a dataframe but gets nan for every column i add final df with code by oh my lawdy end of edit i m trying to get data multiple cells from one sheet from different excel files daily report and make only one excel file with daily data to use it in plots actual vs budget forecasting so far i can get the results i want but i think is not an efficient or elegant way to do it i read excel files with a for and i defined a function for read specific cells from daily report pass this function for the for loop and append data through the loop that creates one column dataframes and then i use concat to get just one dataframe then i write output to excel file i need to read at least cells from this daily report each one would be a column in a dataframe so coding is really long and i m thinking using this code for other reports but i m feeling like it s not clean for now daily reports don t change cell positions any help would be appreciated maybe function could read several cells at once reading excel files function code results data frame rows columns sorry no formatting produccionconacsaptmpterminalmolyptbaewinventario inicialinventario final,0,41,253 picking only the first value equals in time period i have the df which has index with dates and values or i need to filter every first from this data frame in several time periods for example each in df ind means the beginning of time period now i m interested to get the first in each time period,trying to print ascii characters to why does it stop at i m new to python and i m learning coding encoding unicode ascii and so on i would like to print ascii characters according to their codes and using chr function unfortunately the result is wrong it stops at the code i understand these codes return blank but why do they stop the process setup when i run this code in visual studio code the script produces output through but in my console linux mate it blocks that s difficult to understand for me,0,63,97 keep getting none at every input statement i was just making a rock paper and scissor game in python version but whenever i try to run there is none written at every input statement my whole program works fine but i am really annoyed with none is there anything i am doing something wrong in my code i will really appreciate your help here is my code and here is the none written in every input statement,webscraper python beautifulsoup i know what i m trying to do is the simplest but it blows my mind i d like pull data from html page using beautifulsoup to do that i need to use the find function i guess ain t know what to do no more appreciate every form of help here s the html i m working with enter image description here import requests from bs import beautifulsoup url res requests get url html page res content soup beautifulsoup html page html parser text soup find div class col md output blacklist style head meta col md col md for t in text if t parent name not in blacklist output format t sheet html body text body html file object open record html w file object write sheet file object close enter image description here,0,77,130 how to display image writing an html code in jupyter notebook enter image description herewhere am i going wrong i want to view output the stack overflow image from ipython core display import html display display html img src stackoverflow jpg alt stackoverflow com width height result is a broken image icon,i keep getting ran out of input error in for function to open and adjust pickle file i was making stock data macd calculator in python the way of my approach is using for to access pickle datas in certain directory and calculate macd values one by one however i got ran out of input error everytime i checked my directory where pickle datas are stored and it was not empty funny thing is if i just put numbers in i position without using for i could get data of the pickle file please help me to get free from this error here s my code,0,46,107 i am trying to solve an equation with multiple variables for b i am trying to solve a simple equation but this is what is being outputted the equation is y m x b y m and b are already defined i would like to print b,extractinf info form html that has no tags i am using both selenium and beautifulsoup in order to do some web scraping i have managed myself to obtain the next piece of code the output soup produces has the following structure recall both text and output style have been modified for reading reasons i attach an image of the actual output just in case it is more convinient does anyone know how could i obtain every placen in the image moixent would be place in a list something like i have tried parsing it but as it has no tags or at least my html knowledge which is barely none says so i obtain nothing i have also tried using a regular expression which i have just found out where a thing but i am not sure how to do it properly any thoughts thank you in advance output of soup,0,48,151 how do i capture normal output and something like segmentation fault with python i m trying to write a python program to mark score a c program the c program to be tested is supposed to output something like here is the code uploaded by a unqualified student which outputs i tried the following python code to catch the output and error neither stdout nor stderr catches the output how do i capture something like with python,python difference between string formatting long story short can someone explain it to me how is it that be simple line of code can do the same as all of the for loop written by me here s my solution,0,75,39 create discord py server and delete all channels directly i want to create a small discord selfbot bot that completely copies a server everything works except that i can t delete the channels on the new server here is a small excerpt,does keras learn embeddings for words that are not included in the vocabulary that you specified sorry if this is a noob question although i havent found a similar thread i m trying to learn how to create word embeddings using a large dataset of tweets for sentiment classification i m using keras textvectorizer to convert the tweets into sequences i noticed that if a word is not in the vocabulary specified it always maps to integer wouldn t that mean that the model will also learn weights for words that are not in the vocabulary if yes how do you avoid that here s a snippet output tf tensor shape dtype int numpy array dtype int,0,40,161 python reading file not working through tkinter file chooser when i run the code and select a file it doesn t output anything putting the file location manually in the code still outputs nothing and the txt file definitely has content,python variable right n characters i m trying to return the right n characters based on how many characters are right of a specific character in this case it is the sign everything looks like its working except the last line where i m trying to set the number of characters to return by using a formula gives me the below dataset kitty nan kitty nan,0,40,85 how to return last comment i have probably a small problem namely how can i extract a last comment when i use post comments all views if i tried use or last this dont work,is it possible to customize e g a django app model field with html css i have this model field that holds the description image from django admin but when i print it out on the page it looks like the following description model field printed on page so is it possible to edit the description field so it looks better and is more readable using html css etc,0,34,64 how can i use enumerate function in python i have a code snippet like this let s say i have data in the test data is this for loop goes from to or from to,parallel processing for apply function i have a dataframe of records so i tried to do a parallel processing using the joblib library which works fine with my code below but my question is can i try the same code with apply and lambda function which seems like very close to my original code with minimum change instead of using the for loop like in my code please help original code without parallel processing with parallel processing for the purpose of applying the joblib s parallel processing i converted to for loop below,0,39,94 unable to exit python script in docker with a while true and run with u option file dockerfile file test py commands unable to exit the process with ctrl c on ubuntu any help would be appreciated note if i use the cmd in dockerfile to cmd python test py without u option then there are no outputs and using docker with docker compose fails to attach,dask df to parquet can t find pyarrow runtimeerror pyarrow not installed environment from the terminal so i confirmed that i have pyarrow installed but when i try to write a dask dataframe to parquet i get modulenotfounderror no module named pyarrow the exception detail this function works it s a much smaller csv file just to confirm that the df to parquet function works is it looking in the right place for the package i m stuck,0,62,71 what is the difference between numpy array with dimension of size and without that dimension i m might be a bit confused but i wonder what is the difference between say x and y same array but have extra dimension with size are they the same or there is difference between them,svg commands to an array of points in python for plotting i have svg commands printed out in this style how do i convert this into an image and also be able to generate intermediate points an array of points so i can create a d plot in python thanks for helping,0,53,51 swapexacttokensfortokens transaction has different ratio than router interface transaction i m writing a decentralized buy sell program and i ve stumbled on an issue that i find hard to figure out i m using swapexacttokensfortokens to swap this token for wmatic on quickswap the ratio is all wrong tokens for wmatic if i m using the qs interface i can swap tokens for wmatic passing through eth so not a direct swap my questions are,how to count unique values in pandas column base on dictionary values i have the below pandas data frame also i have the below dictionary i want to get a unique count of id based on the list inside the dictionary based on theire id column for example if we consider id g has only one list aasd aasd g i want to get how many unique id s are in the g id column in pandas data frame so it should be for aasd values those are the only three id values in pandas for aasd in g id so i want to create a table just like below for the list name and count of id s or is it possible to get kind a below out put is it possible to do this in python any suggestion would be appreciated thanks in advance,0,78,146 access run nested elements python docx this is the xml extraced from the word document i m trying to get to the w ddlist sections but i cant get past the w r section i know its possible to get the run element the following way but runs doesn t have any list like attribute so i m about clueless how to continue any help will be appreciated,difference between lstmcell and minimalrnncell when i look up the implementation of lstmcell and minimalrnncell in the following link i found that they are different anyone knows the reason and if i want to create my own lstm cell i should follow the instruction of lstmcell or minimalrnncell and if the answer is lstmcell then what is the functionality of minimalrnncell codes for lstmcell codes for minimalrnncell,0,64,70 how to arrange pandas pivot table columns how do i arrange the columns of a pandas pivot table for example for the pivot output how can i have d and e swap positions and how can i swap the large and small positions edit i am looking for a solution which allows for a custom order that would work for other instances,np subtract along an axis is there an easy way to subtract along the axis of d array,0,62,17 how to add extra command line arguments to createsuperuser django i have usermanager class below in the create superuser function i would like to add one more field to set tenant id this has to be taken from the command line when using python manage py createsuperuser if i add tenant id in create superuser function like this i m getting the following error usermanager create superuser missing required positional argument tenant id is there any way i can pass tenant id from command line,how can i random choice a question without the answer for a discord robot quiz game i just started learning how to code in python and i was wondering how can i randomly ask questions for a quiz without the answer that follows for example i d want the robot to ask what s the capital of france but without it saying paris questions what s the capital of france paris who painted the mona lisa da vinci ty,0,77,79 extracting the actual output of generator in a list i am trying to get the actual output from the generator but i get the ouput as generator object please help me achieve the actual output from the generator output expected output,df fillna df mean vs df fillna df mean i m puzzled by this to fillna with mean i should use df fillna df mean but i made the mistake of dropping the bracket df fillna df mean i got a totally different result the documentation for fillna does accept a scalar dict series or dataframe but when i type type df mean i got a method as type which does not make any sense it s not any of the scalar dict series or dataframe accepted by fillna what is actually happening here i hope somebody could help enlighten me thanks a lot,0,41,88 why am i getting this syntax error python python noob here took a swing at the guess the number game this afternoon it all looks fine to me but i keep getting a syntax error on line else player number secret number i ve tried everything but i can t figure it out at all thanks for your help,weird at top of csv file while using pandas with dictionary i want to print a dictionary into a csv file dictionary is containing a subject code as a key and a mark that one student got as a value here is my py code code prints the dict here is csv file i don t know what is causing the at the top any help update printing the data frame brings this,0,57,74 python pygame typeerror can only concatenate list not float to list my son is busy with the coding of pong in python bit with pygame here is the feedback from the terminal here is his code any assistance with regards to how to fix this problem and get the game to work will be appreciated,flask join children in my problem let s say there is person which can have many addresses and each address can have one location is it possible to get a query where persons contain addresses which are joined with their location so when i loop persons i can access data from both addresses and location as one,0,56,56 how to install python on ubuntu since python is no longer supported in ubuntu and the usual deadsnakes method also doesnt work it gives following error,how to run requirement txt file using pip i try to run an python project so i created python virtual environment after this i activate environment after this i try to install requirement from requirement txt file using but it show an error consider using the user option or check the permissions,0,30,50 remove group if contains record with status i would like to group records by id from df and delete group if any of records has status output i would like to get i tried dfnew df groupby id filter lambda x x status but i got the error typeerror filter function returned a series but expected a scalar bool,python project euler question if statement won t execute if index is greater than i have been attempting problem from project euler in python and have come across an error that confuses me basically the x grid of numbers is a list that contains sublists of every line or every number the problem asks me to find the greatest product of four adjacent numbers in the same direction up down left right or diagonally meaning i have to loop through every number and find those combinations to loop through each number i create nested for loops to first loop through the multiple lists and then to loop through the numbers in those lists my for loops look like this i also make pre set combinations in the form of a list based on the variables list and num the hard part of this problem the way i see it is that i can t have all combinations listed above for every number for example for numbers that are less than spaces away from the left side and less than spaces below the first list cannot have a horizontally left diagonally down left diagonally up left and vertically up combination of number as there simply isn t enough space this is expressed with the if statement looking like this piece of code works with the output in my console being the numbers such as are from me printing which list it is and which number place it is so means the first number of the first list and would be the nd number of the nd list however a problem occurs when the code loops to the top right part of the grid the code i implement is yet this doesn t seem to register in fact the full console log looks like this i m confused because list value is under and the number index is above i ve done some troubleshooting and the if statement works without the and num for some reason but i still need that part my full code looks like this if there appear to be any errors in the structuring and such,0,60,371 why is regex not returning any matches i m attempting to use regexes to pull certain substrings from the text in the body of an outlook email here is the function with the regex that i m trying to use here is the raw string i m trying to perform the regex on but when i try to pull one of the entries from the list substring i get a indexerror list index out of range error any suggestions,increment initial time value in floating seconds i have an initial time value like format h m s f and a pandas dataframe with a seconds as floats is there any way to add those seconds to the initial value so first row would be etc,0,76,45 error while fetching data from cassandra using pyspark i am very new to apache spark and i just have to fetch a table from cassandra database below i have appended the data to debug the situation please help and thanks in advance cassandra node spark node cassandra table to be fetched dev device keyspace table name access pyspark with connection to cassandra code to access cassandra table and error can anyone point out what s wrong here,valid range for imshow with rgb data i am new to image processing so this question might seem very basic i want to visualize a collection of rgb images in python when i use the matplotlib s imshow i get the following warning clipping input data to the valid range for imshow with rgb data for floats or for integers i understand that i can transform the ranges of rgb in my images to using suitable min and max values but i have the following questions,0,74,88 neural network input of layer sequential is incompatible with the layer expected shape none found shape none i am working with some data to make a trainable model suing neural network this is the code i am working on it gives me this error valueerror input of layer sequential is incompatible with the layer expected shape none found shape none please any one can help we solving this problem,numba parallel code slower than its sequential counterpart i m new to numba and i m trying to implement an old fortran code in python using numba version but when i add parallel true the program actually slows down my program is very simple i change the positions x and y in a l x l grid and for each position in the grid i perform a summation with parallel false it takes about s to run however with parallel true it takes about s i also tested with another code from and in this case the parallelization works,0,71,98 find the top countries having the highest gdp per capita in each year produce the following table this is how my data looks like i want the output as follows this is just the sample output here is the image of the ouput i have tried this so far i don t know how to replace columns with the country name,fix snowballstemmer error attributeerror english object has no attribute default hello there i am using the package snowballstemmer and i am getting an error i am very glad for any kind of help code error here,0,60,37 how can i make some commands only work if you have a specific permission with python i have a command clear which clears a specific number of messages i do not know how to make this command work if you only have the permission administrator if anyone knows how to do this that would help me a lot and here s my code,how to make subclass typeerror init takes positional argument but were given,0,62,14 python map over list of tuples i have list of tuples like this that are simulating rps game also i have a function like this how do i use map to derive a list of the winners in those rounds i know is starting like this list map rps winner,is there any way how to print changing variable in python tkinter canvas i ve got some variable in while loop is there any way how to print these variables in tkinter window in for example label even when it is while loop or is there any way how to print changing variable in tkinter label,0,49,56 jsondecodeerror expecting value line column char when scaping sec edgar my codes are as follows i could run the exactly same codes last year but when i ran it yesterday the warning popped up jsondecodeerror expecting value line column char why how should i solve the problem thanks a lot,pandas dataframe color styling based on nan values i currently have a pandas dataframe that has four columns and is structured below accordingly as you can see this is a dataframe of transactions i want to color the transaction rows that are considered income as yellow and those that are expenses as green to do so if amount is nan then the row is an income row and otherwise it d be an expense i tried the following after reading up the pandas color styling documentation and other stack overflow posts then after displaying the dataframe it remains unchanged i m not sure why it s not working your help and guidance are appreciated,0,56,112 why int ls does not work in the function i worte two eqivalent i thought codes while one works but the other report an error this one return correct result this one reports an error,determine if a certain score is possible from combining individual scores let s say i want to achieve a certain total score s and there are individual pots from which i can obtain certain individual scores stored as lists of positive integers i d like to know if it is possible to obtain the desired score after at most n i attempts from pot i the scores accumulate e g i m trying to write a code in python to figure this out i think i d start by finding all combinations of obtaining the score s with length less than or equal to the sum of the n is e g for s n n i d find i m unsure currently whether i d need etc as well and iterate over them so question how can i easily obtain this data perhaps with something from itertools then if there wasn t a limit on how many times you could try each pot i d simply check if each element of the combination is in any of the pots if so then it s possible and break the loop if not then move on to the next combination if you try every combination and none work then it s not possible the complication arises from limiting the number of attempts per pot question how might i modify the above approach to account for this and finally question is there a different approach i can take to solve this,0,33,239 how to convert duplicate column names python dataframe to json how to convert dataframe to json df required format,how to round up a decimal properly in python or django i was trying to round up a decimal with the code i found below but it doesn t seem to work properly in python django here is the code here are some of the results i get when i run the function however for some reason i get a weird value when i input i am getting instead of is there any other way i can round up decimals in python django i have gotten this off the internet so there might be some other problems other than the one i mentioned above inputting basically i just want to round up a decimal to the second decimal point like above but of course rounding up or would just be and respectively thank you and please leave any questions you have,0,19,143 i want to transform a list or concatenate this same list i have a list like here that i coded in python and i would like to transform it to be able to integrate it into a dataframe more easily,unable to use joblib parallel with cpu for n number of iterations along with gpu for training models i am developing a custom cross validation function in python which runs for given number of iterations where in each iteration following steps are executed at the end average of mse from all iterations is calculated for iterations it s taking around hours in order to speed up this process i would like to utilize multiple cpu cores physical cpus threads each available on my windows machine with a single gpu attached nvidia quadro gb i found that joblib parallel can be used for executing tasks in a for loop on multiple cpu cores in parallel and used the function as follows regarding limiting the memory growth on gpu i added following code but even for iterations i am getting the following error please let me know if there s solution alternative to use joblib parallel for parallel processing the iterations via cpu along with gpu for training machine learning models thanks in advance surya,0,40,174 how to create a comparision matrix using python i have list in python how can i generate a matrix by subtracting the list element by each othe and create a comaprision matrix and save it into csv,retrieve indices of certain value in a matrix and put it in a nested list i have this matrix let s say there are hundreds of x value and thousands of y lists inside this matrix how will i be able to retrieve the index of value and put it in a nested list here is the sample output,0,37,60 problems with pandas ta indicators rsi i try to put por trading strategy when rsi if and if the previous period if raise this error cannot perform rand with a dtyped float array and scalar of type bool,can someone explain to me how to resolve the argument error below with the use of my code the error here is on positional argument error where the code can not execute because of the position argument error on this line of code customer cars customer requestcar i got an error of typeerror rentcaronhourlybasis missing required positional argument n which i am not sure if it has been resolved i need an explicit explanation on how to resolve all the errors listed above the error my code,0,43,88 resize treeview widget in tkinter i m new to tkinter gui framework of python i have a doubt in treeview widget of the tkinter gui my doubt is how to resize the treeview widget so that i can place the two treeview widget aside photos attached below and i doing a project on mysql database so for the frontend i used tkinter gui screenshot of output which arugument i should use to change the size of treeview widget,how do i generate multiple random lists for a portion of a larger list in python i keep getting duplicate lists started working with python today and decided to test my learnings on a small project i want to have a roster of lets say people from this roster i want there to be x number of teams of y depending on how many people want to play i know how to write this if we assume all names in the roster are going to be used but where i m lost is how to generate unique teams for a composition of something like teams of whenever i try to solve this i will get of the same teams of here is an example of the code i m attempting right now if my input variables were and i would get something returning like how can i change this to get random results closer to this,0,78,161 python regex with brackets i m trying to get a subset of strings like bellow i need to first capture contents between and and then put each of some content in the separate index of an array what i have till now is but it does not work as expected my expected result is something like bellow any help is appreciated update please consider the following as an input string expected output,ctypes calling go dll with arguments c string how to pass a string as argument from python to a go dll using ctypes go code compiled on macos using goos windows goarch cgo enabled cc i w mingw gcc go build buildmode c shared o dist perf nlp dll python code out working solution python,0,73,43 why doesn t this change the variable in my discord py program i wanted to subtract from a variable in this code but it won t subtract it i tried setting it global what should i do i tried requesting the variables with another command but it says the original variable numbers what am i doing wrong if it is required i can send the full code in but i think it isn t needed hopefully thanks for every bit of help,import json with missing keys into postgres with flask sqlalchemy i have a question you guys might be able to answer i have a json file that looks something like this the point is that not every entry has all keys i have a flask sqlalchemy model that looks like this and i have a python script to add the json entries into my postgresql database that looks like this i don t know why but somehow every cell is null except the official id field how so and how can i fix that i m at the end of my wits right now every pointer or help is much appreciated edit what i found out so far is that entry key is not interpreted as entry state for example but actually creates a reference entry key bw for example why is that,0,79,136 dash plotly dropdown puts selected value on the right side this just a small thing but i hate how the selected label is aligned to the right while the options in the dropdown are on the left side i would like to center it or even better put it on the left side,python old pandas merge results in more rows than new pandas i have environments environment environment i have the same code in both versions no modifications were made to it however i have this specific line of code which seems to be causing an issue produces a different output df result pd merge df l df r left on left on right on right on how inner suffixes suffixes df l and df r are just read excel files i checked them in debugger in both versions and they are completely the same so that should be fine also the left on right on and suffixes variables have exactly the same value in both environments checked via debugger as well however when the df result gets generated by the merge function in environment old python old pandas it produces a dataframe with rows in environment new python new pandas it produces a dataframe with only rows the number of columns are the same difference is only in number of rows what is causing this behavior how do i make sure that the environment new python new pandas produces exactly the same output with rows as produced by environment old python old pandas thank you,0,53,197 linkedin bot selenium beautiful soup not reading email in overalay contact info so whenever i run the following code it writes no mail found in the email txt file ive checked the classes in inspect and they re correct anyone has any idea what the problem could be,how to freeze a keras model in tensorflow specifically freeze a saved model format to pb format can any one please explain the procedure to freeze a keras model saved model format into pb format in tensorflow created a sample mobilenet keras model and saved it to the disk in saved model format then in another file i need to load the model and freeze it to a pb format,0,46,72 summing same numbers of different lists into another list now i know there are easier methods but i need to make it in a function and this is my try now it isn t working but could you pls help me,how to understand the trade off between looping and extra numpy dimensions when doing matrix work a common pattern i find myself in is the following alternatively we can do this without a loop by stacking the matrices in the two lists is the second method always faster assuming we can hold those stacks in memory is it merely a speed vs memory trade off how can i better understand this,0,40,69 how to find the centroid of multiple rectangles python i have to find the exact centroid of multiple rectangles the coordinates of each rectangle are as follows i have around rectangles how can i compute the centroid of them i already tried to implement it but the code did not work well my code,how to convert a string to a number where number is embed in further string hi i have a string like this and i am trying to convert it into something like this b and doing something like this and getting error valueerror invalid literal for int with base,0,56,52 how to use drop duplicates with a condition i have a dataframe consisting of two columns column a consists of strings column b consists of numbers column a has duplicates that i want to remove however i only want to retain those duplicates that have the highest number in column b this is an example of how my dataframe looks like what i want is this using drop duplicates,binary search but it doesn t search the upper part of the object list im trying to create a code that searches an item from an object list but it only checks the lower part of the list if i try to search for the items in the lower part of the list it gives good output but when i try the higher part it doesn t do the job code class desired output output any help will really do,0,67,78 how to parse a multiline string which looks like a table into a list of dictionaries i have a multiline string sample below which has a table like structure i have to parse that structure and convert back to key value pairs such that the key is the column header and the value is the value of that row i have used a regex but it s not working properly pfb string expected output i have used the below regex pattern,what is making my model predicting the wrong value when running on my laptop and colab i ve exported a tf model to h format to use it for my project when running and testing on colab it predicts perfectly but when i tried to predict the h format model in my machine laptop it did not predict the correct one therefore it did not work like it used to in colab i ve tried to browse in the net but did not seem to find an answer or a clue does anyone know where the problem might be example input image dog type of golden retriever colab predicts golden retriever correct my machine laptop predicts norwegian elkhound something else that does not look like a golden retriever wrong thanks in advance,0,78,126 dataflow python pickeling issue i have written a simple dataflow program that takes input from a pub sub topic and calculates the fibanacci number for that integer however my dofn is not able to pickle the custom function fibonacci which is giving me errors when running on dataflowrunner can someone help me in telling me what i am doing wrong below is my pipeline code,scrapy runspider how to use different settings i have the following working spider as a process so i can start the spider with python xyz py but how can i use the other informations settings from the settings py eg robotstxt obey false autothrottle enabled true autothrottle start delay etc and how can i make the output to json in that way so the output get overwritten when i run the program now the data is allways appended to the existing items json file when i run a spider with scrapy runspider i would use o or o to overwrite or not overwrite the output file but how can i do this here,0,64,113 how to write row only if value is not null i am converting my json data that i made an api request to to csv however some keys in the object have null values how can i only write rows that have non null values,how to create multiple data frames in for loop i have a list of names i changed them to letters that correspond with values in a data frame column i am trying to create a separate data frame for each name containing that name s associated qty grouped by part number as you can see from the code each time it loops it writes the new loop data over the previous loop s data in df how to i iterate a new data frame name each time it loops so that i end of with separate data frames,0,45,97 trying to extract a string value between dots from a string column im trying to extract a default string value from a string column but without sucess this is the column with some string values what im trying to reach this is my unsucess code and the result could you guys help me i have a kinda difficult with regex and it just blow my mind when i have to deal with it,using gekko in python for a multi objective optimization problem do all objective functions have to be of the same unit as per gekko documentation multiple objective functions are summed and an overall objective value is solved for does this mean that all objective functions have to have the same dimension or unit m or usd or kg if so is there a way to have multiple objectives with differing units also side question is there an easy extract the optimal objective value for each objective function aside from the overall objective value given by the solver,0,73,96 django app incorrect datetime during deployment i have a django model with a datetime field like this locally on my machine this control is created with the local date and time when the application is deployed the field is not created with local time i tried to do this it does not work how to solve this problem i am in central africa,keyerror after re running the same code a keyerror is returned when i try to run the below code my dataframe has the following columns i know that there are many questions on the keyerror name but what was weird is that without changing anything this error appeared while running the code but previously i could run the code with no errors nothing has changed any help on this would be great traceback,0,64,72 how to set a subset with specific category in fashion mnist tensorflow now i have use orginal data with fashion mnist how can i create a subset with specific category like t shirt and dress and in each other category,splitting d array in numpy to make smaller equal d array i have an array shape i want to divide it in blocks like the image each array shape would be then how do i achieve this octant box splitting,0,41,44 do we need query set in createapiview my question is quite straight forward i m actually not sure that queryset is required need for createapiview or not,discord py client get guild id returns nonetype even though it is a member of a guild variable guild should return object class guild but returns nonetype as far as it goes my bot is indeed a member of a guild and the id i am using is also correct what might be wrong,0,27,50 how to make a loop that keeps cheking if theres a certain class hello i m trying to make a loop that keeps searching for a class with buy and if it finds it needs to refresh until it can t find it anymore and then it runs the rest of the code i m using selenium and python help would be much appreciated thanks in advance,discord py editing private message for user edits it for everyone issue i have a discord bot that you can private message one of the commands makes the bot send you a message and then uses bot wait for to wait for the user to answer the message and once they do it will edit the initial message it sent you and change the text to something else this works but if users message the bot and both are waiting on the bot wait for and person replies to the message the bot edits the message for both peoples private message even if the other user never replied to it how do i get it to only edit the message for the user who replied to the bot here is some of my code thanks,0,64,133 how to call a complex sql query in python i have the following sql code this sql code has been tested and runs perfectly on sql server management studio now i have the following code for python which is to communicate with an ms sql server instance when i run it i get the following error where it points to the first semicolon in my code could you show me how i may get this python code to run,applying multiple filter on pandas pivot table how can we apply multiple filter on piviot table i have a dataframe as df i m able to apply one filter on it by the above code is working correct with one filter brand but how do apply one or more filter to this in the below code if you see i have tried to add but i was getting an error which didn t work maybe i m not giving the second filter correctly does anyone know how do i do this,0,79,87 python typeerror zipfile object is not callable when i type the code it shows this error as output how can i fix it any ideas what does it mean the zipfile object is not callable i even declared my zip function like this beforehand i declared extracting zip operation like this above i m writing this code in google colab i added the tensorflow part to my code here,tkinter copy to clipboard via bind control c shortcut clipboard is empty when closing program but via tkinter context menu everything is normal in a custom entry i have a context menu with the function copy the selected text which is performed by pyperclip when executing the copy to clipboard function from the context menu everything works fine the selected text is copied to clipboard when i close the program the text remains on the clipboard and i can paste it into any other application but when i run the same copy to clipboard function using the keyboard shortcut control c the text is copied to the clipboard normally but when i close the tkinter application the clipboard is erased how to solve this example,0,68,122 transformation to multilabel classification i m trying to implement a neural network in python keras that will predict the probability of multiple outcomes at the moment i have the following code for simplicity i reduced the problem to inputs and outputs i need help implementing the output of probabilities for all outcomes poutput poutput poutput currently outputs only and saving them in a table like this one,learnable leakyrelu activation function with pytorch i m trying to write a class for invertible trainable leakyrelu in which the model modifies the negative slope in each iteration however i set requires grad true the negative slope wouldn t update are there any other points that i must modify,0,70,44 matplotlib animation not completing i ve tried to create an animation using matplotlib it seems to be animating correctly but it s not showing all the data points in the dataset its a time series from jan to dec it seems to be animating to only right now below is the entire code,how to filter string of dictionary from a list of python i have a list tht contains strings and those string could be a simple string or key value pair in a string please see below sample i know a way to convert string to list of dictionaries using json loads replace method but the condition is to have all elements as dictionary but in my case a list contains a string and dictionary as a string how to filter in such condition any suggestion,0,55,85 error when converting tweet object to pandas data frame i have extracted tweets using the tweepy library in python however when i try to convert the list object tweets into a pd data frame i get an error message i have looked around and cannot find a solution to the problem help is much appreciated the error occurs when i try to print tweet df update,python conditional nan value replacement of existing values in dataframe i try to transform my dataframe witch i loaded from a csv in that csv are columns that have nan no values the goal is to replace them all for example in column gh row as shown in the picture input dataframe is a value missing i like to replace it with the value of row because latitude longitude time step valid time are equal so i like to have a condition based replacement by those values but not just for gh but also for meansea msl t u and v input dataframe i tryed something like that just for gh my try this is very inefficent for big data frames so i need a better solution,0,65,127 how made cross validation with python hi i made a neural network and i need to do a cross validation i don t know how made that specifically how train or made that if someone knows made that please write or give me some indications here is my code some recomendation for training or validation would be helpful,separate a list in parentheses keeping them inside a list i have a list like this and i want this i am interested in knowing if there is a library that performs this procedure directly otherwise how to do it with some function,0,56,43 i m trying to call multiple images frames and applying a filter on all of them so i got the frames of an image and now i need to turn them all black without the opencv black and white filter but i can use opencv for the rest my issue is that img data image getdata is not working idk,rolling statistics performance pandas vs numpy strides i am interested in calculating statistics in rolling windows on large d numpy arrays for small window sizes using numpy strides a la numpy lib stride tricks sliding window view is faster than pandas rolling window implementation but the opposite is true for large window sizes consider the following the pandas implementation is actually faster for a larger window size whereas the numpy implementation is much slower what is going on under the hood with pandas and how can we get similar performance using numpy how can i get similar performance on large windows in numpy as compared to pandas,0,58,101 how to fix indexerror from numpy result,convert interaction list between proteins into a matrix using numpy for calculing the graph laplacian l it s needed the adjacency matrix i have the protein list nodes and the intreaction list between this proteins edges how can i convert the list into a adjacency matrix with values of if interaction occurs or if not only using numpy the output would be,0,7,63 can i get the screenshot data as a file like object or the image in bytes without saving any file i want to send a screenshot over a discord webhook i am using the dhooks module for this to send a file i need a file like object so i want to get a file like object without having the need to store the screenshot as a file any idea how to do this,how to use csv as instance attritubes in python how do i import csv file and use it as instance attributes for my class here is the code ive written driverandteam csv looks like this i keep getting list of out range error in line of my code but im not understanding why how can i fix my code so it works,0,71,62 python how to start y axis at i am getting the following chart as you can see the first bar starts at its value i want this to actually show the green bar which means y axis needs to be set to zero any help is appreciated,how to find a slice from n m of singular value decomposition matrix whithout cicles svd is equal to uvt where u m k matrix k k diagonal matrix vt transposed k m matrix also uvt can be determined as a u vt u vt u vt where u first column of u first element of vt first column of v scipy contains function svd a which returns uvt how to find for example a u vt u vt without cycles,0,50,91 list of all us zip codes using uszipcode i ve been trying to fetch all us zipcodes for a web scraping project for my company i m trying to use uszipcode library for doing it automatically rather than manually from the website im intersted in but cant figure it out this is my manual attempt this takes alot of time and would like to know how to do the same in more efficient way using uszipcodes,performance changing the data depending on the options while iterating i was writing a personal project and i found myself at a tight spot to make things easier code is basically iterating and printing the names of the users while iterating i check if getlastname option is enabled if its true then add it to the final name string for better understanding check the code below now the problem is my actual code is pretty complex and checks for many factors middlename coloredname so checking each time while iterating is reducing the performance since it checks for many factors and changes the final data what would be the best approach while keeping the code optimised and good if you are confused about what i am trying to achieve take this code for instance this code obviously is pretty bad because it checks every time for each user for options thanks,0,74,152 implement the scalar wise row variant of the matrix vector multiplication using nested for loops i want to write a function matvec row variant scalar a x that implements the scalar wise row variant of the matrix vector multiplication where a is a d array and x is a d array it must use two nested loops and scalar wise access to the entries of A and x this is what i have tried,weird results obtained while solving a set of coupled differential equations using a sparse array in python i have tried to no avail for a week while trying to solve a system of coupled differential equations and reproduce the results shown in the attached image i seem to be getting weird results as shown also i don t seem to know what i might be doing wrong the set of coupled differential equations were solved using newman s band here s a link to the python implementation python solution using band and another link to the original image of the problem in case the attached is not clear enough here you find a clearer image of the problem now what i am trying to do is to solve the same problem by creating a sparse array directly from the discretized equations using a combination of sympy and numpy and then solving using scipy s spsolve here is my code below i need some help to figure out what i am doing wrong i have represented the variables as c ca c cb c cc c cd in my code equation has been linearized and phi and phi are the trial values of the variables cc and cd,0,63,208 generate instance in column with duplicates in pandas input expected output need generate instance for duplicates in the column,reportlab first page different cover page i am creating a pdf report using python and latest reportlab i am trying to assign a different template to my first page without header and footer but my attemps do not work this setup is based on the documentation chapter how can i use a different template only on my first page below code creates a pdf with a simple table of contents and header and footer on all pages,0,19,79 sqlite operationalerror no such table sqlite schema i am facing a weird issue in tableplus when i run the following command it returns table but same query does not work in python python code is given below error i am using sqlite,parallelization with ray not working as expected i am a beginner with parallel processing and i currently experiment with a simple program to understand how ray works i am getting much slower performance with ray in fact if i scale up the input data i get messages in the terminal with the pid of the function and the program stalls essentially i try to split computations in batches of rows and assign each computation to a cpu core what am i doing wrong,0,41,83 no module named pyfiglet fonts failed to execute script due to unhandled exception i have recently compiled a py file to an application and the py works fine but the application gives me this error no module named pyfiglet fonts failed to execute script due to unhandled exception then closes immediately the modules im using,how do i get him to stay awake until i say goodbye building my own voice assistant after each command is given and response returned i have to wake him again i want him to be awake for all queries stuck please help sorry if it seems vague,0,55,48 table words and numerical values and generating text file i am trying to write a table in python but am unable to get the right outcome i am trying to get this output i am using the following code i am getting output also how can i link this to text file generation,explanation of dimension of input in a transformer model model architechture hey i was trying to code the transformer architecture from scratch as a part of my project i wanted to ask that what does the batch size refer to in the dimension of the of the input matrix of the encoder i have us the attached model architecture as my reference let me consider the example of an essay document the seq len refers to the maximum length of the sentence inside the document and the embedding size refers to the size of the word embedding of each word of the sentence in that case does batch size refer to the number of sentences in the document,0,53,115 pandas generate column on groupby and value counts goal is to generate a column pct group by id where pct st value of pts group by id number of same consecutive id value where x and y both are nan for e g when id pct it will loop through whole dataframe sample df expected output i tried,bucket policy with minio please note i am not using aws as the s provider but something called cegedim s following operation is not working with minio client but with boto it s working when i am trying to setup the following policy with minio client it works for the bucket level operations but not for object the level operations minio connection after setting up this policy i can t perform get put or any other operation on objects is there any workaround for this with minio client,0,66,85 using python how to change dimensions and aspect ratio of svg file iam trying to change the dimensions of svg file in python using the following code however the aspect ratio is being kept according to input file how do i resize an svg in python according to new dimensions newwidth x newheight and their corresponding aspect ratio newwidth newheight,intersection points between two functions multiple x axis and y axis coordinates i m working on a script which reads data from a ms excel workbook and does some plotting etc the data read from excel are accelerations measurements in a x a y and a z directions and the time in s separate numpy arrays accelerations are first filtered using a hz low pass filter before being plotted see figure for a plot example which are the permissible acceleration levels i need to find the amount of time the limiting curve is exceeded but the plot is related to a z and abs a y and not time my attempted solution is to the problem is i fail a bullet i ve succeeded in finding intersection points between the limiting curve and my filtered data i ve also managed in to find my data points nearest the intersection points however if i found the closest intersection point for a z this doesn t match the index i get from abs a y intersection points are found by so i m using shapely geometry imported as linestring to find the intersection points between the limiting curves here shown for limiting curve y and the function s l az abs a y to find the my data points closest to the intersection points i used the following approach intersection of two graphs in python find the x value the function i use to get my data point closest to the intersection point is where the array is my filtered acceleration array and the value is either the a z or a y value of the intersection point i suspect the reason for different indices depending on a z or abs a y is because my data points are too far from the actual intersection coordinate i e i might get a a z coordinate which value is close to the intersection point but the corresponding abs a y is way off similar issue is present for the abs a y intersection point data point correlation for upcoming measurements i ll increase the sampling frequency but i doubt this will solve the matter completely i ve attempted some different approaches without much luck and my latest idea is to try to use both intersection points when locating the nearest data point so i check if the index i get from my find nearest index function using a z is the same as the index i get from using find nearest index function for abs a y but i don t know how if that is possible but maybe there s an obvious solution to my problem that i just don t see a correct solution for the accelerations would like the following where the index of my data points match the intersection points desirable plot between intersection points these indices are then used for calculating the amount of time above the limiting curve by taking delta t t index t index but instead i typically get something like where the index found by using a z is different from the index found using a y resulting in a wrong plot and therefore also wrong delta t typical plot between intersection points,0,57,482 how to efficiently filter create mask of numpy array based on list of tuples i try to create mask of numpy array based on list of tuples here is my solution that produces expected result output mask problem is that with bigger data array and increasing number of tuples in filter vals it is getting slower it there any better solution i tried to use np isin data filter vals but it does not provide result i need,python flask sqlalchemy container unable to connect to mysql container i am unable to connect to my mysql database from flask application i am learning to build web application with python flask from this tutorial but tried modifying some elements of it for experimenting with docker even without using docker compose i was unable to connect to the database from the web application let me first give the error traceback in the application log flask test container and this is the mysql container mysql test log here is the starting point of python application microblog py here is the model class this is my compose yaml this is my dockerfile and finally this is the boot sh and these are some necessary environment variables that are being used in the application sorry if the question has become too lengthy i wanted to give as much detail as possible in the question let me know if any other details is required i have been trying to debug this issue for the past week but am unable to find a way to connect the app with the sql server also let me know if i should try any specific method to try to debug this issue edit create app function i tried changing database url from mysql pymysql test user abc dbserver test db to mysql pymysql test user abc mysqldb test db but the issue still persists i also tried adding ports to compose yaml and changing database url to as host but this is giving this error,0,70,235 how to correctly run this simulation i am trying to create a simulation but for some reason or other i get an list index out of range error i am not sure what i am doing wrong precisly it keeps returning the following at if capacity i indexerror list index out of range how can i fix this simulation to run correctly,calling attributes from class inside of a class method code error i m new to classes in any programming language however currently i am trying to create a program that will calculate a users tax position based on inputs the issue i m having is that when i call the attributes in method def get threshold the figures are not adding up i have declared the input as int but it appears to be generating a list when i run the method and the numbers don t add up is anybody able to kindly explain what i have done wrong the idea will be that the class will hold all of the user s income and pension contribution details calculate the tax position and the program will be able to print relevant tax information i have written the code without using classes however would like to move it into a class so that i can request information for additional clients if it s required,0,63,158 django orm query to update reverse many to many field models look like book can have many authors and author can have written many books now this information is required to be updated in the db how can this be done in an efficient way using orm currently the db may have book id linked with author id author id so the update should be able to add author id and delete author id as well,selenium unable to locate element partial text link i am new to selenium and i try to click a link on a second page after the login page the login part works and the browser goes to the next page however on the next page it raises an exception this is my traceback this is my code login info obviously blurred the element that i am looking for is the part after go changes every week that why i use partial link text i hope someone could help me out with this one edit i found the fix by using xpath the problem was solved if someone could elaborate why partial link text does not work that would give me more insight in how selenium works,0,70,126 replace all occurrences in a string by another string i have this string i m trying to replace all p n x by x n for example would return,splitting subtitle files with dialogs to strings or files in python i have a collection of subtitle files that contain dialogues like this i would like to extract only for example jane and then both and to have a resulting string or file like this and then both speakers combined like this so the result is sentence per line and interpunctions removed all but which are kept for contractions e g don t effectively i have managed to clean from interpunctions and numbers timestamps i ve been using regex infile is input file first re sub is to tidy up instances where there is no space after the interpunction sadly i haven t found any elegant way to condition and extract lines that belong to one specific speaker in principle i would like to be able to choose whether all will be saved to the same string file each speaker to a separate string file or one speaker only,0,25,152 selenium python timed out receiving message from renderer error i want to add the plugin called metamask to my browser and check the amount of etherium in my wallet but when i add the plugin sometimes i get this error and sometimes i don t here is my basic code im not using headless chrome thanks,seaborn after dates num date x not showing x equals x y on the graph lmplot after converting dates to floats necessary to use dates in lmplot then when trying to set ax set xticklabels the x disappears on the graph in the lower right corner eg x y,0,54,42 how to stop repetitive messages and the token is changed but it doesn t run i started learning python today and made a discord bot i have a few problems i searched a lot on this site and google i didn t find any solution it s okay to modify my code everything is from the internet so it can be a mess please help me,is there a way to set the expiration date of a bigquery table to none using the python client library the bigquery table created before my billing has been set to expire i don t want the tables to be automatically deleted so i m looking for a way to set the expiration date of these tables to none however i have more than tables so i am looking for a convenient way to do this therefore i m not looking for a way to set them one by one in the console the sample code i wrote is as follows and here s the error message i got any advice would be appreciated,0,63,111 split these strings while inside a list so i have this list and i need help finding a good way to split the list items at every n split wont work because i m assuming that it doesn t register the n as part of the string,replace occurences of a numpy array in another numpy array with a value i have a d numpy array i also have a second d array i want to replace all occurences of the elements of the second array with so eventually my second array should look like is there a way in python numpy i can do this without using a loop i already checked at np where but the condition there is only for example where element value and not multiple thanks a lot,0,45,88 when an object of a class has arguments how do you pass it as an argument of a method in another class this new class cashregister should accept retail object as an argument how do i go about it the class in retail has argument too,psycopg partial identifier result select from prefix prefixed table name what i want select from prefix prefixed table name or select from prefix prefixed table name how can i achieve this as a request from klin why wouldn t work one may simply enter which would result in,0,46,41 push rejected failed to compile python project django heroku it is my first deployment i am trying to push my django project into heroku but it is saying push rejected failed to compile python project i have tried changing the python lower versions but no luck any help would be much appreciated thanks here is my cmd output my pipfile py source url verify ssl true name pypi my pipfile lock my procfile,random sampling of groups after pandas groupby i have a large dataframe that looks like this etc what i want to do is to randomly select a number of responses from each group so that i can analyse them further my groupby function has returned something like this etc i want to have a new dataframe with random responses of each group is that possible using lambda because new df df groupby nationality sex apply lambda x x sample doesn t return what i am looking for is there a way to do this,0,74,88 beautiful soup web scraper indexerror list index out of range i am making a web scraper that scrapes yahoo finance and tells me what the current stock price is i keep getting an error like this after running the program this is the code i am a beginner into python so any help would be appreciated,efficiently finding the indices of a sparse matrix s smallest columns by smallest column i mean the column for which the sum of the elements is the least i e most negative here is my attempt but it isn t very efficient because i build a whole list of the sums of the columns h is a scipy sparse matrix k is the number of indices requested it s not important that the result be sorted,0,57,71 how to use numpy vstack to append row to empty array i want to append some rows of ndarray as values of dictionary however i receive an error for unequal dimensions using np vstack please guide me in this regard desired output dic below is the code i tried error,what is this scrapy error reactornotrestartable i do not understand why my spider wont run i tested the css selector separately so i do not think it is the parsing method traceback message reactornotrestartable,0,53,34 how to save d ndarray to image files i have the following python code that downloads a set of images to train a model with i m trying to save these images to files i ve determined that this is a d array based on the number of times i can index it before getting an error message about trying to index a scalar can anyone show me how to do this,static file css not loading in django i have tried everything i know to fix this all static files are working perfectly other than css views py html head please note that i am using bootstrap in base file if that affects anything settings py project directory i am sure the folders paths are correct as images are rendering correctly thank you in advance,0,70,62 how can call function inside class view in django i have function that return some information about user device and i have one class for show my html and form class how can i use function in class this is my views py this is my urls py,python functions not returning their values properly i am trying to learn python and i have just gotten past conditional statements and i m working on creating my own functions would you mind telling me what i am doing wrong that i have to write the convoluted print statement at the end that calls all of my functions one by one also any style tips would also be greatly appreciated thanks in advance for anything you can provide,0,47,77 python groupby and plotting of data hi i have this dataframe as shown is there a way to plot this for eg for to add up for total the graph need to show the daily statistics i e the total is and temperature is c sorry i forgot to add on i want to show if there is a correlation btn temperature and total thanks,pygame window keeps scales weirdly for some reason when ever i make a program with pygame the window is bigger then i make it but all the coordinates are okay and it s been annoying me a lot can anyone help with this here is a part of code i use to test it here is the output edit putting doesn t work,0,68,63 how to retrieve a link from a discord message i m trying to create a program which needs to read messages from a discord bot and retrieve links from these messages here s the code here s the output in the output there are links but i need to save the second link to a variable and i m wondering how i can do that,can someone explain to me how to resolve the argument error below with the use of my code the error here is on positional argument error where the code can not execute because of the position argument error on this line of code customer cars customer requestcar i got an error of typeerror rentcaronhourlybasis missing required positional argument n which i am not sure if it has been resolved i need an explicit explanation on how to resolve all the errors listed above the error my code,0,62,88 how can i modify the syntax end to print on the next line of while loops i m writing a simple code to print the factor of a number from the user input however the next line of user input starts on the same line as the indexes of previous loop output,python how can i write a text file that pulls data from an excel file format as column header cell value i am trying to automate an output for an excel file so it is more easily readable i have an excel file with columns a through by my plan is to read each row with a date that matches user input then read each cell in the row and if the cell is not blank output the cell value after this the data will be written to a text file in the format name is one of the columns so i think the idea would be to make a dictionary of names with each name having a nested dictionary of each column header and the value i am using openpyxl to complete this task i am able to properly loop through all of the rows and cells that match my criteria however i am having trouble converting this to a text file in the format that i am interested in using can anyone provide some methods of printing the cell values and the accompanying column header using a for loop for all the columns as well as in the desired format happy to provide any more information that is needed thanks to anyone that can help this is also my first post so let me know how else i can help edit i added some of the code i used to loop through the columns and rows work date is a user input value that chooses only rows with the correct date value we want to work with go through each row of given date and print cells with value in them here we select only rows with correct date and print only relevant non empty cells and they are printed and formatted to a txt file,0,52,307 getting a maximum value from a list in pandas columns i have the following dataframe df i would like to apply max of all in the list values and would like to get the following result i have tried this but couldn t succeed can any one help on this,need help deleting two lines in a text file in python so i m working on a school proj and i ve been trying to get a function to work for over a week i still haven t been able to i need to be able to delete a contact which takes up two lines on the code the code either erases everything keeps only the two lines keeps only one line or doubles every line except the first one which he erases please help,0,47,82 specific command executed by certain user discord py i am using discord py in replit to make my discord bot i want to make a command that is executed when two statements are true first is that it is the correct command and second is that the person who typed it is me the maker how do i make this code here is a link to the code please help me,how to transpose rows in a data frame including two columns and show them as column using pandas i have above dataframe i wants to result out to below format data list,0,72,33 how to get the top percentile values in pandas series for each class i was solving a practice question where i wanted to get the top percentile of frauds for each state i was able to solve it in sql but the pandas gives a different answer for me than sql full question,why does the ipython error about input mention raw input i have following line of code to accept identifiers this works great on my python however when i send the notebook to a colleague this error occurs what could be causing this mis match,0,55,43 valueerror when using keras imagedatagenerator i m trying to run this code from i ve tried using a few different version of python even tried it in a ubuntu virtualbox but i still keep getting this error i can easily fix the warning by removing generator but i can t get this code to work can anyone help fix this issue is there a way to test the directory iterator to see if that is the problem,can someone explain to me how to resolve the argument error below with the use of my code the error here is on positional argument error where the code can not execute because of the position argument error on this line of code customer cars customer requestcar i got an error of typeerror rentcaronhourlybasis missing required positional argument n which i am not sure if it has been resolved i need an explicit explanation on how to resolve all the errors listed above the error my code,0,75,88 create multiple columns from datetime object function df with local time local time loc returns based on the column i would like to generate multiple date related columns returns typeerror datelike variables got an unexpected keyword argument result type expected result,either of the two pydantic attributes should be optional i want validate a payload schema i am using pydantic to do that the class created by inheriting pydantic s basemodel is named as payloadvalidator and it has two attributes addcustompages which is list of dictionaries deletecustompages which is a list of strings i want to declare either of the attributes of class payloadvalidator as optional i have tried looking for the solution for this but couldn t find anything,0,32,79 why is this dictionary comprehension for list of dictionaries not returning values i am iterating over a list of dictionaries in a list formatted as follows each dictionary relates to one item of clothing i have only listed the first this is returning the reason for the if statement in there is that not every product has a value for uniq id so i was getting a key error on an earlier version of my code,pandas dataframe series adding character to string values i m looking for help about the following problem i ve got a dataframe all values are strings but my data was considered integer before imported to pandas blabla could be consider as anything not random but useless to know to solve this problem they complicate the way to rebuild id from id and id that s why i want to rebuild id from itself originally id should be id id number id number if id number id number or id id number id number if id number id number but as i said the ids were considered integer before imported so the that started numbers in id and id just went off i want to reconstruct id to fill the that are missing so i did those masks to do it and try to change values corresponding to them what i want is that all zeros are well placed so that the dataframe look like this the columns case is just here to show the number of digit in id but it s not in my original dataframe and i just put it there to improve visualisation you can get rid of it for calculation i ve got this error when i run the code i think it s because pandas is looking at my string slicing as chained slices on my dataframe i also tried to put str in front of all calls to string like str contains in the masks but it doesn t work either how can i do this instead,0,75,253 django model with exactly users references i want to define a game model in which exactly and not more users will compete each of this user can compete in another game in parallel or later i thought about a manytomanyfield but i don t know how to restrict the number of users how to do it,vscode doesn t recognize py solc x doesnt library i m trying to compile a sol with py solc x i downloaded the library with pip install py solc x but still vscode doesn t recognize it please help me fix this the massage after pip install the code,0,57,40 how to use a value from first method in second method in the same class i want to use the d value from can add method for add method but get error moneybox object has no attribute d how to use d value for add method,backtrader fail to show plot graph i am new to coding trying to use backtrader to do a simple backtesting process i was able to execute the buy and sell but when i am trying to plot the graph it shows attributeerror type object gcf has no attribute set new active manager my code is as below see if any one can offer some help many thanks,0,45,64 generator object preventing list comprehension i am trying to turn a string into a list of words then into a list of word lengths for example i think i should be able to do this using list comprehension for example but when i do i get typeerror object of type generator has no len i can t figure out where the generator object is and why it s incompatible with list comprehension any tips suggestions appreciated thanks,python bit connectionerror transaction broadcast failed or unspents were already used so i m trying to make a transaction using the bit library everything was working on testnet but once i tried my script on mainnet it return this error everytime connectionerror transaction broadcast failed or unspents were already used i tried to wait until some additional confirmations checked that both wallets where in mainnet but i can t get it to work here is my code,0,74,77 pandas column from match without merge i need to populate a column based on a match in a different column dataframe i need to create a bosses column i can do it this way this gets me where i want to be just need to rename a column and drop another is there a more efficient way,key error while getting header from json load here is the piece of code i wrote to output json data from api link but when i try to print specified header value i get this error json output prints correctly but specified header doesn t what is a problem,0,58,48 how can i convert instance to dictionary with model method and relationship below is the implementation of model class customer i want to convert the django model class instance to a dictionary somewhat like thanks,convert matlab system identification to python i have a piece of code in matlab that i want to convert to python the matlab code is using the system identification toolbox which is provided here to provide more explanation about the code i have data where i encapsulate it as iddata and split it to train and validation data these splits will be used in order to estimate the best order to identify a linear arx model once identified i want to detect nonlinearity in the system with these orders then i want to construct the arx model find the initial states and convert it to a steady state model finally i want to detect any abnormal behavior to identify if the system was unstable i started the conversion to python and found a package called sippy for linear arx mdeoling here is the code i wrote in python this code will read the data no need for iddata encapsulation and output the best arx model for a given range of orders this means it will perform as arxstruc z z struc nn selstruc v aic and sys arx z nn however when testing both on the same data to compare the output i found that the best orders given by matlab were while python returns when i investigated the reason i found that the loss value is different from matlab than python and since the output would be the order that achieves the minimum loss it is logical to have different orders so can anyone help me with that problem what is the loss function used in matlab and is there a package that simulates the system identification in matlab and provide the same results in python,0,36,286 csv reader reports values out of range i am attempting to convert a csv file into a python data dictionary here my code here are what initial rows of the csv file look like this works but when i include rows and it give me this error tried to troubleshoot but unclear why there is an error,problem with condition if a predefined text exists in the database field then the if condition is satisfied my idea is to insert a condition in the if if in the specified field in the database it says smartphone i have a problem inserting this condition in the if i would like to obtain that if in the device field of the database it says smartphone then the if condition is true i m not getting errors but hello doesn t print the database is the row for example is id street chelsea smartphone,0,58,93 how to convert nested dictionary values to list i have tried this code o p expected o p,how to save one row from dataframe i have a problem with writing row by row to output from dataframe i write my own solution but it s too slow so maybe there is a builtin solution for this problem the goal is to write dataframe s rows separately to the output my code is it possible to make this faster thanks in advance,0,16,62 how to convert list of tuples as dictionary of lists with common item from tuple as key of dictionary suppose i have list of lists i want to transform this as dictionary below also there are performance requirements as the original list is from mb of file contents,is it possible to include additional information on the x axis in matplotlib i have the following matplotlib plot and i would like to know if it is possible to include additional information on the x axis in matplotlib as the red dates that i included at the very beginning and the very end of the plot in my current version these red dates are not in the plot i use the following current code for creating the plot update i tried to include the suggestion from an answer an i have this code but now i get plots the original post without the annotation and one new plot with just a linear function that i don t want to plot and i don t know where it comes from with the annotation what i want is to have the annoation in my figure,0,48,141 opening anaconda prompt with python i want to create a script that will help me with installing packages for spyder therefore i want to use python and have the script first open anaconda prompt then execute the commands and then close that window however i can get it to open for example the calculator but it doesn t seem to open the command prompt for opening the calculator i used how can i get it to open the command prompt,pyttsx runandwait slows down i use the pyttsx library and it slows down the runandwait what is the solution ps pyttsx runandwait method gets stuck i read it it didn t help,0,79,32 random function that choose only the available spots how to pick an available spot value in an array i need a function that always finds an available location,multiple input and multiple output tensorflow model i am trying to build a tensorflow model which takes images as an input and gives output embedding for each input image the images are saved in a list called triplet the part of code is given below when i try to run the code i get the following error can any one please suggest where the problem is also the code provided is simplified for stack overflow so it may have syntax issue thanks in advance,0,30,86 unable to install beautifulsoup package for python using pip on ubuntu i was trying to install beautifulsoup in order to learn web scraping i was using pip to install bs package for python but i am unable to install it any help to resolve the below traceback error note i am using wsl ubuntu,python nonsense syntax error indented blocks in this code why does it give me a syntax error file line if l syntaxerror invalid syntax,0,58,29 twitter api how to get the latest tweet python i have these lines of code just basically gets last tweet from a person i want to have last one only how plz help me,competing regular expressions race condition i m trying to use python ply lex yacc to parse a language called grbl grbl looks something like this the g codes tell a machine to go or move and the coordinates say where lex requires us to specify a unique regular expression for every possible token so in this case i need a regex that will clearly define g and one that will clearly define g etc obviously one s first thought would be r g etc however g code is imprecise the g can be upper or lower case there can be leading zeros etc g g g etc so something for g may be as simple as and for g we could have but this does not work g parses correctly but g gives that is lex thinks that g is a g token and doesn t know what to do with the which is clearly some sort of greedy matching problem unfortunately i can t use the terminator to specify that the string must end with a i realise this might seem simple to some but i ve been at this for hours and can t get it to work does anyone know how to address this problem,0,35,204 how to edit and use a python package containing an so file i have installed a python package as usual using pip install package name it contains the main most relevant file in the form of so extension i want to modify it and use it for my work is it even possible to do it is there a background underlying code for the so file in python that comes along with the package or is it a standalone program,print pandas series vertically aligned when printed with another string i have a pandas series which should be printed with a string the result of the following code does not look pretty result what i want would it be possible with a simple code may be a possible solution but not perfectly what i want,0,77,55 store formatted strings pass in values later i have a dictionary with a lot of strings is it possible to store a formatted string with placeholders and pass in a actual values later i m thinking of something like this the above code obviously doesn t work but i m looking for something similar,how do i discretize a continuous function avoiding noise generation see picture i have a continuous input function which i would like to discretize into lets say discrete bins between and right now i am using np digitize and rescale the output bins to now the problem is that sometime datasets blue line yield results like this i tried pushing up the number of discretization bins but i ended up keeping the same noise and getting just more increments as an example where the algorithm worked with the same settings but another dataset this is the code i used there numofdisc number of bins the red ilne in the graph is not important the continuous blue line is the on i try to discretize and the green line is the discretized result the graphs are created with matplotlyib pyplot using the following code any ideas what i could do to get sensible discretizations like in the second case,0,51,160 is it better to make custom registration with editing django usercreationform class or make it on a new table and class i wanted to make a django authentication but i was confused about wichone is better is it is better to edit the venv lib site packages django contrib auth forms py file and make my custom form and edit db on venv lib site packages django contrib auth models py or it s better to make my authentication system with model and views and forms on my application,histogram with opaque bars if i make a histogram using plotly express then the colors cover each other however if i use ff create distplot then the colors are more transparent this shows transparent colors which is much nicer is there a way to get the colors to appear like that in px histogram,0,72,50 appium driver find element reutrn dict instead of webelement ev appium node v jdk v android sdk python i want to locate the element but the function returns a dictionary type and throw an attributeerror dict object has no attribute click this is the code good is element the following is the return information displayed on appium is this normal if so how should i click the element any help would be appreciated,python move files from one location to other based on partial file name and modified date i m pretty new to python and need help i have files in folder with different names and extensions i m trying to move these files to destination folder based on key word eom in the file name and modified file date within last hours my code below moves all file to destination folder i need help to filter out only files with eom name in it please help thank you file names test txt nov eom csv dec eom csv other eom csv,0,79,92 for loop is only storing the last value in colum i am trying to pull the week number given a date and then add that week number to the corresponding row in a pandas python dataframe when i run a for loop it is only storing the last calculated value instead of recording each value i ve tried append but haven t been able to get anything to work,loop through functions in a class in python i have the following simplified code i want to loop through every function in the class states of course will return name state is not defined but i hope it gives an idea what i try to achieve,0,66,46 converting python dataframe to a particular json structute hi i want to convert my dataframe to a specific json structure my dataframe look something like this and the json structure in which i want to convert my datafram is below i tried implementing this with below code with different orient variables but i didn t get what i wanted so if any can help in achiveing this thanks,send mouse position every seconds pynput i am using pynput to send my mouse position every seconds i tried timing it this code doesn t work it crushes my program mid running the program send the location of the mouse using sockets any tips,0,69,45 maya setting frame range programmatically with the render setup api i am trying to set the start frame with the rendersetup python api in maya like this for some reason the value gets translated in how to set it to the proper value,linux mint and virtualenv activation command ignore me so i have this problem and nowhere i can found something like this linux mint vs code but i try also from terminal and is the same i had created a virtual environment with classic python m venv env then i try to activate venv with classic source env bin activate and i wait that next line in vscode terminal looks like this but not just nothing happen no errors no messages nothing the same line of code like i said also from terminal is the same anybody had experience on this or can show me what mistake do i make thanks,0,47,111 my discord bot doesn t seem to be executing a function on member join i m new to coding discord bots so this might be some easy fix mistake i made but when a member joins my server the bot doesn t seem to react be it to add a role or just send a random message in the console i d also add i m using replit to host my bot,extract white regions from binary images i am trying to select only the eyes that were segmented from some face images here is one example of one binary image the problem is that i want to get each eye of the image putting them centered in a fixed size squared image in this case there will be two images with the eye centered on a fixed nxn squared image i tried to check the following post how to extract white region in an image but it seems to work only in one big part of a binary image how to do that in my case,0,67,105 valueerror when using keras imagedatagenerator i m trying to run this code from i ve tried using a few different version of python even tried it in a ubuntu virtualbox but i still keep getting this error i can easily fix the warning by removing generator but i can t get this code to work can anyone help fix this issue is there a way to test the directory iterator to see if that is the problem,code explain python class keyword argparse with namespace i have given a task to solve and understand python oop concept in following code i did not understand what is the purpose of this following line and how do i access keyword arguments in user class method displayuser because object of user class is already created before passing the argument this is what i thought can anyone explain the following code,0,75,70 setting time with interval of minute i have a dataset which comprises of minutely data for stocks over months i have to create date in the first column and time with interval of minute in the next column for months i am attaching the snap of such data set kindly help me to solve this problem data format,changing column label python plotly how to change column titles first column title should say year and nd column title year i tried using label but kept getting an error,0,64,30 how to remove a tuple from a list of tuples on variable condition i have list of tuples that needs to stripped based on condition from separate variable when appenv non production i want to remove entire production tuple while when appenv production only production must remain,set sep parameter for print function globally is there a way to globally set the sep parameter of the print function i m getting tired of always doing this manually for every print statement simple example of course i could add a shortcut sep n but i d still have to assign the sep parameter for each print statement is there a way to do something like this,0,48,65 find all combinations with set characters i m new and i promise you i ve tried google for the past few hours but i must be using the wrong words and for that why i m here i m trying to find all combinations with some set fixed prefixed characters at in certain positions for example dt fg zr l m n q p characters to choose from,plotting a heatmap based on a scatterplot in seaborn is there any way that i can plot a heatmap in seaborn based on a scatter plot for instance i have the following scatter plot and want to plot the corresponding heatmap in such a way that darker spots in the heatmap shows more crowded areas in the scatter plot,0,63,59 conda activate in script to run a python program i take run the following manually can i run both of these in a shell script,multiple values to single variable python i am tryin to create some really basic list using python only for practice but i am struggling to find answer for how to add multiple values to a single variable program should read one or another depending upon a users input i wish to enter multiple values to a single variable so that i can use just that variable later on,0,25,68 filenotfounderror errno no such file or directory after copying pathname i copy pasted the pathname from the folder i want to extract images from this same exact code was working before but now i get the error message i held down the option key whilst in the folder and clicked copypathname on mac so it cannot possibly be a non existent path folder,command not found discord bot so i am making a discord bot with multiple command but only the one on top seems to work i would really appreciate it if you could tell me what is wrong,0,61,37 why is there a difference in how the in operator behaves this works perfectly but when i apply the in operator to an array like this it fails,how to use temporary file from form upload python django i have a form where users can upload up to images at a time i have changed my file upload max memory size in django settings to so all files uploaded via a form are written to a temp directory in my root folder i am then trying to process the images with opencv this returns the absolute file path of the temp image in a string format so i put that in the cv imread however it creates a nonetype instead of a numpy array like it should and then my program cannot run when it reaches how do i read the temporary file into opencv any help is much appreciated,0,28,120 why am i not getting in python i keep getting even when i changed my range to total what must i do to get,split linestring at given point using shapely split function i have a geopandas dataframe that looks likes this it contains two geometries one being a linestring they are all closed polygons all of them rectangles the other being points the edges of the polygons what i am trying to do is the split the linestrings at the points thus splitting the polygons lenstrings into segments i e the sides of the polygons i tried to do the following thing but i get the following error i suspect i might very well be wrong that split tries all combinations therefore i tried to apply split line by line but i still get the same error how can i solve this any other approach is ok,0,27,121 why python multiprocessing always generate same random values i am using pool map to process my function there is a random value added in the function but i find the result from each process is the same how can i generate different random values for each process this is an example i want to have different values,ssl problems using twilio i m trying to use twilio to send sms i m using their templates to send my first test message i ve manually replaced the sid and the token with their respective values as per twilio s console the os environ function doesn t work the thing is this error appearas as i try to run the code i ve never used an api before i could really use somebody s guidance thanks in advance,0,57,71 how to only show the final result after adding or multiplying all natural numbers it has been a week since i started to self study python and i tried making a program that adds or multiplies all natural numbers and the problem is i want to only show the final result of all the sum or product of all natural numbers how do i do it,how can i do groupby without importing anything and in an expressive and oneliner kind of way i am wondering if it is possible to do grouping of lists in python in a simple way without importing any libraries and example of input could be and output i am thinking something like the implementation of itertools groupby but shorter,0,65,59 checking for word in message previous defined str disnake discord py so i am making a command to post a message into a specific channel and i need to make it so payment option comes up if buying or selling is said instead of when advertising is selected anyway to do this using disnake,nested dictionary to compare against d array so i have this nested dictionary i am trying to test the array against the dictionary the dictionary is essentially a trained decision tree such that and any other condition means no rain for example high partly cloudy false no rain i wrote this function to get the desired output from the above but i am kind of failing at navigating the tree and getting wrong values how can i navigate this dictionary and check for the above mentioned conditions appreciate the help,0,53,92 how to fit mixture of gaussian with custom made function i am familar with matlab and used to do mixed distribution fitting with my own function i wanted to learn the same thing with python but struggling to do i am not sure how to define the parameter constants and get the value of fitted parameters i e mu sigma mu sigma and probability any help will be appreciated,how to create multiple data frames in for loop i have a list of names i changed them to letters that correspond with values in a data frame column i am trying to create a separate data frame for each name containing that name s associated qty grouped by part number as you can see from the code each time it loops it writes the new loop data over the previous loop s data in df how to i iterate a new data frame name each time it loops so that i end of with separate data frames,0,67,97 is onedrive sdk python api still alive the author from python onedrive python onedrive warns that his library is achrived and obsoleted by official library from microsoft and refers to its git repo sdk what perplexes me is that the archived obsoleted library is being maintained while the official repo is dead since years ago what s going on thanks,openai gpt search api not working locally i am using the python client for gpt search model on my own jsonlines files when i run the code on google colab notebook for test purposes it works fine and returns the search responses but when i run the code on my local machine mac m as a web application running on localhost using flask for web service functionalities it gives the following error this error occurs even if i implement the exact same example as given in openai documentation the link to the search example is given here it runs perfectly fine on local machine and on colab notebook if i use the completion api that is used by the gpt playground code link here the code that i have is as follows any idea why this strange behaviour is occurring and how can i solve it thanks,0,56,148 why the string in unicode form is not equal to its unicode code point value we can get the string s unicode code point value why the string in unicode form is not equal to its unicode code point value,learnable leakyrelu activation function with pytorch i m trying to write a class for invertible trainable leakyrelu in which the model modifies the negative slope in each iteration however i set requires grad true the negative slope wouldn t update are there any other points that i must modify,0,40,44 defining month days to show number of days in each month i m taking a crash course intro to python and stumped trying to define month days to print the number of days in each month in a sentence saying month has x days this is what i have come up with so far but i am not sure how to define month,kivy numeric keyboard on text of the text field i am trying to add numeric keyboard in ui which will be display as clicked on the text on filed but some how numeric keyboard not show in the ui i use numeric json file to open the numeric keyboard as per the kivy documentation json file and link is here is my code below,0,60,64 why does the join method for seq object in biopython not work on the last element of a list the code below is from the biopython tutorial i intend to add n after every contig why is the trailing n not present after the third contig ttgca doesn t the index in python and biopython both begin with thank you,icrawler is great for downloading images but how do i save the source url icrawler is great for downloading images but i cannot figure out how to save the image source urls for the purpose of attribution i plan to make slide shows with the images and include a qr code embedded in the image for attribution i m using creative commons reuse with modification like this for each image saved i d like to save a file containing its source url in a separate file,0,60,84 two lines from different dataframes in seaborn s facetgrid i have two dataframes df and df i need to plot two lines coming from each dataframe in the same plot i ve been able to plot the one line but i don t know how to plot the second line i have how do i add a second line which is on the same scale but coming from df to g,tokenize text containing digits i want to create a text classifier the input to the model contains digits along with the text that contains important information don t think i can just throw away the digits is there a way to tokenize this kind of input the input looks like this,0,67,49 how to return all leaves in a recursive tree i m trying to create a function that will return all the leaves in my recursive tree i saw many other posts about it but i couldn t modify it to my own code i am trying to make like a decision tree this is my code from some reason it returns only the root and not the leaves for example diagnoser return all leaves self is supposed to return,cannot resolve file signup i am newbie to django and i need help to solve this problem it states that cannot resolve file signup,0,73,23 why do we need to move if statement i don t understand why moving under end text works but it doesn t work in the position shown below the full code,copy one database to another using sqlalchemy i m trying to copy a database using sqlalchemy the first attempt was but this code does not work since the order in which inserts are done is arbitrary and this violates fk constraints for example inserting a child before a parent will cause such a violation how could i achieve this task is there a part of the framework that would do this easily i can t find it,0,28,75 python jupyter crawling ebay website nested try except error im trying to get the price from pages in ebay but i have different of id tag to the price i v tried few options but i got indentationerror or when i got the output csv got a a column of empty cells,timestamp ecact time calculate this this timestamp from one of website but this timestamp always have few members extra if someone can tell me what is this and why this timestamp example mentioned by real order if someone can tell me what is the relations between those numbers,0,54,48 good looking sphere in matplotlib i ve been trying to plot a d sphere with some curves on it using matplotlib but so far the my results are disappointing i ve tried with several rgb colors opacities and colormaps but the output is similar how could i do something like this bloch sphere that s just what i m looking for thanks in advance,extract from string with multiple lines in python i have been trying to extract the particular substring from multiple lines in python the string goes for lines with foreign characters as well for instance chinese the example is my string n up in the air n out of the woods n not all there n all the way to born to the purple what i want to do extract only the english part and put them in a list here is my way of doing it is that possible to do this in one line thank you,0,59,98 how to shift items in an array by a k number of times shift the items in the given array by some number of times as shown in the below examples i have used the below to achieve the right rotate a list by k positions as of now able to obtain results for test but would like to achieve the test and test,for loop in python why does this return not does anyone know why does this return and not but when i do not indent the return statement it gives me this is my code,0,63,39 async check of several hundred proxies i need to check several hundred proxy servers and get the number of not working script for this proxies in the list i have given a simple version it takes seconds to check working proxies i can t wait that long need to increase the execution speed how can this be done using async,data reset on selenium tab change while trying to use the data i get from one tab in the other tab with selenium it resets the data when the tab changes so i can t use the data how can i prevent this my code for example the output of the code below is but this code gives error i want to use the data of the isimler variable that i got from the previous tab in the new tab,0,61,81 discord py handling user to mentioning other users when the user tried to use the command but mentioning a other members it will sends an errors to the users,scrapy attributeerror dict object has no attribute dont filter i m trying to run this code the webdriver opens the page but soon after it stops working and i receive and error attributeerror dict object has no attribute dont filter this is my code below is the full error i receive i looked everywhere but couldn t find a clear answer in order to get rid of this error any advice would be appreciated thanks for your time,0,29,75 scrap link from balise a inside div using python beautifulsoup this my code enter image description here any solution possible,how to debug the identation levels in a python program i ve just started learning python i m using mu editor and i can t get past the first if statement i click run then enter joe and it keeps asking me who are you am i correct in entering this input in the run section or should it go in the repl or text editor section,0,22,64 pyspark crosstab with percentages i have a dataframe after applying crosstab in the pyspark example below instead of s i want to get the percentages of the rows i can be easily get that with the pandas using the crosstab function how can i get this in pyspark,converting an xlsx file to a dictionary in python pandas i am trying to import a dataframe from an xlsx file to python and then convert this dataframe to a dictionary this is how my excel file looks like where a and b are names of columns and and are names of rows i want to convert the data frame to a dictionary in python using pandas my code is pretty simple what i want to get is but what i get is what might be the issue,0,48,90 cluster values within two columns in groups in pandas i have a dataframe like this and i would like to cluster into groups the val and val values for instance and i should then get here is the dataframe if it can help,generate random binary strings of length i want to generate random binary strings of length i e from to where each string is length i m wondering how i could do this efficiently or pythonically right now i randomly choose between and times and then append the results into a string this seems pretty inefficient and not pythonic is there some library functions i could use for this,0,44,75 new to python and i m trying to add an item to individual lists in a nested list i m trying to create a code that will add milk to each list in a shopping cart nested list but if there is already milk in that list milk should not be added to it,kivy change color of widget at runtime i have the following widget and i add a couple of them to a list which i then draw on the canvas now i want to change the color of a specific key but when i do something like self keys i col nothing changes any ideas on how to fix this full code edit made the code a bit clearer and fixed a bug,0,52,71 why is islice permutations times faster if i keep a reference to the underlying iterator iterating through islice permutations a n is somehow times faster if i just keep an extra reference to the permutations iterator alternating between with and without the extra reference what s going on full code try it online,join rows with same index and keep other rows unchanged i have this data frame i want to get this merge the column text with the same index in column join and reindex id and paraindex rest without change i used this command it only merges the row with the numerical index in column join and exclude row with non index so i changed to this here it merges all rows based on index join but it considers row with index nan as one group therefore join them also to be group however i do not want to join them any idea many thanks i also used this it looks better as it has all columns but no changes,0,51,119 how to compare csv and write result to new csv using pandas i want to compare the sku of source and destination file and if destination sku matches with source i want to copy the meta title meta description and description of that row source csv destination csv merged csv my code is working now but if the number of lines changes increase then it throw error,why are references to python values that are function parameters stored on the stack frame in cpython python works with reference counting that means if there is no more reference to a value then the memory of that value is recycled or in other words as long as there is at least one remaining reference the obj is not deleted and the memory is not released lets consider the following example so my question is why does cpython hold an additional reference to values which are passed to functions on the stack is there any special purpose behind this or is it just an unlucky implementation detail my first thought on this is to prevent the reference count from dropping to zero however we have still an alive reference inside the called function so this does not make any sense to me,0,63,141 python access a class attribute without initializing i have two files where each one contains a class i am trying to access the attribute d from class in class without initializing class the following currently returns an empty dict which makes sense,how do i select element in a list present in an un ordered list using selenium python this the website i am dealing with here i am able to send the code for the security name but in order to submit it i need to click the dropdown element that comes after giving the security name how do i achieve this with selenium i used the code below and its not working staleelementreferenceexception,0,42,71 issues with logging in using python requests note i am doing this on a website which sole purpose is to be used for automation tests the credentials in the payload are the correct ones and when i look at what it prints i do not see sign out which i should see if it has successfully signed in,converting float number into datetime format i have a file that contains datetime in float format example i want to convert this into and leave the timestamp value input expected output,0,58,37 how to delete printed line of file my program read from kody txt file and print it on discord as replay to command i want to delete printed code from kody txt how to do this any ideas atm code didn t work because read coupon return empty value clear all txt file,saving rabbit mq messages into azure storage using python im using below code to receive rabbit mq messages the message format is json i want to save the incoming messages into a file in specified path could someone please let me know how to achieve this thank you,0,49,48 scapy error scapy exception can t attach the bpf filter i found a wifi scanner written in python on youtube direct github script link but i m having an issue with bpf filter as scapy error scapy exception can t attach the bpf filter script output i installed scapy and am running this code by python on m mac any ideas,detect if there are or more of the same symbol so i need to know if in a string which contains only s and s has of one of those in a row my first thought was to iterate through the string like so but it randomly gives out a wrong answer my next idea was to use regex like this but it still sometimes makes mistakes anyone has any ideas on why that would happen regex was taken from here,0,57,84 django drf api shows json format instead of interface i recently updated to django and drf and now my api shows in json format by default whereas before it was showing the interface i would like to see an interface like so but this is what i now get is there a way to change this back to the interface sorry if this is a silly question,repeating messages even after explicitly checking for history in discord i m trying to make a discord bot and i ve added functionality of the tasks repeating after hours using tasks loop after at an interval of hours seconds since the code is run on repl it i ve used uptimerobot to continuously send a ping after minutes to make it running always in the repl it my issue is that even after checking history in the channel the message is getting sent again as you can see in the below image by checking here i mean the explanation which is the explanation that comes with the api i m using nasa api here here you can see the messages repeating twice it shouldn t by the code i ve written here since it checks for the history in the channel however when i restart the repl it ide the code will run alright and print it s the same as it should if the message is already sent but otherwise it s failing what is the issue here appreciate any help,0,70,175 javascript await and python await are they same concept from a user point of view when we think of for loop we could say for loop in javascript or python are the same thing conceptually can we say await in both languages are conceptually same i smell this can be a bad question but albeit interesting question for me,function return first index meets condition my function doesn t stop when the first time the condition is met the lowest value in list started when started at start index what do i have to add to achieve it my code is it returns index instead of index start index is,0,59,52 how to use pandas to rename rows when they are the same in column a my dataframe is i want to use pandas to rename hospital when a row with the same value in the hospital column has a different value in the generalrepresentation column and when a row with the same value in the hospital column has the same value in the generalrepresentation column no renaming is done for hospital the effect i want is shown below,python rest api put method throws i have following python code here when a put request is made to update user data it throws while it works fine when a get request is made to retrieve data for a single user can someone see what is wrong with put i would really appreciate it i saw this project online to learn automation but i got myself stuck with this error,0,79,73 when i run the sportsipy nba teams teams function i am getting notified that the requested page returned a valid response but no data could be found the code that i am running straight from sportsipy documentation returns the following the requested page returned a valid response but no data could be found has the season begun and is the data available on does anyone have any tips on moving forward with getting this information from the api,how to install python statsmodels on apple m i cannot figure out how to install statsmodels on my m machine after following the instructions in similar threads about scipy and numpy issues with m i am able to install these but cannot install statsmodels statsmodels issues were also raised here but unresolved python version python pip version pip the command pip install statsmodels leads to the error message error could not find a version that satisfies the requirement statsmodels has anyone managed to install it thank you,0,76,90 list of all us zip codes using uszipcode i ve been trying to fetch all us zipcodes for a web scraping project for my company i m trying to use uszipcode library for doing it automatically rather than manually from the website im intersted in but cant figure it out this is my manual attempt this takes alot of time and would like to know how to do the same in more efficient way using uszipcodes,how to check if an element from a list exists in mysql query i have this list and this query but it doesn t really work any solutions notice date in the table is a datetime date object,0,74,36 matrix powers in tensorflow given an integer k and a symmetric matrix a as tf variable how to compute the k th power of a most efficiently in tensorflow,convert pandas dictionary to a multi key dictionary where key order is irrelevant i would like to convert a pandas dataframe to a multi key dictionary using ore more columns as the dictionary key and i would like these keys to be order irrelevant here s an example of converting a pandas dictionary to a regular multi key dictionary where order is relevant so df dict will get but df dict will result in a key error potential solutions this is a so question which covers ways to make order irrelevant dictionaries using sorted tuple counter and or frozenset multiples keys dictionary where key order doesn t matter however no apparent solutions jump out at me for using these datatypes and functions with pandas conversion methods the next idea would be to convert the dictionary keys after the dataframe has been converted i tried this but got this error,0,27,146 add test case with robot api how to add a test to a robot file from the api i tried this see code below but it does not work does anyone have an example of adding test cases on a robot test via the api i m probably not using the api features correctly robot test,how to convert list of lists into a dataframe pandas i want to convert these lists into a dataframe expected dataframe note first row is empty since all the first elements are empty,0,55,32 comparing dataframe columns with acceptable deviation in python how can i have the comparison between two pandas dataframe rows considering an acceptable deviation instead of a match for example with acceptable deviation i want to generate the result column below based on the other columns i wasn t able to find any built in functions or pandas functions,unable to install brownie using pipx this is what i got after runing the command pipx install eth brownie on installing cytoolz using pip this is what i get i see there are other ways to install brownie but i don t understand how to create a virtual environment and do other things i don t know what else to do please help,0,59,61 how to plot combo line plot using different x value intervals but same range dataset sample for the monthly sales and semesterly sales my data set and nd,how to read one line then jumps three while in pandas read csv until the end of the text file i have a text file with nexto to thousand rows like so but i only need to read some of the rows of the file marked in red in the image with the pandas read csv function the logic i m trying to do is like read one line then jumps three until the end of the file so i won t use the rows that are useless for me i know that there is the parameter skiprows in the pd read csv function but i m not sure how to pythonly put the logic in the parameter of the function in the end i will need a dataframe with only the following columns of all the text file thanks in advance,0,28,133 issue with else part printing pattern i am trying to print below pattern but not able to able to achieve down word pattern any suggestion or concise approach expected output code the above code printed abnormal pattern in down side how to fix it,issue in visual studio code editor why are files closing when i save them when ever i create a new file add a couple lines of code to the file and attempt to save my work the file immediately closes right when i initiate the save furthermore the file that closes is not appearing in the open recent file list that s located in the file menu edit the file immediately closes after i save as it because when i click run python file it open file explorer tab,0,47,89 capture elements with selenium which are loaded lazy in python trying to click a button with selenium but i keep getting an error nosuchelementexception message no such element unable to locate element method link text selector agree here s the button i am trying to click i assume the popup is loaded lazy i found some sources but could not make it work here s my code i also tried and the popup is definitively there but still get the same error,converting lowercase to uppercase in python using recursion i am a student relatively new to python learning it through classes we were given a question where we have a list as an input and we have to convert each element to uppercase here is my code so far and it does the job but the problem is it is not using recursion and i have absolutely no idea where to use it i am open to all suggestions but layman s terms are preferred edit adding example inputs input rohit mohan anjali ankit akshit output rohit mohan anjali ankit akshit,0,77,99 issue with django json response i have issue with json response messages values gives me user id instead of username how to get username here is my code,python pandas compare columns with nan returns false i have dataframes one is called old and another is called new the dataframes have multiple columns but i am interested in column called addtext when you open the files in excel and compare the addtext columns they are completely identical when i do old new in python it returns false when i do new addtext equals old addtext it returns true why don t they both return true since both columns contain only the nan values in them example output,0,26,89 unable to play sound even after installing playsound in python downloaded the sound from and the syntax of the playsound was from the official site of it still there is no sound played and giving me the below mentioned output of execution output python u c users hp desktop python files hello py,how do i update like dislike vote in database without throwing an error i m making an online business jargon dictionary using mongodb i want to make it possible to vote terms up and down i m getting to grips with crud but i m a bit stumped on the syntax for updating part of a record i have this template the logic is that when like is clicked the code should pull love percent from a dictionary convert to integer or provide value zero if not present add convert to string and update within the same objectid this is the code i wrote for that route i tried using just update or storing the integer but that seemed to fix it a friend suggested update one but i m basically a bit confused and lost can anyone suggest what i m missing here or a better approach i m aware that this doesn t prevent multiple votes from the same user that functionality can come later the dictionary is being staged on heroku here and i have pushed it through with the bug i get the following error on traceback attributeerror dict object has no attribute update one the repository for this code is in github,0,48,200 how fill the missing values in the dataframe as ffill function needs nan none which are not in my dataframe as in the question above is there any other way to do it because i care about not using values np nan input dataframe output,confusion matrix ix not giving correct result two types of csv files i e train csv samples and test csv samples both the dataset contain following attributes id unique id for a news article title the title of a news article author author of the news article text the text of the article could be incomplete status a status that marks the article as potentially unreliable fake real program is working fine but not giving appropriate results for confusion matrix,0,43,81 python why is len always return for list not sure why len is returning just as output in python should be output,all combinations of all elements of a d array so i have matrix a and i want to have all the possible combinations with these elements this means that rows can change between them and columns as well in this situation i would expect a possibilities i have tried it does creates me my desire to output a matrix of but all the rows are equal this means that i get vector times here is an example another example if the output should be all the possible combinations of arrays that the matrix can form another example would be i have the vector layers and then i have vector angle each layer can have one of the angles so i create a matrix a great but now i want to know all possible combinations that layers can have for example layer can have an angle of o layer an angle of o layer an angle of o layer an angle of o and layer and an angle of o this creates the array so all the combinations would be in a matrix how can i generalize this process for bigger matrices am i doing something wrong thank you,0,26,209 combining elements from multiple lists in python say i have some lists i would like to combine elements from those lists above so i would have a new list looks like this how do i do this in python,replace child attribute to parent attibute i am able to create xml with duplicate key and follow suggested answer python dicttoxml same key multiple times but it hit badly performance issue when i user custom class fore more than million record i have tried to update node class above but did not get efficient time improvement later i move to follow link which suggest to use default which is really faster and data process in less than min why is dictionary lookup in python always slower when using user defined objects as keys but i am looking xml following way is there anyway to get following xml node class dict,0,39,111 i can t install the numba package via pip enter image description here i can t install the numba package via pip i want to install the numba package but an error appears every time,how to get selenium to cycle through a hierarchy dropdown i have this link that i have to scrape parts from to get to each part i first need to cycle through a series of clicks to make the elements visible an example is the image below my code however gets stuck after going through one cycle i cannot seem to get it to go through several times please take a look at my code i would appreciate any ideas to assist me write the loop properly my code isn t complete so would love to get any inputs to improve its efficiency,0,33,103 plotly subplots issue with specs value error i am trying to plot subplots with secondary y axis with plotly subplots but no matter what i am trying still getting this type of error valueerror the specs argument to make subplots must be a d list of dictionaries with dimensions x received value of type class list secondary y true secondary y true secondary y true thank you for help,is it possible to shorten the code in pyqt by sticking lineedit in for i have lineedit blocks and i want the textchanged function to trigger when any of them change i decided to take the easy route and write them out in order but now i want to shorten my code i wanna shorted this like this or like this but it does not work thanks for your attention,0,68,71 one column lost after using simpleimputer i used simpleimputer on some dataframe the no of columns in the imputed dataframe is less than the original dataframe cat cols is a list of categorical columns of dataframe x valid and has elements i e original dataframe has rows columns imputed dataframe has rows columns,new to python and trying to find out how to gather the quantity of one specific item in a nested list i m trying to figure out a code that will go through all items of the list and keep a count of how many times the given item occurs without the count funtion this is my code,0,57,57 how to write a text parser logic which identifies keywords from a dictionary how to make a simple text parser that finds keywords and categorizes them accordingly example i have two dictionaries now i want to pick out if the keywords from a are present in b and the result should be something like this i m a beginner and the logic to get this is very confusing,using two dataframes how can i compare a lookup value as a substring in the column in another dataframe to create a new column if the match exists i m attempting to use two dataframes one as a lookup table to find a substring match on the value in my datasets dataframes column after i find the value i d like to create a new column with that value and iterate through the entire column and remove the matched substring from the initial column and loop through until there are no more matches the first problem i m having is i m not able to match or return the value of the match unless it s an exact string the tricky part is sometimes the ingredient name contains multiple words for a single ingredient this is a smaller sample of my code the commented sections include the error or the problem with what i tried ideally my results would look like this the original ingredient name would contain any values that were not found in the lookup in this example there are none what i ve attempted to get the match on the ingredients so far is the following i ve included the error messages and the issue with that line of code the part i m able to match on the exact string returns the following results but i d like to return the value instead of true fase and match on the substring not the exact match perhaps i m going about this problem the wrong way or maybe i m close but i m not grasping something any help that you can offer to lead me in the right direction i appreciate it,0,67,271 attribute error in web scraping in python written some code to scrape a website but i m getting an error nontype object has no attribute text failed to find a solution for this so how can i can fix this error,issue with turning tuple entry variables into an int for a math problem currently i ve been trying to have my tuple variables templentry windlentry dewpointlentry be converted into an integer so i can use them in the math sequence however i keep getting this error whenever it happens typeerror int argument must be a string a bytes like object or a real number not entry i was hoping someone could point in the right direction thank you the code is below,0,41,78 python pandas changing the default x as index to columns instead i have the following as my code with the following graph displaying problem is i wanted to compare each attribute mean age age amount etc next to each other by default pandas takes x as the index how do i change it to take column names instead then there will be comparisons one for each attribute,how to get all combination node given dictionary and list and sort by the longest node in python how to get all combinations listed from a given dictionary in python my dictionary input desidered output sort by the longest node,0,64,42 i having fields but i need to search by username in search field how we can do it in django application in my application there are fields like phone username address id but i need only details of username field when i search it in search box how we can do this can anyone help me with django code,read nested data from json using proto in python i want to read nested data from a json i have created a proto file based on the json but still i am not able to read nested data from this said json nested proto compiling using protoc python out pwd nested proto nested json parse py,0,61,51 how to set field value expiration time i have model user like this i set in the field myfield value foo after i want to set in the field myfield value bar for day and after this period expires the value becomes foo again automatically how can i set that expiration time is there any native django instruments for this,how do i find the country where the latest value changes the most by year imagine i have data like below how do i find the country where the latest value changes the most by year,0,61,35 modulenotfounderror no module named tensorflow python keras applications i am trying to import but it gives the bellow error my tensorflow version is and keras version is,customise polar contour plot axes style i am using gridspec to create a grid of polar contour plots in matplotlib to aid with the visuals i am trying the customise the appearance of the contour plots see this single polar plot as an example mwe below i have two formatting questions in mind how can i customise the r axis to show only and values how can i also make these numbers display in white when plotting multiple polar plots i am choosing to remove the axes and ticks on the other by using ax grid false ax set xticklabels and ax set yticklabels however a white bar along theta remains which i would like to remove see this image as an example of what i mean mwe,0,26,126 nameerror name sqlalchemy is not defined i ve installed sqlalchemy by adding it through project settings but am getting this error which i can t seem to figure out traceback most recent call last file users backup pycharmprojects pythonproject app py line in db sqlalchemy app nameerror name sqlalchemy is not defined app py,keep one value or split even based on association to claim no and cpt code i am experiencing a little trouble with an exercise assigned to me earlier here is a preview of the issue this is what i am using to merge or another desired result would be for the billed charge that is associted to the same claim no and cpt code and maybe modifier to be split even same thing for balance if adding the modifier to this equation complicates things then we can leave it out if this is not possible at all then what about the original desired result displayed in the image above the issue is cause by report a having multiple payment dates thanks in advance and let me know if you have any questions,0,45,132 path to each leaf of a binary tree the function above allpaths appends an array containing the path to each leaf of the binary tree to the global array res the code works just fine but i want to remove the global variable res and make the function return an array instead how can i do that,cannot find element selenium python from stockx hey i am trying to scraep prices off of stockx from upcoming sneakers first the porgramm finds the sneaker and then presses on the stockx link from stockx i would like to press on the red sell button i have tried so many different ways but i cannot seem to find a way to locate or press the link any help much appreciated,0,57,71 search json tree with python i have a json file that looks something like this the letter i need to check if the json file is a and in the json is a v or an r how can i proof this i am like this now in python but i want to know what letter stands on the position from v thanks for the help,how to handle data from async function python i have an asynchronous telegram bot game in which there is a small fighting game applications for the fight are implemented the fight itself but there is one thing there may be a situation where one or both players do not press the attack during the fight how do i set a time limit for attack so that this limit is reset after each attack i tried to implement the timer itself via asyncio sleep which returns true when seconds have passed after the move so here s how to handle this true via asyncio,0,66,103 pandas not replacing the string correctly this my pandas dataframe result i want to remove the b from china and for that i ran the following code but the result was unsatasfying i also received the following warning what s wrong here,matlab python integration on apple silicon i installed python on my apple m using miniforge but i am not able to use a conda environment on matlab however if i use macs built in python version it does work i am not sure what to do so that matlab uses a specific conda environment,0,41,54 how to reply to a message sent by the bot itself i want the bot to reply to its help message by saying this message is now inactive here s the code error message object has no attribute called reply,pandas dataframe set categories the inplace parameter in pandas categorical set categories is deprecated i have following statement in my code which now generates a warning as d python python lib site packages pandas core arrays categorical py futurewarning the inplace parameter in pandas categorical set categories is deprecated and will be removed in a future version removing unused categories will always return a new categorical object res method args kwargs how am i suppose to write to avoid this warning and future errors thanks in advance,0,39,72 youtube subscriptions list scraping i want to scrap my youtube subscriptions list into one csv file i typed this code but i didn t finish coding yet i found this error file users hendy youtube subscriptions scraping py line in soup beautifulsoup source lxml file library frameworks python framework versions lib python site packages bs init py line in init elif len markup and typeerror object of type response has no len i don t know what s the problem,find first occurence and get column name in columns pandas dataframe i am trying to get first occurence in months and get the column name as a new column in a pandas dataframe here is the df result should be mar apr jan accordingly i know that i can make it via for loop iterating one by one but seeking for much elegant solution,0,67,62 ethereum pre defined gas price in web wallet is this possible im trying to find a way to setup a fix gas price gwei in my metamask probably this is not possible in metamask but is there any way to force that or maybe there is any web wallet which offers that functionality,pytest mocking property and setter i m having a real hard time understanding how to mock a class that has a property and setter fixtures that access a private attribute after running the test this is what i get i ve also tried using propertymock in various ways but nothing seems to work how do i get this to work how do i mock the myentity class so that everything works the way it should,0,57,74 starting multiple discord tokens discord py how would i be able to start multiple token with discord py discord python with fetching the tokens from and external and then run each one how would i be to give them a random status,runtime question loading and bliting images i cant blit images in normal speed if the images in array brife review in my code i defined images as a variable x x those images relevant for specific class object draw function and will be bliting in main loop according specific condtions in the object draw function all the images are saved in lst images lst img img img img and bliting from that array according rulles i noticed that if the len of the array is higher then the loop fps is slower and i dont understand why the loading images is outside the loop code example i dont understand whats wrong and why i cant append more images to my images list without reducing runtime another question that not much relevant to this code but rellevant to runtime if this code without the main loop is in file number and in this file i import pygame and init the font only and in file num where the main loop is running i import pygame and init pygame is it reduce my proggram runtime,0,40,181 i m unable to pass the variable value into ldap code to create an account i m trying to pass variable to create account in active directory but i m not sure how to pass it it is creating an account in the variable name not the value of variable,line numbers and go to line i have a quiz and on the final round i would like it to end if it gets an incorrect value i have an if loop but i would like my final else values to have a go to line line number code as it is a long code in order to use this function how could i view line numbers i use portable python scripter,0,47,72 recursively add nested dictionary json to tkinter s treeview i would like to recursively add nested dictionary data made of dom nodes into tkinter s treeview items i was expecting to have a tree structure like unfortunately i noticed quite repeated fields here is the following code i was expecting to have a single html root with corresponding added children unfortunately this is the result below how can i readjust my code to have a perfect tree,why height parameter is not working in label widget pycharm showing me to remove the attribute height it is not an option,0,76,22 object of type inputmediadocument is not json serializable i tried to send file over telegram bot query edit message text inputmediadocument typeerror object of type inputmediadocument is not json serializable,checking multiple condition with numpy array i have a dataframe with several lines and columns and i have transformed it into a numpy array to speed up the calculations the first five columns of the dataframe looked like this these columns are now stored in a numpy array a df values i need to check whether at least two of the five columns satisfy a condition i e their value is larger than a certain threshold initially i wrote a function that performed the operation directly on the dataframe however because i have a very large amount of data and need to repeat the calculations over and over i switched to numpy to take advantage of the vectorization to check the condition i was thinking to use however i cannot figure out how to write the condition on parameters such that it returns a true of false when at least out of the parameters are larger than the threshold i thought to use the sum function on the condition on parameters but i am not sure how to write such condition edit it is important to specify that the thresholds are different for each parameter for example thr thr thr thr thr so i need to check that par thr par thr par thr,0,26,214 probleme when trying to login in django admin hello i have a legacy database wiche use unix time and i have override an absractbaseuser here is my model what i have done to insert unix time in my last login is to change behavior of django signal user logged in like this the get current unix timestamp is a sample function that convert to unix timestamp the get current unix timestamp function when i try to login in django admin i get this error,returning the time stamps of youtube videos based on a list of video ids you can run my code in this google colab file so i wrote a script that takes a videoid of a youtube video like based on this videoid my script returns a list of dictionaries with the youtube transcript the video content like finally i wrote a function that takes an input from the user namely the word sentence that you want to search and the function returns the time stamp with the according hyperlink now comes my question how can i apply this to a list of video ids e g expected output so every mention within all the video ids not just a single video id,0,77,119 implementing kosaraju s algorithm for scc s i am trying to implement kosaraju s algorithm to find strongly connected components of a directed graph in linear time the goal is to store and output the list of scc sizes this code produces the correct output for smaller graphs ex nodes edges but takes a really long time to work for larger graphs how can i optimize this,how to sum a column of a related table in flask sqlalchemy i have a flask application that tracks shift information and the orders logged during that shift the models are set up like this while the user is in the middle of a shift i want to display the total pay they have made so far and i also will commit it into the shift table later as well to get the total pay of all the related orders i tried to query something like but it always returns that appenderbasequery object has no attribute pay i know that i can loop through like this but that can t be as quick efficient or certainly readable as an aggregate function in a query my question is this what is the correct way to sum the orders pay columns or perform aggregate functions of any column of the related orders,0,66,147 pandas getting the mean of columns in multi index dataframe i have a pandas multi index dataframe like shown below i need to calculate the mean of en ez and nz columns under m and em to new columns e g mean also under m and em respectively like shown below can someone show me a workaround for this thanks in advance,is there a way to combine these loops is there a way to combine these two loops to make it more efficient thanks,0,60,24 python remove line if string appears in column i am loading an excel spreadsheet n lines x columns using and would like to apply a filter my goal is to have a list of strings such as the one below and keep the lines in the inputfile which either contains material or material potentially later more options in column of the inputfile many thanks,remove overlapping circles by keeping only largest given a set of circles with random centers and radii i would like to be able to prune this set so that if overlap between circles occurs only the largest circle is retained this is a similar question to the one answered here but the problem listed there seeks to retain the maximum number of non overlapping circles from what i understand i d like to be able to adapt the ilp solution given there to my needs if possible although a brute force search and remove type approach would be fine too the latter is what i ve tried so far but failed to accomplish desired result,0,66,110 errors on if an elif statements i am a beginner at python i am getting syntax errors on elif and if statements if dc dc elif b b,in the example code p progressdialog will not appear unless root withdraw is removed is there another way to keep the tk window from appearing the following code is from using python with root withdraw the idea is to show a widget without the default tk window appearing this works with other widgets however in this case if left in p progressdialog does not appear either i do not have enough experience to be confident that this warrants a bug report am i missing something is there a workaround,0,27,91 python sqlite cannot make table name from variable value the id is value of how can i success this i want to make a table named by variable error,openvino failed to set blob with fp precision not corresponding to user input precision i commanded data type fp to confirm i could use fp precision when i was generating ir format files but i got an error message when i tried to execute my inference engine code with fp precision and device assignation was myriad or gpu here comes my inference engine code and it can work with fp precision and device assignation is cpu which i only change the following three lines my environment is windows with openvino version and my devices are intel coreTM i k with intel uhd graphics and intel neural compute stick,0,30,109 how to collect all book categories with the help of scrapy i am new to scrapy and python and am having trouble understanding the flow from this site i am looking for how to gather all the categories of different types of books using scrapy then determine how many books are listed in each category and export the result to json format which software can i use vsc or spyder,getting a new datatime by offsetting a lapse in the unit of second from a fixed constant datetime given a fix datetime the objective is to create a new datatime based on an offset value under the column offset the unit of the offset value is in term of second the expected output is given in the column time my impression this can be achieved via however the compiler return an error may i know how to resolve issue the full code to reproduce the above issue is as below,0,71,94 python re sub removing words between two delimiters under different cases i have a string that contains patterns like how can i use re sub or other methods to edit this string to or i can remove the s afterward i tried using for loop to hard code it but the string is too long and takes a long time to run,expand information in one dataframe and link with data from other lets say i have dataframe as such and another one my goal is to expand df id to connect it with respective value from df variable to do comparisons of within values of variables from df for each index from df data at hand has large volume what s the most efficient way to expand information from df and ascribe value from df variable,0,60,71 modify equivalent values in a column i m working with pandas but i have a question about how to change equivalent values i want to work with binary values in the class column so i have and i want and to be changed to ah and i don t just have these lines i have in total how do i do it i want this result,how to output only relevant changes while scraping for new discounts in a previous question i got the answer from hedgehog how to check for new discounts and send to telegram if changes detected but another question is how can i get only the new products items in the output and not all the text what is changed my feeling is that the output i got is literally anything what is changed on the website and not only the new added discount here is the code and see the attachment what the output is thanks again for all the effort,0,69,100 error importing randomforestclassifier form sklearn when i try to run the imports chunk of code from a notebook i get this error message can somebody help me i am using the latest versions of python and scykit learn,how to check the aws ec instance runtime in hours using lambda how can i get the running time of aws ec instance more than hours here i tried,0,37,30 add a portion of a dataframe to another dataframe suppose to have two dataframes df and df with equal number of columns but different number of rows e g i would like to add df to the df tail df loc df shape thus obtaining any idea thanks,calculation of rolling weights with initial weight at the first day i have a dataframe for weights and returns and i want to adjust the weights based on the returns one day before except for the initial weights the basic idea is that the weights are changing based on the returns i created an example with the weights returns and the preferred rolling weights with these weights and returns i try to calculate the rolling weights for k w as follows for reproducibility thank you very much for your suggestions,0,44,90 moving specific values into same values column pandas i am trying to separate the values and sort them into another df with numerical values if any values appear in the id it will appear as in the new df and if the value is not present,clicking kivymd check box deselects any other checked boxes i would like the user to be able to select multiple items from a list of check boxes but for some reason checking a second box deselects the first and i cannot understand why my code is below python scratch kv dialog kv i ve reviewed several tutorials and tried my best to understand the documentation but i cannot see where the interaction between discrete check boxes is even happening any help would be greatly appreciated,0,48,82 how to send scrapy command line argument to scrapyd client i want to schedule a spider from scrapyd client by giving the command line arguments as well e g scrapy crawl spider name a person john a location porto o local csv above command works well when running spider directly from scrapy but it does not work when running it from rest api using scrapyd client basically the question is how to send scrapy s command line arguments like a o in scrapyd client,how to merge python io streams into a single iterator but maintain which item comes from which stream the desired functionality is something along the following which should output something like this in real ish time just to be clear running the same program from a cmd will output using p sp popen program arg stdout sp pipe stderr sp stdout will merge the streams but there is no way to distinguish between them using itertools chain will obviously put all lines from one after all lines from the other my only semi working solution involved threads pushing to a collections dequeue and the main program reading from it but this approach seems to mess up the order of multiline blocks written to the stream at the same time i e an exception like might be printed like to avoid the xy problem the end goal is to send the output over to a client in real time using fastapi responses streamingresponse and that client needs to know what is stderr and what is stdout if using a websocket makes this easier that is also ok,0,74,176 can t connect dockerized mysql container from flask app i m trying to make an dockerized app with flask and mysql but i m getting an error with exec db create all on flask sqlalchemy i have confirmed that the following can be connected can you tell me if there are any other settings that are wrong i m using mysqlclient so i also tried the following with the same results,find size of rotated rectangle that covers orginal rectangle hi everyone i have a bounding box of faces from the face detection system in the format x y x y i want to crop out and align the face my current approach is as follows calculate the angle from the eye position then rotate and crop using cv warpaffine function the problem is the new rotated bounding box is not completely covering the old bounding box how i can calculate the size of the new bounding box so it completely contains the old one,0,64,94 utf error while adding data to postgresql with python error characternotinrepertoire error invalid byte sequence for language encoding utf the csv file contains letters containing s i o g i i think the error is caused by this but i don t want to change them,selenium next pages with javascript throwing elementclickinterceptedexception error my code is working fine but the pagination portion throwing the following exception your help is much appreciate script,0,41,27 how to add pandas data to an existing csv file in google cloud storage i m saving files to a csv on my google cloud storage using pandas the problem is that my file gets overwritten when i rewrite data i have however specified the writing mode to a to add afterwards without rewriting the file thanks a lot for your help,how to add a counter for faces detected in this code i followed a tutorial about making a face detection program with opencv with python but now i want to add a counter in the top left with how many faces are detected by cam this is the used code advanced thanks,0,62,53 python text color is not working in cmd but it is working in windows terminal i m just working on a fun project to produce color in the console in the windows terminal it is working fine however in cmd it is not could you please help me windows terminal command prompt thank you,property method in python not returning correct value i am trying to solve the question in which i am asked to use property method to count the number of times the circles are created below is the code for the same the above code gives correct output for the area but counter should be and instead i am getting below output below is the output for input i have tried everything but no luck in the main section of the code no of circles is called as circle no of circles which suggests me that it will use property method of python but the output is wrong please help me find where i am going wrong,0,53,116 django view with slug and id i have this url and this view now i wanna show on that page category view html only the products that have particular slug and pk lets say kategorie cat cat is the category slug and the category pk is and i only wanna show the products that have this category and this pk btw yes product is connected with ecommerce via m m,numpy ndarray sorting to return indices above is numpy ndarray of the shape with errors obtaining in a certain classification task using two of the features the task here is to find smallest achievable error and the pair of features which achieves this minimum error because the data are few the smallest error can be seen by eyes its and the pair of features is either or the diagnal line with values is feature with itself so it was not included i have tried to do it with argsort but it only sort each row separately and i did not arrive at the answer please assist,0,65,110 dataframe object has no attribute value to plot a chart i need to plot a chart but it raises the following error code dataframe,saving colorbar plot as image file i am trying to save a matplotlib colorbar plot as an image file jpg or png i have tried the two ways written in the code below using clb savefig results in the error attributeerror colorbar object has no attribute savefig using plt savefig saves in a blank image without the plot is there something i m missing how to save a colorbar plot as an image,0,24,69 amazon neptune on submitting query attributeerror str object has no attribute source instructions i have the following code running on aws lambda but getting the following error error source code,making subplots in plotly anyone has solution on how to make make the histogram graph a subplot to the ohlc graph with same y axis but different x axises thanks a lot,0,29,30 how to save df to csv to a preferred location rather than desktop i am trying to save df to csv file to a preferred location but getting the following error the system cannot find the path specified however when i try to save it on desktop it works can anyone pls suggest what am i doing wrong here,how to fix error no module named builtin in python i am trying to convert matlab file to python so i found a library called smop whenever i run a code that imports smop library i get an error here is how i am importing smop this is the error message i am getting python site packages smop b py egg smop libsmop py line in modulenotfounderror no module named builtin how can i fix this error,0,55,69 does it matter in which order you use prefetch related and filter in django the title says it all let s take a look at this code for example when using prefetch related first does django fetch all the manytoone manytomany relations without taking into consideration filter and after everything is fetched the filter is applied imo that doesn t matter since there s still one query executed at the end thanks in advance,python data transformation i have a dataset with two columns how to convert into the format given below using python,0,68,20 import databricks notebook dynamic content using workspace api import method i want to import databricks notebook using workspace api import method content of notebook should be dynamic i am trying using below code but it gives error malfunctioned request request contains invalid json body i have tried converting content to base encoded data and pass it in payload still it gives same error main thing i want to achieve is i want to generate content of notebook dynamically,how to add each start and closing tag to section list in hmtlparser what i m attempting in python my code current first few lines of output i think the error is that once the first p strong is read it s true everytime i m just not sure and am totally lost,0,78,49 python numpy array of numpy arrays as object i have some np arrays i want to concatenate them as objects in an np array i want to obtain coordsall this is my code coordsall is now but i want two objects in my output array like many thanks,i either don t understand multiprocessing in python or flask sqlalchemy some time ago i wrote a flask application in python which spawns a new thread that does some processing then updates the application db sqlite on a regular basis the function i use to update the db is quite simple this worked quite well my thread has spawned several other threads each of these calling the update db function above which updated the db correctly now i changed my code because i wanted to make use of a process instead of a thread which would then again spawn those other threads so i did nothing more than simply inherit my class from python multiprocessing process instead of threading thread this child process now does all the work and still correctly very well but what i don t understand is why my db updates still work as before even though i have not changed the logic shown above the global variables flask app and database are set in my main application process before the new process is being started then in this new process i still call the global function update db as above and that still works first how can another process access these two global variables they are not passed from the main process to the child process the latter simply accesses them without any change in code since they are global objects in the python script moreover how can the child process access and update the db if both flask app and database objects have been created in the main process and again never been passed to the child process,0,48,267 ccc j s escape room solution python i am trying to solve the j s escape room problem from the ccc i can t figure out why the recursion does not stop at a return statement here is the link to the problems,is there a function for extraction not a principal root there is a function from math module named sqrt which returns a principal square root of a number for example math sqrt yields as an answer my question is is there a function which can return not only one root but also the second one consider the following code func yields since,0,41,69 how to put different dataframes in different sheets using xlwings python how can i loop over worksheets to put different dataframes using xlwings python i have three different dataframes that i want to put them in a cell of three different sheet i tried the following code ish lines and got this error com error none none none none,the more images i add to an infinite scrollview the smaller they get i m trying to make a reader app in kivy i m having trouble displaying images in a scrollview the more images i add the smaller they get is there some kind of dynamic way i can get the images no matter what size to fit the full screen i do have some code but at this point rather scrap it size hint on the y axis seems to do something but i wanna see if there s a better way,0,61,91 django display a list of post s categories with a number of post hi i am trying to make a template in django that displays a post categories table and has a number of posts with it i can t seem to make it right using annotate when making queries on my model like this views py im receiving list of posts instead and has a posts count key with value of models py where did i miss thanks,build shapely point objects from tif i would like to convert an image tiff into shapely points there are million pixels i need a way to accomplish this without a loop currently taking hours for example i have a tiff file which when opened is a x array the values are pixel values colors that range from to i open tif with rasterio open xxxx tif desired epsg is i need to preserve the pixel value but also attach geospatial positioning this is to be able to sjoin over a polygon to see if the points are inside i can handle the transform after processing but i cannot figure a way to accomplish this without a loop any help would be greatly appreciated,0,75,125 how to assign foreign key inside loop django i want to assign a foreign key to each color in a loop product model color model views,bfs on wikipedia pages is taking very long can someone help me analyze my code s runtime i am trying to perform bfs on wikipedia pages i believe i am implementing this correctly and in the best possible way run time wise keeping it to one thread but it is taking quite a long time to find a connection between two articles here is my implementation it takes sometimes a few minutes before finding a match is this expected due to how big wikipedia is or am i messing something up here and am performing it in a non optimal way or could it be beautiful soup is running too slow,0,26,110 pil image save convert does nt maintain rgb color i am trying to save a numpy array as rgb image using pil image save but it the saved image is not rgb how do i save the image as rgb i am receiving the image as numpy array the link to original image the link to image saved by image save,how to apply different schemas to csvs within a single dataset i m starting with a large zip file of csvs which i unzipped in palantir foundry i now have a dataset which consists of multiple csvs one for each year where the csvs are almost the same schema but have some differences how do i apply a schema to each of the csvs individually or normalize the schema between them,0,56,70 increase the value as soon as the condition is met i think this problem is quite easy but i can not find the correct function of pandas to achieve it or link in stackoverflow i tried it with cumsum but did not succeeded my dataframe looks as follows now i want to have a new column and here it should always be increased after every rd time id the output table should look like this,how to convert a string with comma separated values within a list in python hi i m relatively new to python and not quite getting a resolve for the mentioned issue i have an input list abc def asd trp faq expected output list abc def asd trp faq please help in achieving the same,0,75,46 best way to get first single value of list what is the fastest and best way to get first value from list there are multiple techniques but what is the best memory and speed and why examples below i would be grateful for other techniques as well,django many to many relationship query filter current db status servers with os as linux and with os as windows applications requirement application can have many servers and each server can be part of many applications also need support to create filter only those applications whose os is windows i tried below but it is returning all three servers,0,47,64 seaborn how to apply custom color to each seaborn violinplot how to use custom colors to obtain split violin plots like this image source the standard examples only show colors using up the hue parameter,data structures array problem cannot find the first repeating item i am new to data structures and algorithms and i have a problem we have two arrays and i want to return first repeating item eg arr arr in the above case first repeating item is this is the solution if we use hash table but what i need is the solution in array and this is what i am doing but the problem is that it is returning is repeating but it is not the first one to repeat,0,36,105 curl commands in python notebook fail with internal error i am running the below code in google colab and get the server encountered an internal error or misconfiguration and was unable to complete your request if i am running the command without passing in the variable data like below it runs perfectly fine only when i m looping through the file and passing variables it seems to be failing this works,why does my variable change in the certain function statement only in python my variable won t update if i change it in a function here s the code how can i update my variable for all the script,0,71,36 problem with custom language in pytelegrambotcaptcha i have tried many time to set a custom language for my captcha bot but when i put the text or any else function equal a string i got an error attributeerror nonetype object has no attribute text doc,method to choose variable for model i have a population of million people and variables which have many nulls zeros or for which i develop a python model which works as follows i generate a dataframe of the entire population and variables i take out the variables that i don t need id name for example i partition the data and calculate its indicators with ks samp scipy stats and then filter those with very low indices roc ks then i take the correlations of all the variables and filter again right after this i generate the model using xgboost using shap treeexplainer i get the importance of all the variables that were finally left in my model about variables although i reduced the number of variables there are still too many does anyone know any way to keep removing variables my idea is to get up to variables,0,45,150 update multiple rows in orm model at once i got orm object like this and my table looks like this i want to update my orm object with data so my table would look like this fruits how can i update my orm object fruits having data from updated data list i tried with but it doesn t work,a question on text classification with more than one level of category i am trying to produce a series of product classifiers based on the text description that each product has the data frame i have is similar to the following but is more complicated python and the sklearn library are used description is the textual data now it is only a word but the real one is a longer sentence level is the top category level is a sub category i know how to train a classification model to classify the products into level categories by using the sklearn library below is what i did what i don t know how to do is to build a classification model for each level category that can predict the products level category for example based on the above dataset there should be one classification model for plant to predict fruit or vegetable and another model for animal to predict seafood or livestock do you have any ideas to do it and save the models by using loops,0,57,177 having problem with the usage of driver find element by selenium i am trying to make a bot that auto logins to a website in order to write the username i m trying to use when i m looking that spesific variable from website on inspect the varible is two word like matinput formcontrolname on any other website if that varible is one word like id i simply write id after by and it works what can i do in this situation,how to write sparse global secondary index rows in aws cdk i am attempting to implement something like this using aws cdk where i have a table that is written to every minutes and an aggregator function that sums the values over each day the original writes to the table will contain the following columns player timestamp skills activities i want a sparse gsi to aggregate this daily so these rows will have the columns player date skills activities here is my cdk code and here is my lambda code when i write to the table the aggregator is being correctly called but it fails to write the new global secondary index with this makes sense because the date attribute is not included in the rows written to the original table however it does not look like the table api reference provides an option to specify attributedefinitions i tried writing an empty date column to the table when creating records so that it will be inferred in the schema but got the following error this error is for writing an empty string got a similar error when writing a null value is there a way to achieve this functionality using these tools edit while the table api does not allow users to specify a schema the cfntable api does reference i attempted to achieve this using cfntable however cdk synth fails with the following error i have had some trouble reconciling the level cloudformation apis with the level cdk apis,0,79,252 how to convert beautifulsoup output to a python dictionary also need advise on the type of database useful in managing large data in python when i run the below python code using bs i receive the data which is already in dictionary format how to i convert it in python dictionary or dataframe in python html head head body pre style word wrap break word white space pre wrap futuresprice iv lotsize optionchaindata calldelta calliv callltp callvega putdelta putiv putltp putvega strikes index x index y name calldelta calliv callltp callvega putdelta putiv putltp putvega strikes index x index y name calldelta calliv callltp callvega putdelta putiv putltp putvega strikes index x index y name calldelta calliv callltp callvega putdelta putiv putltp putvega strikes index x index y name calldelta calliv callltp callvega putdelta putiv putltp putvega strikes index x index y name calldelta calliv callltp callvega putdelta putiv putltp putvega strikes index x index y name body html,from import b relative import just does not work plz help i have followed the exact same step from youtube and websites but why this one still does not work using python and this gives error attempted relative import with no known parent package this is the a py script,0,66,50 how to modify a selected text widget in tkinter when pressing a button i have a program that uses text and button widgets i want it to insert a string in the text widget when i press the button but i have no idea of how to do that could anyone help me,i have to sort an array using insertion sort and using recursion without loops i have to sort an array using insertion sort and using recursion without using loops i have tried but it is not sorting anything here is my code output is same as the given array expected output is can anyone help me to find where the problem is,0,53,78 tabula errors javanotfounderror error while using tabula in google cloud function for my application i am using the tabula package to convert the pdf to csv the cloud function i have written is in python i have written it in requirements txt file but i am getting this error requirements file main py how do i resolve this is any alternative for this,add the remaining quarterly columns that do not have any values i have monthly time series data as follows i needed to convert this monthly data into quarterly data as a sum of three months so i adapted the code from here to do just that the resulting df is as follows however i wanted to have all quarters listed in between not just the ones that have a value larger than so my desired output is as follows so in this output there is an additional column q because it is between the first and the last quarter periods even though it has no positive values does anybody know how to do that,0,59,115 opening anaconda prompt with python i want to create a script that will help me with installing packages for spyder therefore i want to use python and have the script first open anaconda prompt then execute the commands and then close that window however i can get it to open for example the calculator but it doesn t seem to open the command prompt for opening the calculator i used how can i get it to open the command prompt,converting rows to wide columns based on duplicated ids in another column in pandas my question is similar to this this and this questions but still cannot resolve it i have a dataframe with duplicated ids i want to make it wide but i do not know how many publication type will i have maybe maybe thus i do not know how many columns wide will i need the max size of wide columns for publication type must be not be more than the number of types for each id expected output for now i do not need to put the same publication type into the same column i do not need all articles in the same column thanks,0,79,121 can t create a pandas data frame in pyspark i have been using pyspark which i have setup locally on my machine to query a large data set which has worked well so far however i would like to create pandas data frames for some of the data but upon creating a pandas data frame i get this error these are the imported libraries now getting this error have no idea why since it worked before,javascript version of while true loop i wrote this bit of code i ve tried the below but it doesnt seem to be working i m having bit of a struggle trying to create a javascript version of it since it seems js while loops constantly rerun but python seems to wait for input before rerunning i am using the readline module to receive input from the console is there something im getting wrong im fairly new to programming any solutions,0,75,79 install uwsgi on m monterey fails with python i installed python via pyenv and then created virtual environment with command python m venv venv which python returns users my name development my project venv bin python then pip install uwsgi fails with following error any suggestions,error with a python string to dateconversion using pandas i m struggling to change the format of the dates of my dataframe i get the following error valueerror to assemble mappings requires at least that year month day be specified day month year is missing that s my code thanks for your help,0,40,51 percentage of occurrences in a column using groupby in python pandas enter image description here suppose i have multiple entries in a column search term i want to calculate the percentage of occurrence of the brand i know how to get the count of each brand but can someone suggest a way to get these in percentage,how to replace string values from column with na and turn column into float i have a column in my dataframe which looks like this dtype object i want to replace unknown with na and turn object into float type but when i do this this error appears typeerror cannot compare types ndarray dtype float and str how to solve this,0,57,59 modify pandas dataframes inside a loop i want to modify some pandas dataframes inside a for loop the problem is that after the loop runs the dataframes are not updated with the modifications what is happening my code,how to remove decimal numbers in pxbax pyplot how can you remove the decimals of a px bar plot with the library pyplot with the following dataframe i execute the next cell to crear a bar grapich with pyplot with the parameter text importe i am able to set the value on each bar but it has many decimal like how can i round those values the column of the dataframe is already round image description,0,38,75 how to convert dask object columns into decimal columns i have this function in pandas i would do however dask doesn t support this so what is another way to convert a column into the decimal type,how to filter multiple rows based on rows and columns condition in pyspark i want to filter multiple rows based on value column ex i want filter velocity from channel name column where value value and i want filter temp from channel name column where value value below id my pysaprk df expected df i tried for channel name velocity and it is working fine but i dont know how i can do this for multiple channel name like velocity and temp below is code also let me know if this is right way to do or how i can do that,0,36,102 how do i make a leaderboard command discord py this is my event that configures levels for each member and stores the information in a json file i would like a leaderboard that lists the top people with the highest level but i am unsure how to go about doing this thanks in advance,unexpected requests exceptions connectionerror i was trying to run this code but a big error has raised i tried to ping this host but failed and google didn t give useful advice could you please tell me why and how to deal with it thanks a lot i have also asked this question on github at,0,54,54 copying files between folders of jupyter notebook i want to copy files from one folder inside jupyter notebook to another folder for example there are some ipynb files text files excel sheets folders hi now i have created another folder named hello and want to copy all the contents of folder hi inside jupyter itself so what will be the desired path to copy,is there a way to plot multiple lines using hvplot line from an xarray array i have multiple ytraces data in an xarray array data trace selection can be done by the above creates a line plot with a widget slider that allows scrolling through the lines with single line displayed at a time i would like to be able to plot all lines without creating the slider widget hvplot documentation is sparse as to how to do that,0,65,77 how to define folder name when saving json file in python how to define folder name when saving json file i tried to add myfoldername inside open but did not work also tried to myfoldername myfilename in filename definition error code,how do i receive interactions via outgoing webhook i m trying to make my discord bot receive an interaction via outgoing webhook it says in the docs that my endpoint needs to be ready to ack a ping message and that my endpoint must be set up to handle signature headers i ve completed both of these steps but it won t work here is my code when i run the bot there is no error message but when i try to save the endpoint url it won t save can someone please help,0,40,90 remove specific endline breaks in python i have a long fasta file and i need to format the lines i tried many things but since i m not much familiar python i couldn t solve exactly i want them to look like i ve tried this but the result not showing lines and also merging all other lines hope you can help me about it thank you,pytorch lightning complex valued cnn training outputs nan after batch i have built a complex valued cnn using complexpytorch where the layers are wrapped in a torch modulelist when running the network i get through the validation sanity check and batch of the training then my loss outputs nans logging gradients in on after backward shows nans immediately does anyone have any suggestions for how i can troubleshoot this i have a real valued version of the network where i m not using complexpytorch and everything works fine so i can t help but feeling that during the network s backward pass there is a problem with my layers being in a torch modulelist also i hard coded the network without a torch modulelist and didn t get this issue either,0,65,120 how to solve installation error of pyodbc on ubunutu i am trying to install pyodbc on ubunut lts and get the following error installing gcc via apt didn t work since it is not available for installation i currently have gcc compiler installed i tried installing python dev python pip as described in error installing pandas profiling with pip on ubuntu and but it didn t solve the issue any help is greatly appreciated,check if column pair in one dataframe exists in another i want to see if the column pair of id and ref in df exists in df i d like to create a boolean column in df to accomplish this desired output i ve tried the following along with a simple assign isin how can i do this without a merge,0,73,58 how to combine turtle with tkinter so i ve got tkinter code that when ran opens up a new window with a square root calculator when i try to get turtle in the same window as the square root calculator windows pop up,trying to read and print netcdf variables in python i have imported a netcdf file into python and am now trying to access specific variables in the file of over variables this is the code i m using in order to just print and read each variables this returns me with the error any idea on how to overcome this error this is the only way i can find that is used to print each variable,0,43,76 getting google returned a response with code error in pytrend i want to get yesterday or todays data from pytrend but every time i use this code i keep getting the request failed google returned a response with code with the data and sometimes timeout or rate limit exceed error my code,getting an error for pyspark when i try to run take i am new to learning py spark so forgive the very basic not detailed question i am trying to sc to read a tsv file and then parse that file however after reading the file when i try to do take on it it gives me the following error which i cannot understand i am running it on windows below is the code and here is the error i am getting any help will be appreciated thank you,0,54,89 error proxy next proxy pool stopiteration i am trying to run a script and it has a standard url for proxies which allows the script to run fine once i add my own proxy url i am getting the error error proxy next proxy pool stopiteration my url is in another file and i can also link that if needed code is below if anyone can help that would be great,tflitekerasmodelconverterv object has no attribute predict i am trying to predict values by loading a saved version of my model here is the code for it my model throws an error tflitekerasmodelconverterv object has no attribute predict can anyone please tell me what can i change here,0,69,48 shamir s secret sharing doesn t work with large ints i am to use a python example of shamir s secret sharing from wikipedia when i give it number a larger than it gives completely different output why doesn t it work after that number and is there a way to get around this,why do i have conda error in vs code for running a python file i ve been trying to get used to vs code and following their video tutorials i followed their debugging video and applied similar thing myself however i get the following error about conda i don t see any print outputs on the screen nor i can t use the input function in the code is there something that i m missing or doing wrong thank you,0,51,76 data visulation problem with bar plot and it s axes i have a problem i will show it you with pictures and tables my dataframe is like above and graph is like below the code is above i want to show the same values in one bar for example mgros sokm and bimas same values how can i show it one bar and one xticks as with all three names one under the other,django unable to add wysiwyg i am trying to implement wysiwyg on my page with this link i am currently at point when they want me to add below but when i added above i got below error message i am attaching urls py do you know why i am getting pasted error message,0,73,56 how to extract specific keys for location to dataframe i have a small data frame which looks like that i would like to arrive at something like that i have tried but i get an error and cannot get through that any help would be much appreciated,failure msg expected a constant of expected bake time with a value of self assertequal expected bake time msg failure msg i am very new to python and programming i am trying to solve the second python exercise on the website i am really struggling to understand why this first task fails the code properly executes in vscode and i pass the tests of this exercise using their online code editor why does the first test fail while the other succeed here is my code,0,47,83 improving performance of finding out how many possible triangles can be made with a given stick i am doing an assessment that is asking by the given n as input which is a length of a stick how many triangles can you make n for example now the codes i wrote are returning accuracy as the web assessment is throwing time limit error code b how can this be made faster,what it means for the incorrect usage of and to check multiple items in a list i understand the proper way to check multiple items in a list is to use any and all like this a slow method is shown below in the second if statement if e in lst and b in lst however the first if statement below does not return any error so what actually it is doing i e what is the exact meaning of if e and b in lst,0,77,83 why settingwithcopywarning is raised using loc i have checked similar questions on so with the settingwithcopywarning error raised using loc but i still don t understand why i have the error in the following example it appears line i succeed to make it disappear with copy but i would like to understand why loc didn t work specifically here does making a conditional slice creates a view even if it s loc edit pandas version is,for loop evaluation order i was looking into the all and any functions to see their guarantees about order for example the documentation states that the any function is equivalent to however when running the following code i would expect the second expression to not be evaluated and thus would return true instead the second line throws typeerror int object is not subscriptable i initially believed that this was some inconsistency in the documentation but indeed when running with the for loop version the result is the same my question is how does it throw the exception if it should not evaluate the second expression by returning true early i thought that python only checked those errors when running the expressions changing to also evaluates the print in both versions can anyone shine some light on this thanks in advance note using python and interaction was performed in the python shell,0,77,152 how to solve cv error opencv error bad argument in function imshow i m learning how to use opencv but i m running into this problem results in this error i m using python bit and the latest version for all the packages thank you,changing picture on python guizero grid when clicked i have been having a terrible problem and would really really appreciate it that somebody could help me can this be fixed so basically on guizero python i want a button to update a picture when clicked here on my battleship game i have a grid with each picture being a water tile when clicked on the water tile i want it to be updated so that the it displays a hit water tile i have tried to make it so this should go to the subroutine hit when clicked and update button s image to a destroyed tile i dont know why this is not working and i feel the solution is obvious but out of reach facepalm,0,43,126 accessing nested json using python i am having a very hard time finding a proper way to print my result from the json that i have i searched for many hours but was not successful in finding the answer here is the jsno that i have using python i want to access the code variable code teslaair i tried many things dumps load loads etc but nothing solved my problem thank you,profile has no user i m trying to use context processor to show profile page and when i use it the website shows profile has no user context processor models py also i made primary url for profile so when i want to go to profile page i write on url accounts profile mohammad account is the name of apps profile is the name of page mohammad is user name hints i want to use profile html on dropdown menu,0,72,75 python comment preserving parsing using only builtin libraries i wrote a library using just ast and inspect libraries to parse and emit uses astor on python internal python constructs just realised that i really need to preserve comments afterall preferably without resorting to a redbaron or libcst as i just need to emit the unaltered commentary is there a clean and concise way of comment preserving parsing emitting python source with just stdlib,function within f string is returning the function outside the string and returning none inside the string i m new to python and trying to do an f string as follows where east room is an instance of a class and get highest priority is a method within the class to display a patient with the highest integer for the severity attribute as follows this is the output conor naseau the next patient is none please i know that this method works as it works perfectly if i call it without the f string thanks for you help,0,72,92 calculating standard error does not give expected result i want calculate standard error of vector and i don t understand why it doesn t work let s consider vector calculating standard error of mean is just to calculate standard deviation and divide it by square root of length of vector however when i calculate this by function i obtain completely something different could you please explain to me why i don t unsterstand why this difference occurs,commanderror d python project resume already exists i am creating a django project i can successfully create virtual environment and pip install django but when i try to create project using there is an error that showed i tried uninstalling django twice but it only allowed me to uninstall once so it is likely not about duplicate django i also checked the lib site packages there are no duplicated folders or folders either however i do have two versions of python right now one installed along with anaconda one is separated from anaconda and directly downloaded from python org right now i am just using the separate python i even checked the python version and the pip version so it should be fine still i could be wrong since i am not that experienced what should i do,0,73,132 how to read sqs message using lambda python in aws i have tried to read message from sqs queue using boto client in lambda python but i face issue with errormessage sqs serviceresource object has no attribute receive message couldnt find the root cause anyone help on this my code in lambda,text games i have few problems with the one i am doing for school and would like a little help at the bottom is the error i am getting when running traceback most recent call last file c users alcsj pycharmprojects sample sample py line in current room dict str rooms starting room keyerror starting room,0,51,49 remove a set of words from a list of text i am trying to remove a list of words from a list of text but output seems like its not getting removed please help me in the removing the text from the list expected output,split the prices from string and place it in another column in pandas i have below dataframe what i m trying to do is to split charge amounts separately to different column tried to use regex and df prices df charges str split expand true with no success any suggestions,0,45,45 opengl vbo can run without error but no graphics the following code should draw a cube each time it is called error code print blocks is in the mainloop if i use glbegin and glend it can be drawn normally but after i use vbo no graphics will be displayed i don t want to use shaders i don t need them also how can i bind colors array to vao,wait for all processes to finish python this question has been asked numerous times but i couldn t find an answer to match my specific set up i have a script which uses multiprocessing here is a much simplified example i would like the pool to close at this point and normal single processing functionality to continue i thought the context manager would handle the closure of the pool and the join would ensure that it only closes once all processes are finished but i am seeing behaviour which suggests that the program is running beyond the context manager before all processes are finished is there more i need to do at this point also in this case there are processes assigned but only tuples of args passed to the function what do the surplus processes do in this instance python v,0,66,145 selenium python framework import issue when i run my selenium python tests via right click run in pycharm all is good however when i try to run with command line pytest i get error here is my folder structure driver py file looks like this testname py looks like this and when i run pytest v s tests testfolder testname py i get following errors in my console thank you for your help,why the the total number in confusion matrix not same as the data input why the total confusion matrix does not have the same number os samples as the dataset the dataset contains but the total at confusion matrix not exceed here is the code,0,68,47 unable to create logfile minute wise in python while using multiprocessing unable to create logfile minute wise in python while using multiprocessing,removing an item and printing the list in one line i was looking for a one line way to remove an item from a list and then print the list the first bit of code works and is straight forward and does what i want which produces the result we want a c but when i tried to make it one line print a b c remove b it returns none can someone explain the difference between these i have seen this question but it does not explain why these produce different outputs and does not really make it all work in one line and this is not actually important for anything i am just trying to learn what is going on here thanks,0,22,118 set the number of minor ticks in matplotlib colorbar i am able to set the number of major ticks of the colorbar using the following code borrowed from here is there a similar way of setting the minor ticks of the colorbar,attributeerror clients object has no attribute is authenticated in django restframework i want to implement a custom two layer of global authentication i e first every request must have a client id and bla bla after that request must have user authentication services like access token and refresh token when i want to implement the first layer it rais following error i m using i m getting the client id from the client request header and validating it as like my setting py config file is like this my client model as follow data in database table,0,42,92 iterate over files in databricks repos i would like to iterate over some files in a folder that has its path in databricks repos how would one do this i don t seem to be able to access the files in repos i have added a picture that shows what folders i would like to access the dbrks sql folders thanks image of the repo folder hierarchy,statsmodels api tsa seasonal decompose plot figsize i am using statsmodels api tsa seasonal decompose to do some seasonal analysis of a time series i set it up using and then try and visualise it using the output was tiny so i tried to use the standard matplotlib command of however this got the warning the documentation says that a matplotlib figure figure is returned from decomposeresult plot so i am unsure as to why this error is happening my version of statsmodels is and i am aware that the documentation is for but conda says that that version does not exist and that i cannot update to it any thoughts would be appreciated,0,68,105 when why use types from typing module for type hints what is exactly the right way for type hinting my ide and resulting code works fine for type hints using either of below options but some types can be imported from the typing module is there a preference for using the import from the typing module over builtins like list or dict examples and,giving input such that it reads the exact dataset among the others tkinter i have a certain number of datasets and i ve given numbers to each of them as the names let s consider datasets so the names are csv csv and so on i m trying to give an input here the number name of the dataset so that my code reads and works on that dataset how do i make that possible i ve done something like giving input and changing it into a string and using pandas read csv string csv but the code s not working can anyone help out,0,63,97 fix for tclerror can t invoke button command i m attempting tkinter in python for the first time but the button command creates an error it should create a window with a button but i just receive the error message,selenium python how to find span number between two values html sample div class lend count span span div div class lend count span span div div class lend count span span div div class lend count span span div div class lend count span span div div class lend count span span div div class lend count span span div div class lend count span span div div class lend count span span div in selenium chrome webdriver i am trying to find the first span that is between range of numbers in this case then click it if nothing on this page throw nosuchelementexception click the next page button and loop back try again tried to use range as well please advise,0,38,98 r to python stochastic process translation i want to translate the r code below into python it is mainly a stochastic process that i need to translate it into python the code implements a markov chain simulation of a jump process with two volatility stages the python attempt is the following i think that i am mis using the sapply like function in pandas but i am receiving an error on what is my mistake,how can i target my mozilla profile on mac os the same way i m targeting it in windows i have a working python script that ll run perfectly on windows it relies on python selenium and my current firefox profile here s the code i m relying on to grab my profile in windows i don t know how to make this work in mac os i guess the os path join function doesn t work the same is there any way to do this,0,76,79 what is the difference between numpy array with dimension of size and without that dimension i m might be a bit confused but i wonder what is the difference between say x and y same array but have extra dimension with size are they the same or there is difference between them,pyautogui if image is not on screen i am trying to use pyautogui to take a screenshot where another image is not found on screen i have checked that the image is not there but my code is not executing can anyone see the problem,0,53,45 python syntaxerror cannot delete literal i have a function and the rest of code not part of function and i get a error i have no idea why is this the case debian ubuntu python,uneven grid when plotting date in plt i want to plot variable by date days and month grid is uneven when month is changing how to force size of grid in this case data is loaded via pandas as dataframe ga code graph,0,34,44 find numpy array with don t cares in a numpy array i would like to find a numpy array with don t cares like where is the don t care and find it in arrays like and return the row index s and for the above sample the a array are normally around rows shape note the b array can have don t cares any where or none examples,hist d using imported data from pandas too many values to unpack i d like to plot a hist d plot based on frequency using x and y data imported using iloc however i keep getting the error valueerror too many values to unpack i ve shown a picture of the type of figure i m trying to produce along with my code,0,69,58 add a for loop if x i m trying to create a function to translate words to numbers one of the parameters is depth if depth is then the function will know ok i m translating a word if depth is the function will know now i m translating a list of words etc in python exist a form to do this,columnconfigure and rowconfigure tkinter page frames im trying to use the container column and row configure methods in order to create boxes that i am able to grid widgets in for each of my pages however it doesn t work when i run the program when i try passing parent instead of self when i create my widgets in my different pages my show frame function doesnt work and instead it displays the widgets from both of my pages at the same time,0,63,82 getting separate means line in a single plot i m working on this figure and wondering if it s possible to get a mean line like the black line in the figure but for each concentration group sorry i can t share the data with you ideas how it is right now how i want it to be red arrows are just to catch your attention,how to take a pickletype data and convert to csv files in a folder using python i am trying to take a pickletype data from sqlalchemy and converted it to csv files in a folder here is a snip of my class with the pickletype data here is my function that i am trying to get that data in pickletype and convert it to csv files in a folder,0,63,69 assign a value from dictionary to the list and convert the list to a dictionary i have a dictionary and a list i want the output as a dictionary with the values of k a assigned to first list k ato the second and so on in the list a like below i tried a lot but couldn t figure out a possible solution to this can anyone please help,select string after string with regex in python imagine that we have a string like i need to get a list of ips between routing for networks and routing information sources like below what i have done till now is but it is not working as expected update my code is as bellow,0,67,53 pyyaml how to set a default representer for non standard objects is it possible to specify a default pyyaml representer for non standard python objects how to instruct pyyaml to use a default representer for all non standard objects for instance i would like to invoke an object s str or repr method iff it cannot be represented safely,valueerror with groupby wrong number of items passed i get this error when i try to run this line i m trying to figure out the total weekly hours each person has worked with the daily hours i m provided with to do this i ve created a dictionary to refer to my current issue is that without using groupby to get weekly hours it ll subtract the minimum contract hours with the daily hours and return the wrong sum for example if a person has worked hours on days and they re a full time employee it ll do rather than take their weekly total hours to understand how many hours i need to add based on their contracted minimum hours the np where also won t work as it takes weekly hours to be the daily hours so the condition will always be true and replace the hours with their contract hours for each day i ve also tried changing the dataframe and filtering it through that w df groupby id contract hours as index false hours sum but it doesn t work i had to add as index false otherwise i d get a keyerror contract hours error initially i d get an indexerror before i added the as index false shown in this question indexerror when i added another groupby with pandas i apologise for repeating the question so many times with different errors but every time i make amends to the code it comes up with a different error and i ve tried different ways around it sample data expectations,0,55,249 how to find all buttons which contains a specific string using selenium python i want to find all buttons on the page which contain the word card or the word bag for example it could be add to card or add to bag or card etc,read xml with python tree getroot i am new to python i have this xml and this code this is an invoice where salesorderret is the header and salesorderlineret is each line of the invoice the problem that i have is i don t know how to read the salesorderlineret individually for each header the code that i have here is adding me all the salesorderlineret from the entire xml and not just one for the header,0,46,75 word cloud counting double words instead of one i am trying to do a word cloud with matplotlib in python and instead of counting single words like will its counting two like i will i have looked at the word cloud documentation and there doesnt seem to be anything that produces this could my input be causing this my code looks like the following,how can i remove a part of xml file i need to remove some parts of a xml file for example this file i want to remove everything between dict dict included that have a string calcification string in it in other words i want only the parts that does not have calcification my desired result for this file would be this is what i have tried result for context those xml files are semantic segmentation information and i want to remove the calcification class annotations,0,64,95 how convert seconds in minutes and seconds mm ss is it possible to convert seconds into minutes and seconds with this format mm ss i try to use datetime timedelta seconds seconds but it returns hh mm ss format thanks in advance,automatic change of discord about me the problem in discord as you may know there is a about me section this section is as description of a profile that you can write yourself bots can have a about me section what i want is to edit this about me section automatically in discord py for example every hours the about me section of the bot change what i tried i searched for a very long time some answers but didn t find anything relevant i saw that you can modify the about me with the developer portal but it s not automate i saw that some people said this will be able in discord py v but didn t find it it may be possible to resolve this probleme with http requests but it s only a supposition i m not very good in this topic show some code,0,35,142 binascii error incorrect padding when making an encrypted password its raising a binascii error when i try to input anything to decrypt the file i m decently new to python and i m not sure why this keeps happening if anyone has any suggestions or even better is able to fix the code please respond,issue in navigating aspx pagination using selenium i would like to scrape this url to iterate over pages and get their content that s what i have tried and i get pages out of specifically the visible page numbers in the url how to paginate all pages in this url,0,52,51 how can i shourtcut these functions in to few lines i m writing a code to execute a weighted tree and make all distances of the edges equal i want to simplify these statements in just a few lines to make it more professional any help,is there a way to combine multiple dataframes into one xlsx sheet and multiple dataframes across separate sheets here i have a function for multiple dataframes across separate tabs sheets multiple dataframes into one xlsx sheet how can we combine both these two functions need one excel file test xlsx with df df df in a sheet name called validation and df df df in a sheet name called validation my attempt where only sheet is created can someone let me know where is the mistake,0,46,80 how do i copy an error line from logfile to another file using python i m developing a script that should scan a night run log file this script should print the whole lines that the word error is shown there into another log file named analyzer which will going to create during the script running the output is an empty new log file without the willing lines the code is developed on python and i linked it to here,selenium gives server error after click django pytest i have a django app that i want to test via pytest and selenium the routine i m trying to go through is to let selenium log in then go to the menu choose one of the options this redirects to a new page which is found fine there i let selenium enter data and click a button to start a submission this too works and redirects to a third page on this third your submission was created successfully page there is a link displayed that the user can click to collect the results of their submission this page this link is displayed correctly the href url is fine but when i let selenium click on it i suddenly get a server error when i do the exact same thing manually it works fine here s my test code slightly simplified i have already tried to use webdriverwait self driver until ec element to be clickable by link text click here for your results click and that doesn t seem to even click i know that error mean s the error is on the server side but before clicking the server is fine all the redirections before this step work fine the urls also check out and manually everything works as expected i have no idea how to narrow down the problem further how can i investigate the reason for this error and hopefully fix it,0,79,233 count the number of days between two dates i am counting number of days between two dates for first testcase output is wrong expected output in first test case day is missing in output,iterate list within a list recursion my question is to create a function which iterates a list within a list and have the code such that if i keep introducing another list within that list it still iterates to return one list e g flatten list gives my attempt at the question but this gives an output of i m quite new to coding and would appreciate a simple answer even if its quite long i ve looked at other stackoverflow questions similar to this however they use complex commands such as isinstance or flatten and they don t quite answer my specific question e g iterate a list using recursion recursively going through a list python,0,36,124 scraping the shoe sizes with bs i am trying to scrape the shoes sizes of this shoe how can i scrape the value,heatmap of minimum median maximum values in python in the dataset below outputs i want to do the following create a heatmap based on the color shade hue my attempt desired output should look like the figure below but using the green yellow red hue thanks in advance,0,23,47 is there a way to increase python time between mouse clicks i know i can use time sleep but i need something that would affect whole script it is automatic test homework and aplication buttons are clicked almost instantly it is a bit anoying because i cant see if everything is working as supposed still learning,python selecting days in between with input date by user i am trying to take some values from a covid database and i wrote the following code which works as i want see below but i have a question for you after the code now i want to add this part of the code to ask the user what is the starting date and the finish date but in the line df df df date start date df date end date there is an error because he cannot compare date to string i actually tried importing datetime but i actually had the same result because there is still a problem because for some reason it only consider a day per month or something similar but anyway the result is not as wanted how to solve the problem selecting the days in between,0,53,140 accuracy in classfication report lower than best estimator from gridsearchcv i performed a grid search on an mlpclassifier why the accuracy in classification report is not identical to the highest split test score in this case in the dataframe output code,why are signatures created with ecdsa python library not valid with coincurve i m switching from the pure python ecdsa library to the much faster coincurve library for signing data i would also like to switch to coincurve for verifying the signatures including the old signatures created by the ecdsa library it appears that signatures created with ecdsa are not always valid in coincurve could someone please explain why this is not working also it seems that cryptography library is able to validate both ecdsa signatures and coincurve signatures without issues consistently what is even more confusing if you run below script a few times is that sometimes it prints point and other times it does not why would coincurve only occasionally find the signature valid,0,43,126 replace all values for every subgroups with subgroup min value with panda apply function without loop i have a panda dataframe df for data visualization i do various boxplot with x diff hours and y diff temp i want to have subgroups of hours and replace all values of each subgroup by min subgroup value i don t want to use a loop is it possible to use panda apply function please,python mysql this use of cursors works but is it correct i have the code below which selects some data from one table finds related data in another table updates the data in the related table and deletes the data from first table the use of cursors below works but not sure it is best do i need to define a new cursor x db cursor each time like this,0,68,71 list of all us zip codes using uszipcode i ve been trying to fetch all us zipcodes for a web scraping project for my company i m trying to use uszipcode library for doing it automatically rather than manually from the website im intersted in but cant figure it out this is my manual attempt this takes alot of time and would like to know how to do the same in more efficient way using uszipcodes,python printing bytes strangely so i have this very simple code when i print a it shows only the first byte and the last byte for some reason does not show properly it prints b xb and it should print b xb x or at least that s what i would like to print now when i look at the file that i stored it saves the bytes exactly how it should with no issue there does anybody know what s going on here also with some integers it prints properly but with this one for example does not,0,74,94 how to check if a property exists in a foreign key model i have a model named product in both foreignkey s i have the same property named number i want to check if that property exists in product model or in its foreignkey s models what i am trying to do is,how to use conda update n base conda properly i have two very simple questions regarding updating conda i e when updating one of my environments with conda update all i get a warning my setup comprises a base environment and two actual work environments say env and env the latter two environments are kept up to date with conda update all issued within each of those environments the base environment was only generated in the installation process of anaconda question should one run conda update n base conda on the command line of the os linux prior to activating any environment or should one activate a particular environment or is the environment out of which this command is issued irrelevant question after running conda update n base conda from out of whatever environment as determined by the answer to question would a subsequent conda update all issued within one of my two work environments env install or update any additional stuff only as a consequence of the previous conda update n base conda ps i find many questions on stackoverflow regarding conda update conda but they don t seem to cover this one,0,51,195 keeping fits files accessibles after closing context manager i m opening fits files hosted on some repo with astropy io fits fits file format like so basically i d like to have a few of them in memory however the data become unavailable once i leave the context manager as the file closes any way to make a copy ensure that i keep the data in memory,python socket takes forever only on first iteration of loop the title says it all the loop takes forever for the first port and then the rest of them only take one second,0,64,33 valueerror invalid color argument in my pygame code i wrote the code for my final project it s a code that makes a bouncing on the wall i wanted to make two balls so i created a class and created several functions but i think that my code is not working,typewritter effect with variable in text in python i want to make typewritter effect with delay between each character however my problem is when i put a variable between the text it doesn t work the first part works but not the second anyone knows how,0,50,45 argparse not overriding default value i managed to write some simple python code using values from csv to create an svg file however argparse does not pass a value from command line i m not able to override the default i want to define c columns with command line when i run the value is still,filenotfoundexception on temporary directory when saving parquet files using python on an azure hdinsight cluster we are saving spark dataframes as parquet files to an azure data lake storage gen using the following code often this works but when we recently upgraded our cluster to run more scripts at the same time around ten to fifteen we consistently get the following exception for a varying small fraction of the scripts py jjavaerror an error occurred while calling o parquet java io filenotfoundexception operation failed the specified path does not exist put pathnotfound the specified path does not exist i think all the spark jobs and tasks actually succeed also the one that saves the table but then the python script exits with the exception we are using spark using scala version openjdk bit server vm hadoop stacktrace log there is also another version of this exception which does occur in a spark task which then fails but spark automatically restarts the failed task and usually it succeeds then in some cases the am will report the app as failed but i don t understand why because all jobs succeeded possible causes as seen in spark temporary creation reason i would expect that the temporary directory will not be moved until all tasks are done looking at the stacktrace it happens in azureblobfilesystem mkdirs which suggests to me that it s trying to create subdirectories somewhere under temporary but it cannot find the directory i m not sure if the temporary directory exists at that point related questions possible options to try,0,56,261 how to list all objects from particular model in django rest framework i have two models my receipt url looks like this and i would like it to show list of all products instead of a number of them how to do this my viewsets serializers,arima fitted values and plot values are different i want to store the estimated values predicted by arima model i am unable to view the values model predict and model fittedvalues is giving me the wrong values model plot predict predict is giving correct view on plot while my fitted values are showing in order of thousands model fittedvalues,0,46,54 initialize non existing keys in ordereddict with default values like defaultdict is there any way to access the non existing keys in ordereddict with default values like which we do in defaultdict this is the real problem keyerror is thrown in the following implementation this implementation is intentionally avoided,understanding legacy python one liner that now gives error i am unable to understand what this line written in python is doing it used to work but now i am getting a list index out of range error cats name gave results and was not null before running the above statement but still i got the error the legacy code is written in aone liner as above when i got the error i had to dissect it as below i tried to write the code in this format to analyze and debug but then i don t get the error i suppose this is not the right translation of the one liner,0,49,107 argparse input range function i need to pass a function in command line and parsing with argparse how can i do that eg python program py params a range b range i ve tested parser add argument p params type json loads but when i try to launch cmd python program py p a range returns this error error argument p params invalid loads value a range,why does pandas groupby keep the key i would like to perform the following operations on a dataframe i got the result below my question is why the id column is kept i expect the id column disappear after this operation what i want is,0,62,44 convert pst to us pacific for use with pytz i m trying to create http endpoints for example if the user made posts in sept november but none in december then jan onward it wouldn t return december but it takes the time zone in pst format because it does a sql query unfortunately pytz the library i m using for getting all posts from a month only accepts time zone in the format us pacific,how to write read serial port with multithreading using pyserial i m currently running into a problem with trying to write to a serial device using pyserial i want to be able to continuously update my terminal by reading the port and handle serial device writing on a seperate thread meanwhile also be able to send a command via user input on the main thread everything runs as expected except for that when i send one of the commands cmda or cmdb the serial s output that i m reading does not change this is expected behaviour as the commands being sent alter the state of the device which in turn changes the device s output that the serial port is reading with all that said it seems that the device is not receiving the command i am sending even though the code continues to run with no exception and all functions seem to be executing as written here is my current code a serialmonitor class that can read the serial port and print out a specific amount of bytes once finding a set of syncbytes and the main thread,0,70,185 how to make my message count command count messages for each server not all in once how do i make my message count command count messages for each server but not all at once because i want to have it like when i type messages on the server it count form only this when i use this on the other server it count from other server only here is code of my coommand,discord py kick command errors with list index out of range we have user bob and i try quickly kick him using only nickname kick bob and when i do that it throws an error indexerror list index out of range how do i can fix it,0,73,47 discord py bot won t leave a voice chat i m currently using these commands to make my bot leave join a vc joining works fine but leaving won t work any help in understanding why would be really appreciated,how do i sum a list of attributes from a google datastore query result looking for an efficient way to sum a list of attributes using ndb queries currently i just fetch the results and run a for loop over them,0,35,41 i have a df with countries and states when i select a particular country i need to get the output as below i need output as in hyd vjy bang output country city india hyd india bang india vjw i tried using to dict to json but i m not getting the desired output thanks,i made a python script to easily find a square root but i can t stop it i made a python script to find the square root of a number and prints out the result so far but it uses an infinite loop and i cannot stop it does anybody know how to stop it when it has printed out the correct answer several times i am looking for a stop condition i can stop it but down know when to stop it here is the code,0,51,86 how to get all the pinned messages in a telegram chat using pytelegrambotapi i m trying to retrieve all the pinned messages in telegram chat for my bot from the following code i am able to retrieve the recent pinned messages is there a way to obtain all of the pinned messages as an array i m using pytelegrambotapi for writing my bot,tkinter set option command for entry after declared it i need to declare the option command for an entry after declare it here s my code here s the full error i got is there another way to pass the command option after declared it because i need to pass the entry in the function parameter set in the command,0,61,58 python create hierarchy from parent child list given the following list i want to create a hierarchical dict of lists so far i ve made this code which runs fine but for some reason the children c and c are repeated twice where did i made a mistake edit the code above produce this output i would need the exact same output but obviously without the duplications here the children of c are repeated twice,np zeros missing required argument shape pos i m working on a notebook from the deeplearning ai course and i ve ran into an error the problem was that i had initialize the parameters of the neural network with zeros i ve filled in the correct shape at correct position in the argument but it does not seem to be working and i m getting the following error enter image description here,0,73,68 fillna is not working in pandas dataframe i have a dataframe where some columns have nans values but when i try to replace it by zero values with fillna it doesn t work i m not getting any change why,i get none for validation form django here is my code for validation and whenever i print password i really dont understand why password is printed properly and password is none i get none can anybody explain to me why this happen,0,38,42 trouble finding least common multiple of numbers i am currently trying to solve euler problem which wants to find the lcm of numbers the code above is brute force but for some reason it doesn t work can someone point me in the right direction,facing issue in passing metadata field with dataproccreateclusteroperator airflow i am facing some issues while installing packages in the dataproc cluster using dataproccreateclusteroperator i am trying to upgrade to airflow error message on further dig down came across a github link where this issue of valueerror metadata was invalid is discussed in community forum i followed the link and used cluster config way to generate the cluster config for dataproccreateclusteroperator but now running into another new issue as below i do not see much information around here is the code,0,47,92 extract data from tensorflow dataset e g to numpy i m loading images via i want to use the obtained data in non tensorflow routines too therefore i want to extract the data e g to numpy arrays how can i achieve this i can t use tfds,comparing dataframe columns with acceptable deviation in python how can i have the comparison between two pandas dataframe rows considering an acceptable deviation instead of a match for example with acceptable deviation i want to generate the result column below based on the other columns i wasn t able to find any built in functions or pandas functions,0,43,59 how to limit numbers accepted in a lineedit im trying to make a lineedit that only accepts numbers from to but even using setvalidator the code can t limit the numbers this is the function that has the lineedit lineedit should not accept numbers that are not between using pyqt version the os is windows,splitting a dataframe not based on a string but a value in a column i have a dataframe cut from a much larger dataframe i need a way to split the dataframe into separate dataframes based on the value column the rows with in the value column and the rows with in the value column need to be split up the best end goal solution is to have one name with the and be separate columns in the same dataframe my idea so far is to split the two and combine them so the data is side by side all tracing back to a single name,0,59,110 django filter and count in template tag i m trying to filter and count a specific queryset in the template with django template engine cant get it to work the film list is the context and film is the table and language is a field any tips on how to use filter and count at the same time in the template engine or should i solve it in another way view,programatically added widget not shown a programatically added widget is not shown dear community as i need to add some plain text i will elaborate i try to add a widget to a floatlayout in kivy and i would expect it to show up on top of the existing label but it s not shown what i m doing wrong python file test kv file thx martin following the hint of furas i changed the kv to still no luck hi is not lurking hidden somwhere,0,69,84 changing an double array field to a single array in hive or pyspark i have a field interest product id which looks something like below the schema is as below as the field interest product id is of array type and also the element is array string the field shows how can i convert it to a array string expected outcome please suggest the best way thanks,register plotly dash callbacks after app run server without having to reload webpage i have built a dash app where new visualizations can be loaded on demand from python classes for static content without callbacks this is working fine when trying to load callbacks these are not active when first calling the page only after having reloaded the webpage once the on demand content works as expected my best guess is that this is caused by registering the callback after having executed app run server preloading however is not an option as the classes in my application require additional input arguments which are only known during runtime of the server so my question is does anyone know a way how to successfully register callbacks after the server is already running or another way to achieve the same behaviour here is my approach so far comparing preloaded behaviour to on demand behaviour,0,65,145 get value dictionary python i have this data and i need access to the value low high etc but i don t find a way to do it im trying this data open but says keyerror i can acces to data meta data time series min inclusive i can access to the values low high using the date but the problem is that the date changes so hope you guys can help me thanks,error while using python to plot geocode data from csv using leaflet folium and pandas i am trying to plot some geocode data to a map but something isn t working can someone assist me please screenshot of the code,0,73,39 decorated function return type remains original when called directly defining a decorator that takes callable int and returns callable str seems to not be understood by mypy is there something i can do so that the return type of foo is not its original return type but the return type specified by the decorator edit simplified the example,how to get the difference of time by considering some specific value in python i have a data set as follows i need to create the activation date in descending order and the time difference of each adjacent row values while considering each nics so the final output should be follows here na represents that there are no any previous activation dates for that nic so that i have used following code to get the activation dates to descending order by considering the nics as follows now i need to get the time difference as mentioned above as a example the time difference for first row nic is na mean that there is no any previous activation date but for second row nic the time difference is month and hour hope it is clear how should i get that time difference by considering each nic and there activation dates,0,58,149 for project euler number i am just wondering what is wrong with my code have been knacking my brain and i do not know how this is on python this just produced an empty bracket i want to know why and how i can fix this thanks,numbering each value in a sequence minimum reproducible example there are deliveries faced in an over i then produce a sequence column that gives the sequence of length type in each over using this code however i want to number each delivery in the sequence eg es ls y es ls y s s y es os y es ls y es ls y or something along those lines that uniquely numbers each delivery,0,48,57 check if values are within intervals in pyspark i have a large dataframe a with intervals like this and i have a dataframe b with sorted non overlapping closed intervals like this i want to check if values of dataframe a are contained in one of the intervals of dataframe b and if so save the id in a new column interval id my output dataframe should look like this is there a way to do this efficiently without udfs,how to perform data cleaning for a text file i have a text file with lots of lines including words and numbers here is an example my question is how can i keep lines that have particular word classificationfactortype fail and objectstatus ok and delete all other lines i would like to save the new text file in the directory here is the code that i wrote,0,77,64 how to kill terminal in vscode using a python code i understand that using import os os exit will pause the code but i would like to kill terminal completely as if i were clicking on the button shaped like a trash can is there any way to do this so i can put it inside my python code,after windows reset lost my user folder where my pycharm projects folder was and can t recover files i just did a reset on windows and deleted all the files but did not wipe my drive clean when i realized that i didn t put my pycharm projects folder into onedrive i started try to recover this folder with all my code in it i found the user folder that held my pycharm projects folder in windows old and when i went into the project folder it had all the logs from messing around with the code and the project foler iml file but did not have any of the actual py files from my coding projects is there anyway to recover these files i tried to look everywhere and have done everything i can to recover these files but nothing is doing the trick,0,58,142 how to use pretrained model pth in pytorch i have one question how to use the saved pre trained model for example i have a model and i train it with the dataset i have and then i save it with the pth extension how to use file pth to test new image thanks,random changing weight i need to implement a class where i am able generate random element based on their weight the tricky part is that i also need to be able to change the weight here is an example output my approach to solving is to find the prefix sum every time a weight is added and append the element current sum weight tuple into the list for set weight a and set weight b the array would be a b then i generate a random number between and the current sum then iterate through the array to find the first sum weight that is less than the random number and return that element however i don t know how to update the sum weight because then i would have to iterate through the array and then find the element and update all the weight of elements after what is a way that i can implement an update for the weight i don t know if using dictionary is better or maybe i should use an ordered dictionary,0,53,175 how to get h over below h when ordering having this dataframe what i would is to have the rows that have the start time with xx xx at the top descending for example ps start time comes from df start dt time,retrieving multiple pages from a stock screener i am scraping data from a stock screener i am able to get the first page with the first results using get screener r the next page would be get screener r to get the next results i tried adding additional get requests but it gives me errors so i am not sure how to code this so it would give me additional rows does anyone know how this would be done thanks new code i m using,0,36,82 how to efficiently filter create mask of numpy array based on list of tuples i try to create mask of numpy array based on list of tuples here is my solution that produces expected result output mask problem is that with bigger data array and increasing number of tuples in filter vals it is getting slower it there any better solution i tried to use np isin data filter vals but it does not provide result i need,update remove many to many field in django i have saved the object in the database with the many to many fields after saving the object in the database i want to append one more id in the many to many field so how can i do that in django models py json from frontend assume the object is saved now what if i want to add id to the account or remove id,0,70,74 how to remove backslash from decoded json string i have records that have a list of maps dict in which i have encoded data in it when we decode the data we get a json string with extra backslashes now i need to remove the backslashes from the json string json output rawdata after decoded data my python program but this is able to remove double backslashes and newline n but it leaves single backslashes output,two csv files read differently in python i have two csv files with data arranged date wise i want to compute the monthly accumulated value for each month and for all the years while reading the csv files it reads without any error however while computing the monthly accumulated values for one times series in one csv file it is doing it correctly but for the other time series the same code malfunctions the only difference i notice is when i read the first csv file with a date and value column and total no of rows the dataframe has rows last row as nan this nan thing is not observed for the other csv file please note that my timeseries starts from xx to xx every year from i am obtaining the monthly accumulated value for each month and then removing the zero values for months jan may and nov dec when my code runs for the first csv i get monthly accumulated values starting from june month of but for the second its starts from january and has a non zero value which ideally should be zero since i am new in python coding i cannot figure out where the issue is any help is appreciated thanks in advance here is my code,0,76,217 generate a d plot from data contained in a three columns file i have a three columns data file structured in this way example i don t know how this kind of file is called but i did not find any example to plot this using d wireframe or d surface plot edit but there is a way to produce a wireframe or surface plot with data structured in this way,python functions not returning their values properly i am trying to learn python and i have just gotten past conditional statements and i m working on creating my own functions would you mind telling me what i am doing wrong that i have to write the convoluted print statement at the end that calls all of my functions one by one also any style tips would also be greatly appreciated thanks in advance for anything you can provide,0,73,77 html input label to python file how do i take the input from an html input label and use it in a python file without having to create a local host i don t need to save the input but just run it in python,convert list using zip to dictionary when i convert lists to the dictionary only one element is stored in the dictionary and i don t know why this is my code i used beautifulsoup in web scraping and store in lists finally i want to clean them and store them in json file,0,44,52 why do we need to pre process image datasets refer to this complete guide on how to use autoencoders in python notice the author add after they loaded the mnist data why do they divide the image data by and why after that why do they reshape a d matrix into d thank you so much,coarsen xarray dataarray with weighted mean let s say i have some dataarray i want to downsample this array to x chunks i can do this with the coarsen function as i understand it this is basically splitting the dataarray into x chunks and averaging each chunk into one value however what i want to do is take a weighted average of this x group so the center points are weighted more heavily in the final mean than the edge points i can create a gaussian kernel with weights like this where window is now a x array with the desired weights for each point however i am unsure how to implement this window kernel when doing the averaging in the coarsen function what is the best way to do this,0,57,129 how to compare csv and write result to new csv using pandas i want to compare the sku of source and destination file and if destination sku matches with source i want to copy the meta title meta description and description of that row source csv destination csv merged csv my code is working now but if the number of lines changes increase then it throw error,for loop is only storing the last value in colum i am trying to pull the week number given a date and then add that week number to the corresponding row in a pandas python dataframe when i run a for loop it is only storing the last calculated value instead of recording each value i ve tried append but haven t been able to get anything to work,0,63,66 i have list of list in that i want to make a list from list before empty list i want like that using python,how can i parse a string number to a float python from excel i have a number in the following type so i ve been trying strip replace among others but i couldn t get a float from my code result monto float m valueerror could not convert string to float,0,24,52 what is the simplest code for bst binary search tree in python with remove key method here i m trying to remove a key by setting the node to be deleted equal to none but inorder method prints it none too output i m trying to write the simplest possible code for bst can your provide a simple implementation of remove key method also point out if you see any mistake in this one thankyou,customise polar contour plot axes style i am using gridspec to create a grid of polar contour plots in matplotlib to aid with the visuals i am trying the customise the appearance of the contour plots see this single polar plot as an example mwe below i have two formatting questions in mind how can i customise the r axis to show only and values how can i also make these numbers display in white when plotting multiple polar plots i am choosing to remove the axes and ticks on the other by using ax grid false ax set xticklabels and ax set yticklabels however a white bar along theta remains which i would like to remove see this image as an example of what i mean mwe,0,70,126 sending message in all guilds on certain event in discord py i used this code to send a message to a certain channel named giveaway index but the problem is that it only send message to the channel named giveaway index only in one guild i want it to send the message to all guilds that have a channel named giveaway index is there any way i can do it,web scraping gives only first elements on a page i tried to scrap the search result elements on this page with selenium but it gives me only the first elements as a result i am not sure why it is a javascript page and how can i scrap all the elements on this search page here is the code i created this is the result for the names on this page as you see it only scrapes the first elements the same for prices images and urls,0,66,93 how to make colormaps for this image in python m i want to make a colormap used in the attached image colorbar i could do it matlab however i can t seem to do it in python so far i tried the code given below but didn t get the result i was looking for,deleting items gitobjecttype blob from azuredevops using rest api i am working on a script in python that will delete given items from azure devops repository using rest api and i m losing my hope it is possible let s say i have a list of objects listed with a sample request from the microsoft documentation and the part of the example result is there any way to delete one of the blobs using rest api any help would be appreciated thank you,0,53,82 how to bubble sort xlsx file so here i want to make a case study about bubble sort where i sort from the smallest to the largest numbers ascending whose data i get from the xlsx file and the number to be sorted is column h median after the data is sorted the other data will be sorted as well the code that i made is running but not effective data,using scipy in python apache beam on gcp dataflow i have a pipeline written in python apache beam and have written some code in it to use scipy when i deploy it i see the following issue numpy distutils system info notfounderror no blas lapack libraries found note accelerate is no longer supported how can i fix this issue,0,72,54 django rest framework patch request with image upload i m trying to make an endpoint for updating the profile image of a user however whenever i make the patch request the profile image field does not change to the uploaded file i ve tested on postman using form data and i get the response updated completed but the profile image field remains null views py models py serializers py urls py,improve speed of filling pandas dataframe with data i m trying to find a more optimized way to add data to a pandas dataframe i already saw other related questions where people suggested to first create lists and then add the data to pandas which i now implemented in my current setup i loop through different lists in the example it is librarynr books and sections and then compute various variables in the example those are not computed but already set nrofletters excitment and review which i add to lists and in the end add the lists to the dataframe does anyone know of further optimizations to improve performance on this example code important note in my final code the variables are not the same for all rows but computed depending on the iterators of the loops see example calculation of excitment example code,0,62,143 spyder nameerror name variable is not defined with vars but gobals works i am creating dynamic variables with when running i get the error nameerror name df is not defined i can debug and see the variable does exist under spyder variable explorer as below it works for global but not vars what am i doing wrong please,how to loop keyboard button on my telegram bot in python i m new in python and telegram bot i would like to loop the data from mysql database and print it as buttons restaurant hotel flight are getting from mysql database now i would like to print these three data as keyboardbuttons to replace button button button is it possible to get data from mysql database and loop it as keyboardbuttons thanks in advance mydb mysql connector connect host localhost user root passwd database my telegram bot sql mydb cursor def startcommand update update context callbackcontext sql execute select name from types sql result sql fetchall for x in sql result context bot send message chat id update effective chat id text x buttons keyboardbutton button keyboardbutton button keyboardbutton button context bot send message chat id update effective chat id text what kind of places are you looking for reply markup replykeyboardmarkup buttons my result my expected result,0,59,124 python making changes to key value of list of list im sending input payload from postman to my flask service like this reading data in flask service i want to make changes to input variable so that my final list of list becomes like this so i want to rename name key to packageid and remove other key values like rebootrequired how should i go about it tried some tricks but was unsuccessful,python is there a way to implement break into a function that is meant to be looped i have a class function that updates class instance parameters when a specific condition is met it looks something like this it is meant to be used in a loop up until the point where the condition is no longer fulfilled i tried using break in the hopes it would also work when executed in a function but it doesn t probability is calculated in the class so i can t just pull the condition out is there another way to do this,0,71,98 replacing the missing value with different values on the same column in pandas dataframe i need to replace with the average of the c values of years for example c value would be what is the best way to do this i have over rows,set foreignkey in django error matching query does not exist i want to set foreignkeys to my tables in views py but i got this error words matching query does not exist at this line of code i don t know what s wrong and why i got this error so how i should set the foreign keys this is my model py code and this is the views py,0,48,68 how to check if a python script has been copied accessed on windows i was wondering if there is a python module that essentially allows for checking whether your python script has been accessed copied and which user has done it from a shared resource more of a curiosity as most google searches have shown results relating to checking if a file copy is complete and not necessarily if a file has been accessed copied and by who thank you,left shift but replace the shifted bits with ones in python the operator does the following returns x with the bits shifted to the left by y places and new bits on the right hand side are zeros this is the same as multiplying x by y i want to have another version where it fills on the new bits is there a built in function for this if not how do i write it,0,77,75 argparse not overriding default value i managed to write some simple python code using values from csv to create an svg file however argparse does not pass a value from command line i m not able to override the default i want to define c columns with command line when i run the value is still,extract and rename zip file from specific folder using python i am using python to unzip a file i have a zip file in folder wowo if i select folder using path and use only file name the code doesn t work but when full path filename given it works i don t want go give full path and file name together i want to define path saperately,0,56,65 why does the ipython error about input mention raw input i have following line of code to accept identifiers this works great on my python however when i send the notebook to a colleague this error occurs what could be causing this mis match,cnn training out of ram cause by big dataset i have a big image dataset of around images my system is out of ram when i train the model i don t want to downsample the dataset is there any way i can fix this issue i know there is a way like i can send images part by part to the model but i don t know how to do that or is there any better way to do this,0,43,81 matplotlib how to show complete hourly date values in x axis values i m trying to create plot with x axis as hourly data step hour although i defined an x data as array with hourly data i ve gotten x values with see screenshot so my questions are how can i fix this null issue how can i get one hour steps x values should represent a day hours,filter time in a dataframe using python i have a column where there is only time after reading that csv file i have converted that column to datetime datatype as it was object when i read it in jupyter notebook when i try to filter i am getting error like below code sample data here i am trying display the rows whose appointment time is between to datatype info could anyone help thanks in advance,0,71,75 numpy polyfit returns an array while i expect a single number i have two lists x and y based on which i want to fit a linear line to do so i use the following code i expected the slope and the constant to be one number since i am using degree in np polyfit but instead it s a numpy array how can i interpret these numbers and which values can i use to fit a line,how to load a dataframe in pyspark to snowflake i am trying to load a dataframe df into snowflake the table is created in snowflake and i am trying exactly what s written in the documentation i am doing the below where appropriate values were kept in the variables i got this error i added the snowflake spark connector and the snowflake jdbc connector to path in environment variables and used that while creating the spark session as well still the issue persists i tried multiple routes but no luck any lead will be appreciated,0,77,93 merge sort string and local variable issue i m quite unfamiliar with python and decided to practice some algorithms here is my implementation of the merge sort i m not too sure why i m getting this error,indeed webscrape selenium script only returning one page of data frame into csv long run time i am currently learning python in order to webscrape and am running into an issue with my current script after closing the pop up on page of indeed and cycling through the pages the script only returns one page into the data frame to csv however it does print out each page in my terminal area it also on occasion only returns part of the data from a page ex page will return info for the first jobs as part of my print df da but nothing for the next additionally it seems to take a very long time to run the script averaging around minutes and seconds for the pages around minute to minutes per page any suggestions i ve attached my script and can also attach the return i get from my print df da if needed below thank you in advance,0,35,162 telebot how do i make my telegram bot to read new messages during a for loop i have this for loop i want to get out of the loop if the user types desactivar vigilancia how do i do it,django model set a week of day field as string from existing models datefield i am trying to set a session class s field based on another model teacher s field basically each teacher has an assigned day of week monday etc and i want each session object to have the teacher name as field based on session s date field for example session class with the date would have the field weekday saturday hence get a my teacher name mr saturday since i need a string value such as monday to query the teacher assigned to that day i m trying to figure out how to do this this raised the error attributeerror datetimefield object has no attribute datetime i m also aware i can get week of day using session date date f d l in templates but i am not sure how to actually use this as model s field and not just for display would appreciate any help,0,40,149 csv file data replacement i have many csv files which looks like i need an short function with that i can overwrite the cell in the data section from data to something like test data i need to replace a big amount of cells in csv files with that method maybe i can read the line line in the file and save it as new one so i knew it s definitely done,quiz game to guess player s zodiac sign i m trying to build a quiz game where the user answers some questions and at the end the game will assign a zodiac sign so what i did now i m trying to get the highest score and display the sign and the definition but i m completely stuck here is part of the problem and this is the code that tries to match the scores this is where i m stuck i don t really know what to do to find the highest score and print it at the end i m trying to do this for each sign,0,71,102 no module requests found visual studio code i cannot run a code in visual studio code with import requests i installed requests with pip install requests and it still doesn t work i tried uninstalling it and installing it again but this didn t work either tried doing it via the terminal which didn t work either,str object has no attribute paste i m working on code that takes different images and overlays them i got this code online and i m trying to change it to work what i wanna do but when i run it i get this exception has occurred attributeerror str object has no attribute paste i m new to python so i m struggling to figure out what s wrong with this any help would be greatly appreciated background variable code jacket variable code i m only pasting part of the code that i need help with out of concern for security all variables in the code above work perfectly fine when i run the program without the code above it runs flawlessly,0,55,116 position of defining a function is it necessary to define a function on the top of a code or can we define it in the middle also i e in the main segment like we define a function in the middle will it result in error during execution and flow of control,selenium webdriver unexpectedalertpresentexception new question another question about same topic previous question about closing the alert selenium webdriver unexpectedalertpresentexception i tried closing the alert but now it gives an error saying no such alert error script,0,51,36 results are not visible when using scrapy with python i was learning how to scrape with scrapy using python the result shows that finished in s when i run it through sublimetext im not able to see what i scrapped im also not able to see a json file which shows wha i scrapped can someone help what i wrote for the code is present below,how can i make a variable for each person in my discord server with python i am making a game for my discord server and i need every member of the discord server to have their own number of coins therefore i need every member of my discord server to have their own variable for their coins if anyone knows how i could do this that would be a huge help thanks,0,67,72 proper c type for nested list of arbitrary and variable depth i m trying to port some code from python to c the python code has a function foo that can take nested lists of ints with variable list depth for example these are legitimate function calls to foo what should the method signature s be for a c method that can accept this kind of argument,create list object from multiline input with only the standard python library i m trying to store this single input into three variables n x n and a list object the variables are correctly written being n x n i ve tried using this but the list only intakes the while i need it to be i ve also tried using while and if loops to try to iterate through the input but that didn t seem to work for me,0,65,88 i accidentally deleted my python venv folder on vs code what should i do i accidentally deleted my python venv folder on vs code i had tried some tutorials i could find on the internet but none of them works anyone know how to restore or redownload the venv file thanks,how does the one hot encoding work in keras image data generator so i have classes for images cat cow and dog when i do i get this and when i do this i get this which i correct as i have cat dog and cow pictures however i don t understand why is for cat shown as or for dog shown as and for cow shown as can anyone please help with the logic,0,51,86 how to update a table from a json loaded object using peewee orm on python can someone help me with this please the above code works fine in updating an sqlite database the bottom doesn t,vscode venv import module i am having trouble figuring out venv and getting my python script to import libraries in vscode i set up a virtual environment and imported libraries necessary matplotlib i ve activate the scripts in venv using venv activate and set my interpreter to venv scripts python exe however my jupiter notebook still is saying that the module is not imported any tips on how i can fix this attached is a screenshot enter image description here,0,35,76 print channel id name into console with discord py so i need my bot to print in which channel it sents a message this is my code i ve tried all of these,what is the latest way to set up headless selenium sorry but i m quite new to python i have checked online and found that there are many videos with ways to create headless google selenium however upon trying those methods i realized that they are all deprecated can anyone update me with the latest method to enable headless selenium for google chrome so the sequence of the program follows updated i have tried adding the suggested answer to my code this is my new code however i get this stacktrace error while running headless chrome if i were to use the normal headful chrome it works perfectly fine,0,31,108 reading and parsing a txt file with nested headers i have a txt file having multiple nested headers textual version down below i have tried using pandas read csv function with multi header option but that does not seems to help pardon any mistakes this is my first question can provide more info sample data column divider,valueerror found input variables with inconsistent numbers of samples i want to apply lstm i have features and rows my data shape after dropping the targeted variable and reshape it for d arrays and my targeted shape when i split the data using this code i got this error valueerror found input variables with inconsistent numbers of samples i defined the model well but when i fit the model also i have another error defining the model fitting the model here i have also this error valueerror input of layer sequential is incompatible with the layer expected ndim found ndim full shape received none how can i resolve this error,0,56,121 understanding python multiprocessing pool map thread safety this question had conflicting answers are python multiprocessing pool thread safe i am new to concurrency patterns and i am trying to run a project that takes in an array and distributes the work of the array onto multiple processes the array is large my understanding is that pool will distribute tasks to the processes my questions are thank you,how to loop through all nested dictionary to give all the parent key concatenated and its value i want the output in the format,0,67,24 how to make time series forecasting with independent variable and one target variable in a problem i am working on i have to make time series forecast to predict a dependent variable a with different independent variable b b b b in python will the linear regression work i am new to predictive modeling,array resetting back to empty python for some reason when i run this code the data array always has something in it even the line before if data index numbercheck but for some reason on the exact line it says list index out of range and the vs code debugger shows that the array data is empty i am unsure of why this is happening appreciate any help,0,52,65 python gtk new tab i m just playing with gtk currently but was wondering if someone has an example code of a window that has a notebook in it and with a click of a button or event it opens a new tab with a gtk for example entry in it and is accessible from further code i can t find any working code like that on the web or on this website,python requests response forbidden so i am trying to scrape this website i was able to scrape data from it without any problems but today it gives me response i tried using proxies passing more information to headers but unfortunately nothing seems to work i could not find any solution on the internet i tried different methods the code that worked before without any problems,0,71,68 python discord bot isn t joinig voice channel the bot doesn t join i don t know what i did wrong it should only join my voice channel nothing else i watched this tutorial but as i said it didn t worked,reportlab first page different cover page i am creating a pdf report using python and latest reportlab i am trying to assign a different template to my first page without header and footer but my attemps do not work this setup is based on the documentation chapter how can i use a different template only on my first page below code creates a pdf with a simple table of contents and header and footer on all pages,0,38,79 python typeerror argument of type int is not iterable problem subject of my project is a dice is thrown times write a program that prints the number of times each number occurs i made it but when i run the code this error occurs here is my code,how to show a widget on top of other widgets in pyqt in my pyqt app i create a virtual keyboard and i want to show this keyboard on top of other widgets in window whenever i click on show button i used a qframe for keyboard and my widgets are in different pages of qstackedwidget in the code blow the keyboard pushes the other widgets up which is not what i want how can i get it to work,0,49,80 how to insert max text as where clause i should be searching based on two where clauses at the same time one is a simple clause the other is max text how to solve price is a column of a database i want to take the highest value of the column records i would like to select the product with the maximum price and search by it and by brand at the same time i am getting this error,pod to pod communication doens t work with python socket in k s in our project we want two pods working as server client that communicate via the python socket library both containers are built locally with docker build pulled locally via imagepullpolicy ifnotpresent on the yaml files and run on the same node of the k s cluster i m running kubernetes vanilla if that s important the communication works well when we the communication fails when both server and client are deployed in k s kubectl logs client f returns i suspect there s a problem with the outgoing request from the client script when it s deployed on the cluster but i can t find where the problem lies server py server yaml client py client yaml,0,79,115 why function returns none why does the cat set size function return none instead of small and the cat color function returns main tiger object at x c d df instead of white conclusion,open and save entire workbook and not just a sheet pandas on python and pandas so i m trying to use pandas to write to a workbook while saving the entire workbook as a whole and not sheet by sheet for example test xlsx has sheets named sheet sheet and sheet currently i m getting an error of attributeerror dict object has no attribute to excel i m trying to open the workbook write some data to a sheet and save the workbook as a whole,0,30,83 how to load string to a pandas df with columns names i have the following string that i read from file i want to create a df that looks like i tried but this doesn t work as expected it gives me df of columns it should be only columns with rows,slice select netcdf between a range of values of the chosen dimension python i am new to python and to netcdf file manipulation i am trying to slice an array by its depth using the depth data from two nc files the file i want to slice is temp while the other two files refer to the mixed layer depth in the ocean respectively in winter mld winter and in summer mld summer similar in structure and different only in depth values i am looking for the temperature data within the summer top and the winter bottom layers for which mld winter temp z mld summer i tried to slice temp using numpy as follow if i try to slice temp by using operator only i obtain or or edited however slicing for example by z slice it works so then i tried to make a range of values by making a slice with mld data returning an error still,0,54,160 i have facing this error input is incompatible with layer model expected shape none found shape this is the code i have tried but it gives me input is incompatible with layer model expected shape none found shape,django filter and count in template tag i m trying to filter and count a specific queryset in the template with django template engine cant get it to work the film list is the context and film is the table and language is a field any tips on how to use filter and count at the same time in the template engine or should i solve it in another way view,0,50,69 dataframe merge for on specific columns i have a basic question on dataframe merge after i merge two dataframe is there a way to pick only few columns in the result for example result pd merge left right on key key result is there a way i can chose only column c from right dataframe and a column from left dataframe for example i would like my result to be like,tuple manipulation in pyspark with lambda python i have a parallelized list of tuples in the format what i want is to multiply the integers within the tuples which will give me this output i have tried but with not effect,0,70,41 copernicus dem xarray select nearest lat lon with multi dimension coordinates this question is related but somehow i still need some help to get this to work xarray select nearest lat lon with multi dimension coordinates i have tried using cartopy but this fails the documentation mentions that the copernicus dem instances are available in geographic coordinates the horizontal reference datum is the world geodetic system wgs g epsg but i do not know how to use this information,how to limit the number of decimal places while writing floats using sqlalchemy i am using sqlalchemy as orm in python with underlying sybase db i want to limit the number of decimal places scale in floating point numbers which will be written from python the underlying column in the sybase table is also of type float so even if the input float is i want to be able to write only to the table i can t change the sybase schema to use decimal with defined precision and scale that has to remain float this has to be handled at the orm level only so far i have tried to model the float column as below both of them don t seem to work i e if i try to write to the table using session add my floats it gets persisted to the db as and not or,0,76,149 user join server doesn t work discord py i m making a bot that welcomes people to my server and its not working at all the bot just does nothing when a user joined pls help i gave it the permission server members intent and this is my code for it i also enabled it on the dev portal,increasing a value each time a function passes through a for loop i am trying to make a for loop that returns response json i from an api with i increasing by each time through the loop example my goal is for get url to run times each time printing the response associated with the increasing i value sorry if this is worded poorly i am a total beginner and self taught thanks in advance,0,56,75 pandas df set dynamic column values by filtered rows here is my dataset i want to do something like this that will update dynamically the correct columns and not add new columns the output result should be i tried many combination but to no avail any help will be very appreciated,taking unique variables from one column and adding up the totals in another python i need some assistance with my code in python that i tried to write my objective is to count the authors who have written a unique number of books in a given time frame the data has multiple duplicate books that need to be removed this is an example of what it looks like now this is how i would like the outcome to be code,0,52,85 how to set the function to display the correct banknotes if the entire amount cannot be withdrawn the function ceases to work how to set the function to display the correct banknotes if the entire amount cannot be withdrawn the function ceases to work,regex to extract multiple numbers with decimal i have the following group of numbers expected result i want to separate this and extract the numbers such that i get the result as shown below attempt i tried the d d regex but this only extracts the number until the first decimal i e i only get question is there a way i can extract the numbers using regex or alternatively someway through python to get the results shown above,0,44,78 django template not receiving context object i m trying to implement a simple sign up form and slightly tearing my hair out for some reason the view doesn t seem to be properly passing the context object i pass it regardless of what it is here s my code urls py views py registration signup html forms py i ve confirmed it s i m sure this is some stupid mistake but i ve been tearing my hair out over this any help would be greatly appreciated,auto send inputs to another python script i have a python script that accepts user inputs before it goes away and does something i m in a position where i now need to run the script multiple times with different values for either of the inputs i d rather not have to keep re running the script and manually enter the values each time as i have over different combinations i believe this can be done fairly fluidly in python here is an example input py below is my attempt of auto sending inputs to input py using the subprocess module might not be the correct approach the file calls input py successfully but i cannot figure what other arguments i need to add to send the specified values code used auto py ideally i want to have a list of the different inputs i want to send to the script so that it loops and adds the second batch of inputs loops again then third batch and so on i m unsure if i m using correct subprocess method any help would be greatly appreciated,0,76,178 how to parse xml with python i have these xml code i m trying to get var name path only some jobs have these element with python but i can t extract i do any help please thanks,exclude id field during a join query i try to create a join query and exclude id field from my result i don t know what is the syntax to add the id parameter to my query,0,36,37 why double if only works for yes does not work for no code,how to overlay a pcolormesh with binary information in python given a d array the objective is to place markers e g shape line overlapping to the d images with reference to a binary d coordinate below specifically a marker will be place if the cell is equivalent to the expected output is as below in this example the marker is in the form of horizontal red line however the marker can be of any other shape that make the code more straight forward may i know how to achieve this with any graphical packages in python the above coordinate can be reproduced by following,0,13,105 how can i shourtcut these functions in to few lines i m writing a code to execute a weighted tree and make all distances of the edges equal i want to simplify these statements in just a few lines to make it more professional any help,how to create empty d array string and how to update the value for a specific index im trying to create a d array i manage to create the array but how to asign values to at specific index got these messages file g min enhet python travscript py line in start list array int int int attribute strip typeerror list indices must be integers or slices not tuple my code thanks in advance,0,46,64 csv table row as label for previous several rows i have a question about tensorflow i have csv data like image attached and i want to map it green row is label for previous rows is it possible to do it inside map function dataset map and how,line numbers and go to line i have a quiz and on the final round i would like it to end if it gets an incorrect value i have an if loop but i would like my final else values to have a go to line line number code as it is a long code in order to use this function how could i view line numbers i use portable python scripter,0,51,72 datetime transformation for column in data frame python i wanted to transform different date formats to one another however when using the print command i still get the old data format what is it that i m doing wrong here,updating filtered data frame in pandas can t find why updating filtered data frames are not working the code is also not returning any error message i d be grateful for hints help so the problem comes when i want to update the dataframe but only to given selection given update function on data frame objects updates the data based on index from data set based on another but it does not do anything when applied to filtered dataframe sample data df df code returns df while below code does not apply any updates to given data frame return df looking for help on solving and why is this happening like so thanks,0,39,111 how to make a face recognition identification and verification program so i made a face detection program for webcam in python using opencv but this just detects the face it doesn t recognise identify who it is so how to i train my program to recognise if it is me my code so far i also wanted to know if there was a way for the program to tell how many faces it is detecting,affine transformation of with python translating my code from matlab i am trying to apply an affine transformation to georeference a terra aster satellite image using python using a tranformation matrix from pairs of coordinates src dst of the four scene corners using functions from the skimage package the tform is the same as in matlab but transposed but the warping creates a plane green image not the one expected as in matlab see wetransfer link below any ideas the numerical values indicate a low contrast or no image depending whether i use tform or tform inverse with tf warp according to solutions i googled download of images from wetransfer mb including input image naivasha tif and output images naivasha georef python png and naivasha georef matlab jpg,0,72,118 how to select div class by find element by xpath i m making instagram like bot but i can not find the element for the post in tag page enter image description here red circle is what i want to click it and the inspected element is enter image description here my code is but it didn t work how do i select this element,unexpected behavior of ml logistic regression i am new to ai and ml so apologies if this is a stupid question i was reading about logistic regression and found out it is a classification supervised ml model so i tried to code an example to give it a try my idea was to see if the program was able to figure out the rule behind the label y i established which is y if and only if x or x is a multiple of but not both otherwise but as you can see the accuracy is very poor am i doing something wrong did i misunderstood the concept of logistic regression dataset code output edit source code of my comment below,0,60,125 how to get value from dict in a loop in a django template i need to get the value of totale in this dictionary dynamically in my template but corrispettivo totale doesn t work i tried this guide but i don t understand how it works how can i access the value of totale,print text with delay in python by using signal how can i print text with delay of second with using signal i don t want using sleep,0,51,27 how to save all element index after removing element in python i did many attempt but stil having problem i know this is because python automatically updating the elements index but dont know how to control it any suggestion will help me,install python and pip on a offline linux server i have installed python on an offline server but i cannot install pip this is what i have done download the archive file pip tar gz and put it on my offline linux server extract the archive file cd pip run python setup py install and this is the error that i get,0,42,67 add links internal pages of pdf file with python i have a python routine that builds a pdf file of around pages i would like to add something like an index page with links to pages inside the same file i would like to know if that is even possible,calculating perimeter of contours opencv python i have this image here with lots of small printer dots in the color cyan magenta and yellow after separating the color channel cmyk i applied a threshold on the image here for the color channel cyan now i want to find a way to calculate the perimeter for each of these dots so in the end i want to have a mean and standard deviation for the perimeter i already found a way with the help from someone here on stackoverflow to compute the mean and std dev for the sizes of the dots with instead now for the area is there a way to get the perimeter,0,51,115 how can i generate a single qr code for multiple links by using python i am new to programming i am trying to generate a qr code by using python where i can access multiple sites using a single qrcode,how can i add a comma or separator when scrapping results using beautifulsoup i m trying to generate my scrapping result based on the following syntaks the result is when i add text the results i have is how can i convert it to,0,40,43 simulation of vanet security project i implement a vanet project with python and i use the blockchain in my project now i want to simulate my project which is simulator that i can use it,accuracy and confusion matrix in cross validation i am training a model to solve binary classification problem usign scikitlearn and i wish to perform cross validation with folds as metrics i would like to get both the average accuracy and a confusion matrix over the folds so using cross validate i can pass multiple metrics to the scoring parameter according to this link i can def a function that returns the confusion matrix at each fold in that piece of code it uses x to predict some output through predict x but shouldn t a test set x test have been used instead and since at each fold a different test set is obtained from cross validate i don t understand how we can just pass x to both confusion matrix scorer and predict other question is clf svm here right,0,37,136 can t call child class method from parent class i was wondering if someone can tell me the error why i can t access the child class method from the parent class thank you code is about a game where we have a soldier and his inventory i try to call soldier add weapon but it returns an error that no add weapon exists for soldier code error i get attributeerror soldier object has no attribute add weapon,pytest triggers assertionerror i m following ex in learn python the hardway by zed shaw however in the book he is using outdated software nose i ve converted his code my code to pytest but i m having some issues i converted the nose testing function asser equal a b to the pytest equivalent assert a b when i run it however i get an error for just this one test the other two tests pass in the same format furthermore the error is pointed just at the line assert gold paths pytest tells me that it passes if i change assert gold paths to assert gold paths is this a false positive to me it reads the same i am asserting that gold paths equals a dictionary can someone explain why the symbol has to be there,0,73,134 extract data from tensorflow dataset e g to numpy i m loading images via i want to use the obtained data in non tensorflow routines too therefore i want to extract the data e g to numpy arrays how can i achieve this i can t use tfds,timestamp binning mechanics when resampling i m not quite clear on how bin membership in dataframe resample is determined example actual output expected output reasoning i expected pandas to create the two bins and the timestamp to fall into the first bin while and the remaining timestamps should fall into the second bin edit i just realized that using hours instead of days yields the expected result why i m using pandas,0,43,74 replace color in numpy image with another color i have two colors a and b i want to swap a and b with eachother in the image so far what i have written is however nothing is changed in the images saved to disk what am i doing wrong,question regarding negative indices in tuples and lists in python in this program why is the output and not this is the case with lists also i noticed print t doesn t give the output as but instead gives what is going on here why can t we go backwards please help me i ve just started python i have no background in programming,0,49,64 how can i convert instance to dictionary with model method and relationship below is the implementation of model class customer i want to convert the django model class instance to a dictionary somewhat like thanks,how can we split an xml with lxml i am looking for a good way to split the following xml into pieces in this occasion two and i am experimenting with the code below but it does not seem very elegant are there better ways to achieve this many thanks in advance for your help,0,36,55 filtering list of dictionaries based on another partial dictionary suppose i have the following list of dicts and a dict how can i find record in dicts based on record having only two of three key value pairs the output would be,importerror cannot import name url from django conf urls after upgrading to django after upgrading to django i get the following error when running python manage py runserver my urls py is as follows,0,42,32 how to run jupyter lab directly without activating every time python jupyter lab i have to run venv sources activate command every time before run the jupyter lab command as my jupyter is installed on virtual environment i want to run jupyter lab from my project path directly without activating every time is this even possible screenshot,keyerror features not found in axis this is another error when i am trying to split the balanced dataset into training and test set by and using the knn model in python what is meant by the error given below what is meant by this error,0,55,48 is there a function for extraction not a principal root there is a function from math module named sqrt which returns a principal square root of a number for example math sqrt yields as an answer my question is is there a function which can return not only one root but also the second one consider the following code func yields since,how to combine variables from a column in only one variable i m working with a dataset from which i had faced the following situation my goal is to combine the simmilar variables from this column e g round and round oval and oval in only one variable how can i combine they,0,69,51 display specific column through pandas i have portalmammals species csv which cotains following columns i want to find out how many taxa are rodent and display those records by using pandas i am trying this but this code giving me only value counts that are true and false how can i display only those records that are true example,split these strings while inside a list so i have this list and i need help finding a good way to split the list items at every n split wont work because i m assuming that it doesn t register the n as part of the string,0,60,45 async with python flask i have this function to render an api page and this function to make the request and to parse the response and then i run the app using waitress but i get typeerror an asyncio future a coroutine or an awaitable is required note i m fairly new to asyncio and flask in general so any advice with a solution is greatly appreciated traceback,how can we create object in desire database in rest framework i m creating project but that project is saving in the default database i want to create that project in other database i m using creatapiview i don t get it how can i use that using otherdataname in get serializer,0,66,47 calculate average the letter length of a phrase with one function i did this programming to calculate the average letters of a phrase do you think this program is responsible for all texts and do you have a better offer thanks,click event not work in pyqt with qlabels i want to define a click event for this class but no error is given and the code does not work properly in this class i want to design a button that the user can click to call a function and perform a specific operation i want to run a method by clicking i am not fluent in english and i can not ask my question well thank you answer this question,0,41,80 how to add each start and closing tag to section list in hmtlparser what i m attempting in python my code current first few lines of output i think the error is that once the first p strong is read it s true everytime i m just not sure and am totally lost,pandas dataframe custom indexing of nested dictionaris and lists i have a dictionary like this which is showing market orders of some cryptocurrency pairs and each list of bids and asks has a fixed number of elements and each element has two values which respectively are showing order price and order amount i m really an amateur in pandas and numpy so what i want to do is to create a dataframe of this dictionary let s name it df and get the first bid or ask of all of the pairs in a single line like this i ve tried a lot of ways but none of them worked as i wanted them to addition as far as possible i want to avoid using loops,0,49,125 scrap asin on amazon webpage with python and selenium anyone know how to make for to scrap asin on this part of source code please asin is always in same part of sourcecode on webpage product i ve try and and and but not work anyone know how to make for scrap asin on this part please thanks for reply bye,add the first day of each month to year month date in python i have a dataframe that contains columns year month and spei value i want to add day column that contains the first day of each month,0,60,40 creating cartesian product of sub dictionary key val pairs i have this dictionary i want a dictionary with the cartesian product of the key val pairs inside i need to create the below dictionary out of it,how to find the three maximum value from a list using loop i have the following dictionary from which i want to get the maximum of the last value from the three how should i go about it using a loop,0,36,42 how to parse a multiline string which looks like a table into a list of dictionaries i have a multiline string sample below which has a table like structure i have to parse that structure and convert back to key value pairs such that the key is the column header and the value is the value of that row i have used a regex but it s not working properly pfb string expected output i have used the below regex pattern,how to calculate time difference between two succesive rows with groupby i have the following dataset of students taking multiple sat exams i want to create a new column diff with the difference of two successive exam dates for each individual student and then filter the value with a particular threshold i e days if the student doesn t have two successive dates we need to drop that student i am trying the following script to create the new column then i m using query to filter the value and get the output this is correctly selecting the student a and removing the students b and c however i m missing the earliest date for the student a though using df df student isin studentlist i m getting the desired result but it s too much of work is there any better way of getting the desired output maybe using diff and le any suggestions would be appreciated thanks,0,78,149 matrix addition in python float values on adding temp and temp i should be getting but i get the following result the float values are being completely ignored i can t understand why this is happening just for reference lambdaa is in the above code,pandas generate column on groupby and value counts goal is to generate a column pct group by id where pct st value of pts group by id number of same consecutive id value where x and y both are nan for e g when id pct it will loop through whole dataframe sample df expected output i tried,0,45,66 how to create sequence number odoo i create sequence in customer module sale and inherit to res partner but i get fill new in my sequence field when i create new customer,why does numexpr evaluate return an error when using functions from mpmath i ve just started using numexpr s evaluate function and i ve come across an annoying error i want it to print per se sin and it does that just perfectly but if i do sec i get typeerror variablenode object is not callable example code when i use eval it instead returns the correct values like it should why does this occur is it because numexpr is an expansion of numpy and automatically sources its functions from numpy numpy doesn t have sec csc cot and thus cannot source functions from mpmath many thanks in advance,0,32,105 how can i join strings that are inside of an element of a multidimensional list i have a multidimensional list with strings inside it s elements for example and i want join these strings into one element something like i am trying with an for loop but i get some errors or unexpected results,using with open from other file i have a python file were i want to add functions that i don t want to have in my main code like open csv files which is this case the problem is when i want to invoke the function where i have the method open with the error valueerror i o operation on closed file appears and for what i found this happens because indentation main py external tools py is there any way to do it in this way or do i have to use open with in my main,0,53,93 thread stops all code for some reason python i have a small loop that starts threads but for some reason the loop stops after it starts the first loop and not continues to start the other threads for some reason it doesn t go to the print loop finished all threads created,filter rows based on highest and lowest column values i have a unique dataframe i need to keep only those rows where the highest score is increased by more than from the lowest score otherwise drop them for example for the student a the lowest score is and after that the score is increased to by so we re gonna drop that for the student b the lowest score is and the score is increased to so we re gonna keep that for the student c the lowest score is but there no score is increased after that it is basically decreased so we re gonna drop that i know that diff and ge would be helpful here but not sure how they would work when the lowest score has to be on the left of highest score and highest score has to be on the right side of lowest score are many columns apart desired output any suggestions would be appreciated thanks,0,52,167 get values from specific columns in different csv files concat and create column based on filename in python i have multiple more than files like this filename csv filename csv i would like to create a matrix in a new csv file where the first column is residue and the others are based on filename without extension below filename it should be values from total column it would be like this thanks in advance,adding subtotal grand total row in pandas muiltiindex produces tuple as an index i have a df i am trying to add a subtotal in multiindex i am able to add it with groups like so but when i add rd item to the group discount all of a sudden i get tuples instead of normal multiindex instead of indexes i get as a tuple whereas i want the same structure as in the first picture but with another level of index i tried playing with level parameter in group by but it always ends up in a single index as a tuple i am not sure where is my mistake,0,79,115 systemd service taking a long time to run i am having service running as background service in ec instance but it taking a long time to start a new one or restart a service refer to image i reboot ec and a service restart at but at the a service print the first log here is my service config file in etc systemd system please help,need help getting pandas to recognize my timeseries dataframe is in min intervals i have this dataset i m trying to set the data to a frequency i ve got pandas to recognize the datetime to the index i ve tried doing this but i get the following error,0,68,46 detect when a specific url is copied to the clipboard how can i detect when the text copied to the clipboard has certain text i need to run a script whenever i copy a specific url to the clipboard,subtract one column by itself based on a condition set by another column i have the following data frame where time stamp is already sorted in the ascending order i want to create a new column in the above data frame that shows the time difference between each row s time stamp value and the first time stamp value above that row where indicator is not nan immediately above row where indicator is not nan below is how the output should look like time diff is a timedelta value but i ll just show subtraction by indices to better illustrate for example df time stamp df time stamp we can use a for loop that keeps track of the last nan entry but i m looking for a solution that does not use a for loop,0,39,133 simulation of vanet security project i implement a vanet project with python and i use the blockchain in my project now i want to simulate my project which is simulator that i can use it,check if part of a string is in part of a string this code prints amazon com how can i also get amazon com as a return when listtocheck does not contain exactly amazon com let s say it contains amazon now there is no output because the com is missing can i say somehow that for example characters of the listtocheck item amaz com mazo has to match with the string to check so it s like get me a return if of the listtocheck item is matching with the stringtocheck,0,37,89 modmail not working attributeerror clientuser object has no attribute send so i was making a discord bot and made a modmail system and got this error can someone plz help and tell me where i am going wrong i searched many similar errors but there it was showing due to send message which was changed in discord py rewrite error my code,how can i download an embeded pdf with playwright python i m trying to download an embeded pdf file or get its raw content to store it in a variable using playwright with python i m getting the following output for page content i can t locate download button nor print button,0,61,49 sort columns names only not rows in python hi i have df input which needs to be sorted for only column names not by rows restructuring the dataframe my required output column names should be sorted after n columns here after columns my input dataframe is as follows required output dataframe thanks in advance,python round with different decimal automatic deciamal i want to round the number showing in my table it looks now like i want it looks like how can i get that use pandas or numpy and as simple as possible thanks,0,52,41 flask event handler not receiving events from socketio i ve been working on a flask chat application for the past few days while trying to add socketio the flask console displays that it is receiving the message but the event handler in my script is not getting executed that is the output the flask console is showing me the browser console outputs nothing here is app py and here is the html file,pygme spritecollideany argument must be rect style object,0,71,8 how can i match color palettes across different seaborn plots i want to make a pie chart and a barplot displot that use the same colour label across both plots but i don t know how to do that those two plots will use different color palettes and what i would like is for each level within group to have the same colour for both the displot and the pie chart any idea how i would do that,what is meant by object that prefixes method names in the python docs i ve been intensively consulting the python docs lately and i can t figure out what the object prefix means for example i ve been reading about and in the docs its definition header is written as here s the link to its entry what added to the confusion is that running raises the error update i also considered the possibility that it s there to denote instance of a class but then the self parameter becomes invalid,0,77,87 pyqt qtoolbutton set style sheet with the autoraise method i am creating a stylesheet qss file for the gui i am trying to add the qtoolbutton method autoraise to the style sheet as but it doesn t recognize the autoraise attribute this is same as you define a disabled attribute for the qpushbutton which is working how can i define the autoraise attribute inside the qss file,how to assign foreign key inside loop django i want to assign a foreign key to each color in a loop product model color model views,0,66,26 creating two lists derived from an analysed dataframe i am in the process of creating a function that can check multiple conditions of my dataset and then return two lists list items to perform x list items to perform y sample data ideal outcome error when running my code so far,how to convert string from variable in table for csv export i am an absolute beginner with python the title probably says it already i usually look for the answers with googling but here i don t even know what term to look for i have a long string in a variable which i suppose will be easily converted to a table only i can t figure out how to do it myself this is my example this is the output now how can i convert this to export it to a csv or what keywords do i have to search for,0,53,98 detect changes in virtualbox guest click on it using python if we have a virtualbox guest running android is it possible for python maybe via vboxapi or a similar library to the clicking at a particular screen coordinates can be done using console mouse putmouseeventabsolute but how can we detect changes to the virtualbox guest display,trying to convert a string to list and then identify if there are int elements in the list python i have a string that i have converted to a list but i am unable to coerce some of the list values to int,0,55,43 creating and filling empty dates with zeroes i have a dataframe df i want to fill the missing dates for each product id with restocking events to start i have created a date range dataframe using dfdate pd dataframe date pd date range simple date min simple date max where simple is some master dataframe and min and max dates are and,why does the float object behave differently with the is operator as far as i know cpython implementation keeps the same object for some same values in order to save memory for example when i create strings with the value hello cpython does not create different pyobject i heard about it with name string interning when i tried to check it with other python types i observed that almost all hashable immutable types are the same and almost all mutable types are the opposite cpython creates a new pyobject even for the same values and i think it s because we can have the same pyobject for immutable objects without having any problem my question arises when i see that the float type behave differently than other immutable types why is it different,0,50,134 cannot get text in xpath lxml python i assumed getting the right path to get all the professors emails on the website but the output list is meaning nothing in the path really dunno why really appreciate your help thank the community so much,why doesn t the following code need a python interpreter i was watching a video to learn numba at the presenter has the following code on screen the presenter then proceeds to instruct numba to release the gil using jnit nogil true his argument is this function does not need to access the python interpreter while it is running in fact we made sure of that so we can additionally tell it to release the gil the presenter then uses this code with multi threads i understand that gil is required by the thread that wishes to interact with the python interpreter and if a code does not need to interact with python interpreter then isn t it that releasing or not releasing gil is moot,0,46,123 how to use numpy vstack to append row to empty array i want to append some rows of ndarray as values of dictionary however i receive an error for unequal dimensions using np vstack please guide me in this regard desired output dic below is the code i tried error,how to keep dpi of sliced image the same as the original image in python cv is there any parameter to specify the dpi of sliced image i want to keep the original dpi instead of changing the dpi,0,53,39 add a for loop if x i m trying to create a function to translate words to numbers one of the parameters is depth if depth is then the function will know ok i m translating a word if depth is the function will know now i m translating a list of words etc in python exist a form to do this,i have a syntax error in python while trying to load the file here is the error i get,0,63,19 how to add double quotes to sequence of char inside a string i have a string in python like that one and i need to add double quotes to non numerical string situated between a and a result should looks like this i m trying with regex since hours but turning crazy any help would be welcome in advance thank you,discord py invoking a command with args on command error when i get an quotation mark error i m trying to run the command again by fixing the quotation marks that are causing the error but i can t get to pass arguments correctly whether i used get command with and without callback or invoke i tried to pass arguments manually but it didn t work i receive no member argument error or there s no member m error depending on the method i use and the message that invokes the command i can t seem to pass arguments appropriately example verify user im a good member i want to be verified,0,61,105 selenium python unable to scroll and click on load more stories button i am new to selenium and would appreciate advice i am trying to click on the load more stories button on npr s website my code seems good but when i run it more stories are never loaded i don t get an error at the same time the code just doesn t behave as expected,in telethon how can i verify if chataction was only from my group channel when i am not sure if my group channel is private or public for now i am assuming e chat takes a specific url of my group channel either it s public or private and works as a filter and if any event like a user joined or left in my group channel it will print in the console,0,66,67 recursively add nested dictionary json to tkinter s treeview i would like to recursively add nested dictionary data made of dom nodes into tkinter s treeview items i was expecting to have a tree structure like unfortunately i noticed quite repeated fields here is the following code i was expecting to have a single html root with corresponding added children unfortunately this is the result below how can i readjust my code to have a perfect tree,changing timeseries column into a date i have a timeseries with columns the first being hours after jan in this column a year is only days with months of days i need to convert this column into a usable date so that i can analyse the other column based on month year etc e g jan being year month day hour i need to make an array with modulo to convert the each row of the hours column into hour of day day of month year etc so that the column is instead a year month day and hour but i don t know how to do this appreciate it might be confusing any help on doing this would be very helpful,0,76,119 how to access the iframe by xpath for web scraping using selenium with python i only find this possible xpath because the ids change when refreshing the page it is body that gets an error when executing the code iframe image,brownie how do i handle exceptions i ve been watching a brownie tutorial video by patrick fantastic lad still i seem to be getting an error when running a particular function but the rest of the functions run perfectly i don t know where i went wrong i ve attached the code snippet and the error message this the error message and below is the code snippet that includes the imports and the particular function these are the imports and the particular function is below,0,41,83 how do you make a conditional loop with onkeypress i m working on a python project for my intro class where i want to make a blizzard with the turtle module so far i ve been able to make a snowflake appear on each keypress but i m not sure how to make it into a conditional loop where when i click it becomes true and keeps looping without me having to click again here s the code i have right now,displaying list values in a dictionary i want to create a dictionary where the key is the athletes first and last name stored as a tuple and the value is a list containing the athletes country and finishing time in hours minutes and seconds in a tuple as shown below i managed to display the name and surname since it is in a tuple by creating a simple for loop but i have no idea how can i display the list part is there a similar way to print list of items in a dictionary,0,78,95 python misinterpret keyboardinterrupt exception when using lingoes i want to write a python program run py that always runs and only stops running when ctr c is pressed this is how i implement it wrapper py run py however when i hold left mouse and select text in the terminal that is running wrapper py this event is understood incorrectly as ctr c then the wrapper py stop running run py my question is how to prevent reading mouse events as keyboardinterrupt in python unix thanks terminal,cannot import name workspace extension from jupyterlab server after updating to the most recent jupyter server when i enter i get how do i correct this do i have incompatabe package versions installed,0,78,31 priority queue in python using comparator is there any way exists that can do the java queue priority comparator comparingint method in python i want the node which has a higher priority come to the front of the queue edited for example,when i use set list a list b it returns a dictionary do sets naturally return dictionaries i m doing some beginner python exercises and one of them is to remove duplicates from a list i ve successfully done it but the strange thing is that it is returning a dictionary instead of a list this is my code thanks in advance,0,41,60 token authentication failed utf codec can t decode byte xe in position invalid continuation byte i m trying to send the json data from azure ml to eventhub this is the screenshot of output of the variable data output and getting following error anyone could help debug the error thanks,is there a method to delete rows from datframe based on condition hello i have a dataframe i want to keep only rows if name contains lastname i e lastname is in name in our case we keep only because dortminex is in md alexia dortminex thnks,0,48,47 converting a text document into a jsonl json lines format i want to convert a text file into a json lines format using python i need this to be applicable to a text file of any length in characters or words as an example i want to convert the following text to this i tried this but not luck,crontab isn t running my python script in macos although the script works when run manually my school always wants us to download pptx and docx for lecture and practicals and i hate that i ll need to always manually delete it after reading finish therefore i d created a script that trashes whatever s in the folder and would like crontab to schedule it to run every hour everything works fine when i manually run this code through the terminal but when i had added this in my crontab i tried giving the file permission to execute but it still wouldn t run at every minute,0,59,103 opening anaconda prompt with python i want to create a script that will help me with installing packages for spyder therefore i want to use python and have the script first open anaconda prompt then execute the commands and then close that window however i can get it to open for example the calculator but it doesn t seem to open the command prompt for opening the calculator i used how can i get it to open the command prompt,django unable to add wysiwyg i am trying to implement wysiwyg on my page with this link i am currently at point when they want me to add below but when i added above i got below error message i am attaching urls py do you know why i am getting pasted error message,0,79,56 runtime error when using pytorch convolutional model i m trying to develop a covid classification model the images dataset i used is of shape torch size when trying to run my model i m getting this runtime error message as shown in the image any help to understand and fix the issue please this is the code,converting a list of coordinates to point geometry my geopandas df looks like this as you can see the geometry column is a list containing longitude and latitude values is there an efficient way to convert them to points this works but is very inefficient when i put this in a loop i get typeerror len of unsized object basically i need the inverse of this question reproducible data here,0,56,70 how to return multiple value from a pytest fixture with scope session i have created pytest fixture in conftest py for creating user and auto login now how to call the get post method using api client and how to access user in multiple test cases written in test views p,how to change value of variable passed as an argument in python i m trying to code a little game about planets in pygame i was trying to implement a way to stop the movement of the planets by stoping them from updating their position if a global variable paused was set to true this is what the code for the main looks like the part of the code that handles the events is in another file and imported as events just to organize it a little bit and the part of the function keydown that is supposed to change the variable paused looks like this note that this function does more than this it checks for k backspace and k escape and does different things at the same time so returning a value is something i m trying to avoid and doesn t work anyways tried it also the part of the code that prevents the planets from moving when paused true looks like this simplified before i moved the event checks to another file everything worked fine the issue now is that the variable paused doesn t change though the rest of the code related to the key events works just fine i did some testing and discovered this the code above will not change the value of myvar which doesn t make a lot of sense to me so is there a way i can invert the variable paused without having to explicitly write the code inside the function keydown inside the gameloop let me know if i made any spelling or grammar mistakes since english is my second language and also let me know if my code sucks which is pretty likely,0,49,280 django app incorrect datetime during deployment i have a django model with a datetime field like this locally on my machine this control is created with the local date and time when the application is deployed the field is not created with local time i tried to do this it does not work how to solve this problem i am in central africa,function to filter dataframe with multiple if and conditions look at a dataframe and a variable and return a set of clients which are in both the infolist and dataframe and any client in infolist with membership fee larger than offer price any client in infolist who feedback is or higher example dataframe infolist expected outcome code tried so far not sure why this isn t working after tons of research,0,64,71 progress pie chart subplot with percentage i m trying to make a donut chart with percentage of completion below is my code actually with this code it worked as i want but now i want to make it with subplots and i change my code as below but i still cannot find a way to show percentage of completion like first dash can you give me a suggestion thank alot here is the first dash here is the second dash,sentiment analysis python tokenization my problem is the follow i want to do a sentiment analysis on italian tweet and i would to tokenise and lemmatise my italian text in order to find new analysis dimension for my thesis the problem is that i would like to tokenise my hashtag splitting also the composed one for example if i have nogreenpass i would have also without the symbol because the sentiment of the phrase would be better understand with all word of the text how could i do this i tried with sapcy but i have no results i created a function to clean my text but i can t have the hashtag in the way i would i m using this code for example here i don t know how add the first and last replacing the symbol and the tokenisation process doesn t work as i would thank you for the time spent for me and for the patience i hope to became stronger in the jupiter analysis and python coding so i could give an help also to your problem thank you guys,0,79,186 python inspect member variable comments how do i inspect the comments of a python instance variable i ve tried any thoughts,why do i get an error when i try a ldap simple request with python i would like to make a small ldap request but i am facing the following error i don t see where the problem comes from is it the request or the connection to the ldap server,0,20,50 autoincrement for primary key not working in sqlalchemy i have attached my models above while inserting a user i get the following error i am using the following packages i went through the documentation and it says autoincrement is a default behavior for primary keys source i am probably doing something wrong thanks for helping out,how to use tkinter buttons for input something,0,57,8 split these strings while inside a list so i have this list and i need help finding a good way to split the list items at every n split wont work because i m assuming that it doesn t register the n as part of the string,custom resource cloudformation to tag event rules i am trying to create custom resource in cloudformation to tag event rule this is the lambda this is the cfn block while creating cloudformation it gave error create failed invalid physicalresourceid but somehow managed to create tags need help to understand why it gave the cloudformation error if it created the tags,0,45,60 error with installing and importing gtts in python i m facing this issue whenever i am installing and importing gtts issue in installing issue in importing i did pip install gtts and imported from gtts import gtts thank you ps python version,sphinx documentation showing double colon in fields i am developing documentation for a package and when i build the sphinx docs i m getting double colons for all of the fields for every function definition i am using the numpydoc style for my docstrings and there are no colons in those docs to indicate where they might be coming from has anyone run into this before it s worth noting that this does not happen to the examples field just parameters returns and return type,0,43,82 less strict mypy evaluation inside functions with the following contrived python script executing mypy something optional py results in exitcode and the output however if i put the offending code in a function running mypy returns with exitcode and outputs success no issues found in source file what is the reason for this behaviour i would assume mypy should be equally strict inside functions,get number of minutes until static time using datetime index i have a dataframe with a datetime index and i d like to get the number of minutes remaining until pm or for each row s day using a column calculation using the answer from this post we can create an empty dataframe with some random datetime s and assign it to the index as an example if the datetime at index n is then the value in the new column for that row should read if it s after its ok for the number to be negative what i had initially tried was this but this gives the error which is fine but i m not even sure i m going about this the right way and this error might just be because of the reproducible code i ve provided but you get what i m trying to do without using a for loop,0,65,153 concat created nan values even after index reset i want to create a csv file that combines the train and test data and labels to use it for a project the problem is that in concat function even after using the index reset the labels continue being nan and i don t understand what is wrong the datasets are in this link,i installed brownie and after installation when i tried to see the version of it i ran into this error i am using macos if that matters importerror dlopen users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so symbol not found pygen send referenced from users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so expected in flat namespace in users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so i tried pip uninstall recordclass and re install it but couldn t fix the problem,0,62,57 python function to combine many dataset without listing them all i wanted to write a function to combine over datasets without actually listing them all ideally having a function to take in one at a time and combine the previous one at the end it accumulates all datasets i am not sure how to recursively accumulate them how should i create this function thanks,python re match exact string with pattern string block emp string block reg re match d d d string returns block emp the above regex works correctly reg re match d d d string returns block here the excepted output for string is null but the regex returns block this regex will not match the full pattern and returns only what matches in the string how to match the string excatly with this pattern thanks,0,65,63 importing error of tensorflow via jupyterlab on python recently i ve downloaded tensorflow it s working when i start ipython using the terminal with the command jupyter notebook however when i use jupyter lab i can t import tensorflow i tried to reinstall tensorflow again but it isn t working any ideas on how to fix this issue n b i m using macos with m chip i m not sure if that s relevant anyway,only django request body contains data not request post i am using forms in django and trying to get the get the data back using request post but this returns an empty dictionary for me querydict when using request body however i get the raw data back how can i get the data from request post as well because i do not want to work with raw data the console output of the print statements are put in comments next to them forms py views py blank html,0,66,81 freqtrade python sell sign i am trying to create a sales order using the freqtrade bot when the current price hits the entry price atr i don t know how i can retrieve the entry price the price i made the purchase this is my code what do i put in place of open rate,extracting value with beautifulsoup get text problem i am trying to extract a single value from the code below my code is i expect but somehow i get strange output what i am doing wrong here,0,54,37 how to edit and use a python package containing an so file i have installed a python package as usual using pip install package name it contains the main most relevant file in the form of so extension i want to modify it and use it for my work is it even possible to do it is there a background underlying code for the so file in python that comes along with the package or is it a standalone program,how can a function handle a numpy array input which is not comma separated i wrote a function to modify a d numpy array to test it i used this format however this function should also handle input where the array is not comma separated how can this function handle the numpy array input which is not comma separated whatever i tried so far to fix it a syntaxerror was raised thank you very much for your help,0,77,76 pydantic dataclass handle validationerror i am looking for solution to handle validationerror when passing data into pydantic dataclass any ways i can replace the field with wrong type with some thing like none value thanks,how to handle the opencv we are implementing the code for brain tumor classification using support vector machine svm but the error arises by running the final block of code,0,35,30 python array problems i want to run a command in a python file and then results from that command to be inside an array so i can insert that array inside a db later here s my code here is my output this cloned like times i want to get every item not all items in item and then that one item cloned times any fix,filenotfounderror errno no such file or directory after copying pathname i copy pasted the pathname from the folder i want to extract images from this same exact code was working before but now i get the error message i held down the option key whilst in the folder and clicked copypathname on mac so it cannot possibly be a non existent path folder,0,62,61 how to fetch one value from one json column of dataframe pandas i have below dataframe in pandas now the th column has nested json string i am trying to fetch just the name field from the nested json as shown below is there any way to do this using pandas,how to format variable in template as currency i am trying to format a string in a template to display as a currency object cost would i be able to do something like f format object cost in the template,0,52,40 how to open a new window which is in another class in tkinter so basically i want to open a new window whose code is in another class from a button click this button is in class how can i accomplsh this the function is open main window an the button is sharingan i just want to open a new window when this button is clicked what code should i write in the function,beautifulsoup finds an html element that contains spaces in its attributes how to use beautifulsoup to find an html element that contains spaces in its attributes i would like to know how to use soup find to find the title that i want because beautifulsoup considers the attribute attrs of title that i want like this class td p br but not like this class td p,0,72,65 python cassandra driver connect to docker container on server cassandra unresolvablecontactpoints i am runnning cassandra in a docker container on a custom server i start cassandra docker like this when i want to conect to the server via the python cassandra driver from datastax like this the exception is thrown after hours of searching through docker network permissions i found the simple solution so maybe this will help you too,parametric pdf estimation histogram vs likelihood given a sample from a distribution and assuming it is gaussian normal distribution with unknown mu sigma the task is to find the parameters mean and standard deviation that describe it best what is the mathematical difference and why does it yield different results and if it is different why and when to use which method i think both are parametric and can be used in the same cases,0,71,75 how to get every value of a key of a json file with multiple dicts how to get every value of a key of a json file with multiple dicts i want to extract every value of username key data json this is what my code so far but it gave me this error keyerror username main py,making subplots in plotly anyone has solution on how to make make the histogram graph a subplot to the ohlc graph with same y axis but different x axises thanks a lot,0,56,30 scrapy run for loop within nested json objects i am scraping a json api using scrapy and want to loop through the offers and then the outcomes as shown in the screenshot below i am getting to the offers ok but then not sure what to write for the get as its unlabeled everything i have tried leads to an error of list object has no attribute get my code is below,is there a way to plot multiple lines using hvplot line from an xarray array i have multiple ytraces data in an xarray array data trace selection can be done by the above creates a line plot with a widget slider that allows scrolling through the lines with single line displayed at a time i would like to be able to plot all lines without creating the slider widget hvplot documentation is sparse as to how to do that,0,72,77 group data by a given range im looking for an algorithm to get different means for different values example i have the values so the output should be and,confusion with lists and recursion first let me give you an example that i do understand output is and it is consistent with what i know even if you don t specify the list explicitly in functional call e g f i l you still can use and change this list in a function and here is an example that i don t understand output is so in first functional call f we create list and append to the list list next we have recursion f where we recreate the list so the list with has gone and was appended list we go to if i statement and getting return from f i but for some reason that i don t understand the final output is it is very confusing our recursion call f i should change the list and i demonstrated in the first example that python should honor any changes in a list why is output and not,0,36,164 filter time in a dataframe using python i have a column where there is only time after reading that csv file i have converted that column to datetime datatype as it was object when i read it in jupyter notebook when i try to filter i am getting error like below code sample data here i am trying display the rows whose appointment time is between to datatype info could anyone help thanks in advance,javascript version of while true loop i wrote this bit of code i ve tried the below but it doesnt seem to be working i m having bit of a struggle trying to create a javascript version of it since it seems js while loops constantly rerun but python seems to wait for input before rerunning i am using the readline module to receive input from the console is there something im getting wrong im fairly new to programming any solutions,0,75,79 how to replace single value in pandas dataframe by index below is an example of what i want to do basically i know the index and the column of the value i want to replace and just want to replace a specific cell no conditional statements,yolov can i add more epochs on the model already done custom training i m trying to make image detection model with images i just tried epochs which took about hours of training the question is if i want to simply add more epochs on the same model how can i do that is there a way that i can load custom trained model since it takes so long i wish i can continue training from epochs already done training i m using colab and i experienced a few times loosing connection during the training so i m afraid of giving more epochs from the start of training,0,46,110 i want to get sendtime as an input in smtplib i am coding a program that sends scheduled emails but i require the time in code like this i would like to get this send time as an input from user like,concatenate variable in athena sql query from python lambda function i have a python lambda function that creates a sql table in athena how do i properly concatenate variables in my query when i set the location value i receive the error response below the function runs successfully if i hard code the location value error response lambda function thank you,0,42,61 why is this dictionary comprehension for list of dictionaries not returning values i am iterating over a list of dictionaries in a list formatted as follows each dictionary relates to one item of clothing i have only listed the first this is returning the reason for the if statement in there is that not every product has a value for uniq id so i was getting a key error on an earlier version of my code,python cassandra driver connect to docker container on server cassandra unresolvablecontactpoints i am runnning cassandra in a docker container on a custom server i start cassandra docker like this when i want to conect to the server via the python cassandra driver from datastax like this the exception is thrown after hours of searching through docker network permissions i found the simple solution so maybe this will help you too,0,75,71 with which library i can bind hotkeys in python code i have a function and i want to bind this function to ctrl alt i already used pynput but it reacts even on typical ctrl or alt how to realize it in more comfortable way i tried pyautogui but it too cause some strange things if i m not mistaken,creating columns in one dataframe only from non matching columns from another dataframe and set all values to i have two dataframes that look like this df and df share the same columns names except d which is only found in df what i would like to do is add d to df but fill all rows with s in other words if a column exists in df but it doesn t in df add that column to df but make all values in that column below i realize it would be very easy to add one column called d to df but this is just a dummy example when in reality i am dealing with much larger and many more dataframes so i am looking for a way to do this with a code i could implement in a loop or iteratively,0,57,144 typeerror bad operand type for abs vpython cyvector vector i m trying to implement the gravitational force between two objects using this code then i got this error,progress pie chart subplot with percentage i m trying to make a donut chart with percentage of completion below is my code actually with this code it worked as i want but now i want to make it with subplots and i change my code as below but i still cannot find a way to show percentage of completion like first dash can you give me a suggestion thank alot here is the first dash here is the second dash,0,25,79 decorating class methods to call a method from the same name i have a class with a bunch of similar looking methods as such my idea was a wrapper like here s the problem if self delegate is a subclass of foo the wrong method is invoked so far i ve found this works but it looks really ugly i wonder if there s a nicer way to accomplish the same thing,how can i make a pygame mouse clicking event i want to add to the variable i when i click the image in pygame how can i do it,0,67,30 i am having problems with skyfield python i want to find out the heliocentric position of jupiter and the corresponding zodiac but i am having basic problems the error i get if someone can help me solve the error problem and then suggest to me how to map jupiter to the constellation i would appreciate it,error with tensorflow map fn unable to specify output signature i am trying to use tensorflow s tf map fn to map a ragged tensor but i am getting an error that i can t fix here is some minimal code that demonstrates the error my desired output is the error i am getting is invalidargumenterror all flat values must have compatible shapes shape at index shape at index if you are using tf map fn then you may need to specify an explicit fn output signature with appropriate ragged rank and or convert output tensors to raggedtensors op raggedtensorfromvariant i realize i need to specify fn output signature but despite experimentation i cannot figure out what it should be edit i cleaned up alonetogether s excellent answer a little bit and created a function that maps ragged tensors his answer uses the tf ragged stack function to convert the tensors to ragged tensors which tf map fn needs for some reason,0,56,146 uploading directory to pinata ipfs api i m trying to upload a directory of pngs to pinata but i keep getting this error here is the code that i ve tried that filepath is indeed a valid filepath i need to have a ipfs or pinata directory with a cid and then a bunch of number pictures in there if there is any other way to do this lmk thank you,binary array in python time series how do i turn below into a data frame where array is a column of values and array is a corresponding column of values this is actually a time series,0,69,38 python pandas valueerror invalid literal for int with base i have a dataframe with a column named year in object format i want to convert object to int but i have this error valueerror invalid literal for int with base here is my code data h df year astype str astype int,input element overshadows the click button python selenium i am trying to send a pnr and then click on the submit button the pnr gets correctly filled in but the submit button is not getting clicked so i commented on the send key line and checked if the submit button is getting clicked and it gets clicked but when i send the pnr value and subsequently click the submit button it doesn t work below is the snapshot of the same and below is the code can anyone help me with how to make the submit button work,0,51,97 seaborn how to apply custom color to each seaborn violinplot how to use custom colors to obtain split violin plots like this image source the standard examples only show colors using up the hue parameter,how to transform pandas df containing boolean columns into a heatmap compatible table i have a table something like this where each cell is containing whether the row is connected to the specified column i want to transform this into a table like this where each cell contains the number of rows from the original table that has both connected to the specific column and row name in the second table for example the in the second table means that there are rows in the original table that is connected to the b and c columns the goal is to plot a heatmap from the second table using plotly,0,36,111 trying to get a member s status right now i am doing it on ready just to try and figure it out the status is returning offline when i am online ultimately i am looking to do this within a looped task where i check whether they are afk every so often is my settings in the discord dev portal anyway any ideas where i messed up,create a new variable based on other variables i have a dataframe in python called df where i have dichotomous variables called ordering ordering ordering ordering with true false values i need to create a variable called clean which is based on the other variables meaning when ordering true then clean ordering when ordering true then clean ordering then clean would be a combination of all the true values from ordering ordering ordering ordering here is an example of how i would like the variable clean to be i have tried the below code but it does not work df clean df ordering df ordering df ordering df ordering would anyone please be able to help me how to do this in python,0,66,126 how to define folder name when saving json file in python how to define folder name when saving json file i tried to add myfoldername inside open but did not work also tried to myfoldername myfilename in filename definition error code,beautifulsoup finds an html element that contains spaces in its attributes how to use beautifulsoup to find an html element that contains spaces in its attributes i would like to know how to use soup find to find the title that i want because beautifulsoup considers the attribute attrs of title that i want like this class td p br but not like this class td p,0,40,65 train neural network model on multiple datasets what i have what i want i can train the datasets separately and save the single models one at a time but i want to load my datasets and create models with them in a single run the solution may be obvious but i am fairly new to this how do i achieve this thanks in advance,django model set a week of day field as string from existing models datefield i am trying to set a session class s field based on another model teacher s field basically each teacher has an assigned day of week monday etc and i want each session object to have the teacher name as field based on session s date field for example session class with the date would have the field weekday saturday hence get a my teacher name mr saturday since i need a string value such as monday to query the teacher assigned to that day i m trying to figure out how to do this this raised the error attributeerror datetimefield object has no attribute datetime i m also aware i can get week of day using session date date f d l in templates but i am not sure how to actually use this as model s field and not just for display would appreciate any help,0,66,149 what is the way to add a text after user input while user adding it in the input in python i would like to make ask the user for any data and put a text after the user input in the execution like below number of persons input how many persons console the screen to be in same step user adding the answer and how many persons persons,getting errors while making a serial connection using netmiko i ve tried dev ttys ttys com but no luck getting following errors while connecting via serial using netmiko,0,69,27 installing http module in python not able to install http module in python warning discarding from command errored out with exit status python setup py egg info check the logs for full command output,python read a line from a file then remove it with threading i have this program that uses python threading to read different lines in a file if it reads a duplicate line then reads another one and once it has read it removes the line from the file the problem is that whenever it reads the file it doesn t update the file or i m not quite sure what s happening it can sometimes read the same line as before therefore breaking it i m not sure if my code is the most effective way to do this,0,37,96 can t download file on put file in pywebio i m having a problem running the pywebio program in combination with flask when i try to use put file or download session from pywebio it produces an error like this and the file cannot be downloaded error status and here s an example of the code i m using,python cv warpperspective tranfromation shows dashed line i took the two dummy destination points pts and pts with four coordinates and implemented wrap perspective transformation twice then output for those points has a dashed line in between input subject as design image ouptput please help me out in getting the smooth stitched without a dotted line,0,53,55 implementing asyncio with pysimplegui i am trying to implement asyncio with pysimplegui in python in this gui example two buttons button and button emulate a long task to accomplish goal expected result current result i thought that i applied async wait according to the rules did i miss something,django schedule run tasks dynamically at particular time periodically from user s order in app without celery i am creating a django app where the user can schedule some tasks to happen at a particular time for example in google calendar we tell google what we will be doing tomorrow and then at right time it sends us a notification similarly here i want it to be flexible for instance the user can tell django the time and function to run django will wait for the time and then run the function like he said turn off lights at pm then django will do it or for example user says remind me to go to the gym in minutes and then after minutes he gets a notification actually the tasks are added dynamically so we can t hardcode them at first code there s a django model known as function in which this function is stored and the user can access it easily i want users to select this function within the application and also give parameters and time and django will run it at that time in short what i need is that the user from within the application is able to set the time of a function or task to run at a particular time maybe periodically or once or maybe in the situation and django runs it on that particular time note user will also give args and kwargs i am taking care of that all i need is django run the function with those args and kwargs only django method without celery or something will be appreciated thanks,0,48,268 how to fix this issue typeerror object has no attribute value in connectivity i can t able to insert values in ssms geting error,dockerize nodejs python project using dockerfile i am currently working for bachelor thesis on a web app together with streamlit however i want to use a vue template from this github repository over here for this i need to install nodejs python and using npm or yarn the needed packages inside the github repository i want to dockerize everything in one container original setup needs this commands including python node js and npm i tried to setup everything with this dockerfile content but at the point yarn build or yarn run serve i receive module errors like ts module node modules vue dist vue has no exported member onmounted check the screenshot what did i do wrong without docker on my local machine everything works as anticipated,0,24,123 updating numbers pandas python but also keep all the data i got two dataframes df df i am using the update function to update the two dataframes result is it possible to get the other numbers too something like this,how can i create a merged cell with a word in it in python i would like to create a merged cell in an excel document with a word in it the function would ideally take as an input arguments start row start col finish row finish col and word this function would edit the document such that i have a merged cell in the range given to the function an example usage in this example i would get a tralala word from column c to column e from row to row,0,40,90 sort the json data based on value in python i have a following json as an output and further need to organize the json in descending order of the sal value please help me achieving the same,why does the ipython error about input mention raw input i have following line of code to accept identifiers this works great on my python however when i send the notebook to a colleague this error occurs what could be causing this mis match,0,37,43 how can a function handle a numpy array input which is not comma separated i wrote a function to modify a d numpy array to test it i used this format however this function should also handle input where the array is not comma separated how can this function handle the numpy array input which is not comma separated whatever i tried so far to fix it a syntaxerror was raised thank you very much for your help,apply arithmetic operation from json file to dataframe without using eval function i have json file contains arithmetic operation list to apply in dataframe columns i used eval function but i could not use eval function due to security issue how can apply arithmetic operation from json file without using eval function my df function will be like the below table,0,76,61 remove duplicate files python can anyone help me out with currently i have text files each file is kb but there are files that are similar or nearly identical how do i remove duplicate files it s best to use python i have a way but it s not good i count the words in the text then compare sorry my english is not good,microsoft graph delete access package assignment i m using microsoft graph api beta version to delete an access package however for deleting an access package i need first to remove all its assignments for doing this i found on the official doc the accesspackageassignment object when i perform a get request on the assignment the response is successful odata context accesspackageid xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx assignmentpolicyid xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx assignmentstate delivered assignmentstatus delivered catalogid xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx expireddatetime none id ad eb baa b a bfef d aef isextended false schedule expiration duration none enddatetime t z type afterdatetime recurrence none startdatetime t z targetid xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx however when i perform a delete request i get the following error error code innererror client request id xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx date t request id xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx message no http resource was found that matches the request uri i suppose this error is due to fact that in doc no delete method is mentioned for the accesspackageassignment object so how can i delete an access package assignment via microsoft graph,0,65,158 is cssselector the only way i can use for shadowroot selenium common exceptions invalidargumentexception message invalid argument invalid locator is css selector the only way i can use to find element inside a shadowroot element i am using python selenium chrome below is my code and the error i got as below if i don t use by css selector,the client noticed that the server is not a supported distribution of elasticsearch i am using elasticsearch version with python django version but i am getting this error the client noticed that the server is not a supported distribution of elasticsearch while searching on the internet i found that downgrading the version of elastic search from is was working for a lot of people as version was updating a few internal scripts but in my case the version is already lower than i used curl x get to check its version also other such issues included node angular and other frameworks which were not relevant to my case how can i solve this issue if i need to downgrade then which version am i supposed to downgrade,0,55,134 new to python and i m trying to add an item to individual lists in a nested list i m trying to create a code that will add milk to each list in a shopping cart nested list but if there is already milk in that list milk should not be added to it,regular expression to remove two line breaks conditionally i m trying to remove two line breaks character at the end of each line in a text file but only if it follows a lowercase letter i e a z i have the following code text that i want to obtain with my code nothing changes in the text my code follows this answered question regular expression to remove line breaks but i am unable to adapt it to two line breaks,0,52,78 best and fastest way to get first value from dictionary values what is the fastest and best way to get first value from dictionary values there are multiple techniques but what is the best memory and speed and why examples below i would be grateful for other techniques as well,my discord bot doesn t seem to be executing a function on member join i m new to coding discord bots so this might be some easy fix mistake i made but when a member joins my server the bot doesn t seem to react be it to add a role or just send a random message in the console i d also add i m using replit to host my bot,0,50,67 colorbar tick values and labels do not match my code the result issue quite alarmingly the colorbar tick labels only match the corresponding tick value on the first and last ticks the bizarre locations of the minor ticks hinted at the major tick labels being wrongly placed except for the minor ticks leading to any idea of what is going on thank you in advance,how to return to previous version of pip install in django i have recently downloaded a django project from github and i downloaded all of the pip install requirements using however i realised that i did not set a virtual env for this project so it seems that the pip installs have affect the entire computer i am now getting an error like below when i try to runserver my other django projects is this error occurring because i did not set up a virtual env before i pip installed for the git hub project is there any way i can reverse my pip installments to the previous version thank you,0,66,111 python publish message to sns with lambda request body i have an aws lambda that is triggered through api gateway set up with the following code however it seems that event does not have the body key i m using this lambda with aws gateway in order to serve as a webhook listener i want to pass the webhook data to my sns topic,label is not updating in python kivy label hello doesnt update to listening on press label hello doesnt update to listening on press,0,64,23 can this conditional be shortened is it possible to just use get function from dictionary for this is this the best we can do to shorten this piece of code n dict is a dict type uppercase d and nes is just a list of str i m just curious if there is a better more pythonic way to retrieve a value like c has with trygetvalue,splitting the total time in seconds and fill the rows of a column value in second frame i have an dataframe look like start time and stop time are in seconds followed by milliseconds and my expected output to be like i dont know how to approach this forward filling may fill nan values but i need the total time seconds to be divided and saved as second frame in accordance with respective labels i dont have any code snippet to go forward all i did is saving it in a dataframe as df pd dataframe data columns labels start time stop time thank you and i really appreciate the help,0,66,107 python tkinter grid not working with classes how do i change the position of the buttons with the grid system i had it working without classes when i run the program it ignores the grid settings i want to use the grid system but it doesn t work this is how it looks now but i want something like this thanks in advance,different upload and download urls for django models s image field i need a way to have different upload and download urls for imagefield i want to upload the image to aws s and while accessing the image i want the image to route through cdn in my case fastly just like i am specifying upload path in imagefield i would like a way to do something similar for accessing image it also seems that i cannot modify avatar url once it is created is there any way around if there is any way i can override the model s behaviour to modify the url while accessing,0,63,104 rename items from a column in pandas i m working in a dataset which i faced the following situation and my goal is to make the variables marquis and marwise be included into the variable marquise how can i combine they,how do i display two number text files correctly i would to ask for solution regarding the file handling matter the problem is when i try to print out the tuples from text file some digits or texts will be missing here s my code file demand txt quantity txt ingredient txt tomato tomato tomato what i got in my terminal is tomato tomato tomat in parallel position the outcome should be tomato tomato tomato in parallel position thanks in advance,0,40,93 best way to get first single value of list what is the fastest and best way to get first value from list there are multiple techniques but what is the best memory and speed and why examples below i would be grateful for other techniques as well,how to extract all numeric like values from string i have a strings that contain different values numeric and non numeric mixed i want to be able to extract the values from the text i could not get my head around how to extract all or most of possible cases i have a partially working solution like this driver code incorrect answer expected answer please note the difference between and and x to y and x to y and z i would appreciate any help thank you,0,47,88 heroku app not deploying error could not find a version that satisfies the requirement it s a flask python app the error is error could not find a version that satisfies the requirement ikp db from versions and in the requirement txt file i rewrote it to be ikp db but still the error is still i used the following commands,xml with multiple tags problem is parsing through an xml that starts right after envelope soup has this data then i am trying to extract data from xml file i also tried i am getting output that is something like this ea issue is i don t have a parent class that creates a boundary i am trying to extract the data in csv format data comes from tally it is called stock summary to be exact i have no idea how to proceed data comes with empty values as well and that needs to be captured as it is edit i am purposefully putting a part of xml that has all the data needed to be extracted row of image is the expected output output needs to be something that has all these values with lowest level granularity every thing in row please have a look at this image for reference,0,63,162 why is regex not returning any matches i m attempting to use regexes to pull certain substrings from the text in the body of an outlook email here is the function with the regex that i m trying to use here is the raw string i m trying to perform the regex on but when i try to pull one of the entries from the list substring i get a indexerror list index out of range error any suggestions,web scraping after a filter has been applied to data i m trying to take data of the premier league website my problem is when i m taking the data from the site mentioned above i get the data from this site so the data and url changes after filtering to a different season but does not appear to change when i m trying to take it from the site my code this prints the total data instead of the filtered data how would i change it to return the filtered data instead e g,0,76,96 want to create a tab delimited file with autonumbers i would like to create a tab delimited file with python and add autonumbering to in first column and in second column i try to create variables and don t know how to add the leading zero s part also writing the variables gives a error message,saving critical errors using logging python i made a little game as my school project i want to save critical errors to my log file that i had created using logging module but i just can t figure out how to log them logging configuration what i want to do every time a program will encounter exception that can t be handled like typeerror or syntaxerror it will be saved in log log file then program will exit but it usually just close program and pritn error in terminal which is not intended i have tried to use but it didn t saved output to log log file instead i have got error message in terminal,0,68,112 how to only show the final result after adding or multiplying all natural numbers it has been a week since i started to self study python and i tried making a program that adds or multiplies all natural numbers and the problem is i want to only show the final result of all the sum or product of all natural numbers how do i do it,how to import method from one package to another for the directory structure below below is the directory structure where i am having trouble importing modules let s say there s a method foo in b c b py which is to be imported into a a py however when i try importing foo as shown below i get an error saying an alternative way that i tried was using relative imports like this but again i get an error saying how exactly should i import foo from b c b py into a a py,0,65,87 conda install c conda forge prophet takes forever to install trying to install fb prophet but it takes so long it has been running for both vscode editor for almost an hour,debold discord py emebed so i m making an embed on my discord bot and i m wanting to remove the big line between the numbers i ve tried name and name ub b but no matter what it will show the annoying blank line code,0,31,41 python face recognition library import error i wanted to try the face regognition package in python but i get this error and couldn t find a working solution online i im using m mac by the way importerror dlopen opt homebrew lib python site packages dlib pybind cpython darwin so x symbol not found in flat namespace png do expand palette rgb neon anyone has a solution for this,selenium how to find a div that hiding in a i want to use selenium to find a div my code is but i got the error what should i do to find this div,0,49,36 how to get only the last folder and filename of a path how can i get the last folder and the filename of a path in python i am doing is there a simpler way,selenium gives server error after click django pytest i have a django app that i want to test via pytest and selenium the routine i m trying to go through is to let selenium log in then go to the menu choose one of the options this redirects to a new page which is found fine there i let selenium enter data and click a button to start a submission this too works and redirects to a third page on this third your submission was created successfully page there is a link displayed that the user can click to collect the results of their submission this page this link is displayed correctly the href url is fine but when i let selenium click on it i suddenly get a server error when i do the exact same thing manually it works fine here s my test code slightly simplified i have already tried to use webdriverwait self driver until ec element to be clickable by link text click here for your results click and that doesn t seem to even click i know that error mean s the error is on the server side but before clicking the server is fine all the redirections before this step work fine the urls also check out and manually everything works as expected i have no idea how to narrow down the problem further how can i investigate the reason for this error and hopefully fix it,0,35,233 how to query and update nested json data in django i have below class defined to do statistics for voting system now i have submission stats in below format when i receive vote submissions for example i want to update num vote from to and user list from to user a user b field in this jsonfield accordingly how to query and update elements in nested jsonfield data please,health status of emr cluster using boto i want to get the health status of emr cluster using boto if it is healthy then i should be able to run my jobs how to know if the cluster is healthy i ran the below code and it returned a dictionary output how can we fetch the instances status out of this and list instances is the correct method to look for the health of the emr cluster thanks,0,69,80 how to solve python error typeerror init takes exactly arguments given i am new to python can someone please help me to solve this error my code is as following i am getting this error i am using python in linux,csv writer python with crlf instead of lf hi i am trying to use csv library to convert my csv file into a new one the code that i wrote is the following the only problem is that in the resulting file test new csv file i have crlf instead of lf here is a sample image of and as a result when i copy the csv column into google docs excel file i am getting a blank line after each row with crlf is it possible to write my code with the use of csv library so that lf is left inside a cell instead of crlf,0,44,106 how to fix this issue typeerror object has no attribute value in connectivity i can t able to insert values in ssms geting error,how to get rid of queryset tag when getting the data on my template from the database django i m having a bad time figuring this out through searching different stackoverflow question but i m using a function based view to make my day simplier but when i m retrieving this single data from a database and showing only one record using slice it throws beside it a tag which commonly see when we test print in our terminals but how exactly to get rid of this here s my code snippet where when i call tutorial title slice it should only call one latest record which works flawlessly but there is a queryset tag beside the shown data,0,24,116 python sqlite cannot make table name from variable value the id is value of how can i success this i want to make a table named by variable error,run code on python flask appengine startup in gcp i need to have a tcp client that listens to messages constantly and publish pub sub events for each message since there is no kafka in gcp i m trying to do it using my flask service which runs using appengine in gcp i m planning on setting the app yaml as but i can t figure out how to trigger code on the flask app startup i ve tried running code in the main py and also tried to manipulate the main function in it but it obviously doesn t work as appengine doesn t run it do you have any idea how can i init the listener on the flask app startup or any other offer regarding how should i implement a tcp client that sends pubsub events or inserting to big query,0,30,137 lights out with branch and bound i m implementing an algorithm using branch and bound to find a solution for the game lights out i can t find the way to relax the restrictions of the game in order to find the bounds how can i relax the problem,apply function across pandas dataframe kruskal wallice i have a dataframe df and can t seem to apply this function across columns for each row i keep getting df desired output obviously i made the p values up,0,47,35 amazon neptune on submitting query attributeerror str object has no attribute source instructions i have the following code running on aws lambda but getting the following error error source code,generate output file python as it can be seen in the code i created two output files one for output after splitting and second output as actual out after removing duplicate lines how can i make only one output file sorry if i sound too stupid i m a beginner,0,29,49 multiplication guessing game in python if wrong guess until it is correct i am trying to write a program as follows it seems i was able to perform and however i am not able to do and when a user gives the wrong answer a new random multiplication is generated can please somebody help me out thanks,python algorithm for solving systems of equations without i need algorithm that solve systems like this example solution my skills are not enough to write this algorithm please help and another algorithm that solve this system as answer here i need two x and two y,0,62,47 cannot change text of kivy kivymd label when i try to get change the text of a label in kivy kivymd it gives me the following error here is part of the main py for a minimal reproducible example kv string hope you can figure this out but i am not good with kivy,uploading a file attachment to outlook office email using selenium python i am working on a project that requires outlook office be automated by selenium i want to upload a file attach to my email but can t figure out how to despite extensive researching i have made many attempts to find the correct element for sending the file path but none have work and result in either no action happening or a nosuchelementexception error being thrown how can i upload a file to an email draft in office as an email attachment using selenium one example of code i have tried modified example from above,0,51,108 extract an element from the class with beautiful soup how would you extract the from data dat,pyqtgraph stacked bar graph i have this set of data i want to draw a stacked bar chart in pyqtgraph similar to this one drawn in matplolib i have checked pyqtgraph bargraphitem documentation but i didn t find any information regarding stacking bar,0,17,41 document creation using google apis in python throws error in the following approach i tried to create a document and insert data into it approach error the file is getting created and the permission is also granted but unable to insert data in the file,how to open images from a path in a txt file if i had a text file that just had lines of full directories to images on my machine eg f desktop images def jpg f desktop images abc jpg c users me downloads orange jpg c users me downloads apple jpg how could i get python to open them by reading the lines in the txt file using the pil module let s say i m just starting with some like above code works if the txt file only had line but how would i do it to read through and open multiple lines thanks,0,45,87 we are trying from instagram importing instagramy from python but it s not working i want to scrape the data from instagram different public and private accounts but when i run the following code,csv table row as label for previous several rows i have a question about tensorflow i have csv data like image attached and i want to map it green row is label for previous rows is it possible to do it inside map function dataset map and how,0,33,51 how to make particular column values as upper case if i have a dataframe like now how do i make a and b column values as uppercase for single column for all columns or expected output how do we do it for two columns at once like we could do the single column one twice but looking for how to do for both columns,what unit is my distance in between two lat long points i have calculated the distance between two points using geopanda s gdf distance function i have my distances but i don t know what unit they are in my geodataframe has a crs of epsg i understand that my coordinate system is using decimal degrees lat long and that the distance function calculates the euclidean distance but what is this distance in my code output,0,64,71 python beautiful soup get correct column headers for each table the following code gets player data but each dataset is different the first data it sees is the quarterback data so it uses these columns for all the data going forward how can i change the header so that for every different dataset it encounters the correct headers are used with the correct data,python executable script modulenotfound i am trying to better understand importing modules i read about how to do this from here and i can get it to work using solution there is an additional variable that i need to figure out though this is a dummy project i am testing with with this setup i can do test script py the goal is to make b package test script py executable without using python test script ie test script however adding the shebang at the top usr bin env python causes an import error i assume it is because python is not loading it as a module based off the above mentioned question but i am not sure how to resolve this,0,64,114 resampling with origin end day i don t understand what origin end day does the docs give the following example the docs explain origin end day like this end day origin is the ceiling midnight of the last day so as far as i understand the line should be equivalent to however passing the timestamp ts index max ceil d produces a different result i m looking for an explanation for this discrepancy and maybe a better general description of the end day argument than the docs provide edit i m using pandas,updating filtered data frame in pandas can t find why updating filtered data frames are not working the code is also not returning any error message i d be grateful for hints help so the problem comes when i want to update the dataframe but only to given selection given update function on data frame objects updates the data based on index from data set based on another but it does not do anything when applied to filtered dataframe sample data df df code returns df while below code does not apply any updates to given data frame return df looking for help on solving and why is this happening like so thanks,0,79,111 how to convert nested dictionary values to list i have tried this code o p expected o p,is there a method to check if string exist in another dataframe i have a dataframe and i have another dataframe like i want to get the id k from the second dataframe if firstname and lastname df are in name df and city df is in address df i want to have in output,0,16,56 gitlab page for sphinx project is not working as expected the link to the whole project i tested the generated document on local machine it works fine and gitlab page is as below is there something wrong with gitlab ci yml,how to import dataframe from py file to ipynb file i am trying to import a dataframe from funcs py file to data ipynb file both are in the same directory funcs py here conn is the pyodbc connection it is working fine as i am able to view dataframe in funcs py error when i tried to import df course in data ipynb it is giving me error i am doing like this but it is giving me error that cannot import df course from funcs please help me in this problem,0,40,86 python wrong ip address detection reading this how do you determine if an ip address is private in python i wrote but that s not correct this is a public ip address how to fix this,fast way to generate large scale random ndarray i want to generate a random matrix of shape e but i find numpy random rand becomes very slow at this scale is there a quicker way,0,35,33 adding a legend to pandas scatterplot i am using the pandas version of scatter not matplotlib how would i add a legend to this graph based on the colors,apply a function in dictionary composed of dataframes with different column names i ve been struggling trying to take a dictionary d composed of n dataframes and apply to them this which is a function to repeat index number of times the column of each dataframe something like this so the dictionary d has the dataframes that look like the before column i tried this way to apply the function i was able to do it this way when i select manually a column name but these dataframes have different column names on purpose but i can t apply this because iloc doesn t work on strings i found weird because it is not selecting the values of the dictionary instead is using the string of the dictionary if i want back the dictionary d with the function applied how can i solve this thanks edits,0,29,144 openpyxl merge cells with x y how to transform id to excel columns letters i m using openpyxl i need to merge cells in a dynamic way so here is my difficulty here is the code to merge cells with openpyxl because i need to do it dynamically in for loops i need to transform to a b to so to be more precise a b aac,check if values are within intervals in pyspark i have a large dataframe a with intervals like this and i have a dataframe b with sorted non overlapping closed intervals like this i want to check if values of dataframe a are contained in one of the intervals of dataframe b and if so save the id in a new column interval id my output dataframe should look like this is there a way to do this efficiently without udfs,0,72,77 datetime index in plotting doesn t work why i want to plot one month of data one data per hour the dataset is over one year why is this code not working error message typeerror cannot do slice indexing on rangeindex with these indexers of type str thanks a lot,i m trying to understand the shap values of a predictive model below please help me understand what s the o p of value explainer means o p o p array although with the summary plot i understood what is the contribution of each feature to the model please explain me what s this numbers in both the output means and array,0,51,63 rotate image by a button in pygame i have this code with which i load the image rotate png and rotate clockwise i would like to modify it by inserting two buttons one for the start and one for the stop if the stop button is not pressed the wheel must start when the start button is pressed and slow down until it stops some idea,python seaborn heatmap numpy asarray i m trying to change the way the image attached looks on display instead of displaying the float i am wanting to return a percentage i e instead of it would display would display as etc below is the section of the code that creates a label i ve tried different things but no success so far any help or suggestions are great appreciated if this isn t an easy task without some heavier code how can i trim the number to two decimal places output example,0,65,93 solidity typeerror object of type set is not json serializable i ran the code in vscode and got a typeerror object of type set is not json serializable i just start to learn to code really don t get it and googled it also didn t know what does json serializable means the full error information is below,checking multiple condition with numpy array i have a dataframe with several lines and columns and i have transformed it into a numpy array to speed up the calculations the first five columns of the dataframe looked like this these columns are now stored in a numpy array a df values i need to check whether at least two of the five columns satisfy a condition i e their value is larger than a certain threshold initially i wrote a function that performed the operation directly on the dataframe however because i have a very large amount of data and need to repeat the calculations over and over i switched to numpy to take advantage of the vectorization to check the condition i was thinking to use however i cannot figure out how to write the condition on parameters such that it returns a true of false when at least out of the parameters are larger than the threshold i thought to use the sum function on the condition on parameters but i am not sure how to write such condition edit it is important to specify that the thresholds are different for each parameter for example thr thr thr thr thr so i need to check that par thr par thr par thr,0,56,214 perceptron algorithm confusion i have this problem that i m trying to solve this is where i need to implement the function but when i try to use my formula but with my input code and run my asserts i get an operands could not be broadcast together with shapes apparently the assertions are correct so i m doing somethin wrong in my predictone function can anyone help,why is opencv gpu cuda template matching so much slower than cpu i have compiled the newest available opencv version for use with the newest cuda with fast math enabled running on a windows machine with a geforce rtx super graphics card arch i m using python runtime results images used source image needle image python code using cpu python code using gpu even if i wouldn t take the time it takes to upload the files to the gpu into consideration the matching time alone takes more than x of the whole process on the cpu my cuda is installed correctly i have run other tests where the gpu outperformed the cpu by a lot but the results for template matching are really disappointing so far why is the gpu performing so badly,0,68,138 add a new column with matching values in a list in pandas i have a dataframe such as and i would like to add a new col column where if within col i have a match with a value in the list i add in that column the matching element of the list expected result,generate in python combinations of n elements of a list taken from r in r and check for constraint satisfaction suppose we have the following list representing candidate ids i would like to generate in an affordable computational time a list containing list of tuples that are the combinations of these candidates taken by with no candidate matching any other candidate in any of the previous lists let s consider an example the first valid combination can be obtained in the simplest way so ex can be appended to the list now i would like to start generating combinations for example ex would be a valid combination since no elements are not repeated in each tuple of the list of tuples of resul so ex can be appended too another case ex couldn t be appended since and are already together in the first tuple of the first element of the list ex so as i mentioned i would like to get just elements that meet the above constraints and for this i would like to know how to generate these combinations of elements taken by and check the satisfaction of the constraints,0,54,201 getting output as character and it s occurrence in the string the input i gave is like this input abccdddeffg and the output i want is character and it s occurrence number output a b c d e f g my code thanks in advance,pip install fails in dockerfile but is possible in container i have a rpi with bit base image for now i need to use bit so armv l architecture i want to run jupyterlab on it and do some data science i am also new to docker so please guide me gently for that i created a dockerfile jupyterlab and some other packages after i created a container from the image i cannot use matplotlib and pandas it misses libjpeg and some other dependencies i couldn t install after reinstalling matplotlib and pandas i finally can import them so why i cannot write this into my dockerfile but can run it inside the container in console this in this line i get an error here is are the build logs of docker i will also provide a pip freeze of the container with matplotlib and panday additionally installed afterwards maybe this helps these are some cmds i issued to partially solve the problem thank you for the time and effort,0,37,168 how to speed up the agg of pandas groupby bins i have created different bins for each column and grouped the dataframe based on these the output of df groupby a bins b bins c bins size indicates the group length is then the statistics of each group are calculated like this,getting py jjavaerror while using apache spark big query connector i am trying to extract data from big query table by using apache spark bigquery storage connector in jupyter notebooks i need to extract this data and write into gcs bucket using some partitioning i have created a data proc cluster in gcp and running jupyter notebook in it below is my code based on scala version i am using the correct version of the spark bigquery connector jar out of below scala version gs spark lib bigquery spark bigquery latest jar scala version gs spark lib bigquery spark bigquery latest jar here the printschema works fine for the table i am looking at but for some reason df wiki pageviews is not working i dont need to do ds show as i have enabled repl eagereval the error i am getting is as below can someone please help me with whats going wrong i am using python kernel not pyspark to configure the sparksession in the notebook and include the spark bigquery connector required to use the bigquery storage api,0,45,163 pygame invalid position for blit i am trying to make a game but when i run the code the game makes enemies appear on the screen it says invalid position for blit however i don t know where to put the blit otherwise i don t know what to do because i m still learning the code was fine before adding the copies not sure why that changed anything this is the full code,how to catch the elements selected through both the conditions once page changes i m trying to scrape some urls but depending on the amount of results the page code changes both below are working but none returns me of the results i m trying to create a if of some sort that will leave no nan results and would much appreciate your help,0,72,63 how to get yesterday s date in epoch time python i can easily get the yesterday date like this how can i do the same for unix epoch time i tried this i could go now to some crazy conversions to convert str to int and so on but that really seems like complete overkill recon there s gotta be a simpler way to do this thanks,iterate through list of number in dataframes python i have a list number data frame and i want to calculate the average using python language enter image description here,0,65,29 discord py channels emojis roles etc lists into real channels emojis roles etc i have a serverinfo command and i want to put a list of all text channels voice channels roles and emojis i tried with ctx guild textchannels voicechannels roles emojis but it returns a list i want to have actual discord channels roles and emotes i tried with maps and it didn t work,how to aggregate counts in sections of a fixed number of hours i have a sequence of pairs the first element in each pair is a string representing a datetime and the second a number i would like to split up the dates into consecutive periods of x hours and sum the corresponding numbers in each hour if x i can do this with at the end hour total is a dict with the sum of the numbers for each hour how can i extend this to work for arbitrary positive values of x a very small example covering just a few hours if x the output is,0,60,111 can not get text with selenium from web browser alert pop up some website may ask me different questions with pop up alerts i can catch them with selenium python but can not see their text i tried and and i do always avoid noalertpresentexception i can do in any way but i never can get an alert object text it is always empty why what am i doing wrong how can i get the text of an alert actually it is confirm box,json to custom objekt in python so i got a problem that i don t know how to solve i want to load objects from json files and convert them into a specific object in python for example i got some json like this and some python code like this how can i turn this in the easiest way possible in the class it belongs to i already found some solutions online but they would require a custom encoder for each class but i want something like one function which creates all objects,0,79,92 how to download all the href pdf inside a class with python beautiful soup i have around pages and each page contains buttons each button has pdf i want to download all the pdf s the program should browse to all the pages and download the pdfs one by one code only searching for pdf but my href does not have pdf page no to this is the website and below is the link,how do i analyze this code for time and space complexity ideas for removing those,0,77,15 how to sum a column of a pandas dataframe and keep only the result of the sum as the value of the column there is a dataframe the final result i would like to get is i use the method it doesn t achieve the results i want what method should i use to achieve my goal,how to get dataframe name from list for newt use in forloop can you please help me with this code i tried to create function to loop through dataframes used in current file listed in list of dfs the code gives me an error return error attributeerror nonetype object has no attribute to excel thank you,0,58,54 valueerror input of layer sequential is incompatible with the layer expected shape none found shape none hi i have the following error i don t know how fix the next error the error happens only in the last part when i want to predict the next day my full code is this,for loop not loading all images in pygame and can t blit them onto screen i m trying to make a blackjack game and i m having trouble loading the images for the cards in the for loop the way that i have named the images is like d png is the image for the card of diamonds and qd png is the image for the queen of diamonds etc my issue is that only the last card types and numbers are being loaded in when i check the length of the cards list it returns only instead of the cards that will be used additionally for the cards that i have loaded i wish for the computer to deal out these cards at random i m using a button module i found online to detect when a button has been clicked so what i m trying to do is allow the player to click on the hit button and be given a card however the card only appears on screen for half a second then disappears,0,55,172 django model importerror attempted relative import with no known parent package i m making a small django app and i just want to make some tests over the queryset of my model however when running code outside the manage py runserver environment i get this error error as already said this works perfectly when making views i can import my article model and create articles from the admin dashboard my app structure looks like this,best way to concat merge list of pandas dataframes into one while preserving all values in a given column i have a list of pandas dataframes as below and would like to concat merge them so that the values in the shared column are exhaustive between all of the dataframes what is the best approach df df df desired outcome,0,74,61 correct way of getting all functions of a module i am trying a get function of a module but when trying with inspect i am getting false value kindy suggest the proper way of doing this expected is the i should be able to get the fuction name which is directly callable here i am able to get the function name but why inspection is throwing false output,pyrogram get all members in a channel with more than members i have a channel with more than members and i m trying to get all of them i know that iter chat members has the limit of members so i m calling get chat members multiple times by increasing the offset like this however i continue to get only the first members when members offset is greater or equal to i get zero members from get chat members is there a way to get all members from a channel with more than members using multiple calls thanks,0,68,96 django double join with multiple models i ve spent quite some time on it and still haven t been able to figure out how to join these tables with django i have a movie database with following models in my postgresql i can pair moviename with genretitle using following query i then get something like this how can i achieve the same output with django views,pandas filtering based on different columns conditions so lets say i have the following dataframe which gives what i want to do it pretty simple i want to filter get rows and get rows where name rachel and job chef expected result set note that the last entry is removed what i have tried so far is this filters other rows where name rachel or job chef i only want to filter the last row where name rachel and in the same row the job chef any help is appreciated thanks,0,64,97 vscode not output dataframe with html format currently i m having problems with when viewing dataframe on vscode i cannot see the dataframe format as on jupyter notebook my dataframe is displayed as follows output exceeds the size limit open the full output data in a text editor i tried the methods this view update i fixed editor accessibilitysupport off in settings json,pydantic initialize numpy ndarray how can i initialize a ndarray when using pydantic this code throws a valueerror the truth value of an array with more than one element is ambiguous use a any or a all,0,61,35 django app incorrect datetime during deployment i have a django model with a datetime field like this locally on my machine this control is created with the local date and time when the application is deployed the field is not created with local time i tried to do this it does not work how to solve this problem i am in central africa,how to drop categorical columns in pandas dataframe i have a df where there are columns in total and categorical columns i want to make a loop to check which are numerical columns if they are not numeric i want to drop it i have made the below loop but this is dropping only one of the categotcal columns and the rest remain as is can you please tell me what i have done wrong and how i can improve my solution thank you,0,64,86 python pygame typeerror can only concatenate list not float to list my son is busy with the coding of pong in python bit with pygame here is the feedback from the terminal here is his code any assistance with regards to how to fix this problem and get the game to work will be appreciated,remove feminine ending in german using regex python in german language feminine endings are innen in innen in innen in innen i want to remove them from the strings that are in list i have come up with the following but it doesn t work because there is a space in front of words like softwareentwicklerinnen how can i correctly do it with regex important is i want to keep format of the string as it is just need to remove feminine ending or i want to return corrected list of strings,0,56,85 how to add a header to an existing csv file without replacing the first row what i want to do is actually as it is written in the title i want to enumerate the columns which initially doesn t have any column names but when i run the code it replaces the data in the first row for example example csv what i want what happens after running the code is there a way to prevent this from happening,selecting from d numpy array with a corresponding d array containing indices of the th dimension i have a d numpy array containing values and would like to obtain a subarray with one less dimension where the values have been selected based on a d array that contains indices of the forth dimension of the first array e g i have the following arrays i found one solution but find it rather complicated and would prefer a one liner is there any better solution to get this array,0,77,86 how to send scrapy command line argument to scrapyd client i want to schedule a spider from scrapyd client by giving the command line arguments as well e g scrapy crawl spider name a person john a location porto o local csv above command works well when running spider directly from scrapy but it does not work when running it from rest api using scrapyd client basically the question is how to send scrapy s command line arguments like a o in scrapyd client,my custom heapify method not working properly in python i am learning data structures and my code is not working properly i tried dubugging and couldn t found anything seems like heapifyinsert is not doing anything here is my code current output expected output so here in the above code i tried to implement heap starting with index position for the sake of simplicity and in heapifyinsert method we are taking parentindex and checking if the value at parent index is greater or less according to heap type and swapping the values any help or clue will be appreciated thanks,0,74,96 replace all occurrences in a string by another string i have this string i m trying to replace all p n x by x n for example would return,how to write a txt file from python gui i am currently trying to make a simple gui which asks a user his age and name the names then get stored in a txt file but the gui is working fine but the names are not getting stored in a txt file i am getting this error exception in tkinter callback traceback most recent call last file c python lib tkinter init py line in call return self func args file c users sumit vs code python projects tkinter course tut py line in getvals f write f uservalue get valueerror i o operation on closed file the code which i am trying to run is as follows,0,25,102 how to check if key value already exist in json so this is my config json and this is my code i want to check if name a already exist or not if already exist it gonna cancel the input if not exist write json will run it func,is there a way to open an image as bytes and return it to a jpg file the new image i get is exactly the same if i open it in notepad but the new image is corrupted and can t be open for some reason,0,47,45 rock paper scissors python while loop i have been trying to make this rock paper scissors game loop all day but each time i put the code in a while loop it keeps giving errors so how do i loop through the game without any issues ps i just started learning python,csv reader reports values out of range i am attempting to convert a csv file into a python data dictionary here my code here are what initial rows of the csv file look like this works but when i include rows and it give me this error tried to troubleshoot but unclear why there is an error,0,53,58 django rest framework trying to get similar products with serializer reversed i m new to drf and im trying to serialize similar product on product heres my code models py serializers py in serializers i have written this type of code which dont works code and heres my productlistserializer i want to get similar products of product but it dont works any ideas how to solve,pandas groupby plotting two lines for each group on one plot i ve been struggling to plot the results of the groupby on three columns i have the data on the different absences absencetype of employees employee over years monthyear i would like to plot in one plot how many absences of a particular type an employee had in each month year i have only two employees in the example but there are more in the data as well as more month year values create data then i map each of the codes of the absencetype into two categories sick or injury what i want to achieve is the following groupby but when i try to plot it it does not fully show what i want so far i managed to get to the stage test plot however employee s id are shown on the x axis and not in the legend what i want to have is something like this desired plot i would like to have time on the x axis and the count for each absence type sick or injury on the y axis there should be two different types of lines e g solid and dashed for each absence type and different colors for each employee e g black and red,0,64,210 pandas shift values from one column to other and drop duplicates using python suppose i am getting a dataframe like this how do get a dataframe such that i will be left with this output this is how i am getting my dataframe how do i shift the numbers from name column to value column please help,multiply only positive values within a column by any values greater than should be multiplied by example dataset expected outcome for col would look like this not sure how to tackle this one if anyone can provide coding or guidance using python pandas,0,57,45 how do i create an alternative constructor using a class method the following code should generate an employee instance from an employee string but doesn t seem to work the instance is not created how do i make it work,selenium succeeding python requests library failing despite same url and same request headers what s the difference when i run that code i get the headers selenium uses i copy these exact headers into a python dict and request as follows when i run this it just hangs indefinitely so there is some issue with the request apart from the headers what is the difference between the requests made by python and selenium how could i identify the issue and hopefully get this working with the python requests library update i updated the code to get the request headers instead but the python requests script has the same result when using these headers just hanging or timing out if i set a timeout parameter further update debug output is as follows,0,39,132 how to take user inputs and store them in a variable in python i need to take user inputs and turn them into a list and further into variables i have a starting command which i can ignore by splitting the message with but the outcome is input input and i need the whole thing to be seperated like input input so i can take the inputs with indexing and further work with them,it is not printing from child class there is super class with the name employee has the following fields empnum name address and dob there are two child class or sub class of employee class they are fulltimeemployee and parttimeemployee fulltimeemployee has monthlysalary other than the fields in super class partitime employee has hourlyrate other than the fields in super class here is a code that i have written in python however when i print it is only printing the fields in the superclass may i know which part im doing wrong,0,78,92 start anaconda from specific env having trouble to start ananconda from particular env i use zsh shell on macos monterey,python inner class inheritence i m trying to define my config py using class in python such that every class will have some static members that will be read for my configuration settings i m using inner classes and using inheritence among them here is an example of what i m trying to do i m getting the error when i m setting var in class mode it says default configs is not defined as if it is treating default configs as a member variable so what am i doing wrong and how can i get this to work also mode var and mode var have values as expected i tried using parent reference as well like prod default configs var but that did not work either i also tried accessing var directly as if inherited it should be usable but i was wrong again,0,20,131 discord member scraper this script scrapes all members ids in a server and then saves the ids in ids json i want to make it save the ids after scraping a specific number of member ids so for example i want it to scrape only user ids and then it saves it or make it only scrape online users ids what should i do,how can i convert instance to dictionary with model method and relationship below is the implementation of model class customer i want to convert the django model class instance to a dictionary somewhat like thanks,0,64,36 multiple instances of unique variables in dataframe column i m working with a pandas dataframe and have a column of dependant variables called class which consists of three classes y n and p however when i run i get i opened up the dataset in excel and tried using the filter to see how many unique variables were in the column excel says there are only the dataset is available here if it s of any benefit,saving multiple pil created images with a loop funtion i want to create multiple random images with pil using a loop function and i want to save them with their respective indices e g image jpg image jpg image jpg etc when i run the code all images are created on one platform and saved in one file where is the problem thanks,0,78,58 how to group data returned from sql and convert in json i have the following data coming from sql result and i have to make a json structure like i know there are multiple ways to do it like involving dicts and list or itertools but unable to figure out a cleaner way to do it because data is variable and it d keep coming from the db,is there a module to convert a tensorflow nn to jax there is a libary to convert jax functions to tensorflow functions is there a similar library to convert tensorflow functions to jax functions,0,67,34 invalid literal for int with base in my views after it worked a while i m keep getting this error invalid literal for int with base from the views in my django project after it worked for a while here is my views py looks like and here all the message models py please help me i m beginner in django,django filter column with or statement i found a question very similar to this one but that one did not specify how to return a specific column and i have been trying combinations for the past few hours with no luck this does not throw me any errors but it does not return anything i am attempting to return that specific column from my models filtering on away team or home team equal to chicago here is the model i am attempting to pull from,0,59,85 python face recognition library import error i wanted to try the face regognition package in python but i get this error and couldn t find a working solution online i im using m mac by the way importerror dlopen opt homebrew lib python site packages dlib pybind cpython darwin so x symbol not found in flat namespace png do expand palette rgb neon anyone has a solution for this,how do i determine if a given p x y point is located within the boundaries of an array below was my attempt i couldn t print out the accurate key if the point is within a part boundary the algorithm should return the part number otherwise the algorithm should return,0,49,49 print pandas series vertically aligned when printed with another string i have a pandas series which should be printed with a string the result of the following code does not look pretty result what i want would it be possible with a simple code may be a possible solution but not perfectly what i want,code for iteratively adding new columns in sql server table i have a list of columns to add into a sql server db i have a table called tabby and want to add these columns to it i tried but i got error programmingerror microsoft odbc driver for sql server sql server incorrect syntax near sqlexecdirectw microsoft odbc driver for sql server sql server statement s could not be prepared,0,55,71 is there a way to override busday count method in numpy i want to override np busday count to include custom off days how do i do it,how to convert to logarithmic scale and back the one using math e at least approximates the answer but the one using is just wrong further context i have to work with numbers between and,0,25,37 trying to automate to click on search button in selenium python module but it is not working i need help to automate to click the search button in this webpage the code works so far until i reach the search button below are the elements for this button the value named search is unique for this button below is the code,valueerror with groupby wrong number of items passed i get this error when i try to run this line i m trying to figure out the total weekly hours each person has worked with the daily hours i m provided with to do this i ve created a dictionary to refer to my current issue is that without using groupby to get weekly hours it ll subtract the minimum contract hours with the daily hours and return the wrong sum for example if a person has worked hours on days and they re a full time employee it ll do rather than take their weekly total hours to understand how many hours i need to add based on their contracted minimum hours the np where also won t work as it takes weekly hours to be the daily hours so the condition will always be true and replace the hours with their contract hours for each day i ve also tried changing the dataframe and filtering it through that w df groupby id contract hours as index false hours sum but it doesn t work i had to add as index false otherwise i d get a keyerror contract hours error initially i d get an indexerror before i added the as index false shown in this question indexerror when i added another groupby with pandas i apologise for repeating the question so many times with different errors but every time i make amends to the code it comes up with a different error and i ve tried different ways around it sample data expectations,0,61,249 how to pass a variable as an argument of another function in python i have a list chart list and i want to call them one by one and plot the chart but i face an error how can i deal with this problem i know that they are strings but i don t know how to give it to the tickerdf,pandas read sql query with comprehension in params i m trying to do a sql query with pandas i have params initial date final date and trader where trader is a list my query looks like this in my params i m trying to do some like this but i have been receiving this in my ide visual studio code can someone help me to fix this,0,60,65 data frame with hidden column values the data frame consists of column value which has some hidden characters when i write the data frame to postgresql i get the below error valueerror a string literal cannot contain nul x characters i some how found the cause of error refer table below missing column value requirement i want to replace that empty area with text miss i tried different method in pandas i m not able to do,duplicate analysis using conditions i am trying to do some analysis of the duplicates prior to drop all of them and keep the first or the last result i want to check the quality of the duplicates in order to keep one or remove both value i want to put some conditions if pic of the duplicates have a difference lower than in the pic column i want to keep one and the the value as a mean if it is higher than that drop both rows i am getting the following error i would need to iterate to do this analysis in the whole df thanks for the help,0,76,111 python pandas pandas correlation one column vs all i m trying to get the correlation between a single column and the rest of the numerical columns of the dataframe but i m stuck i m trying with this but i get the error operands could not be broadcast together with shapes which i assume is because i m trying to find a correlation between a vector my imdb score column with the dataframe of several columns how can this be fixed,i am getting error while installing web module in my django project i am getting this error when i am trying to install web in my django project cant understand whats wrong if anybody knows please help i am installing it in my virtual environment meta c users saran onedrive desktop interview crypto core,0,76,47 i get this error expected d array got d array instead use this code and i get this error expected d array got d array instead when i want to use it with parameters of an excel table if someone can help me i thank you in advance i use all those libraries and functions for the rest of the work,take subset from dataframe based on multiple str patterns i have a pandas dataframe df from df i want to take a subset if either flsa w gk or flsa w fcm is contained in the df model for only one string i would do it as follows the approach below works but seems too lengthy is there a way to do this using fewer lines of code,0,62,63 how to aggregate on nested embedded object in mongodb how can i show only those headers whose active value is false,selenium next pages with javascript throwing elementclickinterceptedexception error my code is working fine but the pagination portion throwing the following exception your help is much appreciate script,0,21,27 convert a groupby object with no aggregation function into a dataframe while keeping the grouping say i have the following dataframe df is there a way to get the grouped data as a dataframe e g edit using set index does not seem to work since it does not group the second columns specified e g country as noted it is not grouped for each country as required,struggles with converting a dbf file to pandas dataframe i m attempting to work with the canadian radio station dbf files made public here i d like to read specifically the fmstatio dbf file into a pandas dataframe i ve tried the two commonly recommended dbf packages in python when using simpledbf i only get the column names when using the dbf to dataframe function i also tried dbf on pypi i m able to read the dbf file into a table and get the following information on the table but when trying to convert into a dataframe i am unsuccessful error i receive might anyone have insight as to the best way to go about working with this kind of dbf file in pandas many thanks in advance,0,65,125 numba is not enhancing the performance i am testing numba performance on some function that takes a numpy array and compare the output is how can i obtain an enhance version of this example,wazirx api wrapper library i am new to using apis and was trying to build a trading bot in python using wazirx exchange s rest api i am unable to understand how to make api calls using their documentation also is this an example of a good api documentation or of a bad one can anyone point to any python wrapper libraries through which i can execute trades using an api key and secret i tried searching a lot but couldn t find any github repository using their api to execute trades i have seen some using the public endpoints only any help would be appreciated,0,35,104 atr trailing stop loss indicator in tradingview i was going through below pinescript code of atr trailing stop loss indicator and was trying to code it in python i m facing difficulty understanding below lines value h gives you the highest value highest high mult atr atr hhv on next line barsince function is giving the count of bars candles when conditions were met what does the complete statement h barssince signifies i mean what value will be stored in prev also what cum function does,tensorflow failedpreconditionerror could not find variable dense bias this could mean that the variable has been deleted i am trying to perform a learning model with openai gym tensorflow and keras i build my model with this method after i build my agent when i call training i get this error that is that the session is not initialized or there is no dense bias variable who can help me solve the problem,0,78,70 if else condition display images in python i have to display different images for this riddle in python code but images are not getting displayed in python jupyter notebook it keeps on processing and no error is displayed can someone guide me how to display different images in if else condition while taking input from user code,python pip install is working only for bit and not bit i was doing a project in python and saw that import ipy was not working in bit python idle when i tried to do it in bit python idle it worked i installed ipy using pip install ipy in cmd this was my python bit idle console input and output i am using windows and python in both bit and bit,0,59,76 saving rabbit mq messages into azure storage using python im using below code to receive rabbit mq messages the message format is json i want to save the incoming messages into a file in specified path could someone please let me know how to achieve this thank you,remove paratheses with text inside from dataframe how do you remove text in paratheses paratheses included from a df column for example should be,0,48,24 music getelementsbyclass the code snippet is from a popular coursera course the error thrown is and when using this the error thrown is can you guide how to debug this,how to convert a pandas series to a numpy array with number of index inside i have a pandas series like following now i want to get a numpy array output like how can i do it without a for loop,0,30,41 sort columns names only not rows in python hi i have df input which needs to be sorted for only column names not by rows restructuring the dataframe my required output column names should be sorted after n columns here after columns my input dataframe is as follows required output dataframe thanks in advance,why the the total number in confusion matrix not same as the data input why the total confusion matrix does not have the same number os samples as the dataset the dataset contains but the total at confusion matrix not exceed here is the code,0,52,47 loop of list into a tabbed new list i am a high school student by observing the inputted sequence i want to create a program that creates general formulas on quadratic to a polynomial with nth power equations this posted code will function as a means of validation for inputted sequences if you have a better code please help me thank you the same concept was shown below here is my code,selenium python how to find span number between two values html sample div class lend count span span div div class lend count span span div div class lend count span span div div class lend count span span div div class lend count span span div div class lend count span span div div class lend count span span div div class lend count span span div div class lend count span span div in selenium chrome webdriver i am trying to find the first span that is between range of numbers in this case then click it if nothing on this page throw nosuchelementexception click the next page button and loop back try again tried to use range as well please advise,0,72,98 how to fix pip is configured with locations that require tls ssl however the ssl module in python is not available when installing tensorflow i was trying to install tensorflow with anaconda i ran the command and there was an error saying i have tried adding anaconda anaconda scripts and anaconda library bin to the path variable i have also tried running the command but nothing seems to be working did i miss anything and are there any other solution,split input data and have one array output i would like to split an input data to an numpy array but i got a separated elements in array not as one array with all elements as the following,0,77,39 data parsing in block units using list input expected output result result code i have an input file which has blocks of information based on a double slash i want to extract only blocks containing homo sapiens from among several blocks when i tried to parse the data with my code i got an issue like result is there a way i can do with my code,how to fix error no module named builtin in python i am trying to convert matlab file to python so i found a library called smop whenever i run a code that imports smop library i get an error here is how i am importing smop this is the error message i am getting python site packages smop b py egg smop libsmop py line in modulenotfounderror no module named builtin how can i fix this error,0,67,69 writing a dict comprehension in loops can anyone help me make this dict comprehension into loop and such so i can understand it better we have not done dict comprehension in school yet and its all a bit confusing thanks for the help print team scores these are the dictionaries in case anyone need them,is there a way to update dict values with array values i m currently working with the following code which would result in a list like below for example what i m trying to figure out is is there a way to take the values from the list and input into a dict for a more user friendly way example of dict below i have attempted to try to do the update dict function but i keep getting errors that it s not valid form of update dict i don t want to append the list as the dict value above already has keys that i would want is there a function that would be able to update the dict values from a list what i want the end result to be is the following is this possible to do i m new to python and just trying to get my hands wet with trying to create different types of programs answer thanks to the comment below which when ran the below is the result,0,53,170 a way to blit multiple buttons from a list with working alpha and color i wanted to blit several button choices depending on the number that a list gives but putting them in a for loop makes the alpha and fill function stop working is there a way to fix this or there s a better alternative to code multiple buttons starting code button and scene class the rest of the code,i am receiving this error when i run my flask app i have even installed wheel then flask bcrypt how do i resolve the following modulenotfounderror this is my init py file i am trying to hash user passwords in my other file using bcrypt following code is init py then the snippet of the code invoking bcrypt this is the error reviewed after thanks in advance,0,71,65 how can i remove none in myresult how can i delete none in the middle of output code a result i want to get from output output,how to find value at specific index in an array in a dataframe i have a dataframe with columns sri and sai each row represents a different location and these columns contain arrays of sri and sai for each location i want to find the index of the maximum value of sai and then find the corresponding value of sri for that index w here is a screenshot of my dataframe called avgt i m able to find the index of the max value of sai for each location row with the following loop but can t find the corresponding value at the same index in sri i get the error indexerror index out of bounds i think what i have written is finding the value at the index of sri rather than the index of each array within sri how can i fix this so that it finds the index of each array within sri for each location,0,27,157 how to remove edit element in xml file using python i have below xml file i want to remove path and also want to edit source source so it looks like below to remove the path i used below code it runs fine but not able to remove path what changes i should do to remove the path and modify source please help thanks,how to get only the last folder and filename of a path how can i get the last folder and the filename of a path in python i am doing is there a simpler way,0,63,35 using discord py to send a message everyday at a specified time i m trying to make a discord bot that will send a message at a channel at a given time i found previous codes but they don t seem to work for me since they give indention errors i m not an experienced programmer and any answer would be very helpful,django orm and condition for same key with multiple options ihave a model webdocuments with multiple objects of different document type and i want to apply and condition i want to return true or false wheather both document type exist of not i have both document type in my db still it returning empty because it filtering both type on save object is there is any way to do it with and operator or i have to loop queryset with all doc types here is my model,0,59,88 resampling with origin end day i don t understand what origin end day does the docs give the following example the docs explain origin end day like this end day origin is the ceiling midnight of the last day so as far as i understand the line should be equivalent to however passing the timestamp ts index max ceil d produces a different result i m looking for an explanation for this discrepancy and maybe a better general description of the end day argument than the docs provide edit i m using pandas,in the tkinter environment display the entered level n and the starting line a xa ya b xb yb i am having a problem solving this problem i need to create a connection between the l label coordinates n and for loop it s marked in code with n counter so when i select in tkinter window from to and on the click of the button display to show a right image of von koch snowflake and a custom starting line a xa ya and b xb yb in python,0,79,88 multi threading python i m trying to optimize a script that connects to some routers based on a list that i provide with ips however it s taking a quite long time to finish the configuration once starts the configuration once when it finishes the previous router my question is would be possible to create a function that doesn t need to wait for it maybe a multithreading function that can configure a few elements simultaneously thanks for any help here,modulenotfounderror no module named sktime transformers i tried importing when i run this i encounter this error,0,79,17 what is the equivalent of side effect for a property mock in unit test i want to mock a property to return different values in order like when you use side effect on a magic mock right now i m doing this any idea how to mock it properly,comparing columns of current row and previous row in the same csv file so if someone has asked this question before i am sorry ahead of time but i could not find an answer i have a data frame that looks like this it is the output of a previous part of the code that writes to a file i have been trying to find a way to write a script to check to see if a resid goes from bottom to top or the opposite and if it does to create a dictionary counting how many times it switches from bottom to top its important to only check the iterations of that particular resid to see if it goes from bottom to top as that next resid corresponds to a different ion which may not switch at all each frame here corresponds to a different time frame of the same atom resid and i am wanting to check if this atom goes from top to bottom over time i will eventually plot the dictionary values but am struggling to get the dictonary i have tried just indexing off of the reader but that did not work so then i tried to use iloc to index the file but this also did not work how would i go about comparing the location between a current row and a previous row if the resid is the same thanks in advance,0,47,239 read csv how to use no delimeter because there s only one column of data my data is a collection of tweets which have quotations commas and characters of every type and they re all separated by newlines that is the only information in the dataset outside of just setting the delimiter to be some character not in the dataset via pd read csv filename csv delimeter r someobscurecharacter how do i import this dataset as a dataframe or series using pandas,custom function for annotate i am trying to extract records with my django orm model the model is represented by goal my goal is to process user level in the query in order to transform those ids in text i have a dict key value with those ids for that i was thinking of writing a function custom level to process the pairing job i am using annotate but i am not really sure of its correct use how would you process the pairing between ids and text in order to get a single text line any clue thank you,0,72,97 getting a wrong result calculating the rsi with tulipy im getting the candles closed price from coinapi the rsi i get is always different as the one i see on tradingview does anyone know why it is different i also tried ta lib but it s more difficult to use thank you,keras lstm dimension value errors i have a problem about dimensions of lstm i have a matrix as input i want to get an output matrix sized but i got this error what is the problem or how can i solve it i tried also different input shapes but i couldn t solve this problem,0,51,59 locally save a dataframe from a remote server in vscode i m running a python script in vscode on a remote server and i want to save a dataframe that is generated in that script locally is this somehow possible thanks,haltserver app failed to load when deploying to google cloud i already tried a couple things i m not able to deploy my python api to google cloud and i don t know exactly what i need to change to get it working my project my app yml my app py tried a couple things now including renaming the app py to main py and changing the app yml accordingly with main app at the end but it all does not work so far this is my latest error in an earlier instance i received a wonder how i could solve this thanks very much for having a look,0,40,102 async check of several hundred proxies i need to check several hundred proxy servers and get the number of not working script for this proxies in the list i have given a simple version it takes seconds to check working proxies i can t wait that long need to increase the execution speed how can this be done using async,how to go back to a list of choices so i m new to python just wanted to know is it possible to use something like goto in c i make a choice like this after him choosing the choice and getting what he chose how do i make him get back to be able to choose from all of the choices again thanks pretty new to python and just learning how to make a basic cmd app,0,61,79 django view with slug and id i have this url and this view now i wanna show on that page category view html only the products that have particular slug and pk lets say kategorie cat cat is the category slug and the category pk is and i only wanna show the products that have this category and this pk btw yes product is connected with ecommerce via m m,python cannot import functions of file git externals project i want to use git externals from here but python complains when using the git externals add url to git repo shell command that it can t import a function from file cli py of the file git externals py file anaconda lib python site packages git externals cli py line in cli from git externals import is git repo externals json path externals root path importerror cannot import name is git repo from git externals anaconda lib python site packages git externals init py how it is imported you can see here the files are in the same directory i also tried to import git externals with print git externals file to see what file was imported it is not the expected git externals py but anaconda lib python site packages git externals init py why is python looking after the init how can i change this or is it the right behaviour regards,0,65,116 empty requests in seleniumwire python i m using selenium wire to scrape requests headers in ubuntu and using firefox driver but driver requests is empty what s the problem with me and result is is there something wrong with ubuntu settings or firefox settings or my code,h py driver issue on qiskit nature drivers while using the ibm quantum experience whenever i want to install any driver an error with the h py appears specifically the error is using default file mode other than r is no longer supported pass the mode to h py file instead does anyone have any solutions to it not sure which version to revert back to thanks,0,44,61 selenium set preferences to download excel file but dialog box pops up i am trying to download a excel file using selenium firefox when i use this function in a script the dialog box to save the file pops up i am on ubuntu i assume the mime type is wrong i have added all i could think of and search for the file in question shows up as a excel spreadsheet,replacing a value with actual if condition with dataframe in python i need help with implementing actual if conditions with dataframe i know the replace and where functions but unfortunately i am not directly able to use them basically i want to change value of a column based on whether a folder exists with a uid if the folder exists in related directory i want to place yes if not i want to place no for example if d data folder exists then folder value of the uid should be yes else it should be no how can i do that,0,72,99 can anyone tell me how to fix this error nomodulenaned pyttsx drivers sapi full error here down so here i imported pyttsx and wanted my ai to speak but it gave me a error full error here,python typeerror int object is not subscriptable currently i am improving my python using tasks on codility and ran into a problem while completing the maxcounter exercise this exercise gives an integer n and a list a where n is within the range and each element of array a is an integer within the range n n represents n counters all beginning at and each element in a represents an operation on the list of counters if a i n then the a i th counter is incremented such that if a i then the th counter is incremented if a i n then all of the counters are set the value of the current maximum after all actions are completed return the list of counters my code is as follows on the line counters i i am receiving the error file tmp solution py line in solution counters i typeerror int object is not subscriptable i am not sure why i am getting this error as i am not calling an integer as a list any insights would be greatly appreciated,0,36,190 split a csv file in appropriate columns i m trying to analyse data from a csv file in python but i get the data as you can see in the image below could you help me to figure out how can i split the data in appropriate columns thank you in advance,project euler names scores python i m struggling to find the logical error in my code so i m kindly asking you to help me find the problem using names txt right click and save link target as a k text file containing over five thousand first names begin by sorting it into alphabetical order then working out the alphabetical value for each name multiply this value by its alphabetical position in the list to obtain a name score for example when the list is sorted into alphabetical order colin which is worth is the th name in the list so colin would obtain a score of what is the total of all the name scores in the file thank all of you for pointing out to the part overlooked by me already edited the answer it gives me is whereas the correct answer is,0,50,160 can t order data frame by index pandas df value counts i have data frame with a month column whose count i m trying to calculate using the following method this method returns i want to use the tolist method on this dataframe but want to order it and can t figure out how to order the dataframe by month that is etc any help would be much appreciated,take all value between punctuation containing a word from a same cells python sql i would like take from the same cell with this design i try to take all value between who have the value p for an other columns i tried with regex replace regexp replace column name concat ws p but it s not working i m not enough good and after many hours to find a solution i ask you to help me lol thank you for your support,0,69,82 what s the definition of image size in opencv what s the size i thought img size img width img width but obviously wrong check this example so what s the definition of it,select sets to create a complete list i want to create a complete list with given sets i have several sets in my solution like the goal is to select sets to create a list with all numbers from to if it is not possible create maximum coverage for example above is an example i need to write an algorithm to find the best sets because i will have at least different sets could you help to find a solution thanks,0,30,84 python create file from list add empty line to the end i have to create the cvs file from the list here is the code i can understand n breaks the line but when i open the file i see last line is empty this is how content looks like is there any way i can remove last empty line found the way to fix this but wanted to check if this is the right way,how to use canny correctly i have an image with a resolution of x i am applying the canny operator to it but the result i am getting doesnt suit me i want all the edges to stand out however when i apply this algorithm to images of lower resolution everything works correctly how can i solve the problem original image result,0,76,62 perceptron algorithm confusion i have this problem that i m trying to solve this is where i need to implement the function but when i try to use my formula but with my input code and run my asserts i get an operands could not be broadcast together with shapes apparently the assertions are correct so i m doing somethin wrong in my predictone function can anyone help,return specific values from an array i have an array like this i want to return only the values into a new array group by the values in final outcome any ideas,0,68,34 how to import random seed in cycle to obtain the same result in anytime i need to get the same results in any iteration i tried to use random seed in my script but it doesn t work how can i fix it my script in this script i got several random tables whole table from one subsample,is it correct in scrapy to have multiple parse methods in one spider is it correct in scrapy to have multiple parse methods in one spider something looking like,0,55,30 can t we iterate over integer using map in python here in line ans list map int num it s returning int object is not iterable can t we just change int number to list using map,python how to reference two string variables and insert a list element in between how can i append the string constructed to a list here is a txt file semi colon signifies start of file here is the code i have now the goal is to write the first line of middlephrase txt to a new txt file named newphrasefile txt then append the following two lines in middlephrase txt to the newphrasefile txt this is the desired output a new txt file being written with content,0,33,85 writing to config py file from another python script i ve created a python script that reads from a config py file using import config to inform it s output config py script py i need current brightness to be permanently incremented in config py after running the script so that subsequent script runs will import the newly updated value instead of it always being in other words how do i write to a config py file like i would any other standard config format like config ini,unable to create logfile minute wise in python while using multiprocessing unable to create logfile minute wise in python while using multiprocessing,0,79,22 how do i reset the underscore in an interactive session i have overriden the underscore variable in the python interactive interpreter how can i make the underscore work again without restarting the interpreter,to generate a list allowing duplicates and fitting a condition from choices i want to output all possible combinations allowing duplicates in the choices in a list of elements in each of the lists there must be at least one of at least one of and at least one of a clumsy way as below it firstly generates a list of using either in all generated lists are examined to have at least each of the qualified ones are put into a big list then the duplicates in the big list are removed loop it many times to make sure good coverage considering the sequence matters that is and are two different lists what would be the smarter and more comprehensive way to do so thank you,0,34,137 pyyaml how to set a default representer for non standard objects is it possible to specify a default pyyaml representer for non standard python objects how to instruct pyyaml to use a default representer for all non standard objects for instance i would like to invoke an object s str or repr method iff it cannot be represented safely,from summarizer import summarizer it s not running in colab i m trying to use the bert text summarizer inside colab but i m getting the following error i am getting the error as below,0,55,32 how to efficiently subset from a cell pandas i have a following problem in a column agent string is a long string like this i need to create a new column typ browser where will be the last word of agent string or chrome if the word chrome is in agent string i came up with this solution which is unfortunately very slow because i have rows is there something faster,weird vector movement in pygame for some reason the movement of my sprite is only diagonally up and left when pressing a diagonally down and right when pressing d and w s just don t work despite the correct vectors being given to move in any direction here s where the inputs are handled and here is the relevant sprite code i can provide the whole program but it s a little over lines so let me know if it s needed,0,68,78 how can i test aws cognito protected apis in python i m trying to test out some aws apis that are protected by cognito i found the first part on how to get the json token but i can t figure out how to use the token correctly so i can authenticate on the api here s my code i m getting the following error message,getting days difference from dates in same column in a groupby in pandas i have a pandas dataframe like this in the code columns the values are always form a specified list here n n n etc i want a dataframe that displays the days it takes to progress from code n x to the next one in sequence for each user i am thinking something like this your help will be much appreciated,0,64,71 compatibility of datetime with cudf and pandas for filter datetime in python i want to test cudf but stuck with a first simple task of filtering by datetime code works perfect with pandas but not with cudf testdata csv looks like with cudf throws keyerror datetime,why does my ide keep saying that my variable can be undefined i am writing a program to calculate the sum of the first n natural numbers but i am having a hard time coding the first part of the program in which i ask for the input from the user about how many successive natural numbers to add it s a very long code for such a simple task because i want the program to be able to ask to try again in case the input isn t a natural number accept mathematical expressions that are equal to a natural number e g to get back to the point why does my ide keep telling me that n can be undefined and if you d be willing to take the time to tell me how to shorten my code that seems a little repetitive i d really appreciate it thank you for your time,0,45,153 how to check if xgboost uses the gpu i m writing a pytest file to check if my machine learning libraries use the gpu for tensorflow i can check this with tf config list physical devices for xgboost i ve so far checked it by looking at gpu utilization nvdidia smi while running my software but how can i check this in a simple test something similar to the test i have for tensorflow would do,get slice indices from mask python i have an n array of floats arr but i only care about the entries that are a given threshold i can obtain a mask like this now i want an n array of the corresponding slice indices for example if arr and threshold then mask false false true true true false true true false true and i want the indices which i can use as arr arr arr to obtain the segments where arr threshold currently i have an ugly for loop solution that follows each stretch of true before appending the corresponding slice indices to a list is there a more concise and readable way to achieve this result,0,69,141 retrieve dataset from a dictionary i have a function that splits a dataset in a non iid setting this function returns a dict of the labels for example if i apply this function to a dataset i obtain this now starting from this dictionary i want to obtain the original dataset split as stated by the dictionary for example dataset will have the samples and so on dataset will have and so on,colab unable to access webpage using flask ngrok i m trying to run flask application on colab but i keep seeing the following when i go to the tunneled page code,0,76,29 shorten if elif elif else i have a program and one function is to sell an item that the user owns it prompts the user to input the name id and amount and it sells but there are a lot of items the user can own so there are lots of if else elif statements how do i shorten this p s i am using replit and replit currently has python here is the sell function for reference,how to prefill input box with future date in django template i am trying to prefill an input field with a future date in a django template how could i set it so object table expiration date default is prefilled with datetime now plus days,0,75,41 how to resave a csv file using pandas in python i have read a csv file using pandas and i need to resave the csv file using code instead of opening the csv file and manually saving it is it possible,split the prices from string and place it in another column in pandas i have below dataframe what i m trying to do is to split charge amounts separately to different column tried to use regex and df prices df charges str split expand true with no success any suggestions,0,41,45 groupby sum of col divided by sum of col i have df like this and i want to calculate how much is students was prepared via his overall score in the exam like this how can i do it edit the answer given by user is right but the values are stacked in the first rows how to implement each value to each needed row,how to properly import neighboring package into current package in python i know there are a million similar questions and articles describing how to define and mange packages in general but the following does not seem to work and i have run out of things to try im hoping i m just missing something completely obvious to someone else this is my current project structure im trying to import afunction from main py in app cube into producer py in app presentation unity as follows but when i try to run the producer file it gives me the following i tried moving files around renaming folders adding and removing init py files but i always get a similar issue in the current setup all of the init files are empty btw another thing to note is that the cube folder used to be at the root level of the project before i added the presentation folder and i was able to import functions and classes both ways between the models and algorithms modules and also import stuff from the cube module into the root level the contents of the cube folder have not changed since it s like adding an extra layer is not meant to work or something which sounds dumb for some final info im using python installed through pyenv on macos catalina as proposed in the first comment of this post running it as follows allows you to run a library module as a script and it works for me now,0,66,248 plotting multiple countplots via a loop i have a pandas dataframe with different columns one being year and another being doy i would like to loop over the years to and plot the doy in different seaborn countplots for each year however this does not work how can i do it,function not working when looping through a list of dataframes i have a list of dataframes that i want to loop through all of them and perform the same actions the dataframes have the same format i used a function and a loop like you see in the code below but it seems that the only changes that are passed is the renaming of the columns am i missing something here,0,53,71 pandas how to convert list of list into series of list i have a dictionary in python each key has a value of nested lists like following and i want to convert the dictionary key into dataframe column names in pandas and the nested lists into series of list like following is there any way to do so,how should we write a code in oop that has to read a file and several libraries i have requirement to write my code in oop format for this i saw few videos on what is oop all the examples i could find through those examples i am not able to lean how to convert my code into oop all i could make out was i have to create a class suppose class interpolate and then def somehow actual forward fill backward fill linear and cubic but i dont know what exactly i have to write in it say,0,58,99 how can i get the dispatch service name using nameko i have a green event that can be dispatched by two different services how can i get the variable with the service name,django form error django db utils integrityerror unique constraint failed legal useragreedtolegal user id whenever i call form save i get django db utils integrityerror unique constraint failed legal useragreedtolegal user id i think this might be because i have a onetoonefield and django is trying to save to useragreedtolegal and user model but the user model already has that id so the unique constraint fails but not sure i am wondering how i can fix this issue i listed my model form and view code below models py forms py views py the result is,0,32,80 creating emr cluster based on ami using boto i have a custom ami i want to create an emr cluster based on that ami using boto i checked the documentation found cli version but didnt find about boto version cli version can anyone please help thanks,comparing two dataframes and only showing the unmatched column records i have a list of dictionaries converted to pandas dataframe i am able to print the unmatched record but i don t want the whole record but only the mismatched column of the record a b c list is a b c i want to get only output of b where the mismatch is assuming list of dictionaries will have multiple dictionaries i have two dataframes and am comparing to find the non matched records i need to get an idea on how to do that possible solutions tried finding the common records and dropping from dataframe but i am getting entire rows however i only need columns only that have unmatched values please note there are around columns,0,47,128 extract fruit from image i am trying to find contour of a fruit within an image and filling it with black so i can either add it to another image or mask it however as per the unexpected outcome image below i m only getting the contour without the filled color this might be due to disconnected lines however i have tried to dilate my image and blur to resolve however unsuccessfully any advise original image unexpected result,adding a string before and after a word in text in python i have list of entities and a text like this text i am krishna i am from bihar i want to be a data scientist i want results like please help me with code in python to get this result,0,76,51 odoo discard change when an exception occurred i need to discard the change user made when an exception occurred to go back to the value when input is valid for example i have field check in check out as date type i need to check the check in must be smaller than check out when the check in is bigger than check out an exception dialog shows when the user closes the exception dialog i need to discard the change for check in,python pandas typeerror unsupported operand type s for datetimearray and str i have classes and interface when i execute my class fingerprinter i have this error typeerror unsupported operand type s for datetimearray and str the problem is my function def str self in my class fingerprinter here is my code,0,78,54 loop in pandas dataframe i have this problem looping through this dataframe its printing the same column for each value thanks,how convert a python post call to restsharp check the two part of code bellow there is two method second one is python method which make a post request to a url but i want to do same api call with same payload with c restsharp i already tried to convert code like bellow but since i don t have idea about python i am not able to understand how can i add payload as its done in python code i already tried to add this payload using request addbody but it is not same as it was done in python code how can i add those payload info with restsharp request exactly as done in py please advice payload data locationtype location input zipcode zip code storecontext generic devicetype web pagetype gateway actionsource glow almbrandid undefined c python,0,21,136 python pandas nlargest not working properly with keep all when i try to use the function below even if keep all the output is however the sorted array is what i want is how can i solve the problem edit for the people who interest to solve it here is the example code which show the problem,python get and set methods versus property decorator i am exploring decorators in python and as a person who came to python from other languages i am a bit confused about the purpose of property and its xxx setter brother in java and c get xxx and set xxx are usually the way to organize encapsulation in python we have these two decorators which require specific syntax and name matching in order to work how is property better than get set methods i have checked this post and still what are the advantages of property besides the availability of the operator,0,59,98 pandas groupby percentage of total and add subtotals similar to this previous post i would like to derive the percentage within each group but based on the sum of multiple columns and add subtotals for example given the dataframe below the ideal results would yield update it would be ideal to groupby both state and office id for situations where there are repeating values for office id column here is an example this should then yield,dill cannot deserialize in another environment overview i need an azure python function to serve up a pickled object and i need the resultant pkl file to be reasonably portable so that it can be used in any typical notebook or python code file with minimal imports test code used to generate test pkl file bytes the result is manually saved to disk as a pkl file code used to load the pkl file in another project the problem in all of my test cases the above code works but when running the code to generate the pkl file from the project which will be deployed to azure the resulting pkl file cannot be loaded in another project like a jupyter notebook when i attempt to load the pkl file the terminal outputs edit after some digging it appears that the app module is the default top level module for azure functions what s further dill is including absolute paths in the output when attempting to serialize functions and lambdas which doesn t seem right does anyone know of a workaround i m not terribly familiar with the territory and any pointers anyone can offer here would be very appreciated,0,76,196 having problem in reading data from multi level columns pivoted format to dataframe in python i have data in a google sheet with columns in below format i want to adjust row and in columns to create a dataframe original dataset i tried result will ignore first two rows looking something to bring first two rows in columns also output req below groupby with year,remove entries in a python set based on condition i used scipy spatial kdtree query pairs which returned a python set of tuples let s say this is the output next i want to erase all the tuples in the set which do not fulfill the condition what would be the most elegant fast pythonic way should i maybe convert to a numpy array,0,68,57 issue with django json response i have issue with json response messages values gives me user id instead of username how to get username here is my code,bfs on wikipedia pages is taking very long can someone help me analyze my code s runtime i am trying to perform bfs on wikipedia pages i believe i am implementing this correctly and in the best possible way run time wise keeping it to one thread but it is taking quite a long time to find a connection between two articles here is my implementation it takes sometimes a few minutes before finding a match is this expected due to how big wikipedia is or am i messing something up here and am performing it in a non optimal way or could it be beautiful soup is running too slow,0,26,110 use namedtuple instead of tuple with typing optional how can i use namedtuple with typing optional instead of this tuple i want to to call the function in the format of result final power stats min max none thank you i tried with stats namedtuple stats optional int optional int,when are linked lists preferred over lists i m learning data structures and algorithms using python i ve learnt that the advantage of linked list is that it does not have a maximum number of nodes unlike arrays in other languages since python automatically resizes our lists for us the advantage has been abstracted away for us therefore i ve always thought that the only advantage linked lists have was that adding a node at the front or back of the linked list was o whereas adding an element to a list could end up being o n from python having to resize the array and copying every element over however i ve just learnt that amortized time complexity is a thing today and that appending to a list takes amortized o so adding an element to a list is actually quicker than adding a node to a linked list since adding a node at anywhere other than the front back of a linked list takes o n time complexity so then what is the point of using linked lists over arrays lists,0,42,175 how to automatically deduct and add value from the output i am making a program of basic automatic computation for math i am having a problem of automatically deducting the sch to get the qualified output of the percentage for example the input would be the output should be automatically the scho is automatically deducted to add value for the mgr to make it automatically if it is,copying an xml node modifying it copying it hi have the following code where i try to duplicate a certain xml node multiple times and in each time insert a small modification according to a list the problem statement is i always receive the last item on list xml copied all other copied nodes where i want to change on each indexing it seems that somehow modifying temp affect the root how to disconnect the two items my input xml looks like this im trying to duplicate the entire dataset node with his childeren multiple times and for each edit the attribute externalsource bmp the result i get is that all the copied node contain the last item in list xml list instead of different value per each node,0,72,128 azure ml studio container has crashed did your init method fail i am trying to deploy an ml model through the azure ml studio using the notebook itself the commands we are using can be found here we have registered the model as below but while running this command we are getting the error that container has crashed did your init method fail the logs are the init method is,scatter points are disappearing when rotating a d surface plot i m trying to get a feel for how well a surface fits my data points by graphing everything and rotating the surface around to check for any oddities in the surface behavior relative to the scattered point in d space the problem is that when i rotate the render to do this the plots disappear how can i make the plots persist you can repro with the below code mainly taken from the amazing answers at python d polynomial surface fit order dependent,0,71,94 send private direct message with bot i m going to send someone a message from a bot the following code snippet is what i wrote to do that when i type sendpm it will ask for an id and then for a message to send when i do this i get this error attributeerror bot object has no attribute get user info,generate all possible combinations of array i have integers i would like to create a list of arrarys using both of these like so int int array array array array array array arrayn is there an efficient way of doing this i m essentially generating all possible combinations of length x using y number of items i m using python but happy to use other methods,0,59,70 why doesn t the int function convert a float to integer while in input function why doesn t the int function convert a float to integer while in input function result,extract data from api and store the records in a pandas dataframe i am looking at the following website and they have the following example for extracting data using their api this produces the following out of which i want to extract only the records bit out of the output and into a more readable format ideally i want this data in a pandas data frame records bunker type marine gas oil bunker sales id month bunker type marine diesel oil bunker sales id month bunker type marine fuel oil cst bunker sales id month bunker type marine fuel oil cst bunker sales id month bunker type marine fuel oil cst bunker sales id month in the format as below how could i go about extracting this data,0,29,138 read shp file from sftp using pysftp i am trying to use pysftp s getfo to read a shapefile without downloading it however the output i get does not seem workable and i m not sure if its possible do this with a shapefile ideally i would like to read in the file and convert it to a geopandas geodataframe from here i can t decode the value and am unsure of how to proceed,polyalphabetic cipher in python decode method doesn t work i am trying to implement some basic ciphers in python the one i m stuck on is a polyalphabetic cipher i ve seen other posts on here that use the same term for what appears to be a different cipher so i ll specify i m trying to implement what this textbook calls a polyalphabetic cipher in chapter section this involves digitizing the message breaking it up into vectors of equal length multiplying each one by a set matrix that is invertible mod adding a shift vector and reversing the digitization to get the encoded message out using the example in the textbook i m trying to encode help with matrix and shift vector and it is encoding to rrgr as the book says it should however when i apply my decode method to rrgr to helo in case more data is helpful i ll add that when i encode and then decode the whole alphabet with the same matrix and shift vector i get abcdefgghjklmnopqrstuvwwyz my code is below apologies for the lack of comments this code isn t for anything important so i didn t bother,0,72,197 pandas merge with left option is losing rows in left data frame i have dataframes the first left dataframe has rows second has only rows when i try to merge these dataframes with left option i get only rows here i get raws reopen the first dataframe here i get raws with marks how can i avoid reloading the first dataframe or fix this problem,data streaming on grpc python with iterator request but get exception iterating requests i tried to use grpc python to make a bidirectional streaming communication but there is some issue on client side request here is my proto here is my client code for generating a iterator request and call the datatransmission function but got the error why this error and is this the right way to use bidirectional grpc communication on python then there are some posts mentioning the following way also the same error,0,71,86 how to make inheritance on odoo object i m trying to add inheritance on existing object in odoo which is portal mixin into repair order object i tried with this code but i got this error any help please thanks,filtering rows that have unique value in a column using pandas i have a df i am trying to keep only rows that have unique value in column value so that the result df looks like this i dropped id because it has more than unique value in column value respectively i read this answer but this simply removes duplicates whereas i want to check if a given column in this case column value has more than unique value i tried but this returns nan for every row since i am trying to fit n returns on n m rows after grouping i can write a function and apply it to every row but i was wondering if there is a smart quick filter that achieves my goal,0,40,139 python jupyter crawling ebay website nested try except error im trying to get the price from pages in ebay but i have different of id tag to the price i v tried few options but i got indentationerror or when i got the output csv got a a column of empty cells,rock paper scissors abstraction in python i did a senior python backend engineer interview that involved implementing a rock paper scissors game the result was not pretty their engineer said i have clumsy implementation all over the place i did an upgrade afterwards but still have one issue that confuses me they would like me to change my original implementation of the game rules to a better abstraction my original implementation is with a mapping i have a role player and role computer class defined elsewhere their critiques are their suggestions are so far i ve created enums for moves and outcome but i m having trouble abstracting the game rules like they asked how would i do that,0,54,115 in graphene how do you provide both a list and a specific element from one right now i have some code that lets me get all items and their properties however i want to also be able to get a specific item right now if i run the query i get a how would i provide a way to get a specific element ideally without providing a whole separate endpoint,request files get is empty in a django project for a project i would like to use two files loaded by the user via two inputs to apply an external script my problem is that i get an error because django doesnt seem to be able to locate these inputs so i have an empty object instead of the file here are my codes home html views py urls py architecture and the error specifies that f type is nonetype i want to point out that i tried to put f request files file and it sends me that file is not found raise multivaluedictkeyerror key if anyone has an idea i cant solve this problem i feel that everything is fine besides i performed the same kind of function on another project and that works perfectly so i dont know thanks,0,70,136 unit test optimization program pyomo i am implementing several optimization programs with pyomo so far i have written some integration tests with unittest on optimal objective value and optimal variable values i would like to write unit tests for each objective and constraints to make sure they are correctly implemented what s the correct way to do it,how can i analyse each letter in a string and pair it with an input i m trying to set it up in a way where i can compare thier input letter with the actual letter and make an if statement if they get it right or wrong i m also gonna have to figure out how to setup this code in a way where number of questions asked to the number of letters,0,58,73 i want store a specific number when achieving the condition in to a list python i want to store and in a list when achieving the conditional wholesale i want to store value ms explain more about what i want i am new to programming sorry if there are errors in the code,selenium python proxy i want to use proxy with selenium i watched the video from youtube how to do it but it doesn t work this is my code why proxy doesn t work please help me kind people,0,55,37 read the elements of a text in python i have a text file like this there is no separation mark when i use these lines of code it returns nothing how can i save its elements in a python list or array,sampling from static data set to create dataframe ignore index in python i am trying to create some random samples of a given size from a static dataframe the goal is to create multiple columns for each sample and each sample drawn is the same size i m expecting to see multiple columns of the same length i e sample size in the fully sampled dataframe but maybe append isn t the right way to go here is the code the output of this is shown in the pic below the red line shows the index i want remove the desired output is shown below that how do i make this happen thanks,0,42,111 why am i getting an error that i m using a local variable inside a function when it is a global variable i have a code right now that i m working on and for some reason whenever i run it my error is local variable buzzcoins referenced before argument as you can see buzzcoins is defined out of a function therefore it should be global if anyone could help me with this that would be a huge help my code,how to get a rolling mean with mean from previous window i am desperatly searching for a solution with pandas maybe you could help me i am looking for a rolling mean with consideration of the previous mean df looks like this now using the rolling window mean function i would get something like this i would like to consider the mean from the first calculation like this where thank you in advance,0,79,71 scrapy crawls no pages i am currently trying to crawl rolex watches on chrono page with the spider called chrono but scrapy crawls pages i have discovered via the shell response css div article item container wt search result that i only get an empty list but i don t know what the reason is output from scrapy is the following and my code for the spider is the following here is my items py,how to prevent binance connector from printing i m using binance connector from after defining key and secret logging information i need to run the last line prints the requested information but i need to prevent this is it possible to prevent this function from printing the retrieved information edit i found that i can retrieve the same information using this doesn t print the information however i would still like to know if there s some modification i can make to binance connector library so i can prevent it from printing the retrieved information because the library basically prints anything i ask it to retrieve and there s information that i can only get throw this library,0,66,112 issue in installing python using pyenv in macos m arm tried to install python using the below command error i tried several combinations as mentioned in this issue thread but it is always resulting in the above error zshrc file,why does this list comprehension based on zip object does not work in subsequent loop iterations i have a piece of code where i want to filter out a part of a list in consecutive loop iterations in the first iteration the code works as expected but in the subsequent iterations the list comprehension returns an empty list i know that this should not be the case based on the data i m passing also the following code works as expected what am i doing wrong here,0,47,86 how to convert lmd file to csv flow cytometry data lmd file extension is often used for generating flow cytometry data but this couldn t be directly used for processing either in r or python is there a way to somehow convert it to csv or some renowned format,create multiple boolean columns in pandas dataframe based on multiple conditions i have a dataset where authors are ranked by the order of authorship etc i want to create three more boolean columns if first if second if last the purpose of this i want to show if the author is ranked or last in the article the last means the maximum number in rank column the maximum number for this authorid in the column rank i can do if first and if second that is pretty easy but not sure how to resolve if last two rules here expected output,0,48,101 replace multiple values of columns i have a data frame with different columns name asset new few value issue etc and i want to change some characters or symbols in the name of columns i can do it in this form but i think it should have a better and shorter way,problems with a branch and bound knapsack algorithm i am working on a knapsack optimization exercise written in python the goal is to fill a knapsack with limited weight capacity with items with a certain value and weight resulting maximizing the total value of the knapsack i ran into a problem with setting the variables when a better solution is found i ve created a simplified version of the code without any constraints demonstrating my problem since there are no constraints the first solution is always the best solution since that is the solution where all items are taken there is an if statement in the code that sets the max value and best taken variables in case a better solution is found however when the print statement at the end of the code prints the max value and best taken variables the max value shows the correct value the sum of the first indices in the list of lists assigned to the items variable the best taken value always ends up as where a value of take both items is expected what am i doing wrong,0,50,182 running telegram bot on heroku so currently i m trying to create a bot that messages every minutes using python telegram bot jobqueue the app is deployed on heroku and it seems to be working just fine but sometimes it doesn t message me after periods of inactivity ex not using start with the bot how do i solve this issue when i check the log it seems to be running fine thanks,installing wxpython on windows distutilsplatformerror microsoft visual c or greater is required i have installed when trying to install wxpython in my project s virtualenv i get this error distutils errors distutilsplatformerror microsoft visual c or greater is required get it with microsoft c build tools both the error and anything i can find on the internet including here tells me to download c build tools and install c or greater the latest version i have what am i missing here is there some sort of path variable that i need to configure somewhere so pip wheel setuptools knows where to find the compiler,0,72,104 list comprehension over tuple of tuple i have the following string conf x x o o x x o which is a tuple of tuple i want to iterate over each element and find the which means the empty space and return a tuple with the coordinate of the what i have tried so far which does not work can someone help with this one,is there a way to copy subfolder without copying recursively am trying to copy subdirectories from directory but i realize the first subfolder copied is copied recursively i would not like that i would like to copy the sub folder intactly when i run the code i have sub dir a sub dir b and dir b copied in new dir i however want dir a and dir b in new dir,0,68,63 how to split strings with double letters python i have been thinking about it for a while now and decided to ask for your help for instance i have a string abcdefggarfse or abcdeefgh my problem is that i would like to split these string at that point where the letters are doubled abcdefggarfse abcdefg and garfse abcdeefgh abcde and efgh thanks a lot,pandas re indexing after picking those that meet a condition i m trying to learn more about re indexing for background context i have a data frame called sleep cycle in this data frame the columns are name age average sleep time i want to pick out only those who s names begin with the letter b i then want to re index these b people so that i have a new data frame that has the same columns but only has those who s name begins with b here was my attempt to do it results re indexing was succesful managed to pick those who only began with the letter b and the columns remained the same great problem was all the data has been replaced with nan can someone help me with this one what am i doing wrong it would be best appreciated if you could suggest a solution that is only in one line of code,0,68,152 how can i create a requirements txt in google colab i have already tested the following pip freeze requirements txt saves all packages in the environment pipreqs returns an empty file i need a compilation of all imported packages with the corresponding version how can i do this in google colab without getting all installed packages,regex strange results when using in order to manage a df i m applying df sum df sum str replace r regex true in order to eliminate the duplicate of record in sum but i m obtaining such strange result in sum,0,57,38 how to save images from url into mongodb using python i have used wikipedia package to get a list of image urls from any wikipedia page now i want to save all the images from the images variable to a mongodb in a collection named images is there any way to do it as there are multiple images can they be saved in a list format,python convert pandas dataframe to dict of lists i need to convert this dataframe to this format what is the best way of transforming this i tried to dict with different values of orient but it didn t give me what i wanted any help would be appreciated thanks in advance,0,66,49 memory leak in spark query causes error when requesting data from the temporary table at first i add the data to the temptable in scala code then read in python imports omitted and then i get the error during the execution how i can avoid it,convert multiple nested json to pandas dataframe here s the response i get from my stock data api provider i need the results to be a simple pandas dataframe with the following columns date company open high low close volume,0,46,39 getting google returned a response with code error in pytrend i want to get yesterday or todays data from pytrend but every time i use this code i keep getting the request failed google returned a response with code with the data and sometimes timeout or rate limit exceed error my code,how to reverse a dictionary in python and create a list out of the duplicate keys value i gave myself a task today just trying to figure out the exercise below in python how can i rather achieve the following result,0,54,41 ssl connection error when trying to connect to aurora instance i m trying to run a python script through a cronjob inside my eks cluster when it tries to connect to my aurora instance it fails stating that i m using an unsupported ssl protocol unsupported protocol log trace any clue the aurora s mysql version is the python is and the mysql connector package is,python scipy confidence interval i am new to python and i wanted to programm a confidence intervall this is the code i used there is actually no problem with the code it works however i found it somewhere but i simply dont understand it i am using confidence interval therefore my alpha is why do i have to write alpha and why do i have to write in the len df what i also dont understand is the loc and scale,0,66,85 difference between secrets compare digest and hmac compare digest there are two strings comparison functions to prevent timing attacks secrets compare digest and hmac compare digest but it s not clear from the documentation how i should choose between them are they the same if so why is there such duplication,selenium next pages with javascript throwing elementclickinterceptedexception error my code is working fine but the pagination portion throwing the following exception your help is much appreciate script,0,42,27 how can i find the last non empty column number of an excel file using openpyxl how can i find the last non empty column number of an excel file using openpyxl so if the last column with data is column n how do i get that letter and then convert it to a number,check dict values and randomize in python i have a sorted dict as below i want to check the values in the above list in python codee and randomize the ids if values are same expected output is check id id id id randomize the ids which has the same values sometimes id in second position and sometimes id in second position,0,53,64 proper c type for nested list of arbitrary and variable depth i m trying to port some code from python to c the python code has a function foo that can take nested lists of ints with variable list depth for example these are legitimate function calls to foo what should the method signature s be for a c method that can accept this kind of argument,fill new column with true false for each unique customer based on condition i need to create new column with true false values if condition is met based on other column than true should be in every row associate with acc no original df output should be true for acc no only my code so far my output is,0,65,58 access browser location we all have seen this prompt as far as i know this is not ip based location this is device based location i don t want ip based location because it s not reliable and if the user browses my website with a vpn the location data is absolutely wrong i ve searched pypi org and djangopackages org but didn t find anything to implement that in my django app is there any solution,django rest framework serializer got attributeerror when attempting to get a value for field field on serializer try to nest serializers attributeerror got attributeerror when attempting to get a value for field vesting choice id on serializer vestinglocationrateserializer the serializer field might be named incorrectly and not match any attribute or key on the queryset instance original exception text was queryset object has no attribute vesting choice id model serializers,0,70,66 no module named cogs music pycache music i m making a discord bot for me and my friends and whenever i run the code i get this missing pycache module error i have no idea why and i can t find anything googling python no module named pycache or anything similar this is the folder layout down to the music pycache running the code with python bot from the directory above bot full traceback,i don t know why guessnum and secretnum don t do the while comparison right i don t get the correct answer it goes into an infinite loop it doesn t recognize when i enter the number it goes into the loop anyway,0,69,40 problem with finding th prime number off the answer is supposed to be but for some reason my brute force program gets more does anyone know why it is one off,how to output this json which is in the format below in discord the code works by the user inputting on discord cryptoupdate bitcoin i want the program to output the following without the speech marks and curly brackets click here for json response output on discord code,0,35,48 countvectorizer but for group of text using the following code countvectorizer break air dried meat into different vector but what i want is to keep air dried meat as vector how do i do it the code i run current output desired outpput,click link automatically and scraping i try to extract the all the products data from this page i tried the problem is that the product details is showed only when i click the product there any option to click all links automatically and scraping the open windows,0,43,48 converting a text document into a jsonl json lines format i want to convert a text file into a json lines format using python i need this to be applicable to a text file of any length in characters or words as an example i want to convert the following text to this i tried this but not luck,list of namedtuples how to calculate the sum of individual elements say i have namedtuple is there any pythonic way to do a one liner sum of each summable or selected qty sell buy profit elements in the list expected result i know i can do following which takes lines of code but would like to replace the sums with something more generic which takes only line of code and then create x like using the sum of the individual elements in the list,0,59,86 using for loop to replace bad nucleotides from dna sequence i have a list of sequences for simplicity like the following one and i want to use for looping to replace every instance of a nucleotide other than a c g t with n my code so far problem is the nucleotides are not replaced and nothing changes in the original sequence and i can t figure out the reason,creating an index from a list of words in python to vectorise words so i have a long list of words called word list that contains duplicates and also have a set word set that is just the word list but without duplicates i also have a function that takes the word list as input raw text it returns the corresponding words within the window size of a word here it is wonderland i would like to instead have this return the index of those words from word set for example instead of i would want could anyone help me with this task for testing i have put a more comprehensive word list here along with my function,0,66,112 dimension error when using model predict in keras my train set has columns including a target column that i m trying to predict while my test set dataframe test has columns when i run the code i receive this error my model looks like this,how can i access the aiohttp s request from a restrequest in minos i have a handling function decorated with the enroute rest command decorator so that my function receives a restrequest instance but i want to directly access the aiohttp web request to directly access to the rel url attribute how can i do that my current code looks like,0,44,55 function is not modifying the argument alright this function s supposed purpose is to simply modify the object matrix accordingly with the dictionary comprehension however i don t want it to return anything i just need the modifications to stick is that possible,how to save long efficient apriori rules rule to pandas df i run association rules using efficient apriori package in python i need to save results my idea is problem is that i have bilions of rules and following code crashes on signal sigkill how can i improve my code please i need to save results by small parts i think but i don t know how thanks,0,41,65 changing column label python plotly how to change column titles first column title should say year and nd column title year i tried using label but kept getting an error,filter rows based on highest and lowest column values i have a unique dataframe i need to keep only those rows where the highest score is increased by more than from the lowest score otherwise drop them for example for the student a the lowest score is and after that the score is increased to by so we re gonna drop that for the student b the lowest score is and the score is increased to so we re gonna keep that for the student c the lowest score is but there no score is increased after that it is basically decreased so we re gonna drop that i know that diff and ge would be helpful here but not sure how they would work when the lowest score has to be on the left of highest score and highest score has to be on the right side of lowest score are many columns apart desired output any suggestions would be appreciated thanks,0,30,167 how can i test aws cognito protected apis in python i m trying to test out some aws apis that are protected by cognito i found the first part on how to get the json token but i can t figure out how to use the token correctly so i can authenticate on the api here s my code i m getting the following error message,python rotatingfilehandler is logging also to archived file how to log multiple processes to single file this is my logging config and i have about different files which each of them has this exactly same logging setup so far so good now the problem after restarting my application all logging records are correctly sent to last file lan runtime and exception log but sometime later few hours few days i dont know exactly trigger and time i observe that also second last file lan runtime and exception log is incrementing by some records from one of those files that have logging set i was not able to find why this is happening my goal is to have all the time only latest file incrementing any ideas,0,64,122 pandas how can i replace rows in a dataframe i am new in python and try to replace rows i have a dataframe such as i have two question how can i replace nd row with th such as how can i put th row above rd row such as,how to click on a specific onclick valueusing selenium and python what can i do to replace find element css selector in selenium python to click on a specific onclick value the browser is google chrome,0,51,33 background wont change tkinter im using a mac and i have this problem after creating window using tkinter its bugs out the background color code example window example,tensorflow crashes on mac m i am trying to start using tensorflow on my m mac however i only get the following message when i try to import tensorflow i have tried using tensorflow versions and but all have the same problem,0,28,45 first and last methods used excluded items i used last to get last item of queryset after exclude some items as below but in output print item that not exists in output i test some other codes as below my holiday model and other model is i test that by first and problem was there too what is problem my code is wrong or bug from django orm using django and postgresql,pysimplegui one line progress meter does not return false when pressing x on windows in the docs of pysimplegui it is stated that the function returns true if either the cancel button is pressed or the x button in the windows titlebar however it is only working for the cancel button in version mwe am i missing something,0,73,56 org apache hadoop fs unsupportedfilesystemexception no filesystem for scheme oci when i am trying to access file stored in oci object storage using pyspark as shown below i am hitting above error,how to change a specifc number of items in a list in python i have a list like this i want to change this list so that the first n occurrence of true remain in place and all others became false for example if n i want to create a new list same as this one and if n this list should be created i can do this in a for loop easily but what is the best way of doing this in python this is my code this code goes over all the items of the list but a portion of it but it has lines of code is there any shorter version or a faster version,0,28,119 parser error when trying to read csv file with pandas on jupyter hey community im new to coding and as a job task they asked me to read a csv file i used the commands and after that second command i get the parser error i would be very thankful for any help i am really hoping on landing this job,i got parse warning when using the panda function i am working to create the knowledge graph by using unstructured data using spacy panda and much more libraries of python but the thing is that i encounter with warning which is parse warning lets see this code and am using jupyter notebook to first extract the triples that is subject object and predicate then am using networkx and matplot library to make the knowledge and i got this warning in my jupyter that is shown below i don t understand why this warning will be there after executing the code and if you guys knows how to convert text file to csv then python then do let me know because am very new to python thanks in advance,0,61,127 how do i run a python script in powerbi i am new to python i am trying to create a bar chart in power bi using python but the script does not seem to work the code is below please find attached the file enter image description here,how to iterate over a dictionary in python to move in different directions i am creating a text based game for my homework i have been able to everything except move between rooms using the directions north south east and west i have not worked with dictionaries much at all and i am struggling i do not understand how to do this especially in the bedroom with different directions directions the game should prompt the player to enter commands to move between rooms the dictionary links a room to other rooms,0,49,92 how to store after groupby how am i able to use the column after using groupby let s say would give i would like to store the top most income s industry name to some variable and use it for other queries so here it would be telecommunications but doing x would give also pls recommend a better wording for this question don t know the right terminologies,purpose of using pass in example python function i m currently taking a python course on udemy and i m at the point where i m learning to create my own functions in the section dealing with functions and tuple unpacking i was shown the example function def employee check work hours my question is simply what is the point of putting pass as an else statement in this specific example messing around it seems to still operate properly whenever i take it out is there a use that i m not aware of or is it just a good habit to get into when creating functions edit the purpose of the function being to designate the employee of the month based on total hours worked,0,66,119 python regex with brackets i m trying to get a subset of strings like bellow i need to first capture contents between and and then put each of some content in the separate index of an array what i have till now is but it does not work as expected my expected result is something like bellow any help is appreciated update please consider the following as an input string expected output,use namedtuple instead of tuple with typing optional how can i use namedtuple with typing optional instead of this tuple i want to to call the function in the format of result final power stats min max none thank you i tried with stats namedtuple stats optional int optional int,0,73,42 breakng the hash i have to break hash codes and find their number but my code is not working these are the hash codes in a csv file my code and my result is,how to convert an iterator into pandas dataframe i was trying to extract checkbox values from a pdf which i am able to with the help of the code below which i found from a thread in stackoverflow and it was provided by fabian python pdf how to read from a form with radio buttons below is the output i am getting i am very new to python programming and not able to convert this output to a dataframe as i want to export it into excel i tried appending the data into a blank list but it s not giving me correct results any help would be much appreciated thank you so much in advance,0,39,116 db object not iterable in flask i m searching for a record in users db and then looping through all the records the code is something like below the above code throws error users object not iterable how can i loop through the records,how do i retrieve the resultant image as a matrix numpy array from results given back by yolov in pytoch i have been learning how to implement pretrained yolo using pytorch and i want to display the output image using opencv s cv imshow method the output image can be displayed using show function and saved using save function i however want to display it using cv imshow and for that i would need the image in the form of a numpy array i m unaware about how we do that or even if that is at all possible here s the code for it a longer way of solving this problem would be to create bounding boxes ourselves over the detected objects in the image and display it but consider me lazy p,0,43,129 i am trying to make an url shortener and i am facing this problem this is the python code this is the error module pyshorteners has no attribute tinyurl,question about returning the right thing from recursive function leetcode i am doing leet code question subtree of another tree given the roots of two binary trees root and subroot return true if there is a subtree of root with the same structure and node values of subroot and false otherwise a subtree of a binary tree tree is a tree that consists of a node in tree and all of this node s descendants the tree tree could also be considered as a subtree of itself i had a working solution however when trying a slightly different approach i ran into a problem with my recursive dfs function the structure of my code is this basically issubtree explores all the nodes in the tree once it finds a node with the same value as subroot it compares the sub tree rooted at that node with the sub tree rooted at subroot with dfs i intended that when the dfs function returns true issubtree will also return true if i ve explored all the nodes in the tree issubtree reaches the end and dfs hasn t returned true at all issubtree will return false however my code always returns false seemingly because of the last line where it returns false i ve tested it and can verify that the return true part in if dfs was reached also i m pretty sure my dfs function is correct my question is is there an elegant way to have my code do what i want it to do,0,29,252 heroku django virtual environment source code modification i managed to deploy my django app with mongodb as database on heroku but i need to modify some source code in django package in the virtual environment how can i access to virtual environment created by heroku from requirements txt or maybe how can i upload directly the virtual environment to heroku and make sure that my git django app is working on it thank you,pandas tidy up groupby aggregation i really struggle with tidying up the table into a normal dataframe again after having aggregated something i had a table like that columns so i calculated average and std of the result column over multiple runs using that command the output is a dataframe like that it looks a bit like three levels df columns outputs the following multiindex how do i flatten that again removing result and putting mean and std into the same level as the rest there are so many commands like reset index drop level and so on but i did not find out yet how to fix that it quite confuses me edit for reproducability here is my entire code and the shortened csv file results csv,0,74,124 python docx how to set font spacing how to set font spacing in python docx or how to add element to w rpr w rpr w spacing w val w rpr,boxplot for tuple groupby throws visibledeprecationwarning creating an ndarray from ragged nested sequences i have timeseries with a parameter value among other columns i would like to boxplot this across both year and month dataframe is a log and datestamp col is not unique and can not be used as an index some examples online use unique datetime as an index with simpler syntax this works just fine box plots are created separately with groupby generating works fine with the boxplot month or year grouping each work separately attempts to get a more granular picture with box plots for months and years appear to generate correct groups however attempts to create a boxplot for each month of each year results in an error the question is where how do i specify dtype object in my syntax to get a few more box plots i want or to be more technical convert index to a string object inside groupby thank you ps flt is another filter and list is used or parameter just as a legacy to be able to add more columns,0,24,182 priority queue in python using comparator is there any way exists that can do the java queue priority comparator comparingint method in python i want the node which has a higher priority come to the front of the queue edited for example,how to cat contents of multiple files from a python script i would like to cat the contents of the files generated from a python script is it possible to do that in a simple one line command for example i would like to have something like where test py produces multiple filenames like so separated by new line i would like to basically do basically reading the contents of the filename produced by the script assume the python script can generate hundreds thousands of filenames though this may seem to work but the problem is it seems to wait until the whole python test py is completed before it performs any cat basically it doesnt seem to cat the contents of the filename as soon as it gets a filename where as cat the filename as it gets it unfortunately it just prints the filename but not the content of the filename,0,41,150 how can i send into db only if it is not already there i have a following problem i would like to send my url to db urls only if my url is not already in db urls i do it using two methods in python can i make this two functions into one that is to check in one query if my urls already exists in urls and if not insert it there thanks,keyboard interrupt crashes my code in python i am a new programmer and even though i just used ctrl c while writing my code to copy paste some code but after that my code stops running due to keyboard interrupt my code is compiled and has no errors please help i tried it another time without ctrl c in a different file but it shows the same error and i am getting the following result nothing seems to happen after that when i debugged the code i found this error,0,72,90 filenotfounderror winerror the system cannot find the file specified error with selenium library in python i am trying to make a web automation bot using python and selenium but i have encountered a problem error here s my code and here s the eror i m am encountered with,it looks like pytest can t rerun tests when running in a container i want to run pytest inside a container and i m finding a different behavior when compared to running pytest in the host just a simple container no orchestrators or anything else when i run pytest at the host level all tests pass some need a couple of rerun but at the end they pass for example with a sample of tests the result of running just pytest is passed rerun in seconds now if instead of running this in the host i build an image and run a container the result is always something along the lines of failed passed in seconds or actually any combination of failed passed failed passed failed notice how in this case there is no mention to any rerun operation the image doesn t have anything fancy it s as simple as copying the requirements tests and run pytest any ideas about what might be happening i m not passing any flag or argument in both cases host or docker it s just a raw pytest i thought that maybe when a test failed it was reporting error and the container was exiting even though i m not using pytest x but that s not the case all tests are run,0,46,224 convert html string tag into string python i am trying to convert the html string tag into string using python here is the content i m trying to convert the result should appear like hello world in bold but i m getting like with the below snippet of code can anyone suggest me how to convert,how do i loop over pandas data frame to create adjacency list i have functions that create an adjacency list but i can only add nodes and edges manually like this but i have a relatively large graph and i can t add them all by hand so i put sample graph data in a data frame looping over df node works but i can t find a way to do the same for add edges so what i am trying to build is a function that takes a data frame and returns a graph like this also i know about libraries like networkx but i need to implement this from scratch,0,54,108 remove group if contains record with status i would like to group records by id from df and delete group if any of records has status output i would like to get i tried dfnew df groupby id filter lambda x x status but i got the error typeerror filter function returned a series but expected a scalar bool,bloxorz a star search i am struggling to implement a star algorithm on bloxorz game which the goal is reach the end using x x block i implement the algorithm but it is inconsistent sometimes it doesn t give the shortest solution for example for this maze my implementation gives this result u l u r r u r r r r r r d r d d d l l l d r d l u r u l d which has moves but there is a shorter solution which has moves u l u r r u r r r r r r d r d d d d d r u l l l l l l d here is my implementation full code is here what could i do for it,0,60,82 noreversematch at details the shortest scientific papers ever published fa c fc a a b e aeddcc f i am trying to add comments in my blogs of my project when i post a comment it shows noreversematch at details the shortest scientific papers ever published fa c fc a a b e aeddcc f here s is blog details page views py of blog details page urls py mapping for blog details page servel url but in server site i get this is there any problem with slug models py of the slug help me out please,importerror cannot import name url from sqlalchemy engine while initiating rasa when i run rasa init in the anaconda prompt i am getting into this error importerror cannot import name url from sqlalchemy engine c users user anaconda lib site packages sqlalchemy engine init py,0,64,33 is it possible to add this kind of default value to caesar cypher python here is a basic function call i would like to do as you can see below in the signature i would like to have the default value in s be the length of the string passed in for convenience is it possible to do this in python or some version of this,tkinter frame not filling out parent container for each page i want the frame to fill out the entire window but when i run my program my page does not fill out the whole window i ve tried setting the weight of both the root self and the containers that are holding my frames but to no avail i am unsure as of what to do next in each page i ran the self configure method in order to check whether the frame has filled out the entire window but it has not,0,66,91 get the middle of all bins from plt hist i have made a histogram with plt hist and i now have an array with the bins in this form is there a easy way to get the middle from these bins end result would be a list with n centers like i don t know beforehand what the bins will be,substituting values of a column if it contains a substring of a list so i have a pandas dataframe and i am trying to substitute each value a string in my case to an element of a list if the string contains thyat element a substring to clarify i have a simple dataframe the desired output looks as follows i can do the following and apply above line of code also for cat and pandas but the problem is this would require many line of code if the list of substrings is very long is there a simpler way to do this hence for each record it needs to check if it contains any element of a list then replace that value by that element,0,60,125 debold discord py emebed so i m making an embed on my discord bot and i m wanting to remove the big line between the numbers i ve tried name and name ub b but no matter what it will show the annoying blank line code,text preprocessing for nlp but from list of dictionaries i m attempting to do an nlp project with a goodreads data set my data set is a list of dictionaries each dictionary looks like so the list is called reviews there are k of these dictionaries in my dataset first question i am only interested in the elements rating and review text i know i can delete elements from each dictionary but how do i do it for all of the dictionaries second question i am able to do sentence and word tokenization of an individual dictionary in the list by specifying the dictionary in the list then the element review text within the dictionary like so and then applying sent tokenize and word tokenize like so but how do i apply these methods to the entire data set i am stuck here and cannot even attempt to do any of the text preprocessing lower casing removing punctuation lemmatizing etc tia,0,41,156 python for loop not working on a dynamic script i m using a dynamic script to remove columns with values equal to column name example below for table named summ script input ideal output output of the script after executing the for loop script above once i re run the script above it would also delete the lname column but why does the for loop not check all columns,can i run unittest pytest with python optimization on i just added a few assert statements to the constructor of a class this has had the immediate effect of making about tests fail rather than fiddle with those tests i d just like pytest to run the application code not the test code obviously with python s optimization switched on o switch which means the asserts are all ignored but looking at the docs and searching i can t find a way to do this i m slightly wondering whether this might be bad practice as arguably the time to see whether asserts fail may be during testing on the other hand another thought is that you might have certain tests integration tests etc which should be run without optimisation so that the asserts take effect and other tests where you are being less scrupulous about the objects you are creating where it might be justifiable to ignore the asserts asserts obviously qualify as part of testing i d like to add more to some of my constructors and other methods typically to check parameters but without making hundreds of tests fail or have to become much more complicated,0,67,196 python def function with error exceptions does not work correctly i defined a function and it s not working correctly it should raise a typeerror exception when type is not int or float and a valueerror exception if value if i use eg n as ppb python tells me and when i use a negative value for ppb it works i m not sure if this is correct too i hope you understand my issues,converting a text file to json using python i have a text file which contains which code in python could be used for converting the text file to a json file looks like this,0,74,34 extract and rename zip file from specific folder using python i am using python to unzip a file i have a zip file in folder wowo if i select folder using path and use only file name the code doesn t work but when full path filename given it works i don t want go give full path and file name together i want to define path saperately,why does a change in nested list doesn t affect the first layers and only the subsequent layers i just wanted to know how do we get the following output the given below is a python code output is why x didn t make any changes in the list y but why x changed the element in list y can you give a detailed and simple explanation to this why,0,65,68 push rejected failed to compile python project django heroku it is my first deployment i am trying to push my django project into heroku but it is saying push rejected failed to compile python project i have tried changing the python lower versions but no luck any help would be much appreciated thanks here is my cmd output my pipfile py source url verify ssl true name pypi my pipfile lock my procfile,multiprocessing is too slow in multiple loops in python i am trying to convert a multiple loop function into a multiprocessing function to take advantage of multiprocessing the initial code looks like this the data looks like this and the output looks like this i want to convert this function into a multiprocessing function what i tried but it s taking too much time to process the data is there something wrong with the code,0,74,74 create multiple dataframes with for loop in python i need to compile grades from files named quiz quiz quiz i have the following transformation the code for one dataframe is the following i want to iterate the same transformations for all the quizzes from quiz to quiz i have tried a for loop but it did not worked thanks by advance,changing keys after loading json file dictionary okay so i am having this issue with json keys and strings i m using a json dump in python to save my game dictionaries and it does work the issue is when i load the dictionaries the game i m making uses int values as keys in the world directory but json stores keys as strings here s a random generation i did so when i use the load function i get key errors due to the int s being converted to strings i attempted a for loop to iterate over the keys and change them back but i get this error about the dictionary changing here s an example of me trying to load a different and also random world its set to print after each loop showing that it works i m not exactly sure what s wrong with it but sadly i ll also have to do this for each location within a region any and all help is appreciated as i ve looked all over so and google but to no avail,0,63,175 convert two columns of a dataframe into a multi index i have the following dataframe it currently has the sequential index that you can see on your left is it possible to convert it into a multi index dataframe the vertical index being the unique values of kline start time and the horizontal index being the unique values of symbol note that kline start time has unique values and symbol has unique values,is there a way to increase the size of the background image in turtle i am trying to make a game in python which requires a background image i already have the image the problem here is my image looks small compared to the big screen i don t want to change the size of the screen because then i would have to redo all the coordinates of the other objects on the screen is there any way i can increase the size of the background image ps i m using python and on vs code thanks in advance this is the picture of what the small picture looks like enter image description here,0,70,113 what type of construct is a for loop in javascript or python or r i understand how to write a for loop and what it does if i wanted however to understand it more deeply could i describe it as a block statement that with a expected group of keywords and appropriate syntax is used for a type of conditional execution,python script works in idle but receives an error when running through console error code can only normalize non empty string names unexpected when i run this code inside the python idle program it works fine i ve tried everything and hope seems to be lost is there any other way for users to input their own key bind like what i m trying to do here if there is any other alternative i would gladly go to that when i run through the console i get the error i m completely lost and don t know how to fix this does anyone have a clue of what the problem even means,0,61,108 i want to create function that creates a new label tkinter python i am new to tkinter please read the above question and please help,how to access data in this model class i m using package libmf to do parallel non negative matrix factorization i e x wh i use the method fit from the class mf as mentioned in below description the resulting matrices are stored in mf model from the github page of the package the class mfmodel is could you explain how to extract information from this class for convenience i also put the notebook on colab here,0,25,74 how to remove a key from a dictionary i have a question about a simple quiz which is removing a specific key from a dictionary with function input must be taken from user for example would remove the first element from the dictionary and return the result i have developed such a code but when i type a it doesn t work when i type only a it is removed could you help me to solve this question,convert column to dataframe column geaders i have the following pandas dataframe i would like it to be converted to a pandas dataframe with one row is there a simple way to do it i tried pivot but was getting weird results,0,77,42 how to overlay an image with another that has transparency using python with opencv i am trying to use opencv to add an image onto another i want to be able to combine this and this note the circle has a transparent background to create this unfortunately all of the solutions i ve found online just give me this i ve looked at at least different on this sight solutions but i cannot find a working one please advise thanks,how can i search a specific element on the page for text using xpath selenium i can t seem to find an example of this what i am trying to do is search a specific div element on the page for text that has the potential to change so it d be like this in my case the div coolid will always be present but the text within it s inner divs and child elements will change depending on which iteration of the page is loaded and i need to search for the presence of certain terms within this coolid div and cool div only because i know it will always be there and i d like to specify the search as much as possible so as not to potentially contaminate results with other text from other places on the page in my head i sort of see it like this using the above example or something to this effect does anyone know how to do this,0,79,163 how to resolve this circulary dependancy with python enums so i have enumerations the problem is that the first enumration is referencing the second and the second is referencing it too here the problem is that the universe enumeration cannot use the civilisation enumeration since it is declared below is there no way around this i d like to be able to have the all the universe civilisation in the universe enum thanks,problem converting epoch to datetime python i have a pandas data frame showing timestamp in epoch i need to convert it to datetime format the code looks like this the data type comes out as pandas core series series i ve tried converting it to int using astype int and pd to numeric but neither seems to work the code returns the following error error message i ve been staring myself blind at this for hours i m sure i m missing something simple can anyone see what i m doing wrong thanks,0,73,85 is there a difference between keras dense layer and pytorch s nn linear layer i noticed the definition of keras dense layer says activation function to use if you don t specify anything no activation is applied ie linear activation a x x so if we have a code like is it basically the same as thank you so much,add a portion of a dataframe to another dataframe suppose to have two dataframes df and df with equal number of columns but different number of rows e g i would like to add df to the df tail df loc df shape thus obtaining any idea thanks,0,58,44 venv with renamed python exectuable i m trying to create a virtual environment using a custom python build e g mayapy exe m venv myvenv but i keep getting the following error error winerror the system cannot find the file specified this is a known issue and has something to do with the fact that i m working with a renamed executable do you guys have any work around for this issue,finding relevant points in the given curve consider the following python code which plots a curve and analyzes it to find some points i have marked in the image above the points i want to calculate i think i can use the first derivative to calculate the first one which is the start of the transition i am not so sure how to calculate the second one which is the end of the transition or when the curve becomes flat i have tried to calculate using the average of the last points in the curve and finding the first value in the curve below that average however it does not seem very reliable edit while investigating the first derivative i came up with the following potential solution which is finding the change of sign to the left and right sides of the peak i illustrate with an image of the first derivative and signal and fit below,0,71,158 python what does the syntax slider var mean in this function i am trying to understanding the following codes i am confused about what does s time val here do a slider variable input parameter thanks,how to get ride of equal column in our panda data frame i have three data frames with sizes of df df df in my columns despite the different columns name there are similar data values all the columns in each three are equal but when i using for example although it must create the same output column but it convert the df df df how i can get ride of this,0,32,78 how to access execution date in airflow for operators other than python or bash i am using bigquery to gcs operator in airflow i want to save the tables in folder with execution start date as name of folder since the tasks run overnight datetime today sometimes gives next day as execution start date how can i access dag execution start date in place of datetime today so that all tables get stored in folder with execution start date as folder name,event loop is closed called after closing the discord bot after completion shutdown the bot gives an error error my code the bot issues such an error after the program is completed how to fix it solutions like these solutions didn t help me the only thing i have improved all the libraries that were discord itself aiohttp and asyncio but they did not lead to a result what can such a problem be related to bot code example,0,78,77 how to plot combo line plot using different x value intervals but same range dataset sample for the monthly sales and semesterly sales my data set and nd,webdriverexception message msedgedriver exe executable may have wrong permissions in google collab i used google collab and browser edge and i tried this code with selenuim and i had this error but i have already downloaded last version edge driver by wget before and i have no idea how can i fixed it because all solutions on stack overflow were for chrome driver and they didn t work for me,0,28,68 how to implement string in python class i m working on a problem called employee class and mostly thru it but it s not printing what i want this is my program and this is the file with my class in it i know i need to implement a string but i m stuck,error message that reads valueerror a is not in list when executing script that encrypts decrypts strings in french this python program encrypts decrypts the english alphabet perfectly fine but as soon as i replace it with the french alphabet i run into errors when debugging the entire error message reads,0,51,49 heroku error while there s nothing here yet i have deployed simple flask app on heroku with docker and access using heroku simple flask prod herokuapp com however i get there s nothing here yet build something amazing error page as i know this happens with incorrect dns setting while using herokudns com but here i use herokuapp com link which should be accessible in any case so what is wrong here flask code my dockerfile my heroku yml,valueerror invalid color argument in my pygame code i wrote the code for my final project it s a code that makes a bouncing on the wall i wanted to make two balls so i created a class and created several functions but i think that my code is not working,0,69,50 systemd service taking a long time to run i am having service running as background service in ec instance but it taking a long time to start a new one or restart a service refer to image i reboot ec and a service restart at but at the a service print the first log here is my service config file in etc systemd system please help,fast search of doubled numbers in array i m trying to search doubled occurrences of numbers in a list but for big arrays like items this taking quite a long time is there any method for speeding it up,0,68,39 scraping the shoe sizes with bs i am trying to scrape the shoes sizes of this shoe how can i scrape the value,how to sample pandas dataframe with minimum distance between i m trying to sample a dataframe based on a given minimum sample interval on the timestamp column every extracted value would be the closest extracted value to the last one that is at least minimum sample interval larger than the last one so what i mean is for the table given below and minimum sample interval here we would extract indexes i ve found a way to do this with iterrows but i would like to avoid iterating over it if possible closest i can think of is integer dividing the timestamp column with floordiv as interval and finding the rows where interval value changes but for a case like i would be selecting instead of which is only larger than instead of,0,23,144 attributeerror in python unit test circle i have to make unit test for circle in python but for the life of me cant figure out why i am getting this error traceback most recent call last file c users user desktop domaci preadvanje circle unittest py line in test area self assertequal circle area file c users user desktop domaci preadvanje class circle py line in area return self radius self radius attributeerror int object has no attribute radius code for circle code for test,how to format plotly legend when using marker color i want to follow up on this post plotly how to colorcode plotly graph objects bar chart using python when using plotly express and specifying color the legend is correctly produced as seen in the post by vestland this is my plotly express code but when using go bar the legend is incorrectly displayed as illustrated here this is my code using graph objects i m learning how to use figurewidget and it seems it can t use plotly express so i have to learn how to use graph objects to plot how do i link the legend to the data such that it works like the plotly express example in vestland s post,0,71,119 how to get nearest match in csv file python if want to get the nearest match in my big csv file in python my shortened csv file is i have made a programm but it isn t finished and i don t know how i can complete it do i have to use an another program algorithm look from left to right on the row and find the row with the most sequential matches to the search data,a tuple is not defined but it contains information i am looking a module ifcopenshell and i see a very weird function in this case tuple is not explicitly defined anywhere but it contains a value my assumption is that tuple comes from an import is that right how can i track where tuple came from here is commenten of function isininstance definition isinstance o object t union type tuple union type tuple any bool return whether an object is an instance of a class or of a subclass thereof a tuple as in isinstance x a b may be given as the target to check against this is equivalent to isinstance x a or isinstance x b or etc,0,76,119 how do i use vlookup using python having mutliple columns in both dataframe i need help on vlookup using python i need only one matching column data of df in df instead of all df data my input is below two dataframes and my output is i tried below code but getting address column blank and when i use below code all columns from df came in df,list value being overwritten even though i am checking for it i m new to python and writing my first project i m trying to implement a check that if a space is already occupied not to move there i can t seem to figure out why my move player method overwrites the index value of the board even though i am explicitly checking it if it is o s turn and x has already been placed in the index o is trying to move to it just overwrites it i have tried hard coding the check for x and o instead of player player as well but can t seem to figure it out does it have to do something with how python works or am i implementing it wrong,0,68,124 how can i send into db only if it is not already there i have a following problem i would like to send my url to db urls only if my url is not already in db urls i do it using two methods in python can i make this two functions into one that is to check in one query if my urls already exists in urls and if not insert it there thanks,how to plot the logistic regression line sklearn with multiple variables i have a data set that has rows each row has values and these values determine if that row is a zero or one i am trying to figure out why this is so i am trying to plot the logistic regression line from so i can see why they are classified how they are but i can t figure out how to do this i can t use a scatter plot since there x data has way more value then the label data my question is how would i go about plotting this,0,72,105 can t install python cryptography on cygwin i have installed python cryptogrpahy package v thru cygwin but when i try to install fabric via pip it tries to build it and fails with next error i didn t find rust compiler in cygwin packages and don t want to build it from sources so i want to figure out why installed cryptography package is not recognized by pip,python is there a way to efficiently search for all objects with a particular attribute context i have a script which generates objects of the same class this class is called state for reference each object holds some value and the goal of the objects is to store and move values around the other attributes of the objects are determined by a nested dictionary such that the dictionary would produce objects with the following attributes more information on this process here combination of nested dictionaries with arbitrary lengths in python problem i need to find some way of finding all the objects that have a certain attribute or set of attributes for example all the objects with the attribute self bar baz may need to take on a certain value and self bar qux need to take on some other value one potential solution one solution is to create a separate object from the environment class for reference which is responsible for creating a list of all instantiated objects the simplest solution is append all the objects to a list and then loop through that list checking which objects have a set of attributes however this gets inefficient very quickly especially considering the set of objects is typically much more complex than the example above a slightly more advanced solution is for the environment object to have all possible attributes e g and the values of these attributes are lists containing all objects with these attributes this way there is no need to filter through the list objects and objects with a set of attributes can be filtered by returning the set of objects in two or more lists however i m not sure additional constraints importantly the attributes that state objects have are not fixed that is it may not be foo and bar or baz or qux but may be completely different keys therefore i cannot hardcode the attributes to search for,0,65,320 creating website with button that executes python script my python program uses an input variable a number each day preferably i want to create a simple website with only input field number and a button which then executes the python script is there any easy way to do so i don t have any experience with making websites,error in flask and python sqlite integration alright so i was creating a simple login program for a recent website that i was working on i m using flask to serve my html page templates i m using the sqlite python module for easy usage of modules so i created an app route for my main website for the login pages you can check the code below i run my program and i get no errors at all i open my login page and the page opens without raising an error here s the page look login page but when i submit my form i get an error not in the console but in the webpage itself method not allowed also here s the code for the database file i used to create my database,0,59,135 cards in bokeh python application i am creating a bokeh application in python and was just wondering if there are any equivalence to shiny dashboard info cards for bokeh applications dashboards i can see that there are cards from the dashboard example top of the dashboard on bokeh site but i can t seem to find the code for this anywhere any ideas on how to create cards using python for bokeh applications would be highly appreciated,why does my ide keep saying that my variable can be undefined i am writing a program to calculate the sum of the first n natural numbers but i am having a hard time coding the first part of the program in which i ask for the input from the user about how many successive natural numbers to add it s a very long code for such a simple task because i want the program to be able to ask to try again in case the input isn t a natural number accept mathematical expressions that are equal to a natural number e g to get back to the point why does my ide keep telling me that n can be undefined and if you d be willing to take the time to tell me how to shorten my code that seems a little repetitive i d really appreciate it thank you for your time,0,78,153 i want to get sendtime as an input in smtplib i am coding a program that sends scheduled emails but i require the time in code like this i would like to get this send time as an input from user like,how to get response from blockchain com by using wss in python i try to connect to blockchain com websocket by using this api i use websockets library for python when i connect by using the interactive client method i have a success but when i try to connect by using my python script i have no any response from server socket this is my script this is what i have in terminal when i use interactive client and i expect to see it when i run my script,0,42,87 typeerror sentinelobject object is not callable i am upgrading my django application from version to while upgrading i am facing below issue i have spent a lot of time to resolve this but didn t get any solution yet here s the traceback of issue which i am facing any help would be highly appreciated thanks in advance,python large float arithmetic for el gamal decryption the decryption math formula for the el gamal method is the following specifically in python i want to compute the following equivalent the issue in the above python code is that the numbers inserted would overflow or result in due to precision consider the following example the expected answer for the above example is i ve tried to research a strategy to deal with this problem and found that using python s default pow x y z which differs from math pow can help pow x y z is equivalent to x y z however i cannot use pow x y z i tried to use pow but i cannot multiply the result of pow by to then as a final step mod by in other words instead of x y z i am trying to perform x y a z but there is clearly a parameter limit or number of operations from pow x y z what can i do to compute the math formula in python,0,58,170 optimizing looping in python in list operation i am using the following code for the iteration but if the length is high then this will become time consuming is there any other optimal way to get this done thanks in advance,reverse for account not found account is not a valid view function or pattern name enter image description here enter image description here enter image description here hello can you help me django gives me this error reverse for account not found account is not a valid view function or pattern name inside the photo is a complete explanation,0,40,59 when an object of a class has arguments how do you pass it as an argument of a method in another class this new class cashregister should accept retail object as an argument how do i go about it the class in retail has argument too,convert text file into array so i ve done a bit of researching and use a variety of different methods but nothing seems to work i m trying to have a program read a txt file in my folder then convert into an array so that a different program can call that program and initiate the program of the other below is the current code i have the print is to test and see if the output is true in return however i get it supposed to fill in things like zero guskgu tyran etc note that i m new to python and currently using the most recent version,0,46,108 how can i solve error open venv bin python invalid argument fatal unable to process path venv bin python this problem i create a django project also create a virtual environment which name is venv after complete my task when i upload this in my github account by github desktop it show fetal error which picture is given below how can i solve this,how to read data that has been split into multiple columns i have the following dataframe this data comes from somewhere else and it has been split however the values correspond to a single variable q along with its indices to clarify even though there are many columns they all correspond to one column q plus an index column notice that the starting index of each column is the continuation of the end of the previous column how can i read the data with pandas i believe i can do it by assigning names to each column and then merging them all together but i was looking for a more elegant solution plus the number of columns is not fixed this is the code that i am using at the moment which does not do the trick i would prefer to use pandas to solve this issue but i can also work without it edit at the request of user the following command gives this output,0,59,166 repeating a while loop python so i am trying to make this rock paper scissors game i want to make a while loop that terminates when user input is quit but it doesnt seem to work it either fails to repeat or continues indefinitly any idea why,what is the name given to a value that is inside a variable as someone who just learned the python basics this might be a weird and stupid question but i got confused also please correct me if there s mistake thanks in advance,0,47,43 python pandas pandas correlation one column vs all i m trying to get the correlation between a single column and the rest of the numerical columns of the dataframe but i m stuck i m trying with this but i get the error operands could not be broadcast together with shapes which i assume is because i m trying to find a correlation between a vector my imdb score column with the dataframe of several columns how can this be fixed,how to read write pandas dataframe acrossing multi class in a shared manner i got this problem when i was trying to access pandas dataframe in a shared manner basically there are different classes maintain different aspects of a single dataframe so over all my classes looks like here is what i want do to repeat call bellow lines as a function i expect to see all the print are same after many times calling but i get bellow after times running what i have growed from aclass doesn t apear available from bclass and cclass i have tried with copy deep false it doesnot work,0,76,103 python why is len always return for list not sure why len is returning just as output in python should be output,how to make a good key for a cache when given a list in python how do i make a good key for a cache when i want it to be a list i don t want to just turn the list into a string because that takes too long for example and are too slow also i can t just do because it doesn t work how do i make the key to the cache without any of these,0,26,77 accept a request to subscribe to a private telegram channel via aiogram there is a task to confirm subscription requests in the telegram channel using a bot if anyone knows how to do this through aiogram or telethon,use selenium to get input element value if it isn t in html is there any way to read the text in an input without calling to get it from html in the image i want to get whatever value i can from the input store it then add a number to it but it s not in the html the input just refers to quantity is there some way i could select the input box copy the value then interact with the value from there,0,38,83 trying to create mongodb collection using below two mongodb collection based on id using python trying to create mongodb collection using below two mongodb collection based on id using python mongo collecton abc mongodb collection def compare mongodb collection abc and def based on id and if matches get abc action from abc and other key value pairs from def result,tkinter fullscreen still available after root resizable false false i am trying to make a python application that requires disabling the window resize and fullscreen mode on a mac i used root resizable false false to do the work it does stop the window from resizing but for disabling the fullscreen mode only if you iconify it first and then deiconify it i wonder why and is there a workaround edit found out that adding the window icon caused this problem solution to this is adding root withdraw and root deiconify after putting the icon,0,60,87 valueerror x and y must be the same size linear regression so i m trying to visualize my linear model regression however when i try to run it it giving me a valueerror i have tried different solutions and also looked other at topics with the same problem stacktrace this is the error code i don t now how i really should tackle this problem thanks a lot,pandas limit the number of rows per class i currently have a pandas dataframe with columns index classname filepath each row is a different image file i want to limit the max number of each class allowed in then apply function to limit to per class,0,67,47 how do i open a link in a new tab using playwright i need to collect all the links from the page open each one alternately in a new tab collect data from the page and close the tab in selenium i would do something similar to this how to implement this functionality in playwright,getting a typeerror not supported between instances of nonetype and int i am a python beginner and i do not understand the error i am getting for this code i am trying to find an x value equal to or as close to mm m as possible using the bisector method this is my error if z typeerror not supported between instances of nonetype and int code or the other error is the code prints nothing if i use the while loop within the def dispcalc function,0,55,90 do special functions get called every time i create an object just like the init method do the other special functions get called automatically when i create an object check out this simple class for example is the str method called automatically when i create a new object,python get and set methods versus property decorator i am exploring decorators in python and as a person who came to python from other languages i am a bit confused about the purpose of property and its xxx setter brother in java and c get xxx and set xxx are usually the way to organize encapsulation in python we have these two decorators which require specific syntax and name matching in order to work how is property better than get set methods i have checked this post and still what are the advantages of property besides the availability of the operator,0,48,98 w dw vs w w dw in torch i discovered a torch behavior by accident today that w w dw does not strictly equal to w dw simple example attached below which outputs expected however if i replace w dw as w w dw it will say that gradient is no longer attached i am curious what might have caused this,uuid not accepted as id in mongodb i am trying to use a uuid as the id of my objects in mongodb the id is generated based on an email when i save the document to the db i get a typeerror saying that i ve also tried this which also gives me a type error looking at this page made me believe that this should be possible,0,70,68 requests exceptions missingschema invalid url no schema supplied full code is stated above full output is stated below i have never ever seen an image link like only with backslashes not this and bs recommends me to use that and i dont know how to solve this error typically followed automate the boring stuff with python book same code as from that book but shoots this error when i try to scrape the site thanks for any help,how to format variable in template as currency i am trying to format a string in a template to display as a currency object cost would i be able to do something like f format object cost in the template,0,79,40 how to generate a environments yml file of a python virtual environment i want to generate a environments yml file of an existing python environment i tried the following command this throws the following error note this is not a conda environment,how can we split an xml with lxml i am looking for a good way to split the following xml into pieces in this occasion two and i am experimenting with the code below but it does not seem very elegant are there better ways to achieve this many thanks in advance for your help,0,40,55 update label text periodically from within function the code below opens a tkinter window with a label showing and when the button is pressed after seconds the label shows instead i am trying to make the label update periodically displaying the numbers through every seconds instead of just and thank you in advance,regex to capture word with at least one number in it i m almost done with all my regex stuff but i encounter another problem i have this regex it captures all stuff i need as and it works but sometimes it has a strange behaviour as far as i understood regex i m noob p my regex is supposed to capture things that contains at least one digit but on this string the output will be i don t understand why buffing and machine are captured o if someone could help me understand this thanks,0,61,100 splitting a text file with hangman drawings to a list i need to split this text file which contains the different segments of a hangman to separate drawings and store it in a list which must be returned by the function and stored in a variable so that i can use it in the main program when the user gets a word correct or incorrect i tried str split and others but nothing seems to work,if elif and else ask only for strings continue the loop if the user enters a number i have been wondering this for a longer time if i check for user input i know how to check for strings but what if i want to check if the user has entered just integers or floats i tried it with an if name int or float block but of course that didn t work can you help me out how do i check for that here is my code of course the input i always converted to a string so i don t know how to do that i also tried this,0,75,111 i can t setup python my computer windows bit one or more issues caused the setup to fail please fix the issues and then retry setup for more inforation see the log file at least windows or windows server are required to install python bit,import csv adding a header with pandas i m importing a csv without a header and i m trying to tweak my script so that a header is included during load in addition to including the header can i define the field types the layout of the file i m importing header and types any ideas for implementation,0,47,55 saving images in a loop faster than multithreading multiprocessing here s a timed example of multiple image arrays of different sizes being saved in a loop as well as concurrently using threads processes and i get these durations on my i mbp aren t threads processes expected to require less time to achieve the same thing and why not in this case,python merge two columns based on condition i have the following dataframe with two columns department and project i want to replace the department entry by the project entry if the project entry is not empty so the dataframe looks like that how can i do this,0,63,47 how to request multiple file in fastapi i have a functionality where i need the user to upload multiple files images the length of the requested files can be dynamic as of now this is the body that i was requesting but i know this is not the ideal way,i want to loop this and everytime it loops i want so it prints untill infinite but it prints what am i doing wrong i want to loop this and everytime it loops i want so it prints untill infinite but it prints what am i doing wrong code,0,49,76 concatenate variable in athena sql query from python lambda function i have a python lambda function that creates a sql table in athena how do i properly concatenate variables in my query when i set the location value i receive the error response below the function runs successfully if i hard code the location value error response lambda function thank you,dictionary append another dictionary to specific key i have a dictionary i would like to append to another dictionary s highseverity key however when i run this last line it gives me an error of what i m looking to do is append the value of vuln a dictionary to the dictionary key vulnsbyseverity highseverity but getting that error note this dictionary vulnsbyseverity will have more than vuln that i m attempting to append to the highseverity key,0,61,75 how do i move both files and folders to the specified directory there is a code that moves files from one directory to another but it doesn t move folders how to make it move both files and folders to the specified directory,how can i iterate through a list of songs and play them one after eachother i am looking to iterate through a list of songs such as songs song mp song mp song mp and i want to play each song one after each other i have tried various methods the most suggested seemed to use pygame however i have not been able to debug the tremendous amount of errors that come with using it my main source code and attempt at this is as shown below upon running this i receive error pygame error modplug load failed i am running this concurrently inside of a slideshow program i have i want this code to run as background music and i plan on checking for the end of the song in a function i already have set,0,42,133 how to calculate different passwords formed lower case english letters in python use python to calculate how many different passwords can be formed with lower case english letters for a letter password there would be possibilities for a letter password each letter is independent of the other so there would be times possibilities using this information print the amount of possible passwords that can be formed with letters,how can i create a merged cell with a word in it in python i would like to create a merged cell in an excel document with a word in it the function would ideally take as an input arguments start row start col finish row finish col and word this function would edit the document such that i have a merged cell in the range given to the function an example usage in this example i would get a tralala word from column c to column e from row to row,0,76,90 changing a label s text is not working properly on transparent widgets this seems like a bug but i wanted to confirm before reporting it i am trying to update a label s text on a transparent widget but for some reason the previous text is partially visible see screenshot below did any one face this issue before is there any known workarounds system specs macos monterey and python screenshot,copy the data from specific files and pate it in master file on a specific sheet i have a folder on my pc which i clean every monday and download new attachments file in total for previous month current month and next month from outlook i have code for that i have one master excel file with sheet january february march december the files i download from outlook has same names as sheet name in master file what i would like to do is this i want to take a data from each outlook file and paste it on corresponding sheet so if i have a file called december xlsb i want to take all the data from sheet and paste it in master file on sheet name december master file and outlook attachments are in different directory preferably i would like to do it with pandas but i welcome to other solutions too im not really sure how should i do or from where should i start for sure i will need for loop and os listdir i guess any help is appreciated,0,70,182 how to extract longitude and langitude from keys i have the following setup for my data frame now i am trying to arrive at having place id lat and lng in columns my code is but unfortunately nothing is happening i have still my core column including the entire geometry,pyspark sql utils analysisexception no such struct field element error when flattening pyspark dataframes suppose we have a pyspark dataframe df with the following schema also suppose we have the following flattening method when i run the flatten method on df i get the following error i am not sure why i am getting this error because this method has worked successfully on other nested pyspark dataframes it is supposed to return a dictionary of flattened pyspark dataframes,0,49,76 extract row from a data frame and make it a new data frame and change its index as like column value i have a data frame df like this now i need first row of data frame and make it another data frame df like but my output come like,use namedtuple instead of tuple with typing optional how can i use namedtuple with typing optional instead of this tuple i want to to call the function in the format of result final power stats min max none thank you i tried with stats namedtuple stats optional int optional int,0,50,42 text keeps blinking in pygame so i am making a code where there is a character a rectangle and and balloon a circle and the character has to catch the balloons before it hits the ground everything worked fine until i tried making the game look a little better and used the blit function to add an image for some reason my text keeps buffering now code,django django filters in a class based views i ask you if you know how put this filters in this class view i used to build my applications using function based views and this is my first time use class based views any idea,0,65,42 importing from cousin module in python i have the following structure and in db py i have something that looks like this i want to be able to use value inside of route a py and also inside of other functions in db py what s the best way to do this,pybind send mpi communicator from python to cpp i have a c class which i intend to call from python s mpi py interface such that each node spawns the class on the c side i m using the open mpi library installed via homebrew and pybind the c class is as follows and here s the python interface spawning the same c i ve already tried sharing an mpi communicator using pybind but i m stuck at a long unhelpful error full message the error points to def set comm somecomputation set comm what is the cause of these errors and how should they be resolved update added answer below by using custom type caster as explained in this answer but is it the only way to go about it,0,47,121 extract tar gz some integer in python i am trying to extract a file name with this format filename tar gz i have tried mutpile wayd but for all of them i get the error that is unknow format it works fine for files ends with tar gz i tried to change the name but still does not work here are what i have tried another way is thanks for your help in advance,regular tensorflow ops not supported by the interpreter error during inference i am currently trying to convert a saved model trained using tensorflow v and keras to a tensorflow lite model the structure of the model is the following the model conversion performed using the following code fragment succeeds meaning no error is thrown and the converted model is written to the output file however when trying to perform an inference on a dummy test input tensor consisting of a single element of the desired shape therefore using the following code the last instruction returns the following error if instead i remove the support to select tf ops during the conversion the following error arises do you have any idea on why this is happening am i missing some steps or did i encounter a layer which is currently not yet supported by tensorflow lite without recognising it thank you in advance for your help python version tensorflow version used both for training and conversion,0,69,166 create a column comment in python source file hello i want to create a comment section right next to all my code lines for documentation purposes i have over lines of code and i don t want to place all the by myself the result i want to achieve is there a way to do this automaticly,how should i correctly handle an api timeout in python background i am writing a py script that calls an api saves the response as a json file and performs various other tasks before saving the response to a xlsx file issue the api i am calling is very unreliable especially as it s a get response with c rows of data as demonstrated by the following intermittent timeout errors in the empty json file which should contain the response function that calls the api objective proposed solution i would like my script to continue to call the api until successful successful no errors the only real solution i can think of is to implement a while loop in my script s function which makes the api call where i am stuck is how i would define the condition to be met in order that the script ends and doesn t get stuck in a infinite loop,0,58,157 keyerror after re running the same code a keyerror is returned when i try to run the below code my dataframe has the following columns i know that there are many questions on the keyerror name but what was weird is that without changing anything this error appeared while running the code but previously i could run the code with no errors nothing has changed any help on this would be great traceback,finding previous group s name in pandas dataframe i want to add a column to my dataframe with repetitive values which contains the name of previous group float and sortable any idea before after,0,72,33 python pandas pandas correlation one column vs all i m trying to get the correlation between a single column and the rest of the numerical columns of the dataframe but i m stuck i m trying with this but i get the error operands could not be broadcast together with shapes which i assume is because i m trying to find a correlation between a vector my imdb score column with the dataframe of several columns how can this be fixed,scrapy script that was supposed to scrape pdf doc files is not working properly i am trying to implement a similar script on my project following this blog post here the code of the spider class from the source my current python is and my os is windows and the error that it returns when trying to execute as a scrapy crawler i have installed all the mentioned pip packages on the blog post and i think its happening due to some error on the antiword module but it also did install successfully as a pip package please help me troubleshoot,0,76,104 how can i apply base html file for extending to every template in django is there a way to extend base html file in python django by default i want it because i am overwriting extends tag in every html file,reshape dataframe using pandas melt to get two value columns my data is in the following format i would like to reshape the dataframe using melt or similar functions with two output value columns any ideas on how to do this without splitting the input array,0,41,46 why does this not work when n gets to i wanted to write a program that tried to look for these primes i have run it a few times and when n gets to it does not have an output in over hours is this just because it will take a while or because something is wrong with it here is my code credit for the isprime function,seperate array into three new arrays using inequalities in python i am trying to split an array into three new arrays using inequalities this will give you an idea of what i am trying to achieve intended output,0,72,38 unable to remove empty keys in a python list i have a python list like this and i want to remove empty keys when i receive some null value in my exemple i need to remove all third block because the actual vl this is my code and it s only removing actual vl but i need to remove third block this is my code but as result i keep getting all fiels,how to display data of relative foreign key in django html page i saw may answer but i don t know why in my page its not working can anyone help me to find the mistake model views py after importing all school html i wanna display multiple image of school i have inlined in admin how we can get all the images that foreign key to schoolmodel,0,73,64 i having fields but i need to search by username in search field how we can do it in django application in my application there are fields like phone username address id but i need only details of username field when i search it in search box how we can do this can anyone help me with django code,matplotlib background matches vscode theme on dark mode and can t see axis i just got a new pc and downloaded visual studio code i m trying to run the exact same plots as the code i had on my other pc just plt plot losses but now matplotlib seems to have a dark background instead of white i found this and this that had opposite problems to clarify i m asking how to change the matplotlib background plots to white note that in my other machine i didn t have to hard code any matplotlib background information so i think it s a visual studio problem but couldn t figure it out,0,61,105 how to use on ready from discord py hello i have trouble using the api discord py i try to display in the console the message received but every time the function on reday returns no message,why does my ide keep saying that my variable can be undefined i am writing a program to calculate the sum of the first n natural numbers but i am having a hard time coding the first part of the program in which i ask for the input from the user about how many successive natural numbers to add it s a very long code for such a simple task because i want the program to be able to ask to try again in case the input isn t a natural number accept mathematical expressions that are equal to a natural number e g to get back to the point why does my ide keep telling me that n can be undefined and if you d be willing to take the time to tell me how to shorten my code that seems a little repetitive i d really appreciate it thank you for your time,0,33,153 python difference between string formatting long story short can someone explain it to me how is it that be simple line of code can do the same as all of the for loop written by me here s my solution,apply function across pandas dataframe kruskal wallice i have a dataframe df and can t seem to apply this function across columns for each row i keep getting df desired output obviously i made the p values up,0,39,35 combing lists into list in python i have these lists in python i would like would to create a new list like this how do i do this in python,pandas dataframe sequentially compare cells to a numeric value and then update the value once a condition is met ive got this dataframe id like compare the price cells to a value dataframe price loc and then record when the price does not equal this value by entering the price under a new column range this price would also then become the value that is used to assess subsequent prices against in the same manner as before this is my attempt however the value doesnt seem to update from its original definition dataframe range loc dataframe range last valid index seems to only refer to dataframe price loc relatively inexperienced with python pandas so thanks in advance for your time and any help comments,0,30,115 why is switch to window method not working for selenium webdriver in python i am trying to switch to a newly opened window using the python selenium webdriver the code worked fine before but now it is showing error surprisingly the switch to window method is not being recognized by python and has no declaration to go to error details,after upgrading to google chrome to version shadow root element search does not work after upgrading to google chrome to version shadow root element search does not work in version everything worked fine error i will be grateful for any help,0,56,42 does anyone know why exactly i get this error in my python code and how to correct it when i run the code below i get this error here s the code,how to calculate the total duration for two certain date time in a csv file could occur multiple times by using python i am working on one sample csv file regarding the logs info from one vending machine pretty new to the pandas every day there will be someone to reload the drinks to the machine by scanning the qr code on the bottle i need to solve the below question q what s the total duration to reload all of the drinks to the machine you can find my sample code and sample csv file below info regarding the type of each column df dtypes below are my thoughts to solve the problem there will be many event statuses but i only need to focus on event qc scan and value columns entered or exited due there might be a value error so for each loading bottle duration is equal to then loop through the whole data frame and sum the each duration save the duration as new column name as duration units in mins eventually save as a new csv file contains the duration info but i am not sure how to write a for loop within the csv file and using python pandas can someone please provide me with a sample code,0,31,214 store json data to json file and save them in the csv file i tried this way but did not work but this problem occurs i want to convert from json to csv an example of what i want please tell me if this is possible,how to convert string from variable in table for csv export i am an absolute beginner with python the title probably says it already i usually look for the answers with googling but here i don t even know what term to look for i have a long string in a variable which i suppose will be easily converted to a table only i can t figure out how to do it myself this is my example this is the output now how can i convert this to export it to a csv or what keywords do i have to search for,0,47,98 keyerror during handling of the above exception another exception occurred i have this error adding this line brings up this error i think that it s a data type problem data df id cont data df apply lambda row row product name row hour shift strftime y m d h m s axis hour shift is a datetime and product name equipment are object,django not showing images in editor error i m try create post and add to this post images and i m use for this django summernote in django picture upload to folder on hard disk but not showing in editor console show error please give me advice how to fix it thank you settings py urls py models py screenshot from console,0,45,59 im trying to copy array but both of them has the same link im using python my code is both of the variables are now but i dont want to apply changes to variable a what should i do ive tried to use the c b statement but it didnt help,amazon pay sdk python createbuttonsignature i m integrating amazon pay sdk python for the web i have done reading all documentation of amazon pay but i didn t get any idea about how to give or create a button signature in frontend backend code here is my code of frontend to create a button of amazon pay one time checkout if anyone implemented this give your valuable answer,0,54,55 joining two dataframes in with pandas if one column matches a set of other columns i am trying to join merge two pandas dataframes but want to join rows if one column matches any of a set of columns on the second frame example with two columns i have eight in my real set multiple matches are not possible for my data df df desired output,selenium next pages with javascript throwing elementclickinterceptedexception error my code is working fine but the pagination portion throwing the following exception your help is much appreciate script,0,67,27 find the coordinates of the triangle containing the largest number of points so basically we have a list of x and y coordinate of points and we need to build a triangle that will contain the largest number of points from this list i can check if this point is in the triangle area or not,displaying list values in a dictionary i want to create a dictionary where the key is the athletes first and last name stored as a tuple and the value is a list containing the athletes country and finishing time in hours minutes and seconds in a tuple as shown below i managed to display the name and surname since it is in a tuple by creating a simple for loop but i have no idea how can i display the list part is there a similar way to print list of items in a dictionary,0,56,95 keyerror class main node python first im really sorry for not so good at english in the method search doesnt work i know x key and key both has a same value but it cant pass the if function so i try the type of x key and key key has a int type x key has class main node help plase with soulution and explanation i want function s remove s search to work i approciate your help,how to write commands in second cmd using the first cmd so i have a python file which i will run using vscode and then it should execute another python script in the background and should display output in new command prompt this was quite helpful but when i execute venv scripts activate bat to open the virtual environment i get stuck and cannot execute further commands i know since its virtual environment we cannot communicate to it directly but is there a way workaround to be able to execute commands even in the virtual environment,0,71,92 how to get something from a webpage with python this page has a url aaab bcccdd and aabb ccddee both are the tokens i want to get the first token in the page with python my python code please help me,message default backend selenium python i m trying to start a selenium application with python via webdriver remote like they recomends on documentation but when i run the code below i get the following error message my code is here i ve already tried to remove the options and use only the recommended code as below but i got the same problem,0,44,62 pandas read sql query with comprehension in params i m trying to do a sql query with pandas i have params initial date final date and trader where trader is a list my query looks like this in my params i m trying to do some like this but i have been receiving this in my ide visual studio code can someone help me to fix this,typeerror add takes exactly positional arguments given why i am getting this error can anyone tell please or explain me how to use it using simple example in below link,0,65,33 scrapy image pipeline object has no attribute spiderinfo error i just met an issue with scrupy image pipeline the background is i just want to download some pics for testing purpose with scrupy image pipeline but after the code composed i met an error when i run the script error message command to run the script scrapy crawl picspider scrupy version scrapy here s the code below,python check if any of lists is not empty and if not do something with corresponding folder that is linked to that list so here i am trying to optimize some code i have code checks if any of lists is empty and if it is not corresponding folder that is linked to that list will be saved in external program so to make it more clear this is code so basically we will in this way keep in keep list only names that are linked to lists that are not empty what do you suggest any algorithm that can optimize this since now when i have only four lists it is easy to manually check it this way but better solution is needed please advice thanks salute,0,67,129 stemming words in a list python nltk i feel like i m doing something really stupid here i am trying to stem words i have in a list but it is not giving me the intended outcome my code is and the ouput i get is as opposed to i feel like i m doing something very silly with my list but could anyone enlighten me what i m doing wrong,webscrape getting the href at the end of each row of this page there is a view posters link that contains a url the first one i have pulled in my code pulls fine as ur i am not sure how to pull the view poster url,0,68,47 selenium useragent i want to open google using the following code is working but i don t understand following line why mozilla and mac os x is there a shorter version with just the standard code,create plotly distplot charts in plotly express i m trying to create a figure like a plotly create distplot however i d like to change the line style to dashed lines looking into the function i see that they say that the function is deprecated and i should use plotly express functions instead however i can t find anything in plotly express examples that shows how to create something like the distplot all of the examples on the plotly website still use create distplot i m fine with using the deprecated function except that i d like to adjust the line style to have a dashed line and i don t see any way to change the line settings only the colors specifically i m looking to take histogram data and create a line and rug plot where the line shows the distribution curve like in the example below can someone please help me figure out how to do this in plotly express or at least how to change the line style of the distplot here is the plotly reference i m using,0,35,171 azure ml studio container has crashed did your init method fail i am trying to deploy an ml model through the azure ml studio using the notebook itself the commands we are using can be found here we have registered the model as below but while running this command we are getting the error that container has crashed did your init method fail the logs are the init method is,call a method in map and lambda using dictionary as input in python without using lambda and map i tried below line to iterate using lambda and map expected output using map and lambda,0,71,34 hi is there a way to write this code more briefly and avoid repeating if i am beginner c users lenovo pictures untitled practice py pycharm png,how to remove t character when reading dataframe from txt file i have a small lab with pandas so i would like to import the data from the txt file my data is like below i write the code below to create df however what i got from the df included t character can you please help remove it once importing data from the txt file this is what i saw from jupyter lab,0,24,74 is there anyway to write latex algorithm in sphinx doc i want to write algorithm in latex in sphinx doc is there anyway to do so,generate pandas dataframe column from list of lists of indexes using list comprehension here is the function i wrote to apply to each row of a df here is df when using i want to get however i get error adding to df col solves the problem but how should i rewrite use list of list of indexes function to be able to apply it to the whole column,0,24,64 when i am fetching the data of students by city in tkinter it s only show last value as i mention i want to print data of student who s belong from city but in label it only shows one data and terminal shows all the data i am using for loop to print data here is text file expected outcome if selected surat then,get the total value per month in python dictionary where key is datetime object and value is list of numbers i have a python dictionary where my key is a datetime object and my values are a list of numbers it looks like this i m trying to get the total values per month based on the key so if the key includes as month then september will have values i m relatively new to python and unsure on what would be the best approach for this so far i have come up with something like this but i think i m approaching it wrong the dictionary,0,63,106 want to create a tab delimited file with autonumbers i would like to create a tab delimited file with python and add autonumbering to in first column and in second column i try to create variables and don t know how to add the leading zero s part also writing the variables gives a error message,why the string in unicode form is not equal to its unicode code point value we can get the string s unicode code point value why the string in unicode form is not equal to its unicode code point value,0,68,40 what data types can be exported as attributes when exporting to graphml with networkx i have a networkx graph with some list and dict attributes that the function nx write graphml doesn t accept as valid type for the export i couldn t find a function that would automatically ignore those attributes so i decided to create one myself i know that int float and string are accepted but i don t know if there are others and if so which ones,splitting a column with more than one kind of separators i m working with a dataset which one of the columns i need to split into three other columns this column is like this than i tried to split it in the x like the code i used below but when i checked the value counts from the new column it showed me that there is other separator besides the x see like some rows have three values separated by so i d like to create these new columns and know if it is possible and if how to split using more than one separator,0,77,104 python icalendar rrule until property raising error i m trying to use the rrule function to make an event recur every monday and wednesday until a specific date however i m not sure how to specify the end date for the until property this is the error i m getting valueerror you must use datetime date timedelta time or tuple for periods,error in rule configure veins vlc configure veins protobuf my question is regarding veins gym the dependencies highlighted at the beginning of that file work well however i receive an error when running snakemake jall here is a log file i believe that the error is in the command env becasue in the command prompt i also get env is not recognized as an internal or external command operable program or batch file i could probably change it to the command mentioned here however i cannot find the source file where this command is called i use windows bit python veins gym gym omnetpp sumo veins protoc any advice on how to tackle this problem is very appreciated thanks,0,59,121 adding the last position of an array to the same array in matlab one can do how can i replicate this in python,why stripe gives me this error every few hours network error connectionerror i receive the following error every few hours why i think this is related to stripe payment during handling of the above error some other errors occur stack overflow keeps saying that my post is mostly code and i should add more explanation so i keep repeating this sentence stack overflow keeps saying that my post is mostly code and i should add more explanation so i keep repeating this sentence,0,23,81 retrieve indices of certain value in a matrix and put it in a nested list i have this matrix let s say there are hundreds of x value and thousands of y lists inside this matrix how will i be able to retrieve the index of value and put it in a nested list here is the sample output,fitting a datetime datetime format with curve fit i have the code below my problem is in the format datetime datetime i can t fit it using a gaussian function this is the result of execution it traceback most recent call last file datetime fit py line in parameters covariance curve fit fun time temperature file home lhoussine anaconda lib python site packages scipy optimize minpack py line in curve fit xdata np asarray chkfinite xdata float file home lhoussine anaconda lib python site packages numpy lib function base py line in asarray chkfinite a asarray a dtype dtype order order typeerror float argument must be a string or a number not datetime datetime,0,60,83 numpy use sets as rows and columns of matrix i have arrays has countries has dates the other has a data structure like so country date otherfield i need to make a matrix with countries as rows dates as columns and otherfield as the corresponding value for each row and column and i was wondering if there is a cool way to use numpy to do this expected output should be something like this,how to send request disconnect from server to all clients and server still live python socket when i disconnect all clients in server server doesn t continue live how can i do for living server import socket threading tkinter server clients thank you,0,78,42 how do i convert this json to dataframe i have a json that i am struggling to convert into a python dataframe the json takes the following form ultimately i want to achieve the following table i have tried pd read json but i always get an error mixing dicts with non series may lead to ambiguous ordering,issue when trying to apply format to date column pandas i am trying to set date format to a pandas dataframe column however i get this error why i cannot format this date column to day month year format,0,55,37 how can i store results from a loop in a dataframe i have the following loop creating kpi values for each of my subsets is there a way to store this in a nice table something like this with the sku value and sku scaled in the columns edit code used to create kpi function,python how can i print an alphabet from a list given a number given a number from to i m trying to return an alphabet in the corresponding position from a list example i have tried the following as expected that returns a type error because there are no integer values in my list what can i do to return an element from my list in which its position is equal to the users number input,0,56,77 replacing all but one type of character in a string python the desired output of this code would have been l ll but it was l ll an l ll an lilli n lillia sorry about this i m not the best at code but i d appreciate a solution thanks,what does a mean in python array what is the meaning of in a python array the code below is what it was written like please help me,0,43,31 execute df grep w not parsing output correctly i am trying to run the shell command df h grep w using python to watch the root partition usage and wanted to avoid shell true option for security the code i tried as follows the output i get is expected output is,extract data from api and store the records in a pandas dataframe i am looking at the following website and they have the following example for extracting data using their api this produces the following out of which i want to extract only the records bit out of the output and into a more readable format ideally i want this data in a pandas data frame records bunker type marine gas oil bunker sales id month bunker type marine diesel oil bunker sales id month bunker type marine fuel oil cst bunker sales id month bunker type marine fuel oil cst bunker sales id month bunker type marine fuel oil cst bunker sales id month in the format as below how could i go about extracting this data,0,54,138 pandas split column of unequal length list into multiple columns in python i have a list of codes in one column his name course code that i would like to put each code is a new column can you guys please give me some guidance how to do that thanks,importerror dlopen apple silicon i am new to python i was trying to import some libraries but i get this error in vs code when i run the same thing on pycharm ce it doesn t even recognize the module cv i know i have installed opencv python but the issue still persists i tried searching for this error but didn t find any working solution is this something which can t be solved now due to the architecture as i got a mach o file but is an incompatible architecture have x need arm e error in there too i am using m mac monterey on a side node if this issue is unresolved can anyone please point out any alternative for this like would google colab be fine,0,50,125 python define function to get the weighted median i have the following dataframe i have defined the following function however when i call the function wmedian df i get an error keyerror close the outcome i am trying to get is what is missing in my function i don t understand why i m getting that error,django turn settings debug to true for testing swagger endpint i have this test for checking if i can ping the swagger endpoint so this test fails because i only have swagger added to url when settings debug true i thought override settings debug true would fix that but it doesn t my test passes when i manually set settings debug true under my settings py file otherwise it throws an error because it can t find the endpoint i ve tried decorating both the class and the function with override settings and in both cases it threw the error because it couldn t find the endpoint i m not particularly attached to this way of testing to see if swagger is working this test is just to check if swagger isn t returning an error regarding annotation if anyone knows a better way to test this i m open to that i ve also tried but that also gives django urls exceptions noreversematch reverse for swagger not found swagger is not a valid view function or pattern name it only works when i set test init py,0,54,166 python text color is not working in cmd but it is working in windows terminal i m just working on a fun project to produce color in the console in the windows terminal it is working fine however in cmd it is not could you please help me windows terminal command prompt thank you,python bool compare vs string compare which is faster i need to process a very large csv file during the process the first line needs some special attention so the obvious code would be to check for the value in the csv line but that means a string compare for every line around another option would be to set a boolean and let the boolean compare come first in an or expression both options are below i ve checked that in an or expression the second part is not evaluated when the first part is true the boolean is initialized just above the for loop and set in the if statement when the extra processing is done the question is is the second option with the bool compare significantly faster no need to convert to so different question than,0,53,135 python round to remove trailing zeros the code below is used to find the x using gradient descent and the problem here is that the final result of req is and when i round it it results in how can i round to get or instead without using any other module,apache kafka setup consumer error json decoder error extra data line column char the consumer bin kafka console consumer sh bootstrap server kafka topic my topic works and i can see the logs as t z ts uid ciaup fxwzqyssoh id orig h fe f eff fef a id orig p id resp h ff fb id resp p proto udp service dns duration orig bytes resp bytes conn state s missed bytes history d orig pkts orig ip bytes resp pkts resp ip bytes however with the consumer code listed below i am getting json decoder error extra data line column char which seems to be an easy error related to parsing the data which has each log starting with the date time as shown above meaning the consumer gets the first log but cannot parse it easy enough yet it seems i cannot get around it as this is part of the kafkaconsumer object if anyone can give a hint or show how to do it it would be great thanks and regards m,0,55,126 is there anyway to write latex algorithm in sphinx doc i want to write algorithm in latex in sphinx doc is there anyway to do so,extracting text in between certain text tags in python so let s say i have a piece of text note this is a file i m reading in so it isn t actually commented out in the code and i want to extract the elements just before the square brackets for example in this piece of text i would like customer service and technical service is there any cool way to got about doing this using some application of regex because i m stumped at the moment,0,24,82 loop to match dictionary keys from list append dictionary with associated data in other columns i want to loop through my data and population my dictonairies with event value and their corresponding xcordadjusted and ycordadjusted dataframe my work output,filter dataframe based on differnce between multiple columns i am working on the following dataframe df i need to keep only that name where any val column increase by more than from the previous val column if one column increases by less than from the previous column or doesn t even increase we need to drop that name desired output what would be the smartest way of doing it any suggestions would be appreciated thanks,0,39,76 json serialization of dictionary with complex objects i am trying to serialize the dictionary playerselo for saving loading it as from json but as it s not a serializable object and i can t find a way to do it,running two tensorflow trainings in parallel using joblib and dask i have the following code that runs two tensorflow trainings in parallel using dask workers implemented in docker containers i need to launch two processes using the same dask client where each will train their respective models with n workers to that end i do the following the problem is that i don t know if the entire process is thread safe are there any concurrency elements that i m missing,0,36,79 i cannot import a module into python i m taking a django course and when i go to put urls it s causing this problem code folder structure,command not found discord bot so i am making a discord bot with multiple command but only the one on top seems to work i would really appreciate it if you could tell me what is wrong,0,26,37 raise an error but the type is valid what to do this is the init of the class those the values and it raises the error what s the problem,is it possible to close a browser then reopen it in selenium to reset cache i m trying to close the browser then reopen it without getting any errors i tried doing driver close then webdriver chrome executable path driver path options option to reopen it but it brings up selenium common exceptions invalidsessionidexception message invalid session id if you re wondering why i want to do this i m tyring to clear all cache and cookies i thought maybe delete all cookies might work but it doesn t you should be able to recreative everything with this this is the error,0,29,86 how to merge rows inside a dataframe in python i want to merge this dataframe so that the rows gets merged with the highest value from each of the columns and there are more similar inputs like this where each four of them has the same session name the output i want the blank space in row indicates empty string i don t know what code to write to get my desired output,how to create a score counter where scores add for every second i d like to add special score counter to my game can finish when player get for example scores and player will win however i absolutely don t know how to realize it what do i have to do probably i have to use pygame userevent,0,75,58 unable to handle empty td value in web scraping i am scraping a wiki page but there are some empty td elements in some rows therefore i used to store those rows element in a list but when i print row list those rows list with empty td value which should now have append na value those are still empty i e na have not appended in list how could i fix this,python subprocess permissionerror when i try to execute a file which is located inside the program files directory i get a permissionerror execption excat error code,0,71,26 how to do exponential curve fitting in python i ve tried to resolve this code i do not understand why the generated red lines are not located in their respective dot graphs i have an exponential function evaluated for each one who can help me solve this code i would like to generate a correct regression for each graph with its regression points and lines respectively thank you all,how to solve python error typeerror init takes exactly arguments given i am new to python can someone please help me to solve this error my code is as following i am getting this error i am using python in linux,0,68,44 import packages with dependency of local modules in python i am trying to understand how to import a module from a package from another folder in python considering that this module imports a local module say i have the following structure say i want to use the method f print loca in b py currently running b prompts me how could i fix this import error below is what i have b py context py d py f py thank you,how to implement string in python class i m working on a problem called employee class and mostly thru it but it s not printing what i want this is my program and this is the file with my class in it i know i need to implement a string but i m stuck,0,74,51 extract a dict cell and transform expand a dict cell into multiple rows i have a table with a dataset something like the following its cols and rows the order of the records in the names dictionary cell is important there can be more than of each title i would like to do the following tasks,function view throws an exception of unboundlocalerror at group share when a user tries share a post what could possibly be the course of this exception unboundlocalerror at group share when i try sharing post of another user in a group the exception trace seems to be on the the first line of the forloop new new post video add img here is my view for users to share post here is my model post,0,60,71 problems with pandas ta indicators rsi i try to put por trading strategy when rsi if and if the previous period if raise this error cannot perform rand with a dtyped float array and scalar of type bool,python does a variable inside the for loop get created only once or once per iteration in the following for loop how many times is x created i e how many times is a new piece of memory allocated only once or once per iteration i m assuming it s the former but i d like to be sure,0,43,57 why getting blank list after using filter and map function program to map and filter to make a list whose elements are cubes of even numbers function for even number to use in filter,cplex with student edition on google colab i have google colab but i get the warning for using cplex and docplex i want to use google colab and i have the student version license already for cplex how can i link my google colab with this do i need to be running to local run time can someone show the steps to linking google colab to the student license cplex i have on my pc thanks,0,34,77 create a custom signal filter in python scipy i am trying to implement the following filter using python and scipy i already know how to implement basic filter like this however the filter at hand is much more complex and i don t know how to attack the problem thanks,pairing parameterisation and fixtures in pytest i have a python package that checks the formatting of data stored in excel files there are various different sheets to check with different formats and in my pytest setup i have some example files that are expected to throw different kinds of errors or pass because these files are reused across multiple tests i have them as a fixture in conftest py what i want to be able to do is to use this fixture in different tests but specify what the expected values are for a particular test as parameterisation to the test to keep the information for a test together with the test for a toy example as it stands that repeats each parameterisation for each fixture param value good with row good with row bad with row etc what i want to be able to do is to pair the fixture and parameterisation so that the first set of examples is checked using good and the second set using bad is there a simple way,0,50,177 typeerror can t round symbolic expression i wrote a function that computes the value of the derivative when passing arguments but when passing a function with abs the results are symbols instead of floats however the result i need to round to decimal places and i can t figure out how to fix it,filesize of dockerimage doubles with different python version as baseimage i build dockerimages for a jupyterlab with some apt and pip packages the filesize of the images differs quite much i only took a another python version here are the dockerfiles for comparison this dockerfile is build with python as baseimage this is the one with python as baseimage the wheels folder and some other files are deleted in both cases why is there such a big difference in filesize,0,53,82 simplify writing if else collection of django queries i have code in a django views py that looks like when it comes to writing views is there a more accepted concise way of avoiding repitition while still maintaining readability and extensibility or do views py files tend to look like this or are dispatch tables more common,centering a dcc input field in plotly dash i am trying to center a dcc input text field to the middle of the screen however the solutions found here plotly dash center dcc input text field nor the page has proven to fix the problem my code is ive tried the textalign center as well which works for the html h element above the input bar any ideas see the picture below for reference for what exactly i would like to happen,0,53,78 unexpected requests exceptions connectionerror i was trying to run this code but a big error has raised i tried to ping this host but failed and google didn t give useful advice could you please tell me why and how to deal with it thanks a lot i have also asked this question on github at,python vlc switching playback media between launches i m trying to set up a system where my start screen video loops until of buttons is pressed gpio buttons then the playback changes to either a video with subtitles or no subtitles once that has finished its play through it reverts back to the splash screen video i have additional tickers in here just to count the number of play throughs per day for analytics my test device also only has button hooked up which is why gpio is never used implementation will be identical to gpio s so once one is working the other won t be hard to match up when i launch the script the media played is not always splash the script also closes the window at the end of playback and opens a new one to play the media i believe this may be due to not establishing an xwindow for raspberry pi any advice,0,54,156 resize treeview widget in tkinter i m new to tkinter gui framework of python i have a doubt in treeview widget of the tkinter gui my doubt is how to resize the treeview widget so that i can place the two treeview widget aside photos attached below and i doing a project on mysql database so for the frontend i used tkinter gui screenshot of output which arugument i should use to change the size of treeview widget,scrapy shell view response not working proprly when i open the scrapy shell through the command scrapy shell this example comes from the scrapy tutorial i enter the command view response which opens my navigator firefox to be precise with a path looking like file tmp tmpnzkkilst html and the error file not found any idea on how to solve this issue,0,78,59 gaussian curve fitting in physics i have this data i tried to fit by a gaussian function but i can t found an appropriate function i tried using curve fit from scipy optimize i used this code this is the result of this fit very bad fit the error message,flask react server side event i am trying to implement a simple push function from python flask to react for in app notifications on the backend i got the following python code on the front end react const eventsource new eventsource stream when i run this in the console i get an error also can t understand why i don t see any of the flask s prints from my function this is the same example as in almost every basic example that i could find that dealing with sse thanks,0,51,86 how to create directory from script path when i run this code i get this error,seaborn timeseries line breaks when hue is added i am having trouble plotting a timeseries plot using seaborn by adding hue to the plot the timeseries plot breaks i can t figure out why the time series plot break in between and how can i stop dates from overlapping the code to replicate the issue is below how can i fix the line break and dates overlapping,0,16,67 python how to link a filename to a memory file the memory file will be an input of another program not python so a file name is needed,stanza throws keyerror feat dropout i am using the cltk library to do nlp with ancient greek i recently upgraded python from to and since then whenever i try to do even the simplest things e g the quickstart code i get the error keyerror feat dropout the stack trace tracks it to site packages stanza models tokenization trainer py line i ve seen one instance of the same error and tried the solution there but got nowhere i would appreciate any help,0,28,76 jupyter console runtimewarning coroutine zmqsocketchannel msg ready was never awaited by running jupyter console any press of enter button show this error i have tried different computers with different linux distributions ubuntu mint manjaro kde manjaro xfce i tried different python versions different ipython verions and even with docker interesting that jupyter qtconsole jupyter notebook and ipython are working fine all answers i searched were about ipython or jupyter notebook but i need jupyter console,convert docx to pdf using python within google app engine i am trying to convert a docx file i have in my tmp directory to pdf using python within google app engine i have used docx pdf before but google app engine or linux doesnt support this module i have seen people use libreoffice to convert the file but i dont know how to install libreoffice within google app engine i could really use some help,0,68,75 how to parse a multiline string which looks like a table into a list of dictionaries i have a multiline string sample below which has a table like structure i have to parse that structure and convert back to key value pairs such that the key is the column header and the value is the value of that row i have used a regex but it s not working properly pfb string expected output i have used the below regex pattern,how to apply a affine transformation to a single dot in pil in pil i have rotated a rectangle by an angle and pasted it back to the background image i d like to know what will be the new coordinates of a specific corner function old coord new coordinates i have read in the documentation it mentioned the center of rotation by default is the center of the image here is my code how can i find the new coordinates value i keep getting wrong value background image input rectangle image input the output i got with zero rotation as expected output i got after degree rotation,0,78,107 python applying condition on after decimal point in dataframe column i have a dataframe which contains a column like below i have to apply condition after decimal point those conditions are it will replace and it will replace how can i do it properly thanks in advance,how to add action to button i added classes button to they do action in my game but i don t khow how to realize them what should i do to my program will work correctly without errors,0,52,37 pandas split column of unequal length list into multiple columns in python i have a list of codes in one column his name course code that i would like to put each code is a new column can you guys please give me some guidance how to do that thanks,is there an easy way to use asserts in python to check for results printed on screen whereas assert in python is ideal to verify wether certain function calls return an expected output for a given input could it also be used to check for results printed on screen i e in procedures that return no results but only have side efffects like printing stuff on screen the context of this question is how to write such automated tests that i would like to include in an automated grader tool since expect the answer to this question to be assert does not serve this purpose what other trick could i use then to check the screen output produced by a procedure,0,50,120 pandas how to remove filter null na values how can i achieve the following i want to remove rows grouped by id if at least there is a null in column inv the outcome i am looking for should be like this,in telethon how can i verify if chataction was only from my group channel when i am not sure if my group channel is private or public for now i am assuming e chat takes a specific url of my group channel either it s public or private and works as a filter and if any event like a user joined or left in my group channel it will print in the console,0,40,67 can pandas findall return a str instead of list i have a pandas dataframe containing a lot of variables i would like to keep only the number followed by da so the first column is da i have been using the pandas function findall but this returns a list which i would like to avoid so that i end up with a column index looking like this is there a smoother way to do this,how to input dataset while using salesforce merlion package for timeseries forecasting i have installed salesforce merlion package in my conda environment now i want to use my own dataset to run the algorithm for forecasting here i need only one univariate series to forecast but i cannot figure out how to do that as there are some variables which i cannot find how to initialize those in the example provided in github using some already splitted dataset can someone can help me out here github example for forecasting is like this the complete code with internal dataset is available in the following link here they are using their internal dataset m now i have to use my dataset so my code is like this i am getting this following error at this line,0,75,132 django pluralize person as people trying to output the correct plural value in django template when count is more than p review markers helpful count person reviews markers helpful count length pluralize found this helpful p still returns persons or persons instead of person and people any help to fix this in the template,how to extract acronyms and abbreviations from pandas dataframe i have a pandas dataframe a column with text data i want to extract all unique acronyms and abbreviations in that text column so far i have a function to extract all acronyms and abbreviations from a given text i want to apply extract all unique acronyms and abbreviations from the text column sample data desired output,0,52,65 best way to get first single value of list what is the fastest and best way to get first value from list there are multiple techniques but what is the best memory and speed and why examples below i would be grateful for other techniques as well,matplotlib tight layout with annotation causes figure to get smaller and smaller i have a figurecanvasqtagg that creates plots with the user selecting what data to plot and the canvas updates the plots by calling self fig clear and creating the new plot this has worked fine but i ran into a problem i have designed a certain plot with an annotation under the axes but every time the figure is updated the plot gets smaller and smaller this code replicates the problem in this example fiddling with the xycoords argument sometimes solves it for example using xycoords axes points or data seems to work but this does not solve the issue in my actual application disabling tight layout also seems to solve it but i need tight layout for various reasons the fact that the axes get smaller and smaller each time suggests that self fig clear does not actually clear everything something is being remembered between iterations of the plot is there a way i can completely purge the fig object and start a new one or would it be best to close the actual canvas and create a new one each time,0,47,190 how do i fix a http error bad request in python i am trying to access checkpoint firewall by using it s api but for some reason i am getting http error bad request i have never had this before any ideas here is my code basically same thing is working fine with python this is python code,selenium python proxy i want to use proxy with selenium i watched the video from youtube how to do it but it doesn t work this is my code why proxy doesn t work please help me kind people,0,60,37 attributeerror str object has no attribute descendants error with automation scraping with bs and selenium my objective with this code is to scrap the allocation of brazilian funds my problem starts with bs i already tried to scrap the table using soup find all table id dlaplics or using class all of them return an error i already saw a lot of videos but i m feeling unable to solve that by myself right now,rolling percentile pandas this gives percentile values for a column below but is there a way to get the rolling percentile values for a column by using this similar method without writing functions or loops and longer code currently when adding the rolling window it is not working if there is not pandas desperately needs to add this as a feature for the rolling it is there for quantile it makes no sense to not have it for the percentiles as well,0,71,82 print pandas series vertically aligned when printed with another string i have a pandas series which should be printed with a string the result of the following code does not look pretty result what i want would it be possible with a simple code may be a possible solution but not perfectly what i want,how can i replace a string match with part of itself in python i need to process text in python and replace any occurrence of xz by x where x is the first letter enclosed in the brackets and z can be a string of variable length note that i do not want the brackets in the output for example alehos cr e sjt should become alehoscsjt i think re sub could be a way to go but i am not sure how to implement it,0,55,82 why is the insantiation of this singleton class giving different values why do these two statement give different outcomes here s the entire code,why does np vectorize work here when np where throws a typeerror i have a pandas dataframe where a column called myenum has values of either or i am trying to translate s and s to strings and use an enum s name attribute to help i think this is a question about understanding the guts of np where vs np vectorize as they relate to dataframe series i am curious why the attempt throws an error using np where yet works using np vectorize i would like to learn from this and better understand best vectorization practices in dataframes,0,23,96 pandas how to remove filter null na values how can i achieve the following i want to remove rows grouped by id if at least there is a null in column inv the outcome i am looking for should be like this,pdfplumber memory hogging crash with large pdf files using pdfplumber to extract text from large pdf files crashes it,0,40,19 how would i index this json response to access this specific section i have provided an example of what the json looks like i am trying to print each drivers information separately but can only print the key drivers below is a snippet of the piece of code dealing with the json,error no matching distribution found for markupsafe trying to install libraries in a newly created environment after using the command and got an error,0,52,24 django rest framework serializer got attributeerror when attempting to get a value for field field on serializer try to nest serializers attributeerror got attributeerror when attempting to get a value for field vesting choice id on serializer vestinglocationrateserializer the serializer field might be named incorrectly and not match any attribute or key on the queryset instance original exception text was queryset object has no attribute vesting choice id model serializers,valueerror error when checking input expected permute input to have dimensions but got array with shape i have been debugging this error for the past week and i m not sure why my code is not working we have a custom environment and our reinforcement learning problem is taking a x image and deciding if we should do action or action full error log i have looked at a lot of other posts regarding this error and most seems to point out that the input shape needs to be d width height channel which doesn t seem to be working for us we also tried batch size window length width height channel but doing so gives us another error valueerror input of layer permute is incompatible with the layer expected ndim found ndim full shape received none any help on this problem would really be appreciated,0,66,152 breakng the hash i have to break hash codes and find their number but my code is not working these are the hash codes in a csv file my code and my result is,getting flask model objects to javascript using ajax for context i m coding a student personalized weekly calendar and i have made a database using flask sqlalchemy where i store all my lessons and their information my current goal is to link the database with my html table so i have a class lessons in models py which i filled with data and i have no problem using it in my html or python code but i would like to use it in a javascript function and it seems so complex just to link both from what i ve read ajax could be a solution to my issue but after many tries i couldn t get to anything i jsonify my list of lessons but when i receive it in my ajax function it s unusable any idea what i m doing wrong my js function my route note i m a beginner and this is my first post my description might not be clear enough in which case i ll be more than happy to answer your questions,0,39,169 python selenium google click i agree button i am trying to get some data from google but it i get the before you continue google popup i am trying to make selenium locate the button and click it and return to the getting data but it seems even if i have the button id in the code it doesn t find it,trying to input a rgb fmri dicom image modify it and save it as a grayscale dicom image in python using pydicom i am trying to take in an rgb fmri scan as input and output the same scan but in grayscale with the color parts burned white essentially whenever i try and modify any of the data elements such as photometric interpretation and samples per pixel and use save as to write the new dicom file i am unable to open that dicom scan with the dicom viewer giving me the error that it isn t a dicom image my code is below any help is appreciate thanks in advance,0,61,109 sorting hash numbers in using matrices in python i m working on project to check for copies between two drives and i got stuck on sorting the output i have now is filename hash location in two list called drive and drive the output id e like to end up with two text files with a list of the files that aren t in the other drive i m not sure how to go about this maybe i should use dictionaries,python tkinter destroy not working after using threading timer code part after the destroy command has worked the window is closed but the program continues to work you can disable it only with the help of the task manager or cmd but there s no any errors code part if i run this part after the first one i see an error tkinter tclerror can t invoke image command application has been destroyed but if i run only this part without the first one then it works and i can see the photo in the window so the problem is i need to close window after threading timer then i need to open window with an image,0,78,115 cluster values within two columns in groups in pandas i have a dataframe like this and i would like to cluster into groups the val and val values for instance and i should then get here is the dataframe if it can help,how to fix command injection issue on checkmarx for parse args i have python code that parses input parameters checkmarx says the following the application s main method calls an os shell command with cmd using an untrusted string with the command to execute this could allow an attacker to inject an arbitrary command and enable a command injection attack the attacker may be able to inject the executed command via user input parse args i think i need to strip the unneeded characters like and but am unsure how where to do it can i do it before this line opt agrs parser parse args thanks,0,44,101 how can we persist changes in a docker container i am using a python program to scrape and save data in a sqlite db file there is no mention of sqlite in the dockerfile what should i do to save changes in the data db file this is my dockerfile can you please guide me step by step thanks,is there any way to replicate realtime streaming from azure blob storage to to azure my sql we can basically use databricks as intermediate but i m stuck on the python script to replicate data from blob storage to azure my sql every second we are using csv file here the script needs to store the csv s in current timestamps,0,57,59 how can i loops throught all column in each row using pandas in python hello there to all you guy i got a dataframe like this how i can loop through columns in each row and get the result like this using pandas in python the result will be a list like this or separate list like this,separately save the model weight in pytorch i am using pytorch to train a deep learning model i wonder if it is possible for me to separately save the model weight for example i have the bert model as the base model and an additional linear layer on the top after i train this model can i save the weight for the bert model and this linear layer separately,0,58,69 python pandas nlargest not working properly with keep all when i try to use the function below even if keep all the output is however the sorted array is what i want is how can i solve the problem edit for the people who interest to solve it here is the example code which show the problem,celery sqs don t receive messages i m trying to make a queue system using celery sqs still in my local environment with localstack i m not able to receive messages in worker it just doesn t show anything there is a question some time ago but i m ok in their config i m using all other sqs sns activities from other function but isn t working from celery my current setup is like this docker config and the celery instantiation is down used a get queue directly to be sure of its link please maybe you have some ideas to start because i lost half of the day trying to figure out what is wrong,0,59,106 best practices request for np where that obviates the double dereferencing of the np where object i would like to evaluate clearly imax but that is not what np where returns to obtain imax i must use a two step process that involves doubly dereference the np where object but this is inelegant is there a best practice that avoids the double dereferencing and obtains imax in one pass and i don t mean np where x max x which is still inelegant,passing errors types into a custom error handling class python being a python novice i resolve problems in interesting ways this being one of them i m wanting to pass error messages into a error handling script a class so i can customise the error message for example when filenotfounderror is raised i want to display send a message like cant find xxx file check yyy directory or connectionreseterror message database connection restarted and so on about different messages so when an exception is raised i am passing the error to firstly how to capture e g filenotfounderror without pulling out of a string secondly what the professional way thirdly since i need a bunch of if elif to generate the unique message why bother with a special class just put e g except filenotfounderror as e with unique message and put under main and do times for each error type raised then main becomes messy thanks,0,73,155 how to query on multiple filters in pymongo s find one and update method i am trying to use pymongo s find one and update method to update some values in mongodb but i need to filter based on two different conditions and this does not seem possible i tried passing in a list of filters akin to name name date date but this did not work is there no way to filter on multiple conditions with this method how else can i achieve this thanks,can t download playwright python properly i tried to install playwright in my laptop i typed to command prompt however only the first lines running without error i got the error message for playwright install i ve added playwright into path but still getting the same error,0,78,46 i can t setup python my computer windows bit one or more issues caused the setup to fail please fix the issues and then retry setup for more inforation see the log file at least windows or windows server are required to install python bit,reading multiple csv files from azure blob storage using databricks pyspark how to read multiple csv files with different columns and file path names and make a single dataframe here is an example just paths however there are many paths based on frn and filename columns can be concatenated and filled with na if there is no value present adding new columns based on frn and filename as mentioned in path with respective dataframe of csv file in each filename folder there is only one single csv is present but there is multiple filename folder under each single frn folder for example i tried this but how can i concat these different csv files and create new columns like frn and filename as well,0,47,126 how to validate json with help of jsonschema i want to validate my json input my json i expected exception because job is not job how to validate this json,printing out features used in feature selection with xgboost feature importance scores i m using xgboost feature importance scores to perform feature selection in my knn model using the following code taken from this article the output that i m getting is showing me for each iteration the number of featues used select x train shape the threshhold that is used everytime a feature is removed thresh the classification report and the confusion matrix this output will keep on going until the number of features used reaches n what i want to do is that i want to also include the names of the features used or removed in each iteration but i can t figure it out is there a way to get it done,0,30,121 how pull a docker image and give it a diferente name i need pull a docker image of tensorflow i know that for pull a image i have to use this commmand but i dont want my image with this name how can i change this name in the moment that i pull it,what s python json serializable i have two ways to represent python object by json dumps first second then i tried p json dumps person the second way would say it s not json serializable so basically for python json dumps only work for built in object like dict object,0,55,44 python sdk equivalent of the rest api endpoint apigateway locations get i am trying to find the python sdk equivalent of the rest api endpoint apigateway locations get here is the url for the rest api documentation i couldn t find any documentation on how to achieve the same using their python sdk can someone point me in the right direction,maximized window with tkinter i want my window to be maximized like i pressed the button left to the x not fullscreen i find that this can be with root state zoomed at the start it looks like its working but it s not the window sometimes appears maximized but when i click on it it goes fullscreen i just want the taskbar on windows to be shown and the tkinter window to be maximized,0,56,72 most efficient way to compute differences and intersection of two sets in python let s say we have two sets s and s i require three different sets based on these two sets these could be easily computed as follows is there a way to compute these sets more efficiently i imagine the different set operations have multiple internal processing steps in common so there might be redundancy,pandas collapse multiple columns into one with this dataframe aggregation i get this how do i reshape it in order to end up with,0,67,25 how do i use yolov without the internet for kaggle competition i am attempting to use a software called yolov in my python code for a kaggle competition the only thing is it requires you not to use the internet i have the yolov file already loaded into the kaggle code but am unsure how to call in in my code i ve tried loading it in the following way but keep getting errors,get text from span class with beautifulsoup and requests so i tried to get a specific text from a website but it only gives me the error floor soup find span class text white fs px text truncate attribute value text attributeerror nonetype object has no attribute text i specifically want to get the floor price text my code,0,73,53 how do i fetch the x tracking id request header value using python i m trying to fetch the x tracking id value as it s shown in chrome dev tools to replicate a request is there a possible way to do so using python example image from google chrome s dev tools,how i can print the start and end dates of a data frame i have these lines of code and when i run it i would like to see the dates of training validation and test like this instead of the indices,0,46,42 python result from console error string format i have a problem with my console program a total of four initial results are expected from me the interesting thing is that two of them work correctly the other two make the following mistake also since i m a beginner i want to ask how to create a variable that can read both text and number,how to copy every repository folder from one jfrog artifactory to another jfrog artifactory using python there is a package called dohq artifactory in python which copies file from one to another artifactory but not folders repositories i have tried to copy folder with same package but it didn t work please let me know how to accomplish this with python or suggest if there is any better way to accomplish this,0,62,68 creating a new column using string match and based on if else condition i have a data frame with a column url text containing text output from an ocr i am trying to create a new column blocked where the rows equal if a condition is met and otherwise i have tried to insert the above code in the following function however when i apply the function to my data frame i get the following error,what is self referring to in this pytorch derived nn module class method i am following this tutorial for pytorch and there is a line of code that makes no sense to me in the derived class mnistmodule method training step of the nn module class the line is out self images please can someone explain to me what is happening here is this correct or not and if this is convention to follow thanks here s the snippet,0,76,75 affect value to dataframe respecting conditions i have two dataframes df and df df have columns id date val val date and df contains columns id date date i want to affect date of df to date of df and date of df to date of df for all the rows of df content of df df the result should be,unable to run vscode s debugger with dockerized django project every time when i run a debugger there happen many things but not what i expect i m running a project with docker compose up checking the localhost if backend backend is okay it s down what s funny the container is running because i m attached to this with vscode s remote containers the debugpy library is installed the first approach to run a debugger end with such info in debug console and it s down backend is also down second try and it s down but backend is up i m able to login etc the third try ends with such an error connect econnrefused any tips code manage py the local docker compose yml and the launch json,0,63,119 pandas assing a full dataframe to a subdataframe i need to assign a full dataframe to a part of another bigger dataframe based on some conditions so i have two dataframes the first lets say and what i want to do is something like to get in df the values of df the result that i get is that the rows of df wih a became nan how can i fix this issue thanks for the answers,installing cython packages error cannot compile i am installing implicit through git and i got this error during installation i am using tensorflow tensorflow gpu as my docker base image image digest a e ae c f af e caa e d ab fbd bb a this error never happened before i am not sure what happened to the compiler or which compiler should be used please help me any help or advise are welcomed,0,79,60 eval and extract field with pd series for multiple columns hi i have a bunch of json ish strings stored in columns as shown in a and i would like to extract the form field i would like to do this per row for all columns i can get it to work per cell with the code below but i am having trouble getting it to work on a dataframe scale any advice is welcomed thank you for looking cheers,how can i make a function out of this so i don t have to copy paste the same piece of code currently in my code i am just copy and pasting blocks of code like these times i need some help on how to make this into a function to save space,0,78,53 path to each leaf of a binary tree the function above allpaths appends an array containing the path to each leaf of the binary tree to the global array res the code works just fine but i want to remove the global variable res and make the function return an array instead how can i do that,tensorflow how can i detect handwriting numbers in an image if i have a trained mnist model i have trained a model using mnist dataset by the example code from i have an image containing several handwriting numbers and other characters in different sizes and in different colors i want to detect the handwriting numbers using the trained model and draw a bound rectangle around each number is it possible any advice is appreciated my environment tensorflow python keras is used,0,57,86 how pull a docker image and give it a diferente name i need pull a docker image of tensorflow i know that for pull a image i have to use this commmand but i dont want my image with this name how can i change this name in the moment that i pull it,convert column to dataframe column geaders i have the following pandas dataframe i would like it to be converted to a pandas dataframe with one row is there a simple way to do it i tried pivot but was getting weird results,0,55,42 tkinter window opens but no widget shows up i have just started working with tkinter and written the below simple code however after running no widget appears in the opened window the only thing that appears is this what could be the problem,replace occurences of a numpy array in another numpy array with a value i have a d numpy array i also have a second d array i want to replace all occurences of the elements of the second array with so eventually my second array should look like is there a way in python numpy i can do this without using a loop i already checked at np where but the condition there is only for example where element value and not multiple thanks a lot,0,43,88 can someone please fix it so that the function can detect whether the input has at least one symbol in it i want to see if i can fix this part because i am not sure how i can use this function to find a special character in the password,issues adding variable to getwindowswithtitle so i am having issues with getwindowswithtitle function from pygetwindow when i ask for input before the getwindowswithtitle call i get the following error if i comment out my input call the getwindowswithtitle works just fine the following is my code so far i am trying to get input to choose which window to select but even putting target in the getwindowswithtitle it gives me the same error does anyone know why i am getting this error after putting in my input,0,50,87 how to order dates from most recent to least recent so here is this the code i use to insert into the tkinter listbox of downloaded files from the downloads folder to list all zip files how would i be able to make sure it orders the files from most recent to least recent,pythonic way to design class which has default data members which can be overridden by kwargs i think the title gives the general idea of what i am looking for but to be more specific i will give an example with code so let s say i have a python class with a few required position variables that also takes an arbitrary number of keyword arguments the class has many data members and some of them will be defined by the required position variables but most are keyword argument variables where the program has default values for these variables but if the user uses a keyword argument this will override the defaults i am looking for the most pythonic way to initialize a class of this type i have two ideas for how to do this but each of them feels unsatisfying and like there is a more pythonic way i am missing or i don t love the first option because it seems wasteful to set a bunch of default data members if a bunch are going to be changed especially if there are many data members i don t love the second option because it looks unnecessarily busy and less readable in my opinion i like the separation of the default values from the user defined values and think it will make my code easier to read and change also i am using kwargs instead of keyword arguments with default values because i am still in the early phase of the development of this codebase so the member variables needed are subject to change but also because there is going to be a lot of member variables and it will make the function signature very ugly to have all of those parameters apologies if my question is a bit long winded this is one of my first times asking questions on stackoverflow and i wanted to make sure i gave enough detail also if it makes a difference my code needs to work in python and later,0,54,336 anaconda not creating environment yml file i m using conda env export to create an environment yml file as the documentation suggest although the yml file content displays on the anaconda prompt it doesn t seems to create any file neither on current or any directory where could the file be stored why it doesn t create a file,how to pass a filename as a class variable i am trying to build a tkinter app which allows you load documents and then analyse them i must admit i am still getting to grips with object oriented programming so apologies if this is a simple answer i have built this class to hold the filepath variables for the rest of the app to use however everytime i try to pass the following i get the following error is it not possible to pass a filepath as a class variable supplementary question will this approach enable me to call on these variables in other classes at a later date,0,55,108 how to fix this error with discord py embed in webhooks i am trying to make a webhook but i managed to fix most of it but now i keep getting this error and i don t know where to start here is the error and here is the file if you could give me anything to try that would greatly help me i am also using the latest discord py module and python,bind a label to a given encoding with sklearn labelencoder i want the encodind of pad to be is it possible to bind a label to an encoding with labelencoder,0,72,32 how i can set id in django rest framework json api response i am using django rest framework json api then i want to set id in the response i know the response gets id from django model instance but if i set the instance to the serializer the id will be null,calculate age between two dates in year where one column has single date and other column has list of dates in python i have two columns one has the single date and may have list of dates it can be empty list also i want to calculate the difference of age between first column and all the dates of the second column i have column and column as input and i am expecting output in the form result,0,51,78 cannot resize array using np resize i am trying to resize an array to x my code is as below when i go to reshape later on in my code i get the following you can see from the error that the array hasnt changed size and is still i believe im missing something simple but i cant seem to find it thanks,developing a generalized logic of getting highlighted area from multiple pdfs into pandas dataframe using python i have created a solution using python which extracts highlighted portions from the pdf using pymupdf and fitz this is the code for the same this when run on pdfs gives me a result like this list ashmore close brothers close brothers list hdfc bank ltd icici bank ltd infosys ltd in list the no of columns which was highlighted in pdf was in list the no of columns which was highlighted in pdf was if i have to build a dataframe from this how do i develop a logic to build a generalized one if a pdf is having columns so then in dataframe as well it should be so that the dataframe columns will be in sync with the list above this is how i have built the dataframe logic this code fails doesn t work properly if columns highlighted from pdfs are more than how do i generalize this please help edit using laurent s code i get this output which is not expected this is the list that i get when i print highlights this is the highlights alt i get after printing it highlights alt this is the dataframe that i get df,0,63,228 selenium python timed out receiving message from renderer error i want to add the plugin called metamask to my browser and check the amount of etherium in my wallet but when i add the plugin sometimes i get this error and sometimes i don t here is my basic code im not using headless chrome thanks,how to filter a value from the results in python s how can i filter this specific piece of information attached my code i would like to do print it like below exclude other information filename object key object value output any help would be appreciated,0,54,45 is there a way to find the value for the last day of each month in a dataframe i have a dataframe which gives me the daily quantity levels of various articles i want to get a dataframe which gives me the quantity levels on the last day of every month of each article original df target df is there any way to obtain it i tried group by item and date with tail but it didn t work,extracting url from html in python i am trying to obtain a list containing different url that appear partially when you see the html version of this webpage i have tried a couple of different things yet they don t really work first attempt links contains the following in it you can see the pieces that i want for example url content renfe es es cercanias cercanias valencia lineas jcr content root responsivegrid rftabdetailline item html i would like to obtain all the different content renfe es es cercanias cercanias valencia lineas jcr content root responsivegrid rftabdetailline item whatever html in a list in order to do so i have tried an extract and using regular expressions but i have not been succesful second attempt following the steps that are shown in the answer to this question extractinf info form html that has no tags i obtained the next piece of code i thought that it would work because of the similarities in the output it produces but when defining parsed list the next error is returned does anyone have anythoughts thank you all in advance,0,78,157 pip install does not install local module package from setup cfg i have the following pipfile and setup cfg and when i perform pip install e it installs the packages under install requires but not the local package pipfile setup cfg when i run pip list i can only see the following but i cannot see my cli package,attempted relative import with no known parent package error wsgi contract test py i have the regular source files under the libs tral directory however the entry file for this test is located under test contract inject i do not want to move this test file into libs since this file should be nowhere near production code as it is a rather hazardous file security wise in node js this would of worked fine but there seems to be something with python imports i m not grasping,0,56,79 getting output as character and it s occurrence in the string the input i gave is like this input abccdddeffg and the output i want is character and it s occurrence number output a b c d e f g my code thanks in advance,valueerror and ambiguous truth value when using if statement in pandas i get this error when i run my if statement in pandas my code so what i m trying to figure out how many hours we need to top up if they re a full time or part time worker their minimum is and the if statement i m trying to execute is supposed to add the remainder hours the minimum hours hours worked and add it to the existing hours that they actually worked to reach the minimum otherwise if they exceeded the hours for the week then just return hours worked is there another way i can do this where i can just replace their hours worked with either or depending on their work status if the hours is the numbers in the ftorpt dict sample data expectations thanks,0,37,142 warning fitimage when running kivymd when run kivymd app i get why do i get this warning code link convert toman to crypto with kivy,place binance future order using python binance wrapper error apierror code mandatory parameter e was not sent i create future order with mandatory parameters this code gives error binance doc link,0,20,29 how to check if xgboost uses the gpu i m writing a pytest file to check if my machine learning libraries use the gpu for tensorflow i can check this with tf config list physical devices for xgboost i ve so far checked it by looking at gpu utilization nvdidia smi while running my software but how can i check this in a simple test something similar to the test i have for tensorflow would do,dataframe pairs of columns division i have a dataframe and want to get divisions of pairs of columns like below i want to combine the last three lines into one like but i only get an error of valueerror columns must be same length as key if i just simply print df a b c df a b c i will only get a dataframe with nans of shape edit now i know why my original one line code doesn t work actually the arithmetic operations of two dataframes will be conducted between the columns with same labels while those columns without same label in another dataframe will generate nans the result dataframe will have the union of the columns of the two operating dataframes that s why my original solution will give an valueerror and the div will generate nans following example will be helpful to explain,0,69,146 python if else on one line with continue statement similar to suggestions listed here is it possible to do the same with the continue statement something like this thanks for the help,scrapy notimplementederror scraperrspider parse callback is not defined i am new to scrapy i was seeing a tutorial and implementing a spider but this error always keeps up coming please help i have tried everywhere but i can t fix it this is the error i think this is my code,0,31,50 how to print all rows data from csv file with pandas in python i have a csv file which has rows i want to print them all with pandas module but it only printing rows how can i print all of them,integrityerror at authentication addprofilepic unique constraint failed authentication userprofile user id i am working with a blog project where i am trying to add profile picture of the user whenever i submit the picture it gives me unique constraint failed authentication userprofile user id views py models py forms py here comes profilepic html but the server shows me this unique constraint failed authentication userprofile user id where is the problem thanks in advance,0,43,59 json data parsing using python to get the specific headers value i have a following json file format in which the data will be having dynamic update i have to parse the json file using python with the following scenario if the status pass then the results of value should be maths q q kindly me with this scenario using python,getting for result in cursor limit error after using find one i m making a discord bot and i m just trying to set a dictionary to be a post in my mongodb database the code was working just fine yesterday but now no longer works and returns literally hundreds of errors the code i was just using to test what gave the errors obviously i m using password instead of my password i also tried setting players to find id darragh and then but still got errors any help would be appreciated,0,60,86 dynamically created classes with the same name i m trying to dynamically create subclasses in python with type and here s what i see in the output obviously this was not my intention two questions in that respect,sqlalchemy orm define custom function in model for selects how can i define custom filter function for model so i won t duplicate it across my app i mean if i have some model like this and i often use such select get row data for specific table and row i don t want to use activerecord mixin where i can get session inside model so i want to make some function which will get params and return object for session execute i didn t find anything useful in documentation,0,36,87 composing arbitrary functions in python i am following category theory for programmers and trying to implement a compose function in python what i have currently is but this will not work because i don t know whether g args in compose will return an object which is an iterator or just a single return value is there a way to write compose in python without using isinstance,how can i parse a string number to a float python from excel i have a number in the following type so i ve been trying strip replace among others but i couldn t get a float from my code result monto float m valueerror could not convert string to float,0,65,52 lookiny for the odd even i can t find how to look for the odd even from this list list plat mobil b ab b ty b ay b dd b am b d d kj ae gh ae aa it s hard enough for me can you help me to slove that,iterating over indexes of a list to see if they are equal i am trying to write a function that will analyze a string to check if it contains two of the same letter in a row i wrote the function for it but it doesnt work any idea why,0,59,50 good looking sphere in matplotlib i ve been trying to plot a d sphere with some curves on it using matplotlib but so far the my results are disappointing i ve tried with several rgb colors opacities and colormaps but the output is similar how could i do something like this bloch sphere that s just what i m looking for thanks in advance,how do i specify a file type filter in plyer so that the user is only allowed to select files with certain extenions i am looking for something like filters extension i tried this but it does not work i can still select files with extensions other than jpeg and jpg,0,59,52 countvectorizer but for group of text using the following code countvectorizer break air dried meat into different vector but what i want is to keep air dried meat as vector how do i do it the code i run current output desired outpput,how to access environment name in kedro pipeline is there any way to access the kedro pipeline environment name actually below is my problem i am loading the config paths as below but i have few environments like conf server conf test etc so if i have env name available i can add it to conf paths as conf env name so that kedro will read the files from the respective env folder but now if the env path is not added to conf paths the files are not being read by kedro even if i specify the env name while i run kedro like kedro run env server i searched for all the docs but was not able to find any solution edit elaborating more on the problem i am using the above given parameters and catalog dicts in the nodes i only have keys that are common for all runs in conf base parameters yml and the environment specific keys in conf server parameters yml but when i do kedro run env server i am getting keyerror which means the keys in conf server parameters yml is not available in the parameters dict if i add conf server to config paths kedro is running well without keyerror,0,43,189 problem connecting to mongodb atlas using python i have a problem connecting to mongo would appreciate help thanks and error,pyparsing nestedexpr how to match some curly brackets used for nesting which are also part of literals i am trying to parse files that are formatted as below and some times same nestedexpr character is used within the literal that i need to extract as is input actual output expected output as can be seen i want my script to return path as is without parsing it into array below you can see the code i tried and any help is greatly appreciated,0,20,83 is the time complexity of string a the same as string string a in both statements i am appending a character a to the string s which statement has the better time complexity in python,how can i reorder a numpy array from high to low in another array without using in built functions i am having a bit of trouble here plus i am new to using numpy what i want to do is reorder the array t in v from high to low and changing the highest number to everytime in the array t without using unbuilt functions i would truly appreciate any help thank you,0,38,74 how to insert something at the end of a entry in tkinter i am making a calculator and whenever i click the number buttons on the calculator it always inserts them at the beginning but i want to insert them to the end of the entry how do i insert them at the right instead of the left,create a new column that details if rows in one pyspark dataframe matches a a row in another column of a dataframe i want to create a function that creates a new column from a left join in pyspark that details if a value in one column matches or does not match the column of another dataframe row by row for example we have one pyspark dataframe d that has columns id and name and another pyspark dataframe d that has the same columns id and name i m trying to make a function that joins these two tables and creates a new column that shows true or false if the same id exists in both dataframes so far i have this i m new to pyspark can someone please help me thanks in advance,0,58,134 updating numbers pandas python but also keep all the data i got two dataframes df df i am using the update function to update the two dataframes result is it possible to get the other numbers too something like this,extract lines containing specific words input expected output code i read the input file based on block and if the word homo sapiens is included in the blocks i extracted the blocks also in the block the line starting with dr is defined as dr and the line starting with ft is defined as ft how should i write output using dr and ft to get expected output,0,40,70 how to save images from url into mongodb using python i have used wikipedia package to get a list of image urls from any wikipedia page now i want to save all the images from the images variable to a mongodb in a collection named images is there any way to do it as there are multiple images can they be saved in a list format,running telegram bot on heroku so currently i m trying to create a bot that messages every minutes using python telegram bot jobqueue the app is deployed on heroku and it seems to be working just fine but sometimes it doesn t message me after periods of inactivity ex not using start with the bot how do i solve this issue when i check the log it seems to be running fine thanks,0,66,72 error while builder loading in kivy invalid indentation must be a multiple of n spaces so i ve been working on a kivy app and was having some trouble with builder loading some kv language the code crashes when i run it error message code what am i doing wrong can someone help me to fix this error,loop counter behaving unexpectedly i am having trouble understanding why the counter variable even though incremented within the nested loop is not having any effect on the number of times the parent loop runs the code below gives the output when the increment inside the nested loop is supposed to stop it from executing the second and the third time is the i inside the nested for pointing to a different i,0,57,75 mfi indicator from talib python library doesn t return any value im using binance websocket stream to get kline data im trying to get data or values from mfi money flow index to automate some trades i tried other indicators such as rsi and it worked,pytesseract manga text detector i want to detect text from manga i tried with pytesseract but it does not detect all the texts do you know any solution to increase the quality of detection of pytesseract on these types of images exemple not detect text sens is not detected currently i m just doing a detection without a specific setting,0,44,61 count the number of days between two dates i am counting number of days between two dates for first testcase output is wrong expected output in first test case day is missing in output,how to access execution date in airflow for operators other than python or bash i am using bigquery to gcs operator in airflow i want to save the tables in folder with execution start date as name of folder since the tasks run overnight datetime today sometimes gives next day as execution start date how can i access dag execution start date in place of datetime today so that all tables get stored in folder with execution start date as folder name,0,36,78 how to delete outliers of a specific column i d to delete some outliers from my dataframe outliers i d like to delete are values bigger than and below from columns ending by g and in that case i found a way to filter columns ending by g but at this point i can t find a way to delete my outliers,using arrays as values with matplotlib im currently trying to plot the data i recieve from an api hypixel by pushing the values into an array and using that array as input for a matplotlib graph i wanted to make sure it worked so i made a test program see below and sure enough i couldnt get it to work im completely lost so i just wanted to ask if any of you knew how to use an array as input for a matplotlib thanks,0,63,86 convert multiple string elements list to a list with single element split by comma using python i have a list with string elements lst h e l l o and i want to convert it to a single element list but split by the expected list will like this how could i do that,neural network in python warning tensorflow model was constructed with shape none for input i have data that rows and nine columns from xlsx columns for x and columns for y i devided it to data training and data testing so i have for testing and for training so i have x test y test x train and y train i use neural network in python and i have this code then i predict x test with this code after that i can predict thats data then i want to input a new data with this code then i entering new data and i want to predict the new data so i array the input data with this code then i predict with this code but i found an error like this,0,56,138 return previous row value based on id column to find differences between current row and previous row i am new to python i am having a problem trying to look up previous row values based on id and timestamp in a python dataframe can anyone please advise how i should derive the solution below is a simple example for example id timestamp sapstock laststockdate laststockvalue,what is the right way to implement an interface like class in python what is the right way to make every class that inherits from the superclass have the same functionality in python the superclass doesn t implement anything it just defines the needed functionality for the child classes to be used by functions in some app what is the right way to implement such a thing in python,0,75,69 what data types can be exported as attributes when exporting to graphml with networkx i have a networkx graph with some list and dict attributes that the function nx write graphml doesn t accept as valid type for the export i couldn t find a function that would automatically ignore those attributes so i decided to create one myself i know that int float and string are accepted but i don t know if there are others and if so which ones,extract element within string into nested list i am working on a routing project the route looks like this cnshg b pamit r coctg b ushou r coctg b usmsy and i want to break it into a nested list also a route contains multiple segments for example cnshg pamit is one segment transported using b and then pamit coctg transported using r i e rail and so on input the output should be like this i have tried using regex and the below codes but it didn t work thanks a lot,0,77,79 how to get deleted users from channel telethon in telegram when i click subscribers it shows me about last users and about deleted users i tried this this gives me only last users and deleted users i need all deleted users how can i get them,how to print json value in python i have this json value and want print the number for day am able to print the content for the android json value but i want to print only the value for the day which is this is my result with the above code,0,51,53 why am i not getting in python i keep getting even when i changed my range to total what must i do to get,download part of a youtube video using python i ve been trying to be able to download only a part of a youtube video after many searches i found out that this workaround explains how to do that but i didn t understand where should i put this code to run this is the workaround can somebody explain how it works in details,0,27,63 modify equivalent values in a column i m working with pandas but i have a question about how to change equivalent values i want to work with binary values in the class column so i have and i want and to be changed to ah and i don t just have these lines i have in total how do i do it i want this result,why does this code print something different depending on the indentation i noticed that when the print msg is not indented inside the for loop and is indented on the same place as the for loop then it only prints the information from the update statement i did but when it is the way it is down below it works how it should be giving me the information i requested here is my code,0,69,73 create a histogram in python i m trying to create a histogram in python my fuction is the next one it is supposed to look like this but with my function it looks like this besides anyone who knows to represent it in that way too,python function about logistic equation the original logistic function that represents the change in population size per year is delta n r n k n i m trying to write a new function that takes in r k n the initial value of n which stands for initial population size and t the number of years and return the population n after t years below is my code it does work but when i plug in t which is supposed to mean there is no change in time it stills return some n that is different from n which means my code is likely wrong do people have any idea as to how i can fix my code,0,46,112 import rest framework swagger views could not be resolved i wanted to implement swagger in django rest framework for that i install django rest swagger and register in setting py but while importing in url py it show error how can i use rest framework swagger,how to add multiple sensors on this python script i m trying to control gpio state using bluetooth using bluetooth terminal involving both gpio output on off device and gpio input binary sensor the script for the gpio input sensor part is the following by that the gpio output part worked but only one of the sensors worked i know python is known to only run sensor but i needed the first one written above the gpio one what should i change add in the script so it can run both sensors gpio and gpio or any other way so that the bluetooth terminal can access multiple python programs if i have to make separate script for the gpio one,0,37,115 append subresult list to result list i m trying to solve leetcode combinations sum problem and i ve did using recursion method pasting my approach here in my recursion function helper in base case when target i m appending my subres to finres i ve tried finres append subres but its not appending to finres it s actually appending and removing later later when i did subres copy its working fine so how can i add subres with just append,what to use in place of predict classes in a jupyter notebook with tensorflow nlp text generation i am trying to follow a tensorflow nlp tutorial to train a neural network to generate poetry lyric like outputs using my own compiled sources i only know basic python so this is definitely far above my level of competence it seems that the tutorial is slightly outdated as i am receiving this error code i understand that the attribute predict classes is deprecated and no longer used in current versions of tensorflow this was a line of code suggested in an answer but i don t understand how to include it into my code np argmax model predict x test axis any help would be appreciated here is the section of code that is giving me trouble along with the error code i included a link to the full jupyter notebook as well here is the link to the video i was following and here is the copy of the jupyter notebook,0,72,161 sqlite operationalerror no such table sqlite schema i am facing a weird issue in tableplus when i run the following command it returns table but same query does not work in python python code is given below error i am using sqlite,filtering list of dictionaries based on another partial dictionary suppose i have the following list of dicts and a dict how can i find record in dicts based on record having only two of three key value pairs the output would be,0,41,42 how to get a google sheet id which doesnt exist yet i have a google worksheet with which i m doing pivot tables i would like to add pivot tables in new sheets that dont exist yet one pivot table by sheet on the same spreadsheet currently i m creating new sheets and recovering their ids by hand i wish it was automatic here my pivot table do you have any ideas,typeerror webdriver init got an unexpected keyword argument firefox options error using firefox options as arguments in selenium python i m trying to create a script which downloads a file from a website and for this i want to change the download filepath when i try to do this with the firefox options it gives me this error code,0,72,55 python pandas dataseries slice with label vs index discrepancy when i select slice using the labels as below output is but when i select slice using index as below output is why is that when we select with index it is selecting with step whereas with label it is selecting the final label as well,python modulenotfounderror no module named pytorch net i am trying to import a file from a folder named pytorch net from a folder named ai physicist into a script named models py i have tried to change the folder locations of the files get an init py file into the main ai physicist folder and change the sys path append command to get only the folder with the files inside of it i have also looked at other posts and have tried their solutions but to no avail here are the posts that i have found and have tried what does os path abspath os path join os path dirname file os path pardir mean python import python module using sys path append file structure here is the error in its entirety and lastly here is the code that i am using models py any help on what i would be missing would be very appreciated thank you,0,55,137 mysql connector errors operationalerror mysql connection not available i get this error message on pythonanywhere when i reload the app a couple of times i need to reload the app from pythonanywhere to make it work error message file home sideproject virtualenvs myvirtualenv lib python site packages mysql connector connection cext py line in cursor raise errors operationalerror mysql connection not available mysql connector errors operationalerror mysql connection not available anyone please help me with this server js file code sql connection py file code,how to compare two lists in python with the if loc condition i have two lists and i need to compare those two lists in below manner output getting expected output,0,63,31 selenium wait until method hello fellow programmers i have a simple question is equivalent to i m developing this selenium app and sometimes the server traffic is quite massive which leads to different loading times when moving from page to page i found time sleep n isn t efficient but if i use the wait until ec block will the code execute once the condition is met it won t waste time if use wait webdriverwait browser and the page loads in seconds,column with string values representing list of sets extract relevant info to new columns i got some ugly data i have a dataframe with a column c that has values that are strings for ea row however it s a bit more complex the strings look like below yep they are strings no definitely not a list of string sets outright strings i want to iterate through ea row and get the info values actually strings from the sets actually strings that have cat and cat to create two new columns to populate what i want ideas,0,79,96 subtract one from last nonzero value in row multiple column i have created a dataframe with dates and the amount of days each month from a dataframe of arrival and departure dates this dataframe can be n columns long what i want to do is select the last column with a value that is nonzero and subtract basically looking like this afterwards i have tried using numpy with but this does not seem to work correctly with pandas,find a connected subgraph with n nodes and e edges in python i have a very large undirected graph dataset in the form of txt which i converted to networkx graph i need to extract a connected subgraph containing n nodes and e edges if possible but not necessary how do i go about it this is the code i wrote for finding largest connected subgraph the subgraph i want is somewhere in the middle of min and max subgraphs any help help will be appreciated edit it can be any n nodes no specific nodes required,0,79,99 assign variable value in json payload fomat i am using python a i would like to generate payload for each of the json records i am using each variable to access the record how to assign variable value each in this case in payload i tried each and other methods but didn t work code snippet below,is there a way to drop rows with low frequency given a threshold value with the following data i would like to remove the rows with low frequency suppose i pick as a threshold how can i only keep rows whose frequency is greater than or threshold x desired output i will only keep rows where the user row id has bought from or more retailers columns note that this is not the total of each row for example user will be dropped since he only bought from two retailers but user will be kept he bought from retailers actual data has million rows and k columns i have done some reading on the site and don t seem to come across an example much similar to my problem much appreciate your help,0,56,139 choosing a column which has a certain value i have an numpy array as the following i am trying to only show the array which has third value in this case when i execute my code i get the following output i do not know why i get those arrays my code is below,python different output when casting the recursive call with str function i want the result to be of type string so i tried to cast the recursive call with str function when returning a result of type int the function below works fine output but when casting the recursive call to str str n factor n i got a different result output what am i doing wrong,0,59,69 discord py kick command errors with list index out of range we have user bob and i try quickly kick him using only nickname kick bob and when i do that it throws an error indexerror list index out of range how do i can fix it,command not found discord bot so i am making a discord bot with multiple command but only the one on top seems to work i would really appreciate it if you could tell me what is wrong,0,47,37 get element range in list and swap i want to swap element list by range in python my code is and my output is but what i want is swapped by list index range,function returning different results with same inputs i m working on a modeling function to model the motion of a train in my script i have a check that runs a function three times the second and third time it returns the same values however on the first time it returns different values this is written inside a for loop that randomly selects a set of parameters then runs them through to generate the odes you see at the beginning the error is happening underneath the optimization area the first call on rk generates a different set of results than the second and third which both generate the exact same results i can t figure out why the first time is different than the second and third furthermore when i plug those best ode la etc into the rk function again later on in the script it fails the checks and returns none despite those parameters having passed the checks earlier for reference here s the rk function itself,0,34,163 count the frequency that a bunch of values occurs in a dataframe column pretty new to python and pandas i have a values in a column of my dataframe like this i want to get in output a result like this im a bit lost with groupby or count values etc thanks for the help,scraping a list of urls using beautifulsoup and convert data to csv i am new to python questions below i have a list of urls i want to scrape data from i don t know what is wrong with my code i am unable to retrieve results from all urls the code is only scraping the first url and not the rest how can i successfully scrape data title info description application in all urls in the list if question works how can i convert the data into a csv file here is the code,0,57,95 how to handle duplicated or blank columns and add number in duplicated ones in python dataframe dataframe has columns with repeated dates and empty columns i tried objective to add any string value like a jan repeated column and blank columns renamed as a b so on output required in tabular form for further processing and storage,azure synapse development code writing best practice our group is starting to work on azure synapse for our data analytics and we ve seen the integrated notebooks and sql however these are very minimal and might be good place to start but soon enough we ll want to move the work to some ide like vscode or pycharm any best practices on how or which ides are integrating with my azure synapse code any of them where i can run sql or notebooks from my local ide to the synapse account and if on the subject any best practices on developing in synapse at all regarding how to write and test my work before firing it in the environment,0,57,117 django startproject fails no module named zoneinfo i am creating a new project in django my set up is on running django admin startproject myproject i recieve the following error any clues on how to resolve this issue,how do i update like dislike vote in database without throwing an error i m making an online business jargon dictionary using mongodb i want to make it possible to vote terms up and down i m getting to grips with crud but i m a bit stumped on the syntax for updating part of a record i have this template the logic is that when like is clicked the code should pull love percent from a dictionary convert to integer or provide value zero if not present add convert to string and update within the same objectid this is the code i wrote for that route i tried using just update or storing the integer but that seemed to fix it a friend suggested update one but i m basically a bit confused and lost can anyone suggest what i m missing here or a better approach i m aware that this doesn t prevent multiple votes from the same user that functionality can come later the dictionary is being staged on heroku here and i have pushed it through with the bug i get the following error on traceback attributeerror dict object has no attribute update one the repository for this code is in github,0,37,200 generate a specific designed pdf from basic html input i want to generate a pdf with a specific background from three simple input fields a title a message and a signature as shown in the picture below example of desired result i have some experience with creating web sites with python flask but i struggle with how to tackle this challenge,parallel job processing with azure service bus queues i have an azure service bus queue with rest api requests for database ingestion jobs for this i have a requirement to create task workers to complete each job asynchronously as given in the below diagram i want to process these messages in parallel will celery work for this is there any suggestion on what i can choose to complete this thanks in advance,0,59,72 how do i determine if a given p x y point is located within the boundaries of an array below was my attempt i couldn t print out the accurate key if the point is within a part boundary the algorithm should return the part number otherwise the algorithm should return,log message not displaying on console below is the code i am trying to run but the log message is not getting displayed on the console i am running code on pycharm with python,0,49,34 how to create a list of named lists in python i need to create a list of named lists so that i can iterate over them this works but i m wondering if there isn t a better way the reason for doing it this way is that i have a function do some list operation l and i want to do something like rather than i ve been searching for how to build list of named lists to no avail,access denied by acls for operation read uid error odoo models access denied by acls for operation read uid model product template fields activity ids you do not have enough rights to access the fields activity ids on product template product template please contact your system administrator even when i wrote this in model access i still have the same issue mail access mail activity access mail activity mail model mail activity,0,74,57 scrapy run for loop within nested json objects i am scraping a json api using scrapy and want to loop through the offers and then the outcomes as shown in the screenshot below i am getting to the offers ok but then not sure what to write for the get as its unlabeled everything i have tried leads to an error of list object has no attribute get my code is below,using a function to retrieve keys to put in a dataframe i am using streamlit and pandas i am using a function which returns keys from a api dictionary imported from another py file the function does return the keys i want however when i convert the function into a dataframe with streamlit i get errors can anyone help i want to show the data represented by the function usdmarket as a dataframe the last line returns the data in json format,0,72,82 convert pandas core series series data from nan to none django i have a pandas core series series class when the field is empty i get nan as a value and like that it stores in database i want to convert that empty value to none so i can manipulate with none value what i tried is here but this isn t working can someone help me please,grouping rows into a new pandas dataframe with one row per group i have the following dataframe my goal is to create a new dataframe as shown in the screenshot below grouping when short trade or pnl it s the same thing the first column of the new dataframe trade n is just an id for each different trade the new column pnl is the sum for each group from the initial dataframe lastly duration d is the number of days each trade lasted i have found a workaround looping through the dataframe and checking each row but i m pretty sure there s a more efficient solution using pandas numpy,0,61,109 how to find inverse of mod when there is an unknown number i have a formula like x mod how can i find x in python trial and error is not allowed,python login with requests i need to download a large number of photos off a certain site i however cannot download these photo s if i am not logged into the site itself my first approach was to use requests module to download the photos and just continuously change the url s using code this doesnt work because as mentioned previously i need to be logged into the website first how would i go about doing this using requests or any other python module,0,41,82 where to set environment variable in azure data studio python notebook i started using azure data studio notebook i am having some credentials in environment variables how can i use those environment variables in azure data studio,python discord bot use of async not allowed outside of async function i am making a discord bot in python and some of the commands have the bot typing a bunch of nonsense but i have to have the whole async with asyncio sleep everytime i would like to put in a seperate method that i can call something like this but this doesn t work as i cannot use the keyword async and await outside of async method is there a clean workaround for this,0,37,85 adding sum of the nested dictionary values using keys from the list i was creating a war game and i have this dictionary of weapons and the damage they do on another type of troops also i have a list which has the keys from the dictionary stored in it i need to get this output i tried this,reminder notification when button clicked after few hours minutes need some help on javascript button my use case need a button like thing where when we click the button it should get time out for min with a notification a sound and it should get autoreset because we need to use this button multiple times in day i ve a python script which can remember me but needed this usecase in real time to implement other code is there any possible way to do this and can someone help me in achieving this any help is much appreciated thank you,0,60,98 error when adding scrapy to flatpak project i m building a flatpak builded gnome builder project now i want to add scrapy to my project i use flatpak pip generator to generate scrapy package and add it in my manifest like but when i run i get the following error and if i add python setuptools rust it leads to this error any idea to solve this problem tks in advance,countvectorizer does not process my text data it keep giving me attributeerror list object has no attribute lower i have created process textdata function that takes in a pandas dataframe column of text then performs the following convert text to lower case and remove all punctuation optionally apply stemming apply ngram tokenisation returns the tokenised text as a list after that i implement the function into sklearn countvectorizer and it give me this error what am i doing wrong can somebody help with this,0,65,87 python exercise array with max numbers in the exact position this is the exercise write a maximum sequences function that receives two positive integers n and k and a list l of integers having length n k and returns a list l of length k constructed as follows im stuck here how you can see i created the sub arrays and the len check but i have no idea how to build the l array without numpy tnx,regex having optional groups with non capturing groups i have an regex with multiple optional and non capturing groups all of these groups can occur but don t have to the regex should use non capturing groups to return the whole string when i set the last group also as optional the regex will have several grouped results when i set the first group as not optional the regex matches why is that the input will be something like input text xyz t vx n expected output t vx n thanks in advance,0,78,89 remove specific endline breaks in python i have a long fasta file and i need to format the lines i tried many things but since i m not much familiar python i couldn t solve exactly i want them to look like i ve tried this but the result not showing lines and also merging all other lines hope you can help me about it thank you,how to get text from handwriting image in python the image the image is handwritten line of text this is extracting the text some what but not the expect same in the image and the code is the output buttered off before there twinkling like new yar sytemy hung cuter of tempting uwitationx they beaged hi to contre the extera,0,65,60 python datetime converter i m trying to write a python function to standardize incoming timestamps to yyyy mm ddthh mm tz offset example issue question how are others handling this type of issue in python,python pandas iterate through list and map i m trying to make a simple script that should get the id of an item and get some stats associated with it and add it to the dataframe it returns nan and i don t know why edit i was comparing the integer stored in one dataframe with the string in the other one it works beautifully now,0,30,64 import crowdcount to python shows error even once i installed it i would like to import this models to my python code when i run my code it shows this error i installed the crowdcount and also shows this error the problem with src if i did only import crowdcount it works fine,static file css not loading in django i have tried everything i know to fix this all static files are working perfectly other than css views py html head please note that i am using bootstrap in base file if that affects anything settings py project directory i am sure the folders paths are correct as images are rendering correctly thank you in advance,0,53,62 pandas split column of unequal length list into multiple columns in python i have a list of codes in one column his name course code that i would like to put each code is a new column can you guys please give me some guidance how to do that thanks,openpyxl number format not applied until manually applied code expected result i open up test xlsm and in column a all dates should already be in the format yyyy mm dd actual result while the yyyy mm dd format gets applied without any issues when i run the python code i then have to open up the excel file select each cell manually and hit return in the formula window for the yyyy mm dd format to be applied is there a way for my specified date format to be applied through the python code rather than having to manually apply it by opening up excel and selecting each cell going to the formula bar and hitting return every time thanks in advance,0,50,115 writing to config py file from another python script i ve created a python script that reads from a config py file using import config to inform it s output config py script py i need current brightness to be permanently incremented in config py after running the script so that subsequent script runs will import the newly updated value instead of it always being in other words how do i write to a config py file like i would any other standard config format like config ini,plotly putting y axis two plots in the same range in python i have two box plots side by side but i want to have them to have the same y axis range in this case currently the plot on the right side does not have the same y axis range as the left one i have tried it using fig update layout yaxis range but i am not having any success here here s the plot here s the code,0,79,73 pandas merge overwriting lists in column how do i prevent mutation in the list upon merge as later i want to concatenate the images on both columns many thanks,plot average of multiple line plots with different x values i have multiple dataframes that look similar to this where the x columns are my indices i want to plot the average line plot for these multiple datasets my idea was to concatenate the two dataframes so that i have a scatterplot and can do a best fit line but pandas is throwing an error reindexing only valid with uniquely valued index objects i ve read other questions for this error message and have renamed my index names and column names to x x and y and y but it is still complaining i believe because some of the x values are the same what am i doing wrong here,0,29,119 python state trip program code registers visiting the same state as one trip i m currently coding a state trip code that documents what states you ve visited in python if i input that i visited the state of nj twice my code registers this as only visiting nj one time i provided a picture and my entire code below enter image description here code is below,failed to produce content url using an address in a search box of a website i m trying to figure out any way using requests module to produce score url using a search keyword in a website for example when i type this address habgood st city of white rock in the search bar of this website i get this score url i dug around a lot in chrome dev tools to find any way to produce the same score url using requests module but i ended up getting the following which produces no slug or score url in there how can i produce score url using an address in the search box,0,67,113 why am i getting this syntax error python python noob here took a swing at the guess the number game this afternoon it all looks fine to me but i keep getting a syntax error on line else player number secret number i ve tried everything but i can t figure it out at all thanks for your help,how to append data in to the dataframe the code is working fine and give me the image link but i want give name image image and so on to get output like these as you seen in picture,0,57,38 ros and python versions when launching nodes ros imu bno package works on noetic running ubuntu intel nuc but throws an error on kinetic running on raspberry pi ubiquity robotics image must be python vs python on the nuc python on the pi kinda stuck not sure where to geek from here process ros imu bno node started with pid,dynamically selecting columns in pandas based on a list of strings i currently have a dataframe like this how would i select the columns dynamically and append them to another list for example so that xx is the following something like this but on a much larger scale i keep getting the following error when i try i get,0,60,59 need help detecting collision in python ive tried multiple things to try to detect collision between the player turtle and the apple turtle and nothing happens what i wanted it to do is that when the turtles get too close the player turtle disappears if the apple gets to low below the player it resets back up top here is the code ive done im new to code so im not very good,discord ext commands errors commandinvokeerror command raised an exception keyerror link i tried to make a discord py bot command that sends random dog fact and image but i ve got this error here s the code,0,73,30 python result from console error string format i have a problem with my console program a total of four initial results are expected from me the interesting thing is that two of them work correctly the other two make the following mistake also since i m a beginner i want to ask how to create a variable that can read both text and number,how to get row number and specify tooltip from another columns in that row the problem is that i can t iterate through whole dataframe and for each cellwidgetitem in specific row in column specify tooltip from another columns in the same row above code works and does show whole dataframe in qtablewidget and below code works for extracting text from several columns and settooltip for cellwidgetitem from row and column but when i get more than one hundred rows it would be such a long code to copy and specify manually for each cellwidgetitem from row etc the tooltip i tried this code below to get it work but unfortunately i can t nothing happens but it passes so that it has no errors please give me a solution thank you very much,0,62,135 split in regex python infix notation in numerical expressions i want to write a python script where the user can input like that the output should always be such that what i have been doing is but it does not work and i am not super familiar with regex can anyone help out,can i optimize three parameters with a distributionlambda layer i need to create a neural network layer to optimize the three parameters of a generalizedextremevalue distribution that are loc scale and concentration but when more than one parameter is passed to a distributionlambda layer all training metrics are nan and the output distribution is empty plotting the x train and y train it seems that the input datasets are right anyway the neural network outputs a distribution with nan instead of mean and stddev i tried changing the batch size the epochs and the number of outputs from the dense layer but nothing worked,0,53,101 understanding python multiprocessing pool map thread safety this question had conflicting answers are python multiprocessing pool thread safe i am new to concurrency patterns and i am trying to run a project that takes in an array and distributes the work of the array onto multiple processes the array is large my understanding is that pool will distribute tasks to the processes my questions are thank you,multiple input and multiple output tensorflow model i am trying to build a tensorflow model which takes images as an input and gives output embedding for each input image the images are saved in a list called triplet the part of code is given below when i try to run the code i get the following error can any one please suggest where the problem is also the code provided is simplified for stack overflow so it may have syntax issue thanks in advance,0,67,86 how to print p variable inside ipdb i have variable called p and i want to print its value inside ipdb i can t to it since p has an alias inside ipdb how can i force p to print its value,adding to set if part of tuple not exists i would like to use something similar to the add function to add tuples to a set however i want them not to be added if a part of that tuple already exists in the set for example this gives me a result as but i would like the a b combination to only appear once the first time it is added so that my result is,0,41,74 python pandas changing the default x as index to columns instead i have the following as my code with the following graph displaying problem is i wanted to compare each attribute mean age age amount etc next to each other by default pandas takes x as the index how do i change it to take column names instead then there will be comparisons one for each attribute,how would i find the current decibel level and set it as a variable i m looking to find the current decibel level in a room using a microphone and setting it as a variable i haven t been able to find any python code on this so i m very stuck it would be good if the variable could refresh every of a second but it doesn t have to thanks for your help,0,64,72 getting google returned a response with code error in pytrend i want to get yesterday or todays data from pytrend but every time i use this code i keep getting the request failed google returned a response with code with the data and sometimes timeout or rate limit exceed error my code,why is same url scraped twice instead of two different start urls i have the following spider when i run it then the print output states that the first url of start urls has been scraped twice why is this happening as key bits of the pages load via javascript then it might be useful for me to include the selenium middleware i m using,0,54,62 python screencapture set window traceback most recent call last i am getting an error executing this code traceback most recent call last file c users jamie poredski downloads piano tiles bot py line in screencapture set window file c users jamie poredski downloads piano tiles bot py line in screencapture contours hierarchy cv findcontours thresh valueerror not enough values to unpack expected got,getting the max value from a list of columns by their index in pandas i have a dataframe with a variety of columns but the key part of data i am looking to extract is in columns which are named using datetime values which hold a floating point number for currency i am basically just looking to find the max value of any column that is of a date value i e per row i originally used list to try find any column with in but guessing due to the format i can t directly reference the datetime values example df,0,51,102 valueerror dimensions must be equal but are and with input shapes i have an error in my code and i ve done read the documentation but it still error how this error can be fixed code and here is the model summary here is the code to fit in training data and i got this error valueerror in user code,conditional when calling functions sequentially in python i have four functions and each one returns a list as a result i want whichever of these functions that i call sequentially brings a list not to look at the others thank you for your help in short i don t want it to go to other functions at all whichever brings results,0,63,60 tstables attributeerror module pandas tseries has no attribute index background i have a dataframe which i am trying to write append to a tstable i am executing it using jupyter notebook python problem i am getting an error while trying to append dataframe structure code ref python for finance by yves hilpisch the error happens after the above command,i am creating a lambda using python to create a file in s bucket but its only creating one row need iteration based creation i am creating an aws lambda function using python to create a file in an s bucket but it is only creating one row need iteration based creation below is my code above code is creating a json file in the s bucket but i want to iteration of say so that file has record,0,58,81 having problem in reading data from multi level columns pivoted format to dataframe in python i have data in a google sheet with columns in below format i want to adjust row and in columns to create a dataframe original dataset i tried result will ignore first two rows looking something to bring first two rows in columns also output req below groupby with year,plotting multiple data sets as one average and adding error bars matplotlib i need to analyze some data taken in my lab but it goes beyond my limited programming skills i have multiple sets of similar data and i need to take the average of all of these and plot that with error bars the idea is to plot the area of an optical signal which is recorded by a photomultiplier tube versus the angle of the diffuser that emits the optical signal to collect the data the diffuser is rotated from to degrees and stops every degrees for the photomultiplier tube pmt to record the area optical waveform i have three individual sets of data that look like pmt angle area ignore the diode data that is used to normalize the area values for the pmt so essentially what is plotted is pmt angle normalizedarea instead of three individual graphs in one plot like the picture attached has i need to plot them all as one average of the three data sets combined and with error bars to show the deviation between data sets thank you in advance here is my code,0,68,198 pyyaml how to set a default representer for non standard objects is it possible to specify a default pyyaml representer for non standard python objects how to instruct pyyaml to use a default representer for all non standard objects for instance i would like to invoke an object s str or repr method iff it cannot be represented safely,python ssh failure i got an issue when using paramiko to ssh user pass no pubkey used to a apc pdu net mgmt card the same code works if it connects to a cisco switch is it something related to low python version or i should tune the ssh parameters for this particular low profile device apc pdu any of your suggestion is highly appreciated code snippet errors,0,55,65 db object not iterable in flask i m searching for a record in users db and then looping through all the records the code is something like below the above code throws error users object not iterable how can i loop through the records,how to convert a panda series of d numpy array to d numpy array if i convert the series with ser values it is not with shape but how to convert can result to a d array,0,43,39 how to create an animated line plot with ploty express i m trying to create an animated line plot to illustrate the price increase of different asset classes over time year but it doesn t work and i don t know why what i ve done so far output,subprocess contradiction between two programs i know this may seem weird but i m trying to understand why the following happens i m editing a python program at work and when i run the following python function i get in the output that type c is bytes and sys stdout write c runs regularly and prints one byte at a time but when i run this function from a standalone program i get the following error how is that possible,0,46,74 how to save d ndarray to image files i have the following python code that downloads a set of images to train a model with i m trying to save these images to files i ve determined that this is a d array based on the number of times i can index it before getting an error message about trying to index a scalar can anyone show me how to do this,tkinter set option command for entry after declared it i need to declare the option command for an entry after declare it here s my code here s the full error i got is there another way to pass the command option after declared it because i need to pass the entry in the function parameter set in the command,0,70,58 avoid type casting when selecting a row i ve got a dataframe with enforced data types which are quite important to my application correctly yields however when i pick one row using iloc pandas suddently casts everything into float presumably because it turns it into a series which wants a data type yields that causes downstream problems as i need the data in the correct types how can i pull out a single row while maintaining the correct types,how to make a multiple if statements more pythonic and condensed i am writing a piece of software that checks the input to a function before passing it to a database to do this i need to check the type of data before i send it right now i am using different if else statements how can i condense this and make it easier to read thank you,0,79,68 how to convert infix to prefix if the operator present in front of expression if an equation is how could i convert it into prefix it s operator is in front of the equation,having troubles detecting when a certain audio plays from the desktops output i am currently writing a piece of software to detect whether a certain sound was played on a computer if true it would change a setting in a certain software so far i have this when i run the code i get two separate errors with these errors i have not been test whether it does detect or not would love your expertise on this,0,37,77 templatedoesnotexist at fund me issue i have went through the answers to similar question on this site but nothing seems to work as i receive the same error message each time help would be greatly appreciated error message on the bottom directory tree directory tree urls py in fund proj urls py in fund me views py settings py relevant code error message and traceback error msg and traceback,transform a log file to csv using pandas i am trying to transform a log file that looks like this to a csv file i have tried to remove the first few lines which i don t need and added name for columns manually then did this this this has worked for the first log file but not for the other files as i get some additional columns for each one of them the output i want to get is something like this my method is definitely not the most efficient is there some other way i can do this thank you,0,62,101 how to retry process with while loop in python except i want to retry it with while loop,why does my ide keep saying that my variable can be undefined i am writing a program to calculate the sum of the first n natural numbers but i am having a hard time coding the first part of the program in which i ask for the input from the user about how many successive natural numbers to add it s a very long code for such a simple task because i want the program to be able to ask to try again in case the input isn t a natural number accept mathematical expressions that are equal to a natural number e g to get back to the point why does my ide keep telling me that n can be undefined and if you d be willing to take the time to tell me how to shorten my code that seems a little repetitive i d really appreciate it thank you for your time,0,19,153 need values to unpack in for loop got in django after updating my project from django to django i am facing this issue need values to unpack in for loop got let us consider my views py as how could i solve my issue,applying a condition for all similar values within a column in a pandas dataframe i have the following dataset in a pandas dataframe so what im trying to do is to find whether the number of datapoints for each patient patient id is equal to the number cbct images taken for that patient for example for patient p the number cbct images taken is equal to the number of datapoints and for patient p the number of cbct images taken does not equal to the total number of datapoints for that partient i would like to assign this condition to a new column where value yes if it is true and no where it false please let me know if you need clarificartions with my question thanks,0,51,127 python argparse with two defaults when the argument is and is not specified for the argument f i want it,project id in error message is not the one set in gcloud config set when use google api client library i call the storage transfer api following the documentation this is my code before executing this script i ran the gcloud config list to make sure the project id was correct and that the environment variable google application credentials was not set but i see another project id aaaaaaaaaaa in the next returned error message googleapiclient errors httperror httperror when requesting returned caller does not have required permission to use project aaaaaaaaaaa grant the caller the roles serviceusage serviceusageconsumer role or a custom role with the serviceusage services use permission by visiting and then retry propagation of the new permission may take a few minutes details type type googleapis com google rpc help links description google developer console iam admin url type type googleapis com google rpc errorinfo reason user project denied domain googleapis com metadata service storagetransfer googleapis com consumer projects aaaaaaaaaaa,0,20,143 returning multiple dataframes with python so i want to write a function that looks something like this here a b and c are all different functions returning the dataframes a table b table and c table respectively what i m not sure now is how to write the return statement to make it return the content of every dataframe,how to print this pyramid pattern up side down i am trying to print below pyramid pattern but not clicking how to build logic for it pattern i have tried this code seems like this is not a right approach to get it any solution is appreciated output of above pattern,0,55,52 how to use pretrained model pth in pytorch i have one question how to use the saved pre trained model for example i have a model and i train it with the dataset i have and then i save it with the pth extension how to use file pth to test new image thanks,in keras how to control the number of mini batches drawn during one epoch i read keras s official manual and a few examples such as this one i understand that we can specify the size of a mini batch using the batch size parameter and specify the number of epochs using the epochs parameter but how can we decide how many mini batches are there within one epoch in scikit learn there are a few options to indirectly control this such as max iter tol etc but i failed to find something similar in keras,0,53,89 why is my python script printing none after using a function and using input print this is my code which prints this how can i stop it from printing none i ve read that i should use return but i m not really sure what i should do also this is the whole videosourcedeclaration function,numba why guvectorize is so slow i am learning numba to try to optimize my code first i calculated a exp b x where a and b are two parameters and x a large numpy array i used the jit decorator the output is d array with len x elements this the code the output is so everything worked well i have a large time decrease with numba optimization the machine where this code runs has cores after i decided to use an array of a and b parameters par np array i i for i in range x is unchanged this is the beginning of my problems first as the output is a d array of shape len x elements it seems that i could not use jit decorator but i must use guvectorize decorator i have written this code very similar to the one above that works but the benchmarks are not good the code with numba optimization is slower than the code written only with numpy functions as it is the first time i used numba i suppose there is something that i have not understood any help would be appreciated,0,52,191 solidity typeerror object of type set is not json serializable i ran the code in vscode and got a typeerror object of type set is not json serializable i just start to learn to code really don t get it and googled it also didn t know what does json serializable means the full error information is below,python selenium check all checkboxes on page i m trying to tick all checkboxes on a page there are about of them and this code seems to work but only ticks what is visible on the screen it doesn t scroll down the table and tick the remaining boxes i m thinking it s only finding those on the screen as the rest are still loading i need to wait until all checkboxes have loaded but i m not sure about how to go about this any help is appreciated below is the table row,0,56,91 clearmap cell alignment section file not found error encountering an error when running this cell does any one know how to fix it thank you cfos and autofluo images have been resampled align with the template reference file in atlas is it necessary to debug this file file homeanaconda envs clearmapstable lib python site packages tifffile tifffile py line in open self fh open self file self mode filenotfounderror errno no such file or directory home clearmap documentation example haloperidol haloperidol debug resampled tif,keras functional api imcompatible layer problem i was trying to make ddpg critic s neural network layer with code and i got problem about it would be thankful if you point out the problem and how to solve it,0,67,37 how to dynamically set the output name for a blob in azure functions for python i created an azure function in python that gets triggered after a blob upload happens i would like to copy and rename the blob to another storage this is what i have right now this works fine but it only copies the file how can i rename the file dynamically during runtime thx,scrapy attributeerror type object settingsframe has no attribute enable connect protocol i am using a conda environment on windows just after installing scrapy i am on the trial and i have a problem in launching scrapy shell i input scrapy shell url and i get this error message is there someone explain me about this error i saw some posts in sof that many peoples recommend to do upgrade the version in this case what do i have to do,0,68,79 how to code an if loop to create a new string itself i need to create a string every time the user calls a specific function is called up a new string needs to be created with the user s name as its name but the name consists of name so i need to separate the part after too can anyone write a function to do these things i d be really grateful,python hexidecimal byte interconversion oddity i must be missing something yet the following doesn t convert back anyone know the error here,0,73,21 change the icon size of mdrectangleflaticonbutton how could i change the size of the icon inside my button i tried it many ways but neither of them worked i will have of theese buttons but i want an icon for them as well how could i change the size of the icon changing the border thickness would also be good my code,indirect fixture doesn t exist when parametrising tests with fixtures i m using pytest and i m trying to pass a fixture as a value in a parametrised test i read the documentation for parametrised tests and the indirect true parameter but when i try to run it i keep getting an error message i require the fixtures of different objects for different tests and i have the code below the error message i keep getting is in test parametrize user full name indirect fixture normal user doesn t exist is it necessary to specify which fixtures should be indirect in conftest py or am i writing the code for the parametrised test incorrectly,0,63,105 missingpluginerror the atoti jupyterlab plugin is missing install it and try again i am pretty new to working with atoti while running the code session visualize exploration i am encountered with the error i have installed atoti by using pip install atoti jupyterlab but still continue to be encountered by this error,replace string in paragraph while keeping style docx library i am replacing the strings in tables and paragraphs of word document however the styles change how can i keep original style format there was a similar post however it did not help me maybe i did something wrong,0,49,48 pandas calendar issue this code for custombusinessday works fine output however when adding an optional calendar as in date functionality it produces the next business day even though today s date dec is not a holiday according to a specified calendar below output,extracting coefficients from ransac regression i have this code snippet taken from here what i m failing to do is to extract the parameters from the predicted data i e for the cubic function i would like to know the a b c and d from the ax bx cx d equation how can this be done in the pipeline especially for the ransac estimator,0,45,66 cannot change text of kivy kivymd label when i try to get change the text of a label in kivy kivymd it gives me the following error here is part of the main py for a minimal reproducible example kv string hope you can figure this out but i am not good with kivy,pyqt this application failed to start because no qt platform plugin could be initialized have a problem with pyqt designer i install pyqt with pip install pyqt and then pip install pyqt tools everything ok but when i try to run designer it open messagebox with error this application failed to start because no qt platform plugin could be initialized how to deal with it go to python lib site packages pyqt qt plugins in plugins copy platform folder after that go to python lib site packages pyqt tools qt bin paste folder here do copy and replace i ve tried this but there s no pyqt tools qt bin folder,0,51,94 indexerror list index out of range idk where although compilation works successfully i get an error indexerror list index out of range the function takes as argument a sequence and returns a list of items without any elements with the same value next to each other and preserving the original order of elements the code i write thanks for help,python selenium driver quit won t terminate the program midway the following section of the code suppose to terminate stop the program when except occurs with driver quit however the program continues runs what did i missed here,0,60,34 python net how to run python script from file py how to run py files and call function by using python net library i have tried below code but it is not running main py file when i try to run from string it is working,error recursion is detected during loading of cv binary extensions check opencv installation i was just finished compiling opencv using visual studio and cmake i finished building the library and was about to test it in my cmd prompt and i got this error here is a the error any suggestions on how to solve this,0,43,56 how to put different dataframes in different sheets using xlwings python how can i loop over worksheets to put different dataframes using xlwings python i have three different dataframes that i want to put them in a cell of three different sheet i tried the following code ish lines and got this error com error none none none none,for loop python by year and groupby operation new here i have rainfall data that shows seasonal totals from for rain gauges i e rg rg i did a spatial join to associate each rain gauge with the watershed it s in i m interested in looking at these yearly i did one for where it shows me the season rainfall totals for each watershed how do i write a for loop that iterates over the data for each year and puts it all in one dataframe any help is appreciated thank you,0,61,96 if statement with buttons so i have a problem im trying to make a program with buttons so you could choose something with buttons im running python i made the buttons customized them everything is good with the buttons now i want to add an if statement something like i tried adding that it just doesn t work all help is apreciated,how to use argmin and find minimum value from array i m new to python so the code may not be the best i m trying to find the minimum total cost totalc and the corresponding m k and xm values that go with this minimum cost i m not sure how to do this i have tried using min totalc however this gives an error within the loop or outside the loop only returns the value of totalc and not the corresponding m k and xm values any help would be appreciated this section is at the end of the code i have included my entire code i have tried using minindex totalc argmin but i m not sure how to use it and it only returns each time,0,63,125 how to find inverse of mod when there is an unknown number i have a formula like x mod how can i find x in python trial and error is not allowed,issues adding variable to getwindowswithtitle so i am having issues with getwindowswithtitle function from pygetwindow when i ask for input before the getwindowswithtitle call i get the following error if i comment out my input call the getwindowswithtitle works just fine the following is my code so far i am trying to get input to choose which window to select but even putting target in the getwindowswithtitle it gives me the same error does anyone know why i am getting this error after putting in my input,0,41,87 i want add my simples list in list of comprehension in python i have two lists of values and i would like to create a list which could be seen as a x matrix where the first column is my the values of my first list and the other column is the values of my second list here are my two lists,use precompiled numpy package instead of building it when performing poetry install during build with github actions i m using poetry with python my project depends on numpy that takes minutes to install each time i run my continuous integration pipeline is there a way to make poetry use some kind of compiled numpy package instead of rebuilding it each build i ve already mitigated this issue by caching my virtual environment repository following steps described in this answer but i want a solution that works even if i change my poetry lock file or if my cache is expired i can only use ubuntu latest image in github actions due to corporate policy rules,0,63,116 getting extra numbers while handling big numbers in python i tried why i am not getting how do i obtain the real result,how do i stop my program from reading the second while loop when not needed i have some homework which i m not sure how to finish the task given was to make a script which would ask the user to enter his name after entering it the script would check if the name entered matches with any of the names on a pre existing list if the name matches the script would ask the user if they would like to delete the name off the list or keep it if the name doesn t match with any names on the list it asks if the user if they d like to add it on it the script should write the list of names in the end i wrote it like this issue is that i have no idea how to stop it once the user chooses to delete their name off the list it always reads the next while because the deleted name is no longer on the list also i am very sorry if this looks like poo poo i m new to coding,0,23,181 airflow pipeline is not triggered actually i ve defined a pipeline start date from dec this is same as am singapore time on dec as by default the pipeline is in utc i ve set it to pm utc i e am sgt the pipeline seems to not trigger at am singapore time i don t under stand why the pipeline is not triggered below is the dag config,different query results for local server and production server without changing the code and updating the display order of pictures on my production server django postgresql bootstrap nginx uwsgi has changed see the picture before now i can t reproduce this problem on my local server with same backup code in django orm i have this result reboot nginx postgresql didn t help what could have happened and how to fix it,0,73,61 how can i do groupby without importing anything and in an expressive and oneliner kind of way i am wondering if it is possible to do grouping of lists in python in a simple way without importing any libraries and example of input could be and output i am thinking something like the implementation of itertools groupby but shorter,why does this miller rabin test implement the use of n instead of well i was learning miller rabin primality test algorithm through this tutorial video at instead of checking if pow a exp n in the last while loop he used if pow a exp n n why does it have to be n i did check it by writing it in c and turns out n is the only possible way of getting the right answer he did also try to explain why but it is just weird to me why is this the case it makes no sense to me it is supposed to be instead of n and n makes it work but doesn t make it work i really need someone to clarify this for me one more thing i did watch the first video where he explains how the algorithm works so i think i comprehended most of what he said,0,59,149 how to convert dask object columns into decimal columns i have this function in pandas i would do however dask doesn t support this so what is another way to convert a column into the decimal type,splitting a column with more than one kind of separators i m working with a dataset which one of the columns i need to split into three other columns this column is like this than i tried to split it in the x like the code i used below but when i checked the value counts from the new column it showed me that there is other separator besides the x see like some rows have three values separated by so i d like to create these new columns and know if it is possible and if how to split using more than one separator,0,36,104 find duplicates within a column and pull into new df i have two dataframes with duplicates within one column i need to extract the duplicates into a separate dataframe for example although the col in the green row is not the same i need to extract it from df only and pull it into a new df but also working with thousands of rows for hoping for a way to do this in bulk,partition set with constraints backtracking with python i have a set of n items that i want to split in k subsets of size n n nk with n n nk n i also have constraints on which item can belong to which subset for my problem at least one solution always exist i m looking to implement an algorithm in python to generate at least one solution possibilities sizes constraints possible solution so far i have tried brute force with success but i now want to find a more optimized algorithm i was thinking about backtracking but i m not sure it is the right method nor if my implementation is right one possible expected solution unfortunately this code fails to find a solution eventhough it works with the previous example what am i missing thank you very much,0,74,178 python how to click on an opened outlook email win i need to click on an opened outlook email a specific approve link that says approve request i opened the wanted email correctly but i can t click on the specific link here is the code,combining true values in multiple list into a single list index sensitve let s suppose i have two lists output and based on these lists i want a single list which has indexes set to true based on the index of trues one or more in a number of lists all the lists have the same length and the target list must have the same length as well what could be the pythonic way to do that so that i may get the desired list list desired output,0,45,88 how to get deleted users from channel telethon in telegram when i click subscribers it shows me about last users and about deleted users i tried this this gives me only last users and deleted users i need all deleted users how can i get them,check and return boolean when there is substring in string hi i am searching only the exact substring from string column and return true false row has sting abc case sensitive but when i tried to return it returns true for all rows below is code i have tried is there any modification in above statement to get output column required output,0,51,59 how to make code that changes status using discord py i want some code that switches the status from playing help to playing number of servers servers every mins using task loop current code error stat is not defined i need code that uses client guild not bot guild please,why doesn t the int function convert a float to integer while in input function why doesn t the int function convert a float to integer while in input function result,0,47,29 how to call upon csv file on pandas python using words just to simplified the problem i make a list of fruits how i ranked them and their colour and i want to call them with their name and here is the csv file when i run the program when i put in the number in it and i dont want that i want when i put thanks in advance,http server not responding until after the connection closes i have an application which uses the requests package to post to a server in my testing environment i want to stand up a simple server so that i can validate the client s requests however when i call requests post it just hangs the server doesn t respond at all until after the client finally times out and the connection closes ironically the server then sends a ok here s my mre for the server here s my mre for the client,0,71,87 why does playwright not change url once button is clicked on uber eats essantially i want to enter an address into uber eats and go on to the next page however i have noticed that the url isn t actually changing once the button is clicked i have tried doing the same thing by specifically targeting the find food button on the landing page for some reason this doesn t actually change the page help would be appreciated thank you,in python i d like to eliminate some dictionary items n in a list of dictionaries d is the list of dictionaries the items i want to remove from the list are here s my failed attempt please help,0,78,51 package libffi was not found in the pkg config search path docker i would like to install some django packages including django rest auth and django allauth these packages are able to be installed in my local venv but when building and running docker containers they give exit code with the errors package libffi was not found in the pkg config search path,why don t i see log lines in my pyspark code when i would expect them to appear i have some pyspark code i m writing where i want to execute joins and other operations but i want to log when this phase is successfully completed why don t i see this logged in the order i would expect it sure seems like everything shows up all at once even when my job is continuing to do work,0,59,75 problem with assigning d array as a one slice of d array i try to load series of dicom files into d array i do this on bad way because i got an error something like this not fluent in python valueerror could not broadcast input array from shape into shape i don t understand why because i specify the shape as,typeerror makesentence missing required positional arguments c d e and f my task is use reduce to concatenate all the countries and to produce this sentence estonia finland sweden denmark norway and iceland are north european countries by using list here are the list and my code but i m getting typeerror makesentence missing required positional arguments c d e and f if i write something like it works with no error what is the problem i m really confused,0,64,80 how to convert the data from solana account info to readable txt or json with python i get the output image attached blxrjfggrq wzt l hj d actually longer than this image attached my guess is this is some base or something but i have no idea what it is or how to convert the data to readable format in python any help is much appreciated,procfile declares types none procfile i want to host django server over heroku and my procfile looks like this and this my file structure both procfile and requirements txt are in root folder enter image description here and it is giving me this error continously and this my requirements txt please help i am stuck at this for days,0,63,60 with which library i can bind hotkeys in python code i have a function and i want to bind this function to ctrl alt i already used pynput but it reacts even on typical ctrl or alt how to realize it in more comfortable way i tried pyautogui but it too cause some strange things if i m not mistaken,python how do you decorate methods in child classes using a method in the parent class code example i tried to use super func though it s shoddy to copy paste that in every class that has parent as the parent and has the foo method any elegant solutions,0,57,47 how to replace a file which ws opened using sys stdout in python i am using sys stdout method to print the logs for test run now i am having a test case which will run every hour and my goal is to replace the log file with the latest one everytime it runs but using the following code the log is getting accululated in the same file every hour how to achieve this goal,how to un exclud directory in pycharm i am trying to un exclud directory in pycharm someone know how to do so,0,73,20 why the view of some photos read by cv imread and plt imread are different i have some photos taken by uav and i find that the view of some photos read by cv imread and plt imread are different one of them is upside down rotation but most photos are the same why,how to get the mean values per different group of rows with pandas i have an ascii file as following i want to calculate for both columns separately the mean values of the first rows then the next rows then the next rows so as to get the following output how i could do that in python with pandas in case i would have a stable group of rows e g per rows i would do the following,0,51,81 exe file doesn t output the result text file i create a python script that outputs the result in a text file and it works but when i convert it to exe file it doesn t create the the textfile i used pyinstaller and auto py to exe to covent python script to exe file,about base b encode and b decode just like when i encode the int array by base standard b encode item where the item is then i get the result as then do an inverse process the result is why will be like this why it is not the same to value of item,0,49,53 error while running python code into c please how to solve it hey everyone i m trying to run script python into c as i m a beginner but i got this error microsoft scripting syntaxerrorexception unexpected token from my c code and my python code is but i don t know how to solve it the full issue and the error by details i don t know how to solve it please help,python choice get return selected wieght value i use choices to select a value randomly whith weight value is it possible to store the used weight value to a variable thanks,0,69,32 typeerror send login mail got multiple values for argument email i am learning celery reddis and trying to send email through celery i have created a task in which i have encapsulated my send email logic i am calling the send login mail function and passing the keyword arguments using delay am i using delay wrong i have tried using apply async but still couldn t make it work p,how do skimage morphology remove small holes and skimage morphology remove small objects differ both of these methods are included in the scikit image library for python i m trying to extract certain objects from images and ran into these two methods in a senior dev s code written for the same purpose i have read the documentation for both skimage morphology remove small holes and skimage morphology remove small objects but i can t understand what difference these two methods pose when they are run on a ndarray containing an image,0,62,72 selenium set preferences to download excel file but dialog box pops up i am trying to download a excel file using selenium firefox when i use this function in a script the dialog box to save the file pops up i am on ubuntu i assume the mime type is wrong i have added all i could think of and search for the file in question shows up as a excel spreadsheet,how to replace single value in pandas dataframe by index below is an example of what i want to do basically i know the index and the column of the value i want to replace and just want to replace a specific cell no conditional statements,0,72,46 how can i set layout size in streamlit is it possible to set height and width in streamlit layout i know that there is possibility to set layout wide and centered but its not enough for me map is too big when i use wide too small when i use centered when i set a size folium map there is a blank white space between layout and map i would like to set this size without blank spaces wide centered,nested dictionary to compare against d array so i have this nested dictionary i am trying to test the array against the dictionary the dictionary is essentially a trained decision tree such that and any other condition means no rain for example high partly cloudy false no rain i wrote this function to get the desired output from the above but i am kind of failing at navigating the tree and getting wrong values how can i navigate this dictionary and check for the above mentioned conditions appreciate the help,0,79,92 python selenium proxy in chrome i have been searching loads of forums for using a proxy in python with the selenium library to prevent max number timeout with web scraping through selenium i found the script below in many forums but it just doesn t seem to work for me whatsoever could anyone please help me and give me some advice on how to implement proxy in chrome through python with selenium thanks a lot script,add a z constraint such that the value of a z variable equals to the return value of some function i have a python function that takes a real number and returns a string e g i start a z solver now i want to tell the solver find a value of r such that fun r returns hello i am facing the following problems is it possible to implement what i want,0,75,71 why do we need to pre process image datasets refer to this complete guide on how to use autoencoders in python notice the author add after they loaded the mnist data why do they divide the image data by and why after that why do they reshape a d matrix into d thank you so much,how do i document projects within monorepo using readthedocs sphinx i would like to use readthedocs org platform to document a set of related software stored using monorepo principle the repository structure is following i prepared the documentation for each subcomponent in its docs directory and now i am in trouble how to idiomatically set up readthedocs to host each of my components one solution i found is to import the repository three times and set path to conf py manually in advanced setting section of web administration however i lose the possibility to use readthedocs yaml file configuration another solution i have in mind is to create separate docs directory in the root and somehow merge the three documentations into this one but it involves lots of duplication between components documentations and this merged documentation i have only a little to zero experience with sphinx what is the idiomatic way to document monorepo in readthedocs org,0,57,154 how to get without using the return statement class inside function variable value it is my code i can not even use the database i need get without using the return statement class inside function variable values erorr,rolling dice script python thanks for read this i was trying to reset the script below to every time the user answer no on the rolling dice sentence the script goes back to the beginning but i dont know whats is wrong the script consist on choose the dice that you want to roll and get a random number now i cant run the script doesn t work anymore,0,37,68 pandas getting the mean of columns in multi index dataframe i have a pandas multi index dataframe like shown below i need to calculate the mean of en ez and nz columns under m and em to new columns e g mean also under m and em respectively like shown below can someone show me a workaround for this thanks in advance,computing many quadratic forms in numpy suppose i have a collection of square matrices sigma sigma these are stored in a numpy array sigma such that sigma sigma sigma sigma etc i have a corresponding set of vectors v v stored in a matrix v such that v v v v etc i am trying to produce a vector a such that a is v t sigma v a scalar value a is v t sigma v etc i m a bit bewildered by the documentation for einsum tensordot and the like which seem promising but which i have been unable to coerce into giving me the desired answer for example i want a function foo sigma y that returns a vector equivalent to,0,60,137 empty requests in seleniumwire python i m using selenium wire to scrape requests headers in ubuntu and using firefox driver but driver requests is empty what s the problem with me and result is is there something wrong with ubuntu settings or firefox settings or my code,current date via psycopg posrtgresql is getting the day before rather the real current date i just noticed this behavior and didn t find much clue here s the quick testing code the output is but if i run the same sql in postgresql client directly i got the result of and the versions of each component as below did anyone encounter the same by the way i m running all these on m mac not sure if this matters supplement outcome as per mentioned in comment section timezone related trial modified python code by changing the sql it appears psycopg result is having hours gap but from cli the gap doesn t intercept,0,44,110 latency in spark streaming job databricks which sources from an azure iot hub i have been using a spark streaming job using python on databricks to load sources from an azure iothub however i noticed when we have a large number of received frames the job comes long so we have latency knowing that when we look at the metrics the cpu and memory are not used at of their capacity,how do i refer to an element in a nested list within a for loop i have a nested list of coordinates x y x y x y i want to use a for loop in order to determine the distance in the x direction between two consecutive points i want to do the same thing for the y direction later this is my attempt so far apparently i doesn t give you the subsequent x value in the next list but adds to the first x value my question is how do i refer to the subsequent x value in my nested list so if i referred to p i also want to get p in that loop i also tried adding another variable j and assigning it j i so that i can refer to the subsequent x value by using j however i get the error that one cannot concatenate list to int thank you in advance,0,72,152 when downloading pyrebase on my m mac rsa throws an error how can i fix this when downloading pyrebase for flask development on mac with m chip in a rosetta terminal with the command pip install pyrebase i cannot install rsa i keep receiving the error is there a workaround for this issue i tried alternatively to pip install pyrebase but run into the same issue,how to write read serial port with multithreading using pyserial i m currently running into a problem with trying to write to a serial device using pyserial i want to be able to continuously update my terminal by reading the port and handle serial device writing on a seperate thread meanwhile also be able to send a command via user input on the main thread everything runs as expected except for that when i send one of the commands cmda or cmdb the serial s output that i m reading does not change this is expected behaviour as the commands being sent alter the state of the device which in turn changes the device s output that the serial port is reading with all that said it seems that the device is not receiving the command i am sending even though the code continues to run with no exception and all functions seem to be executing as written here is my current code a serialmonitor class that can read the serial port and print out a specific amount of bytes once finding a set of syncbytes and the main thread,0,66,185 selenium common exceptions webdriverexception message in python selenium the following codes run with python selenium without an issue but after upgrading selenium package from to code above doesn t work anymore the complete exception messages nothing is specified after selenium common exceptions webdriverexception message i couldn t figure out what goes wrong chrome version and chromedriver version is as follows any help would be appreciated,no response in discord hey so when i type opgg or ftgopgg it will not come up with anything on the following it was working like an hour ago but i could not use both commands i don t know if i ve gotten code work or if there is a mistake,0,61,50 python web scraping data to csv i was trying to use python web scraping then output a csv file but the print format is not matching csv format outputenter image description here how to print this expecting results enter image description here thanks below is my script,how do i use vlookup using python having mutliple columns in both dataframe i need help on vlookup using python i need only one matching column data of df in df instead of all df data my input is below two dataframes and my output is i tried below code but getting address column blank and when i use below code all columns from df came in df,0,47,68 can t install ta lib on amazon sagemaker i can t manage to install ta lib on amazon sage maker the error is very weird,make negative values of numpy array positive i have i want to make the negative values positive e g is there an easy way to do this thank you so much in advance,0,21,40 install error with typeerror object of type nonetype has no len i want to install pygrowup library from github when i download the file and run the setup py file in vsc error root internal python error in the inspect module below is the traceback from this internal error typeerror object of type nonetype has no len how can i fix this,neptune aws sortorder asc and desc don t give reverses of each other i am searching for with my table and i get all the tables i expect sorted by score though i am not sure if it s in the correct order since i don t know how to get the scores from elasticsearch when i reverse it i e from sortorder desc to asc i do not get the exact reverse what is the reason for this,0,61,74 i keep getting nameerror name root is not defined in tkinter when running a registration application i keep getting nameerror name root is not defined when running the code i have ran code similar to this before which seemed to work however that didn t involve many functions if any at all any help with this would be much appreciated,what is the proper way to compute confidence intervals with pytorch for classification and regression i wanted to report etc confidence intervals on my data using pytorch but confidence intervals seems too important to leave my implementation untested or criticized so i wanted feedback should be checked by at least some expert furthermore i already noticed i got nan values when my values when negative which make me think my code only works for classification at the very least but i also do regression i am also surprised that using the numpy code directly actually gave me differentiable tensors not something i was expecting so is this correct output how do i fix the code above for regression e g negative values of arbitrary magnitude sort of surprised there isn t an implementation already and especially not an official pytorch one given how important ci is supposed to be perhaps a deep learning bad habit rarely seen it in papers unfortunately references,0,60,163 pause and resume for tkinter pomodoro clock i ve been working on a python tkinter pomodoro clock about everything else works perfectly except for the resume button this is my code the pause function has some issues i can get it the stopwatch to pause but when resumes the stopwatch starts increasing and decreasing randomly help would be greatly appreciated,how to accept urls without a protocol the following is a subclass of pydantic s basemodel when i send a request with a body like this the second url is invalid how to accept urls without a protocol,0,59,37 i can t install the numba package via pip enter image description here i can t install the numba package via pip i want to install the numba package but an error appears every time,adding the median as text to plotly express px box facets how would i add the median values for each of the target categories and each of the faceted subplots i would like to add the values at the bottom of the subplots or to right of the boxes,0,33,50 django context not passing in html template i am not understanding where i am doing mistake i am trying to passing context in my html page but why context isn t passing see my code views py urls py html see my terminal result where all object printing from context why i am not seeing any object in my html page where i am doing mistake,why am i getting empty dataframe message when using concat i am trying to view the predicted price for msft and i am referring to a book titled machine learning and data science blueprints for finance it provides a sample code as a case study to determine the future stock price of msft the code is below however when i start debugging it the terminal shows the following message the code is below i know the data is present because when i print x or y it shows up with it it must be an issue with concat,0,63,98 how to use api key without directly using it in the python code i want get data using hubspot api in python however i don t want to show my apikey in the code what would be the best practice to get data using api without showing your api key i am currently working in jupyter notebook,how to get random names from a list without repeating names python i am very new to python and i have run into a problem that i can t find the solution for i am trying to create a unique character generator to create the names i have a pool of names that are in a txt file and also suffix which are in another one however i run into the problem that when i run the code sometimes the same names appear as they are chosen at random each time round this is the code that i have written for it i will be thankful for any help,0,56,108 mocking namedtemporaryfile in python unnittest i have a function like below i am trying to test the xcom push key value but i can t figure out how to mock the namedtemporaryfile i have the following test i get the following error when running the test typeerror expected str bytes or os pathlike object not magicmock i am new to mocking an having trouble figuring it out any help would be appriciated,problem with condition if a predefined text exists in the database field then the if condition is satisfied my idea is to insert a condition in the if if in the specified field in the database it says smartphone i have a problem inserting this condition in the if i would like to obtain that if in the device field of the database it says smartphone then the if condition is true i m not getting errors but hello doesn t print the database is the row for example is id street chelsea smartphone,0,68,93 pyttsx not working process finished with exit code i am making an artificial intelligence ai assistant and i wrote this to make it speak it does not speak and shows how to fix it,how to deal with consecutive missing values of stock price in a time series using python i have a data frame consisting of two time series describing two different stock prices spanning over five years with an interval of approximately minutes i am struggling to decide how to deal with the missing values to build a meaningful model some info about the data frame total number rows number of missing values in series number of missing values in series often there are missing values in consecutive rows which is what makes me confused about how to deal with this dataset below is a portion of the data plots of series column and series column visualisation of series visualisation of series any advice would be appreciated thanks,0,35,131 how can we add quotes around a string in a column in a data frame i have a field named location it looks like this i am trying to add double quotes around the string so it looks like this i tried this it does something very weird i also tried this it adds way too many quotes thoughts,callback function doesn t print unless ran by jupyter here is the minimal code needed to reproduce the problem i call an api with a callback function that prints what comes out of the api call if i run this code in jupyter i get the output if i run it with python file py i don t get any output i already checked the api s code but that does nothing weird setting debugging to true isn t helpful either note that there is once dependency the bitvavo api install it with pip install python bitvavo api here is the expected output i get from jupyter,0,59,100 how can we persist changes in a docker container i am using a python program to scrape and save data in a sqlite db file there is no mention of sqlite in the dockerfile what should i do to save changes in the data db file this is my dockerfile can you please guide me step by step thanks,reading multiple csv files from azure blob storage using databricks pyspark how to read multiple csv files with different columns and file path names and make a single dataframe here is an example just paths however there are many paths based on frn and filename columns can be concatenated and filled with na if there is no value present adding new columns based on frn and filename as mentioned in path with respective dataframe of csv file in each filename folder there is only one single csv is present but there is multiple filename folder under each single frn folder for example i tried this but how can i concat these different csv files and create new columns like frn and filename as well,0,57,126 python what does the syntax slider var mean in this function i am trying to understanding the following codes i am confused about what does s time val here do a slider variable input parameter thanks,how to change values of rows based on groupby i have the following df i wish to change the values x if the id s algo has a so in the above df only id and has a s algo hence the values should be x to achieve this i do desired results my question say i wish to iterate over the group of ids and make the adjustment there inside my for loop how should it be done,0,32,79 how to fix connection refuse error using mail sent function in django hello i am new to django i am making a blog project i want to add sharing feature in my project via email i am facing an error called connection refuse error error look like that connectionrefusederror at url win error no connection could be made because the target machine actively refused it setting py where i defined my views function my views file look like that views py,matplotlib pyplot plot average curve for multiple graphs i m a beginner in matplotlib i ve already created some graphs from a dataframe now i want to create the average graph from multiple graphs can anyone help me with this my graphs look like this the graphs look like this this is the dataset i use now i would like to create the average curve from all these graphs can someone help me with the code how to do this in the easiest way thanks in advance for the help,0,79,89 finding number of times rows of a particular column are repeated using pandas from a given data frame i need a new data frame that consists only of those rows of a particular column that is repeated three times using pandas for eg if my input dataframe is then my output data frame should be only of those rows where name is repeated three times,converting chars in d list to int values python i m trying to convert this maze to this is there a quick way to do convert the char values to ints i don t know exactly what i need to be searching for also what is the best way to traverse this,0,65,50 i have to print the directory of main directory error is filenotfounderror winerror the system cannot find the file specified as i have to print the list from the output of dir main e g c users xyz abc mno,create a column comment in python source file hello i want to create a comment section right next to all my code lines for documentation purposes i have over lines of code and i don t want to place all the by myself the result i want to achieve is there a way to do this automaticly,0,35,58 list index out of range when trying to remove instance from list the out of range error shows when i try to remove an instance from a list but doesn t pop up when i just pass the statement,pandas sum values from minutes to hour time data values with pandas i have a question i want to sum time data values with pandas i have data in minutes step and i want to sum the values for one hour for example my data i want to have this data is called test my soulution i would be happy if somebody can help me thank you,0,38,68 django drf sending email with html template html template appears as plain text i m trying to send emails from django using a html template it does send the email but the html is sent as plain text how can i make the email appear as html to the receiver i m using django views py activate email html,removing any characters after a comma in a column python i have a column in a df like so i want to know how to remove the comma and following characters from elements in the column that have it so new one like this i know i can rename each element individually but i d like a way to do this at once for the whole column thanks,0,57,67 method not allowed error after deploying python app on heroku i have scrapped a website and after scrapping i have successfully deployed it on heroku but it gives me the error method not allowed i cannot understand the error please help me to solve this error this is link my python app deployed on heroku,discord py how to make the bot leave voice channel after the mp file is finished discord py how to make the bot leave voice channel after the mp file is finished,0,56,32 discord py how to make the bot leave voice channel after the mp file is finished discord py how to make the bot leave voice channel after the mp file is finished,why python multiprocessing always generate same random values i am using pool map to process my function there is a random value added in the function but i find the result from each process is the same how can i generate different random values for each process this is an example i want to have different values,0,32,57 how to merge list of dictionaries by unique key value i want to merge list of dictionary provided below with unique channel and zrepcode sample input sample output,what s python json serializable i have two ways to represent python object by json dumps first second then i tried p json dumps person the second way would say it s not json serializable so basically for python json dumps only work for built in object like dict object,0,28,44 plot confidence interval of a duration series i measured the duration of requests i got now an array of elements each element represents the duration of a connection request in milliseconds i want to plot the confidence interval in python and in a clearly arranged manner do you have any idea how i should plot them,how to add multiple dictionary to a json file in python how can i add multiple dictionary in a json file i want to add or dictionaries once and after a while to add or or dictionaries in same json file exemple i want to add it to a test json file and after a while i want to add the dictionary and after a while i want to add this for example edit this is first output than i append dict to list and this is the output it create a second list and put dict in it how can i change the code to put dict in my first list,0,59,121 how to make a window bounce back when it touches edge of screen tinker this is my code i want to bounce back my window when it touches the screen edge but its just going off the screen whats wrong in my code pls help,how do i configure my azure function s environment so that i can use the cosmosdb client in python code i am building an azure static app with an api written in python i d like to use the cosmos client i m able to configure my local machine so that local development works but i m unable to get this code to work in production i deployed the the code and the function fails when i check application insights i see error messages exception while executing function functions my commands result failure exception modulenotfounderror no module named azure cosmos i assume that i must need to run a command or add something to requirements txt but i cannot find out what it is,0,45,116 i installed brownie and after installation when i tried to see the version of it i ran into this error i am using macos if that matters importerror dlopen users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so symbol not found pygen send referenced from users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so expected in flat namespace in users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so i tried pip uninstall recordclass and re install it but couldn t fix the problem,how to find the three maximum value from a list using loop i have the following dictionary from which i want to get the maximum of the last value from the three how should i go about it using a loop,0,57,42 pandas number of unique distinct characters in a string how do we calculate the number of unique characters in a string in pandas dataframe i have data in column like this i want to add another column which mentions the length of unique characters in each string expected output so far i have tried however the above code gives me this result please help,how to efficiently check page text for a list of keywords in selenium i have a list of keywords a b c and i d like to check which appear on a given page using selenium ideally each with the number of occurrences the naive way would be to look for each separately using xpath contains text a or body text page source etc but it seems to be an overkill to go over the entire page again and again for each of the strings i have quite a few sites to go over so i d like to do it efficiently do i just get all text from the entire html so including the title and the description on top of the body and then perform all the searching on my own outside of the scope of selenium e g rabin karp etc or is there a reasonable out of the box solution,0,63,148 for loop in python why does this return not does anyone know why does this return and not but when i do not indent the return statement it gives me this is my code,selenium in python not finding any elements i have written numerous scripts to scrape websites i am looking to scrape games and odds from here i am not able to find any elements at all i have looked for almost all the div items but tried root and it didn t work the code i am able to find the root item but i am unable to find other elements for example the games are contained in a div with the classes ae aj im s h i j ak l m al o am q an added this line of code but the events variable is empty,0,39,108 how to extract longitude and langitude from keys i have the following setup for my data frame now i am trying to arrive at having place id lat and lng in columns my code is but unfortunately nothing is happening i have still my core column including the entire geometry,what is the most efficient way to compute the sum of all pixels inside a given rectangle in an image my solution is as follows is there any better more efficient algorithm to do this,0,49,35 getting recaptcha result from ebay sold page scraping i m trying to get some information from the total sold page of an item in ebay because the api request for that is not available anymore i ve tried both bs beautiful soup and selenium but getting recaptcha result and not the page s content itself any help with that issue thanks,follow up i m trying to input an integer into a website box using selenium and i m getting an invalid syntax error on the send keys the cmd prompt then reads the following i m not sure what is causing the syntax error further help is appreciated i fixed a number if issues in my original code based on helpful responses to my original question but i m still getting a syntax error on the send keys,0,58,73 want overwrite a file with panda using to csv when i do it a second time i get error permissionerror errno permission denied datasets titanic x train csv here is the code it fails here and the final error output is the documentation says that to csv always overwrites so i am surprised that is works once then fails thereafter,django schedule run tasks dynamically at particular time periodically from user s order in app without celery i am creating a django app where the user can schedule some tasks to happen at a particular time for example in google calendar we tell google what we will be doing tomorrow and then at right time it sends us a notification similarly here i want it to be flexible for instance the user can tell django the time and function to run django will wait for the time and then run the function like he said turn off lights at pm then django will do it or for example user says remind me to go to the gym in minutes and then after minutes he gets a notification actually the tasks are added dynamically so we can t hardcode them at first code there s a django model known as function in which this function is stored and the user can access it easily i want users to select this function within the application and also give parameters and time and django will run it at that time in short what i need is that the user from within the application is able to set the time of a function or task to run at a particular time maybe periodically or once or maybe in the situation and django runs it on that particular time note user will also give args and kwargs i am taking care of that all i need is django run the function with those args and kwargs only django method without celery or something will be appreciated thanks,0,55,268 play youtube video until finished i am using a selenium to code python script to search and play a youtube video this is my code so everything works fine but i would like to know what is the best way to have the script wait until the video is finished before finishing i saw different ways to do so using youtube api or using selenium with elements appearing is there a preferred way to do it,why does my pandas list contain duplicates i have a function that takes api response and tests to see if a condition is met if meta not in api response if the condition is met i extract the key pair value percent complete value from the response and print it to the console this value is a percentage and only appears once in the api response my issue is when it prints to the console the list which should contain x value e g is printing the value twice e g if percent complete the console will print your data requested associated with id is complete is there anything wrong with my code that might be causing this function example api response,0,76,122 how can i install fastapi properly i want to install fastapi using pip in vscode using but i am getting this huge error what am i doing wrong,how can i structure this dataset for analysis visualization some columns contain lists instead of single values python pandas question how can i improve either my method expand traits posted below or the data structure i am trying to use i estimate the runtime of my solution to be a few hours which seems like i went very wrong somewhere considering it takes minutes to collect all of the data and possibly a few hours to transform it into something i can analyze i have collected some data that is essentially a pandas dataframe where some columns in the table are a list of lists technically formatted as strings so when i evaluate them i am using ast literal eval column if that s relevant to explain the context a bit the data contains historical stats from league of legends tft game mode i am aiming to perform some analysis on it in terms of being able to group by each item in the list and see how they perform on average i can only really think of doing this in terms of tables something like df groupby by trait mean to get the average win rate for each trait but am open to other ideas here is an example of the dataset the total records in the table is approximately doesn t sound like much but my original idea was to basically unpivot the nested lists into their own record my idea looks a little something like due to the number of items in each list this transformation will turn my records into a few hundred thousand another thing to note is that because this transformation would be unique to each column that contains lists i would need to perform it separately as far as i know on each column here is the current code i am using to do this to the traits column which takes my computer around mins to complete also pretty average pc nothing crazy but equivalent to intel i gigs of ram is this approach logical or am i missing something here i can t imagine this being the optimal method i also might have gone wrong somewhere in my expand traits method,0,28,370 how do i reset the underscore in an interactive session i have overriden the underscore variable in the python interactive interpreter how can i make the underscore work again without restarting the interpreter,python optimize weights in portfolio i have the following dataframe with weights and then i normalize each row using i want to optimize the normalized weights of each row such that no weight is less than or greater than if the weight is greater than it will be clipped to and the additional weight will be distributed to the other entries in a pro rata fashion meaning the second largest weight will receive more weight so it gets close to and if there is any remaining weight it will be distributed to the third and so on can this be done using the optimize function thank you update i would also like to set a minimum bound for the weights in my original question the minimum weight bound was automatically considered as zero however i would like to set a constraint such that the minimum weight is at at least equal to for example,0,34,159 pandas how can i replace rows in a dataframe i am new in python and try to replace rows i have a dataframe such as i have two question how can i replace nd row with th such as how can i put th row above rd row such as,my python innterpreter works weird the full code is here,0,51,14 python speech recognition ubuntu alsa lib i am trying to convert speech to text using speechrecognition on ubuntu this is throwing an error i am doing this in my laptop with inbuilt microphone i tried all possible answers on stack overflow please don t consider this as duplicate,convert a groupby object with no aggregation function into a dataframe while keeping the grouping say i have the following dataframe df is there a way to get the grouped data as a dataframe e g edit using set index does not seem to work since it does not group the second columns specified e g country as noted it is not grouped for each country as required,0,48,65 can t press image buttons in python tkinter i created non existing px image so i can set it to the button and set width and height by pixels but for some reason i can t press the button after that and for some reason the function runs even without clicking it what am i doing wrong,how to add each start and closing tag to section list in hmtlparser what i m attempting in python my code current first few lines of output i think the error is that once the first p strong is read it s true everytime i m just not sure and am totally lost,0,53,49 ball doesn t bounce of screen edges in pygame i m building a pong game in python with pygame for some reason the ball in the game doesn t bounce off the walls screen edges sometimes it bounces off the walls once or twice and stops i don t know why that happens could someone check my code to see if there are any errors,colab unable to access webpage using flask ngrok i m trying to run flask application on colab but i keep seeing the following when i go to the tunneled page code,0,62,29 how to use scipy optimize minimize for function with variables i m trying to optimise this function by finding the best values for sigma s sigma y and epsilon strain and stress should be dimensional numpy arrays i ve tried but i get valueerror can only convert an array of size to a python scalar i m a bit confused how to use minimise this,log message not displaying on console below is the code i am trying to run but the log message is not getting displayed on the console i am running code on pycharm with python,0,61,34 widgets are not clickeable qt designer i ve been trying to make gui but my biggest problem right now is that any of the buttons are clickable even if i code an action for them and as you can see in this picture i can t select numbers in the spin boxes either,docker container not able to connect with docker container name as hostname i have a docker network with my applications in them i am unable to start my selenium application to connect to web apps and have to use the raw ip for it to work if i were to use my docker container names as the hostname an error occurs below error received docker network here is my docker compose file it connects to the dummy network but it does not seem to be able to connect to other docker containers using the docker container name as hostnames docker compose file,0,51,99 python using tabula java unsupported classversion i try to use the tabula module with python and have this code when i try to run this code on windows i get this error i checked the java installation an get this infos and what i have to do to use tabula on this configuration,how do i create one xlsx file that merges three txt files into their own columns here are the txt files where the colon represents the beginning of the file here is my code so far this imports the files and creates them as a list to my understanding the desired outcome would be,0,52,54 count the number of days between two dates i am counting number of days between two dates for first testcase output is wrong expected output in first test case day is missing in output,how to make a window bounce back when it touches edge of screen tinker this is my code i want to bounce back my window when it touches the screen edge but its just going off the screen whats wrong in my code pls help,0,36,45 django filter and count in template tag i m trying to filter and count a specific queryset in the template with django template engine cant get it to work the film list is the context and film is the table and language is a field any tips on how to use filter and count at the same time in the template engine or should i solve it in another way view,can t download playwright python properly i tried to install playwright in my laptop i typed to command prompt however only the first lines running without error i got the error message for playwright install i ve added playwright into path but still getting the same error,0,69,46 fill new column with true false for each unique account with subset of another columns if exact duplicate python i need to create new column unrated duplicate with true false values if subset start end qty sig rate is exact duplicate for each unique date range start end then assign true to rows where specific value charged n original df output should be my code but it doesn t work the way i want thank you,log message not displaying on console below is the code i am trying to run but the log message is not getting displayed on the console i am running code on pycharm with python,0,79,34 two seaborn plots with different scales displayed on same plot but bars overlap i am trying to include seaborn countplots with different scales on the same plot but the bars display as different widths and overlap as shown below any idea how to get around this setting dodge false doesn t work as the bars appear on top of each other,pandas read csv fails on na values from my point of view in the code below i explicit declared as a na value or missing for an int column while reading a csv file but i got the error message so it looks like that pandas recognize the as a na value but treat it like an error but it should just interpret it as a na value because i defined it that why why doesn t it a workaround could be to tread the columns all as strings and convert them after read csv but that is not the kind of solution i am looking here for i assume i missunderstand the options of read csv,0,60,111 python raise error when comparing objects of different type for equality as far as i understand in python comparing the instances of two different classes for equality does i encountered multiple times situations where a raised exception would have helped me to spot a bug in my code martijn pieters has sketched in this post a way to do that but also mentioned that it s unpythonic besides being unpythonic are there actual problems arising from this approach,how can i fix icon of python executable after using pyinstaller when i want to create an exe file using pyinstaller in ide called pycharm i have a problem to open main exe after i did these commands pyinstaller onefile windowed icon savings ico main py or pyinstaller exe onefile windowed icon savings ico main py i can find that executable file really created on my directory folder c users user pycharmprojects pythonlesson dist but when i clicking on it main exe nothing happens but i see main exe running behind the scenes in task manager how can i make main exe open immediately instead of just running behind the scenes in task manager i can t see main exe running on desktop after clicking on it maybe it depends on icon of exe,0,77,116 reading multiple txt files from multiple folders i have folders each containing txt files i need to read all of them in order to compare the word counts of each folder i know how to read multiple files in one folder but it is slow is there a more efficient way instead of reading the folder one by one like below,how to import a file from another folder in python i have the following folder structure in the file file a py i put from folder b import file b as fb but file a py works only in debug mode meaning that the code produces the expected results if i run file a py in the standard way i get the error modulenotfounderror no module named folder b i also changed the configuration before running the code putting c users src as the working directory of file a py but it still doesn t work what can be a solution,0,63,87 is it possible to shorten the code in pyqt by sticking lineedit in for i have lineedit blocks and i want the textchanged function to trigger when any of them change i decided to take the easy route and write them out in order but now i want to shorten my code i wanna shorted this like this or like this but it does not work thanks for your attention,pip fails to find brew installed libs with m chip folks with new m chip brew stores its libraries in the different location opt homebrew instead of usr local and now when pip needs some packages installed by brew in my case leveldb for plyvel it s not able to find it until i use rosetta brew version to put in the old directory usr local i ve added eval opt homebrew bin brew shellenv in my zshrc to import brew related vars and i thought it should do the thing but no lack do you have any tips on how to handle this issue,0,71,94 how to convert a python list to into pandas dataframe i have below list which i have simplified note how my list has select and from statements the output i am trying to achieve is a dataframe or let s say excel output is there a way to achieve this result i have tried many things but it won t work,pyspark map and apply calculation using value from dictionaries i have two dictionaries one where userid is the key and their location is the value the first items look like this and another dictionary where placeid is the key and the location is the value the first items look like this now i got an rdd where userid placeid and a rating from the user on the place is given i would like to calculate the distance between the user and place and keep the rating using geodesic from geopy distance i could convert and join the values of the dictionaries and replace them with userid and placeid but i m looking for a solution that uses the pyspark language i came around mapvalues but that doesn t quite do the trick for me so eventually i would like to get the distance and the rating that was given,0,62,147 browser back button takes user back inside after logout i have been working on a web interface using flask and having some issues with back button in browser as after logging out hitting it takes user back inside i have found similar questions and tried their answers but the issue is not resolved i am attaching a simple example kindly have a look at it main login html logged in html,print to the console when my bot leaves a server i have recently released a discord bot and i want to know whenever it is kicked from a server is there a way to do this,0,68,36 cloud function cannot import name storage from google cloud unknown location why am i getting this error this is my requirements txt and my main py it works completely fine in my local machine terminal when i execute my code but why is cloud function complaining about my user code,no module named odf due to wrong python version i have many different versions of python but a version that i use and that terminal show me if use command python version is when i use command pip list i got a big list of library including the one i recently installed odfpy i open vscode choose python version and try to import odf but modulenotfounderror no module named odf for sure i need to set something on vscode or change some configuration in linux but i cannot find a normal explanation of how to solve this issue if i change the python version in vscode with odfpy and also django just installed is recognized so i suppose that even if the python version selected on the terminal is when i pip install something is installed on version how do you manage this,0,47,149 extract an element from the class with beautiful soup how would you extract the from data dat,how can u bulid a tree with weighted egdes i am trying to construct a a weighted general tree are there any built in data structures in python to implement it or any simplified code,0,17,35 why does my code not replace the repeatd letters in aardvark and baboon example why does my code not replace the repeated letters in aardvark and baboon example this an exercise for the hangman game,wrong output on python string to datetime so i want to read csv and make a plot for the data i use plotly candlestick to output stock data however some problems i met here very strange the output for dataframe that reading from excel is like this here i am using strptime to convert the data to datetime but the output is wrong you can see that was converted to why how can i get the correct result and i will need to use it on plotly candlestick function data sample if you need,0,36,98 what does sys executable do in jupyter notebook i bought a book which comes with jupyter notebook in the first chapter it asks me to install required libraries it use sys executable m i never see it before what does sys executable and m do also why use user at the end typically i just use pip install numpy anyone can help me understand it thank you,hi i am trying to develop insert functionality using python and postgress hi i am trying to develop insert functionality using python and postgress sql what i am trying to achieve is that when insert a value the id should be auto incremented as i have set it that way but still gives me an error of non null see error below this is my current code error i am receiving this is how i created my table how do i avoid the error so my code takes in all the value and only auto increment the id column based on the insert statement,0,65,104 adding a legend to pandas scatterplot i am using the pandas version of scatter not matplotlib how would i add a legend to this graph based on the colors,two line plots with the same color in plotly i am quiet new to plotly and usually use matplotlib however i have to use plotly this time due to dash what i want is very simple with matplotlib but i don t get it working with plotly two lines in the same figure that have the same color with matplotlib this would look as follows however i have a hard time controlling the color in plotly how do i get the above result with plotly i have tried a kind of workaround which gives me two lines with the same color but not the color i want which is black the result should look something like this i understand that it is normally bad practice to use the same color for two lines however in this specific case it is not i want to plot some self defined boundaries that function as a reference for other data that is to be added to the figure extra these lines should not be included in the legend however i want to plot d data in between these lines for which i would like to use some color coding this color coding is preferably in the legend added as a colorbar thank you very much for your help,0,29,208 using python how to change dimensions and aspect ratio of svg file iam trying to change the dimensions of svg file in python using the following code however the aspect ratio is being kept according to input file how do i resize an svg in python according to new dimensions newwidth x newheight and their corresponding aspect ratio newwidth newheight,comparing three numpy arrays so wherever one is not a given value the other are not that given value either is there an effective way in which to compare all three numpy arrays at once for example if the given value to check is wherever the value is not it should be not for all three arrays the only way i ve thought of how to do this would be checking that occurrences that arr arr is however this only checks one direction between the two arrays and then i need to also incorporate arr this seems inefficient and might end up with some logical hole this should pass however this should fail due to arr having a where other arrays have s,0,57,132 finding impulse response of the block diagram i have the following block diagram and each subsystem i need to find the overall impulse response for n the individual impulse response for each subsystem was found as shown then i performed the following convolution and addition to find overall impulse response but i got the following error not certain how i should incorporate the range of n values considered,how to compare lists of tuple while considering the reverse order of tuple i have two lists of tuples a and b and i want to extract the tuple from a if the tuple is in b too the question is how to extract the tuples while considering the reverse order of elements in it for example in this case the expected output is,0,68,67 how to call methods using schedule module in python we can call a simple function using schedule like this but when im creating a class and calling a method i get,rename items from a column in pandas i m working in a dataset which i faced the following situation and my goal is to make the variables marquis and marwise be included into the variable marquise how can i combine they,0,31,40 why isn t my code working where i m wrong write a function rotate m that takes a list representation m of a square matrix as input and returns the matrix obtained by rotating the original matrix clockwize by degrees for instance if we rotate the matrix above we get rotate your function should not modify the argument m provided to the function rotate print rotate,installing python macbook air m problem i am gettin following error while installing python on macbook air m i run the following command the following error is thrown my question is that how can i install python on macbook air m using brew,0,68,44 selenium wait until method hello fellow programmers i have a simple question is equivalent to i m developing this selenium app and sometimes the server traffic is quite massive which leads to different loading times when moving from page to page i found time sleep n isn t efficient but if i use the wait until ec block will the code execute once the condition is met it won t waste time if use wait webdriverwait browser and the page loads in seconds,create multiple boolean columns in pandas dataframe based on multiple conditions i have a dataset where authors are ranked by the order of authorship etc i want to create three more boolean columns if first if second if last the purpose of this i want to show if the author is ranked or last in the article the last means the maximum number in rank column the maximum number for this authorid in the column rank i can do if first and if second that is pretty easy but not sure how to resolve if last two rules here expected output,0,79,101 seaborn after dates num date x not showing x equals x y on the graph lmplot after converting dates to floats necessary to use dates in lmplot then when trying to set ax set xticklabels the x disappears on the graph in the lower right corner eg x y,how to distinguish between and true equivalently and false the following code block raises the aforementioned question i can understand that being a subclass of int this is the expected behavior of bool but does that not affect the structure of list how can i handle their and or true and false explicit presence in any case i e i want something like true false in case of d in a pure pythonic way,0,42,87 replace string in paragraph while keeping style docx library i am replacing the strings in tables and paragraphs of word document however the styles change how can i keep original style format there was a similar post however it did not help me maybe i did something wrong,not able to select any of the options from select using selenium and python according to this tutorial i should use this but i get this error i think its not working since the elements show up after the usr clicks the box but i have no idea how to get around that to select the element with selenium ultimately i am trying to target this box i don t know if its because of the old selenium syntax getting deprecated or not any help would be greatly appreciated,0,48,87 how to convert the data from solana account info to readable txt or json with python i get the output image attached blxrjfggrq wzt l hj d actually longer than this image attached my guess is this is some base or something but i have no idea what it is or how to convert the data to readable format in python any help is much appreciated,how can i set layout size in streamlit is it possible to set height and width in streamlit layout i know that there is possibility to set layout wide and centered but its not enough for me map is too big when i use wide too small when i use centered when i set a size folium map there is a blank white space between layout and map i would like to set this size without blank spaces wide centered,0,63,79 attributeerror in python unit test circle i have to make unit test for circle in python but for the life of me cant figure out why i am getting this error traceback most recent call last file c users user desktop domaci preadvanje circle unittest py line in test area self assertequal circle area file c users user desktop domaci preadvanje class circle py line in area return self radius self radius attributeerror int object has no attribute radius code for circle code for test,pointing numba to the tbb is there a way to point numba to the latest version of the tbb installed on my virtual environment please by default numba finds an outdated version of the tbb and resorts to omp here is the numba warning although the installed version of tbb is,0,71,51 is there a pandas function to create a df of an dict object inside a df so now i have a csv file which is a df to csv stuff and it looks like this i want to ask if there s someway to merge that dict stuff into the df you can find the whole csv file here here is my code,pandas dataframe custom indexing of nested dictionaris and lists i have a dictionary like this which is showing market orders of some cryptocurrency pairs and each list of bids and asks has a fixed number of elements and each element has two values which respectively are showing order price and order amount i m really an amateur in pandas and numpy so what i want to do is to create a dataframe of this dictionary let s name it df and get the first bid or ask of all of the pairs in a single line like this i ve tried a lot of ways but none of them worked as i wanted them to addition as far as possible i want to avoid using loops,0,60,125 recognise list comprehension type take this following code to anyone reading it s clear that stripped should be of type however mypy recognised it as how can i get mypy to recognise it as union list str list bytes,permissionerror errno for os rename as quick action this question represents the latest issue encountered when solving another problem let me explain the current issue first and leave the initial difficult at the end this python command works when running the python script in automator using the the run button on the top right however when run as a quick action it throws the error all suggested solution tell me to grant various programmes full disk access however after having done so for terminal finder automator and bash i still see the error i even changed the permissions for the folder to be renamed in the get info box nothing has helped this problems seems to be isomorphic with a problem i had earlier with another commend not working as a quick action this command works in pycharm it works when i run the python code containing it in automator using the run button in the top right however it does not work when i run this workflow as a quick action triggered by a keyboard short cut the quick action clearly works as the little cog rotates but the file remains unchanged,0,35,192 having problem in reading data from multi level columns pivoted format to dataframe in python i have data in a google sheet with columns in below format i want to adjust row and in columns to create a dataframe original dataset i tried result will ignore first two rows looking something to bring first two rows in columns also output req below groupby with year,python check if any of lists is not empty and if not do something with corresponding folder that is linked to that list so here i am trying to optimize some code i have code checks if any of lists is empty and if it is not corresponding folder that is linked to that list will be saved in external program so to make it more clear this is code so basically we will in this way keep in keep list only names that are linked to lists that are not empty what do you suggest any algorithm that can optimize this since now when i have only four lists it is easy to manually check it this way but better solution is needed please advice thanks salute,0,68,129 pandas read sql query with comprehension in params i m trying to do a sql query with pandas i have params initial date final date and trader where trader is a list my query looks like this in my params i m trying to do some like this but i have been receiving this in my ide visual studio code can someone help me to fix this,settings object has no attribute django restframework i know this question has been asked before but i am unable to understand the answer i have defined an environment variable in settings py then i call it in views py but i am getting this error settings object has no attribute s path,0,65,49 what s a good way to handle shadowing variables what s a good way to handle variables in helper functions that would naturally take the same name as an outer variable like here where ive added the underscores of course it would work without the underscores but ive heard its bad hygiene to shadow variables like that the underscores are ugly and invite mistakes arguably moreso than the shadowing itself,function view throws an exception of unboundlocalerror at group share when a user tries share a post what could possibly be the course of this exception unboundlocalerror at group share when i try sharing post of another user in a group the exception trace seems to be on the the first line of the forloop new new post video add img here is my view for users to share post here is my model post,0,68,71 typeerror str object does not support item assignment in dot product calculation i have the dataframe as follow the rscore and nscore values for each column should be drived from the dot similarty of two vectors as follow but i got,how to read and append multiple cells from different excel files in python in a simpler way edit from the code given by oh my lawdy thanks i got the result seen in picture it s like joining lists in a dataframe but gets nan for every column i add final df with code by oh my lawdy end of edit i m trying to get data multiple cells from one sheet from different excel files daily report and make only one excel file with daily data to use it in plots actual vs budget forecasting so far i can get the results i want but i think is not an efficient or elegant way to do it i read excel files with a for and i defined a function for read specific cells from daily report pass this function for the for loop and append data through the loop that creates one column dataframes and then i use concat to get just one dataframe then i write output to excel file i need to read at least cells from this daily report each one would be a column in a dataframe so coding is really long and i m thinking using this code for other reports but i m feeling like it s not clean for now daily reports don t change cell positions any help would be appreciated maybe function could read several cells at once reading excel files function code results data frame rows columns sorry no formatting produccionconacsaptmpterminalmolyptbaewinventario inicialinventario final,0,41,253 python how to start y axis at i am getting the following chart as you can see the first bar starts at its value i want this to actually show the green bar which means y axis needs to be set to zero any help is appreciated,how to connect to azure data lake storage using presto on python so i need to use presto to connect to adls now i have read hive can connect to adls and presto can be used to connect to hive but i could not find a single article on how to connect to adls using hive using python thanks in advance,0,50,61 how to check if xgboost uses the gpu i m writing a pytest file to check if my machine learning libraries use the gpu for tensorflow i can check this with tf config list physical devices for xgboost i ve so far checked it by looking at gpu utilization nvdidia smi while running my software but how can i check this in a simple test something similar to the test i have for tensorflow would do,how to add path to deal with this warning warning the script pygmentize is installed in home maulik local bin which is not on path consider adding this directory to path or if you prefer to suppress this warning use no warn script location,0,69,38 hi is there a way to write this code more briefly and avoid repeating if i am beginner c users lenovo pictures untitled practice py pycharm png,the same phrase is repeating while using different command i m developing a telegram bot i do this on my code and the question is why my bot repeat the same first phrase when i put the second command ps the code is working now i deleted bot pulling under the if and i put the hello and start commands in differents lines,0,24,62 django typeerror expected str bytes or os pathlike object not nonetype i am writing a webpage that can run a python script by clicking a button on html here is what i have views py urls py home html directory screenshot the problem is with this line of code out run sys executable test py inp shell false stdout pipe from views py how can i fix this thanks,specify data port in ftp terminal or python i have to upload a file into an ftp server from a specific ip so i have to use ssh tunnels to connect to the ftp server for that i use ssh nl localhost ftpserver com root myserver com this way i can connect to the ftp server using ftp localhost and the command port will be to and everything works great until i want to use the data port i need a way to specify what port i want to use for data transfer in active mode to create another ssh tunnel and pass it through there i know it s by default but i can t assign my local port i need to use or something i need a solution for both the terminal command line and pythons ftplib,0,55,141 extrapolate category from a categorical variable and apply them to another variable in pandas starting from a cutted variable from a pd dataframe like this i would like to extrapolate the the category and apply them to another continous variable in order to obtain the variable y segmented with the same class of the variable x,changing tkinter treeview column to only show date not time i have a tkinter treeview which is populated by data from an sqlite table from a separate file the date column comes from an excel spreadsheet but the column in excel is text so i figured that it should import to the sqlite table as a string however when the treeview is displayed it displays in the format of date time instead of just being the date i am not sure why this is i assume i need to use date to retrieve the date part of the datetime value but where do i do that i have added the code which populates my treeview i think the solution is about editing the last line with the table insert to pick up whether a value is a datetime value and change it to just a date with date my column where i need just the date,0,55,155 why swagger ui doesn t show prameters and response i m using django and djangorestframwork and drf yasg i have this api in view py module and in url py module i have i need to have gameid in query params but it can not be seen there,using click in a shell script that has a hy program in a here document how can i convert the following working example of using click with shell python repl i think to hy when i use the following hy example with test sh name shadowrylander count i get when i should be getting normally i can use hy eof eof without issue,0,42,67 launch vscode script from powershell prompt attempted to use the commands as suggested by others in the comment no results or change i have switched from commandprompt to powershell and want to use the same command i used in command prompt to open the file i m working on in vscode i e code in powershell this doesn t launch vscode or really do anything noticeable would love some insights thanks,convert pandas column with object type to date iso format i have dataframe as below i tried to use this solution how do i convert dates into iso datetime format in a pandas dataframe to convert my timestamp column to iso format but it is not working my df test timestamp still appear as object column instead of datetime please help,0,68,61 why does my code not replace the repeatd letters in aardvark and baboon example why does my code not replace the repeated letters in aardvark and baboon example this an exercise for the hangman game,how to connect salesforce database in django perform api calls using python how to connect salesforce database in django perform api calls using python,0,36,25 pandas using value from a column as an index to extract value from an existing column into a new column the datframeis shown below i d like to add another column newcol which uses the value in the price column to look up the position in the name column output m code is obviously wrong,passing a value to a modal in django i want to add a delete confirmation modal after clicking on a delete button on a table generated by a number of objects from a django view what i have in the modal is something like this how can i use the i variable in the modal since i am outside the loop can i use anything to reference that variable into the modal or probably use javascript to perform that action or is there something i can do with jinja itself thanks,0,54,91 python decorator inheritance issue how can i access bar s help message from within my help decorator without passing it as a parameter in run,how to delete take certain channels and categories and delete them discord py i want that when a user writes a command the bot deletes certain channels with certain names but i can t succeed error code,0,22,35 how do i move both files and folders to the specified directory there is a code that moves files from one directory to another but it doesn t move folders how to make it move both files and folders to the specified directory,resampling with origin end day i don t understand what origin end day does the docs give the following example the docs explain origin end day like this end day origin is the ceiling midnight of the last day so as far as i understand the line should be equivalent to however passing the timestamp ts index max ceil d produces a different result i m looking for an explanation for this discrepancy and maybe a better general description of the end day argument than the docs provide edit i m using pandas,0,42,79 check the string is ending with using python i need to check whether the string ends with or not i have tried with the below code and it s not working as expected,how to filter string of dictionary from a list of python i have a list tht contains strings and those string could be a simple string or key value pair in a string please see below sample i know a way to convert string to list of dictionaries using json loads replace method but the condition is to have all elements as dictionary but in my case a list contains a string and dictionary as a string how to filter in such condition any suggestion,0,34,85 convert number to cardinal in python i want replace any number in string to cardinal num then print it i have one challenge the user may not draw any spaces between the number and the next character input output,is it possible that python takes very long to assign a name to a huge list gb i am working with a very long list of lists i m talking gb if you put it in a file a cleaned corpus in my script i assign it a name and then use it in another function that has to do with word vec spacy and semantic similarity calculate for each word in a list of words what is their semantic similarity i e how similar are the contexts in which these words appear i have many steps in my script and i ask it to print something after some of the steps all to an output file i am using bash to execute the script it s been hours and nothing is in my output file which i assume means that the list has not been assigned the name yet however when i run a py script with only the list in it also assigned to a name it takes very short also the model usually loads very quickly so that shouldn t be the problem either so am i doing something wrong here this is how i made the list that process worked i already have the list and the actual list is just a huge list of lists thanks for your help,0,39,221 how to follow a large file in python without loading it all in the memory i tried the solution in this answer since the file i m tailing can grow large than gb the server is choking any suggestions on how to follow it without storing all in memory,comparing two csv files in python and output i have two csv files i need to compare file with file and output any lines that are in file which are not in file issue is when there is two lines with exact value in file output should show the value that is not in file instead it is removing both values as duplicates is there any way to do this the code i am using now is file address value ce e ce e fb d fb d fb d fb d fb d fb d file address value ce e fb d fb d fb d fb d fb d fb d output should be address value ce e,0,48,106 how to solve the duplicate integer issue in an array for the isvalidsubsequence array sequence question prompt for isvalidsubsequence how to solve this repeating s issue using my code,microsoft teams api or event to get when a user speaks i am using ubuntu as my work operating system and microsoft teams will be working full time in mute mode so i would i like to know whether there is an api or event through which i can get whether someone speak through teams so that i can automate and reduce my music volume at once or is there any way in linux or python to pick up when microsoft teams is using speaker or alsa driver etc,0,28,89 how to extract elements based on condition they contains a specific element i d like to extract all href from item list that also contains class list item pay count every item is encapsulated in a div with class box information and has an a some of the items has lists with class list item pay count at the bottom of class list score only these items href i try to scrape,create random integer ndarray sampled from different span per element i want to generate an ndarray a full of random integers which are sampled from different ranges according to another array span for example is there a fast way to do get a,0,61,42 problem with eliminating rows that contain nan in selected rows in ascii data file i have an ascii data file containing nans in each row my goal is to keep the rows where column name lat is not nan here s the partial listing of my data file here s my code any help thanks,python creating new lines based on user input i am wondering how you can let a given user input create new lines automatically like for instance let the user input for example be now i actually want this to be displayed as as you can see in the last example it is creating new lines each time i know you can create new lines with n but not how to import this into user inputs automatically i hope you understand with the example given above,0,53,86 how to handle file delete after returning it has response in django rest framework i am performing the below steps in my drf code i need to delete the file which i downloaded from sftp or simply delete everything in downloads folder what is the best approach to achieve this how about an async celery task before returning fileresponse,displaying values of checkbuttons in python tkinter i have created a list of checkbuttons displaying different pizzas to choose when one or more buttons are clicked it will calculate the total price of pizzas i have a function with for loop and if statement excuting the price of pizza when clicked how can i make the output display the total price of pizzas if one or more pizzas are clicked but also display you have ordered no pizza when none have been clicked in my if statement it is displaying the total price of pizzas clicked but also displaying you have ordered no pizza due to the other choices not being clicked i need it to display you ordered no pizza when only no buttons have been clicked,0,59,130 object of type inputmediadocument is not json serializable i tried to send file over telegram bot query edit message text inputmediadocument typeerror object of type inputmediadocument is not json serializable,how to instantiate and populate class variables using a list i would like to instantiate variables within a class using a list this is what i am trying to achieve is there any method to automatically instantiate variables using list which might not be known at the time i write the code for the class,0,26,55 pil image save convert does nt maintain rgb color i am trying to save a numpy array as rgb image using pil image save but it the saved image is not rgb how do i save the image as rgb i am receiving the image as numpy array the link to original image the link to image saved by image save,extract white regions from binary images i am trying to select only the eyes that were segmented from some face images here is one example of one binary image the problem is that i want to get each eye of the image putting them centered in a fixed size squared image in this case there will be two images with the eye centered on a fixed nxn squared image i tried to check the following post how to extract white region in an image but it seems to work only in one big part of a binary image how to do that in my case,0,56,105 javascript adding character to endline so i m trying to run a tests js for a python code i ve written everything seems fine however at the end of each line n character the tests js file is appending a character the file internally uses the tostring method to convert the python output to a string and then compares it with the expected string using toequal my code the output the tests js code,why does my update to a listbox in a while loop with pysimplegui end up in my program hanging so i am building a little python program to do some cost and throughput calculations for me keep in mind i am a python novice and completely new to pysimplegui with this project i am specifically concerned with why in the code below line thruput window listbox update prompt within the update values function is causing the program to hang i would think it should update with the indicated string and continue on through the while loop but instead it just stalls out and doesn t even update the listbox element with prompt any ideas thanks for the help and apologies for the long code block i don t post on here often and wasn t sure how much to include so i just posted the whole thing edit so i took your advice on getting rid of the nested windows thanks and just set up a right column that appears when the appropriate selection in the left column is clicked but even though it s much simpler now i am never able to even enter the correct or append loops now what am i missing i m sure it s something simple i am overcomplicating,0,71,206 soql query using like and string list i analysing data from salesforce using python and am searching for records with usernames containing jack jones or jill in them the current non ideal solution that i have is i have an example here and have managed to get the following example to work however i am unable to pass a list of strings such as is there a way to pass the list into the soql query itself thanks t,duplicate entry for key order details primary i am getting this error message mysql connector errors integrityerror duplicate entry for key order details primary when i try to add new order and its details using python and sql query complete error message here is my code orders order details order details foreign key,0,78,48 how to avoid subfolders creation while zipping files i am trying to zip the files from the list localpath list in to one zip file reports zip it works as expected but when i extract the reports zip file there are folders created inside it i e all the xls files are under files sample what i need is just the xls files without any folder structure,how to cast an array to a matrix i have a dataset with the following shapes my task is to perform non linear separable classification by binary logistic regression but i get the following error in visualization part how can i reshape array into matrix below is my implementation for the reference the expected result should be like this expected image but i get the following image resulting image,0,62,74 customized scan of lists for consecutive values i have a list as follows given an initial index e g id i would like to find the index of the last item ld in the list such that all values between id and ld are greater than zero inclusive consider this example if id a ld ld what would be the most efficient way for doing so,python re sub removing words between two delimiters under different cases i have a string that contains patterns like how can i use re sub or other methods to edit this string to or i can remove the s afterward i tried using for loop to hard code it but the string is too long and takes a long time to run,0,75,60 i would like to print all alphabet letters in the string below however i do not get an output when i run the code what am i doing wrong i would like to print all alphabet letters in the string below however i do not get an output when i run the code not even an error what am i doing wrong no output,convert interaction list between proteins into a matrix using numpy for calculing the graph laplacian l it s needed the adjacency matrix i have the protein list nodes and the intreaction list between this proteins edges how can i convert the list into a adjacency matrix with values of if interaction occurs or if not only using numpy the output would be,0,65,63 strip get rid of a url encoding of a newline i want to strip url from a newline oa on a normal string you can use rstrip or strip method but for url it for some reason doesn t work do you know how to fix it,how to get random names from a list without repeating names python i am very new to python and i have run into a problem that i can t find the solution for i am trying to create a unique character generator to create the names i have a pool of names that are in a txt file and also suffix which are in another one however i run into the problem that when i run the code sometimes the same names appear as they are chosen at random each time round this is the code that i have written for it i will be thankful for any help,0,45,108 how to read sqs message using lambda python in aws i have tried to read message from sqs queue using boto client in lambda python but i face issue with errormessage sqs serviceresource object has no attribute receive message couldnt find the root cause anyone help on this my code in lambda,i am authenticating to azure through python to list down all my virtual machines and i am getting this error i am getting this error when i try to list down all my vms on azure through python my code is below,0,51,42 how to stop visual studio from referencing netframework version because latest version of vs doesn t support net earlier than i am making a simple python command line application i also tried to change from the application tab of project but the problem is the application tab doesnt exist shown in screenshot below i just want it to reference to the latest version of net how do i fix it error no application tab,splitting a column with more than one kind of separators i m working with a dataset which one of the columns i need to split into three other columns this column is like this than i tried to split it in the x like the code i used below but when i checked the value counts from the new column it showed me that there is other separator besides the x see like some rows have three values separated by so i d like to create these new columns and know if it is possible and if how to split using more than one separator,0,73,104 django rest framework patch request with image upload i m trying to make an endpoint for updating the profile image of a user however whenever i make the patch request the profile image field does not change to the uploaded file i ve tested on postman using form data and i get the response updated completed but the profile image field remains null views py models py serializers py urls py,compile python class with numba i am using the numba jitclass decorator to compile a python class honda that takes another python class car as input argument numba can t identity the type of the type of python object class how can i simply use any python object of any class type inside a class that is compiled by a numba jitclass and add class members njit methods to be used is there any better way to achieve this rather than a numba jitclass,0,62,84 can t upload file from python requests while curl is work fine i am trying to upload file to some api with this function and get client error unprocessable entity for url while curl command works fine what makes the difference,when i use set list a list b it returns a dictionary do sets naturally return dictionaries i m doing some beginner python exercises and one of them is to remove duplicates from a list i ve successfully done it but the strange thing is that it is returning a dictionary instead of a list this is my code thanks in advance,0,42,60 access vault credentials using api i am trying to access vault credentials using python api i am doing something wrong as i always get access denied i have used the following code,no output when executing the script python vscode i m developing a simple reactive programming script example to download images from a web but when i execute the script in vscode i do not get any type of output i already tried creating a virtualenv in the terminal i get this output ps c users ernes desktop paradigmas c users ernes appdata local programs python python python exe c users ernes desktop paradigmas jose py ps c users ernes desktop paradigmas,0,32,59 subordinate function call from main function throwing error as can be seen i am declaring x x and x as global variables in the subordinate function and already including these variables as arguments for the main function appreciate any help,npm install don t install file node mdule node gyp error i have been trying to solve this error for days i check a lot of solutions inside internet and stackoverflow and i m desperate looking for help so inside my project when i write i had errer i have installed nodejs v npm python visual studio,0,40,57 find the top countries having the highest gdp per capita in each year produce the following table this is how my data looks like i want the output as follows this is just the sample output here is the image of the ouput i have tried this so far i don t know how to replace columns with the country name,how to train a lstm on a sequence of dates if i wanted to train an lstm to predict the next date in a sequence of dates how would i do that since lstm require a scaled value example of data,0,60,41 how to output this json which is in the format below in discord the code works by the user inputting on discord cryptoupdate bitcoin i want the program to output the following without the speech marks and curly brackets click here for json response output on discord code,how to install python package libpmf from makefile i would like to install package libpmf whose official website is the complete file of this package can be downloaded from here after unzip we have inside folder python we have inside readme we have my os is windows pro version h build and my anaconda is anaconda windows x i could not understand the instruction type make in this directory could you please elaborate on how to install the package in this situation,0,48,83 hover over button color in tkinter im working on this tkinter project im close to finishing but i cant seem to find a way to change the button color when i hover on it so can you help here is my code the buttons are submitbtn playbtn quitbtn i want the hover over buttons to be black there already red i just want them to be black when i hover over them thx,add extra instances to my x test and y test after using train test split i m working on a multi class classification problem in which i have my data categorized into classes what i want to do is to extract out all the instances that are related to one classification from my training dataset and include in my testing dataset what i did until now is this i m not sure how to continue further how can i add the instances that are stored in filtered df to x test and y test,0,71,86 apparently empty groups generated with itertools groupby i have some troubles with groupby from itertools output is it works as expected itertools grouper objects seems to be readable only once maybe iterators but list li it seems empty i don t understand why this one works join grp for k grp in groupby aahfffddssssnnb aa h fff dd ssss nn b i am using version question already asked to newsgroup comp lang python without any answsers,selecting from d numpy array with a corresponding d array containing indices of the th dimension i have a d numpy array containing values and would like to obtain a subarray with one less dimension where the values have been selected based on a d array that contains indices of the forth dimension of the first array e g i have the following arrays i found one solution but find it rather complicated and would prefer a one liner is there any better solution to get this array,0,74,86 is there an api to add remove delete notes for microsoft sticky notes i am using microsoft sticky notes and i want to create a script that can sync these sticky notes with my google keep notes although i haven t found any way to do this programmatically and i m not sure if this is even possible especially as it is a uwp app,checking if tweet is in reply to deleted tweet i m writing a program to scrape tweets between two specific dates from a user while making sure that they are not retweets or replies i am using snscrape and tweepy this is what i have for the check however if the tweet is in reply to a tweet that has been deleted then the tweet is no longer considered a reply and the check passes as none is there a way around this i m looking at pulling tweets from large companies like tesco and sainsburys and manually sorting through their tweets by hand will be tedious and want to find a way to fix this within the code an example of this is this tweet as the code passes the check for inreplytotweetid is none any help would be greatly appreciated thank you,0,64,142 can t download file on put file in pywebio i m having a problem running the pywebio program in combination with flask when i try to use put file or download session from pywebio it produces an error like this and the file cannot be downloaded error status and here s an example of the code i m using,implementing asyncio with pysimplegui i am trying to implement asyncio with pysimplegui in python in this gui example two buttons button and button emulate a long task to accomplish goal expected result current result i thought that i applied async wait according to the rules did i miss something,0,53,48 how to drag camera with the mouse like in blender i ve found a program that you can move around the camera with the mouse in pyopengl by doing some things i dont fully undesthand but as you drag the object around it starts to lose the top to bottom orientation unlike programs like blender and sketchup is there a way to fix that or another way to manipulate the camera,how convert seconds in minutes and seconds mm ss is it possible to convert seconds into minutes and seconds with this format mm ss i try to use datetime timedelta seconds seconds but it returns hh mm ss format thanks in advance,0,70,35 how to get h over below h when ordering having this dataframe what i would is to have the rows that have the start time with xx xx at the top descending for example ps start time comes from df start dt time,how to update column value in postgres table from python based on condition i have postgres table alpha with following values alpha my connection string i want to update the active status to expired based on two conditions expected output how could the update query written from python for postgres,0,36,49 python datetime converter i m trying to write a python function to standardize incoming timestamps to yyyy mm ddthh mm tz offset example issue question how are others handling this type of issue in python,connecting cache database in azure function i m looking to a way to simply access to a cache database using python i need to make sql query on this database i ve heard about a python package intersys but i can t find it anymore having this package would be the most simple way i ve tried using pyodbc connection with the appropriate cache driver it works on my machine however when i try to deploi the function in production linux os the driver s file is not found thank you,0,30,87 how made cross validation with python hi i made a neural network and i need to do a cross validation i don t know how made that specifically how train or made that if someone knows made that please write or give me some indications here is my code some recomendation for training or validation would be helpful,python pandas groupby and if any condition i have a dataframe similar to the one below and i would like to create a new variable which contains true false if for each project the sector a has been covered at least once i m trying with the group by function and wanted to use the transform method but since my data is text i don t know how to use it,0,56,67 python how to start y axis at i am getting the following chart as you can see the first bar starts at its value i want this to actually show the green bar which means y axis needs to be set to zero any help is appreciated,scrape text with playwright is slow on part of the code using page locator i have made a script in playwright to scrape some text this is the part i have problems here i scrape a series name using locator and it works when the series are not present is skipped but it takes seconds to the code move on the log is below what is the problem can i improve it i think its because of the try statement but why as i have the same code for per example author and it is fast i know it is not good to use playwright best are other modules,0,50,109 python sqlite using executemany with unspecified number of parameters i am using python with pyodbc library i am fetching data from the remote mssql database into the local sqlite file i have a table named products in both databases i m doing something like this works well until i have a table with over fields do i really have to write fifty times,even though assigned zero to variables yet i am getting error cannot aasign to literal error what is the issue here,0,64,21 how to get the indexes of the same values in a list say i have a list like this l how do i get the indexes of those s that have been repeated,how do you use headless chrome with selenium this question is asked because i want to know what is the optimal way to do this in as there have been changes and i see that people are doing it differently i want to be able to automate my twitter follow bot in the background using headless i am also new to python and still learning so i d appreciate code lines code,0,40,72 svg commands to an array of points in python for plotting i have svg commands printed out in this style how do i convert this into an image and also be able to generate intermediate points an array of points so i can create a d plot in python thanks for helping,getting attribute from terrafrom cdk deployed lambda i m using terraform cdk to deploy a lambda function and am trying to set a trigger to it using s notifications i m sorta new to cdk so i m not sure where things might be going wrong here reading this example and based also on what s done using regular cdk i thought that to access the function arn so to add it to bucket notification setting it d be my function arn but it renders the following string tftoken token xxx it seems to me that i d be able to fetch the arn somewhere with this value but i couldn t find out where i thought of breaking it up into two stacks but i needed both lambda and its notification trigger to be deployed together the code is,0,51,129 django rest framework patch request with image upload i m trying to make an endpoint for updating the profile image of a user however whenever i make the patch request the profile image field does not change to the uploaded file i ve tested on postman using form data and i get the response updated completed but the profile image field remains null views py models py serializers py urls py,i have a list of strings and i want to put every string through my code how would i do that so i have a list of strings and i want to put every string through my code how would i do that and this would be the list of strings and i would like each of them to go through the fg part and i want it to output,0,62,70 cannot change text of kivy kivymd label when i try to get change the text of a label in kivy kivymd it gives me the following error here is part of the main py for a minimal reproducible example kv string hope you can figure this out but i am not good with kivy,django to use two filterview classes in one template i am creating a search form using filterview in the main window double click the input form in the search form in the main window to display the modal i want to display another filterview class in modal the class of these two filterviews is different in the model filter and form that they refer to how can this be achieved views py html templates,0,51,71 how fill the missing values in the dataframe as ffill function needs nan none which are not in my dataframe as in the question above is there any other way to do it because i care about not using values np nan input dataframe output,how to save numbers as text when exporting a pandas dataframe i have a csv file with data in a field of this type that is with leading zeros text type the case is that i want to save them in another dataframe after other calculations and i would like to keep those zeros but no matter how hard i look it always converts them without zeros the ones above would be i have converted just in case with dtypes to str but it does nothing ff pd read csv dir lotr dats coinc f csv ff posif ff posif astype str how could i keep the first format which is the one that interests me type xxx thanks a lot,0,43,125 how do i select element in a list present in an un ordered list using selenium python this the website i am dealing with here i am able to send the code for the security name but in order to submit it i need to click the dropdown element that comes after giving the security name how do i achieve this with selenium i used the code below and its not working staleelementreferenceexception,error trying to plot a graph of solution to a second order ode using euler method i am doing a project where i want to use euler s method to show a solution to this second order different equation y y y so i started by changing the second order into a system of first order equations y u u f t y u with initial condition y u so i get two equation in the end y n y n u n t n t n u n u n f u y n t t n t n this is my code however when i run the code it give me the error can anyone help me check if my idea works and if not what other approaches i can take thanks,0,71,129 i can t connect to postgres using docker and django this is the docker compose file i m using the python image on a ubuntu system i ve already changed the files in etc postgresql main i m getting this error this is the database i m setting up in django,python combinactions via list comprehension with variable input array let s say i have a list array abc def ghi and i want to compute all the different combinations i e comb adg adh adi bdg without using itertools combinations this is possible e g via result x y z for x in pos for y in pos for z in pos how to rewrite the list comprehension with variable length array list e g result a b c for a in pos for for z in pos,0,46,74 concat multiple csv s with the same column name im having trouble with concatting these pandas dataframes as i keep getting a error saying pandas errors invalidindexerror reindexing only valid with uniquely valued index objects i am also trying to make my code less clunky and run smoother i was also wondering if there was a way to get multiple pages on one csv using python any help would be great,how to valid the captured incoming empty field in a table the problem in code is that if a field is missed then it raises error and if i except the error then it will not show anything i want that if a field is missed then it store the incoming fields i got in a packet and show in the table for empty field it doesn t show anything and leave the field empty in table basically i want that it stores the incoming field and prints in table and didn t raise error for the missed field i m trying it now on filecapture to check working but i need to do this on livecapture,0,68,114 django redirects to non existing url two days ago i created a django project and it worked all right but now when i am working on another django project still when i run server it s redirecting me to the older project i am using different virtual environment for both of them even after deleting the old one the issue is not resolved thanks in advance,django render to string returns nonetype error using django pagination i m trying to do endless pagination using ajax i followed the example here my view returns the first page of results just fine but when i attempt to build the content for the additional pages and return it as json using render to string i get an error while appending data onto my content variable error message models py views py media item html apparently there is something wrong with media media in my render to string but i m not sure what it is is there something i ve overlooked here,0,65,91 find common character in list of strings i want to find common chars in given list of strings without using collections library can someone help on this input output,extracting useful features from a pytorch efficient net b model i have a pytorch cnn based on efficientnet pytorch efficientnet b that does a very good job at the binary classification plus of fairly complex chest x rays i want to extract features and use them in a related model efficientnet pytorch has a very handy method model extract features with the given example it works well and i get those results as advertised but i need the features more in the shape of or something similar i need enough features to be fairly discriminatory but with not too many to be unwieldy i am familiar with the technique of adding a layer or series of layers ending with a fully connected layer with the outputs of the size that i need if that is what i need to do here can someone please lead me through the process architecture etc also it would be great if the solution leveraged the method mentioned above,0,29,163 python cannot read global variable in function even though i used global keyword i want to access the variable number of messages in class a but i get number of messages is not defined error even though i used global keyword here is a code sample,check if value is maximum minimum of previous current and next value i have a time series data frame and i want to list the days when in three consecutive days high was the highest the second day and the same thing but the value of low was the lowest the second day i tried these two lines but i hardcoded the date after viewing the data i want to know if there is a way to not hardcode it df highest df loc high max df lowest df loc low min here s a piece of data,0,42,91 pygame invalid position for blit i am trying to make a game but when i run the code the game makes enemies appear on the screen it says invalid position for blit however i don t know where to put the blit otherwise i don t know what to do because i m still learning the code was fine before adding the copies not sure why that changed anything this is the full code,how can i get vscode integrated terminal in macos to launch correct version of python i recently installed python on macos and i m trying to set up vscode as my file editor and integrated terminal i successfully installed the python extension as you can see in lower left corner of screenshot however when i open a terminal session and check the version of python it displays screenshot of vscode window i tried various settings in the settings json file including terminal integrated inheritenv false as recommended in various so posts but it didn t help can someone help me set the integrated terminal to launch python here are a few facts that might be helpful last thing if i type the echo path command from the integrated terminal i get the following,0,72,130 method object is not subscriptable i don t know which is wrong can someone help me where i got it wrong,django display a list of post s categories with a number of post hi i am trying to make a template in django that displays a post categories table and has a number of posts with it i can t seem to make it right using annotate when making queries on my model like this views py im receiving list of posts instead and has a posts count key with value of models py where did i miss thanks,0,20,75 how to change values of rows based on groupby i have the following df i wish to change the values x if the id s algo has a so in the above df only id and has a s algo hence the values should be x to achieve this i do desired results my question say i wish to iterate over the group of ids and make the adjustment there inside my for loop how should it be done,how can i make my class more robust to operator function overloading i am writing a class for which objects are initialised with two parameters a b the intention is to assign instances of this class to variables so that i can have an equation written symbolically in python code but have operator overloading perform unique operations on a and b in running the above example code i encountered the following output through guesswork i was able to see that a complaint about no callable exp method probably meant i needed to define a new method in my class which ended up working just fine but now i will have to write another method for np expm and so on as i require thankfully i only need np exp and np log to work but i also tried math exp on my object and i started getting a type error so now my question is the custom exp method in the class seemed to work for overloading the numpy function but how am i supposed to handle math exp not working it must be possible because somehow when calling math exp on a numpy array numpy understands that a element array can be turned into a scalar and then passed to math exp without issue i mean i guess this technically is about overloading a function but before i realised defining a new exp was the fix to my first problem i had no idea why a method like rpow wasn t being called,0,79,245 how do i make this piece of python code work i am making a project on replit that makes money not in real life i want the wheat seads melon seeds pumpkin seeds wheat melon pumpkin to be available in and out of functions and be changed in different functions i tried to put these variables in and out of the farm command to remove the syntax error but it doesn t work if you can also improve this piece of code,utilize python input to perform dateshift on a dataset i have a dataset where whenever a date value in the update column is entered into the input prompt date date and date values will be updated according to these rules the only data that is changing are the dates which are essentially getting shifted based upon the user input data desired input prompt will ask user which date value they wish to input user inputs the date which updates the remaining column date values based on rules above doing i believe i can use a combination of a function as well as user prompt to approach this problem type input use input variable in function or script to create date update for date date and date i am looking for some starting point suggestion or a good foundation documentation on how to best approach this problem i am still researching any suggestion is appreciated,0,77,154 noreversematch at details the shortest scientific papers ever published fa c fc a a b e aeddcc f i am trying to add comments in my blogs of my project when i post a comment it shows noreversematch at details the shortest scientific papers ever published fa c fc a a b e aeddcc f here s is blog details page views py of blog details page urls py mapping for blog details page servel url but in server site i get this is there any problem with slug models py of the slug help me out please,trying to write files into dags folder i m trying to create folders and write files into the dags folder which is located in a google cloud storage bucket this using airflow using the following python code no error is raised and yet no folder nor file is created anywhere i tried the same method with the data directory which actually works,0,64,61 boto get waiter does not stop and start instance correctly problem hello i m trying to stop and start instances in the same lambda function i m using waiters however the code above only stops the instance but doesn t start it back up as it does not wait for the stop please help me correct the code thank you code,how can i modify a label in tkinter i have been trying to figure out a way to modify the label to print element to in a line and repeat i have attached a picture to hopefully clarify what i am trying to accomplish my goal is to make the results look like the following a b c d a b c d,0,57,73 python s enumerate equivalent in c i am learning c and have been taking a lot of online courses i am looking for a simpler neater way to enumerate a list within a list in python we can do something like this in just one line does it have to involve lambda and linq in c if so what would be the solution i tried it with dictionary in c but my gut tells me this is not a perfect solution,debold discord py emebed so i m making an embed on my discord bot and i m wanting to remove the big line between the numbers i ve tried name and name ub b but no matter what it will show the annoying blank line code,0,79,41 how scipy dist rvs works is unclear from documentation i am currently sampling from a custom discrete distribution like so where p is a list of probabilities of length n i can t figure out when i look through the documentation what the computational complexity is as the only thing the documentation says about the rvs function is the following link to the documentation here how does the function work bonus question is there a faster way to do this,printing out a matrix out of a two dimensional list i would like to implement the str method to nicely format the string representation of the matrix one line per row two characters per number d and a space between numbers for example i ve tried this but my output becomes how would i solve this because the none shouldn t be there,0,77,61 problem with eliminating rows that contain nan in selected rows in ascii data file i have an ascii data file containing nans in each row my goal is to keep the rows where column name lat is not nan here s the partial listing of my data file here s my code any help thanks,how to analyse space complexity of algorithm for countnondivisible i m trying to analyse the worst case space complexity of this algorithm for solving codility s countnondivisible problem the problem statement youre given an array a consisting of n integers for each number a i such that i n we want to count the number of elements of the array that are not the divisors of a i we say that these elements are non divisors write a function that given such an array returns a sequence of integers representing the amount of non divisors for each element write an efficient algorithm for the following assumptions the algorithm with comments added by me the article states that the expected worst case space complexity is o n but the divisors dict requires space for the sets of divisors it stores if each value in the dict were an integer it would be clear to me why the worst case space complexity is o n but each value is a set of integers so i think it follows that the total space required for the sets of divisors is proportional to the total number of divisors in the worst case roughly how many divisors will be stored across all these sets the worst case should occur when for a given n we maximise the total number of divisors stored across all the sets to do this i think we could use the following algorithm as an example if n then n and before sorting bi b and after sorting bi b and input array a the total number of divisors is what im struggling with is how to generalise this for any n in the range i assume the o n worst case space complexity is stated proved somewhere by codility but i havent been able to find where is my analysis above on the right lines if so how would i finish calculating the worst case space complexity if not then is it actually o n and if its o n what am i doing wrong in my analysis,0,53,454 how to check if a custom solution violates any constraints in ortools i m using the ortools to solve a cp problem however the solution is not really what i expected and there exists a better solution therefore i would like to check if a custom solution is feasible and check which constraint is violated if it s not is there anyway i could do that i appreciate all your help,when i am trying to use cryptography pbkdf hash in python but when i enter a wrong password it throws error this is the kdf setup this is my hash algorithm this is the error i am getting when input a wrong password and then try to re enter it libraries used sqlite hashlib tkinter customtkinter functools uuid pyperclip base cryptography,0,69,60 how to get a better view extract the values from acf plot i wrote the following code to get an autocorrelation plot of a time series that i have and the output is the following chart is there any way to zoom in on the initial values of the autocorrelation plot or at least get the values i need these to be a bit more clear to set the hyperparameters for my sarima analysis,discord ext commands errors commandinvokeerror command raised an exception attributeerror nonetype object has no attribute qualified name i am making a custom help command for my bot and here is my code,0,72,27 pyttsx not working process finished with exit code i am making an artificial intelligence ai assistant and i wrote this to make it speak it does not speak and shows how to fix it,volttron bacnet grab multiple configs py i am trying to auto discover bacnet devices in volttron on a lan with grab multiple configs this message below is from the linux terminal when i am trying run proxy grab bacnet config py where my args or something is incorrect usage grab multiple configs py h use proxy proxy id proxy id out directory out directory ini ini csv file this is my bacnet proxy id d cd b a f b bb b d when i run this from terminal python grab multiple configs py out directory desktop volttron scripts bacnet configs use proxy proxy id d cd b a f b bb b d multie csv i get the usage error is it because my args aren t in the correct order edit snip of vctl status,0,35,93 get execution for given date here s some code i have which fetches the executions from a state machine which started on a given date however it seems inefficient to list all executions and then filter them is there no way to filter the executions without pulling all of them from aws,how to make vscode run your code from the location of the code i keep on getting module not found errors in python and by printing out os getcwd i found that vscode seems to be running things from the workspace folder the top level folder in the editor rather than the folder that the code is in thus it can t find the the modules because all of my relative import and path changing code doesn t work i did some research and found the option python terminal executeinfiledir true in settings which seems like it should change this but when i press f the code still seems to be run out of the workspace folder how can i get the code to be run out of the same folder that the file is in when i run my code,0,51,134 how to filter list of dictionaries in python i have a list of dictionaries which is as follow how can i get a list of the latest vehicles for each vehicletype based on their creationdate i expect something like this i tried separating out each dictionary based on their vehicletype into different lists and then picking up the latest one i believe there might be a more optimal way to do this,how to show a widget on top of other widgets in pyqt in my pyqt app i create a virtual keyboard and i want to show this keyboard on top of other widgets in window whenever i click on show button i used a qframe for keyboard and my widgets are in different pages of qstackedwidget in the code blow the keyboard pushes the other widgets up which is not what i want how can i get it to work,0,72,80 list divide based on element from another list i have two lists as follows so basically i want to break list a into smaller chunks based on start stop values from list b e g something like this can someone please help me figure this out,installing wxpython on windows distutilsplatformerror microsoft visual c or greater is required i have installed when trying to install wxpython in my project s virtualenv i get this error distutils errors distutilsplatformerror microsoft visual c or greater is required get it with microsoft c build tools both the error and anything i can find on the internet including here tells me to download c build tools and install c or greater the latest version i have what am i missing here is there some sort of path variable that i need to configure somewhere so pip wheel setuptools knows where to find the compiler,0,45,104 trying to get the i index on pandas dataframe failling i am trying to loop over a dataframe in order to compare the i and i index as follows i get this error keyerror traceback most recent call last in for index row in df iterrows if df at index col df at index col print true else in getitem self key key self convert key key return self obj get value key takeable self takeable def setitem self key value,how to start a python program using java runtime getruntime exec i am writing a program that requires the starting of a python script before the rest of the java code runs however i cannot find a solution to my issues i would appreciate if someone could suggest a solution to the problem i am facing code i need help on the part under the comment start python,0,79,66 push rejected failed to compile python project django heroku it is my first deployment i am trying to push my django project into heroku but it is saying push rejected failed to compile python project i have tried changing the python lower versions but no luck any help would be much appreciated thanks here is my cmd output my pipfile py source url verify ssl true name pypi my pipfile lock my procfile,i m unable to pass the variable value into ldap code to create an account i m trying to pass variable to create account in active directory but i m not sure how to pass it it is creating an account in the variable name not the value of variable,0,74,47 pandas groupby percentage of total and add subtotals similar to this previous post i would like to derive the percentage within each group but based on the sum of multiple columns and add subtotals for example given the dataframe below the ideal results would yield update it would be ideal to groupby both state and office id for situations where there are repeating values for office id column here is an example this should then yield,invalid file path or buffer object type class nonetype python django i have a issue on read excel file uploaded by user here my code when i give request files monthly file it gave multidict key value error so im using request files get monthly file to get user uploaded file but it gives invalid file path or buffer object type class nonetype value error how can i resolve it thanks in advance,0,76,64 how to use tf gather similar to the numpy slicing i have a list of indices representing the rows and columns that i d like to access when i use them as r c i am able to obtain the corresponding elements in a numpy array i would like to perform the same operation in tf and am using tf gather i have tried different commands but could not manage to get the same results as i do in numpy,pandas read csv fails on na values from my point of view in the code below i explicit declared as a na value or missing for an int column while reading a csv file but i got the error message so it looks like that pandas recognize the as a na value but treat it like an error but it should just interpret it as a na value because i defined it that why why doesn t it a workaround could be to tread the columns all as strings and convert them after read csv but that is not the kind of solution i am looking here for i assume i missunderstand the options of read csv,0,77,111 how to import install dependencies packages from a global system environment to a virtual environment i have installed my needed packages dependencies in the global system environment instead of my virtual environment virtualenv because i have used the command pip install package name outside of the virtual environment so i want to know how can i make a list out of them and install them in any of my virtualenvs,what does sys executable do in jupyter notebook i bought a book which comes with jupyter notebook in the first chapter it asks me to install required libraries it use sys executable m i never see it before what does sys executable and m do also why use user at the end typically i just use pip install numpy anyone can help me understand it thank you,0,69,65 python docx how to set font spacing how to set font spacing in python docx or how to add element to w rpr w rpr w spacing w val w rpr,enumerate values in a column minimum reproducible example i then produce a length type column that is a combination of length and delivery type using this code the problem is that i wish to enumerate each delivery from for each delivery of the over so that it looks like this,0,24,49 how to get member count at on member join event in discord py i am trying to get membercount at on member join event in discord py my code but the channel with channel id is not updating and it becomes,increment a dictionary value by one in python with querying hash table by one time like map merge in java for example given list of str a b a a b i want to get the counts of distinct string a b the naive method is like following however it needs twice hash table queries in fact when we firstly called the get method we have already known the bucket location in principle we can modify the bucket value in place without searching the bucket location twice i know in java we can use map merge to get this optimization how to do it in python,0,35,108 python data transformation i have a dataset with two columns how to convert into the format given below using python,getting days difference from dates in same column in a groupby in pandas i have a pandas dataframe like this in the code columns the values are always form a specified list here n n n etc i want a dataframe that displays the days it takes to progress from code n x to the next one in sequence for each user i am thinking something like this your help will be much appreciated,0,20,71 improvements in the v pokemon battle game i m trying to create a mini pokemon battle game with some pokemons their movesets and their stats it was going smooth until a weird error occured in creating the pokemon s typechart line no to here s the code can anyone please help also i ll be glad to have some suggestions and improvements in this code,how can i have pip ignore all of the sub dependencies of a single dependency in a requirements txt file i m using python s virtual environment python m venv venv and pip with requirements txt i need to use a package python particle which has a dependency on a very old version of requests i want to use a more recent version of requests or later but because python particle is explicitly calling out requests i get an error when trying to use a later version of requests is there a way to tell pip that the user requested version takes priority alternatively is there a way to tell pip to do dependency resolution for all packages except one things i ve tried setup py pip override one of the dependency s sub dependency from requirements txt but when i tried that i still got the error the version of pip that i m using is the error message from pip,0,70,153 adding legends to axes d plot i m trying to add a legend to a d plot and i ended up getting this the legend is incorrectly displaying one color and in a list rather than separate legends for each label what am i doing wrong,how to make a dictionary of inputs these are the inputs and i tried to make dictionaries of each line separated by for example name signalsandsystems this is my code but the code makes dictionaries only from the first line of the inputs the answer that i m looking for is,0,45,50 how to apply limit to get results i am trying to scrape the images they will give me images but i want t apply limit that they will give me only images can you help me in these matter,typeerror command object is not subscriptable this is part of my script that handels getting a custom prefix if needed i can send all of it that s my current script for getting the prefix and setting it depending which server it called from it worked great on my test bot but when i transferred it over it seemed not to anymore thats my error code i get it says typeerror command object is not subscriptable but i have no idea where command is its not included in my json file that s my json folder and it doesnt contain command in it so i m not sure why it being called,0,42,109 async check of several hundred proxies i need to check several hundred proxy servers and get the number of not working script for this proxies in the list i have given a simple version it takes seconds to check working proxies i can t wait that long need to increase the execution speed how can this be done using async,how can i target my mozilla profile on mac os the same way i m targeting it in windows i have a working python script that ll run perfectly on windows it relies on python selenium and my current firefox profile here s the code i m relying on to grab my profile in windows i don t know how to make this work in mac os i guess the os path join function doesn t work the same is there any way to do this,0,61,79 parser error when trying to read csv file with pandas on jupyter hey community im new to coding and as a job task they asked me to read a csv file i used the commands and after that second command i get the parser error i would be very thankful for any help i am really hoping on landing this job,iterate through list of number in dataframes python i have a list number data frame and i want to calculate the average using python language enter image description here,0,61,29 list of every integer except with list comprehensions is there a simpler way to achieve this with list comprehensions i m new to them and currently trying to improve my coding basically in list you have all the numbers from to except thanks,django drf sending email with html template html template appears as plain text i m trying to send emails from django using a html template it does send the email but the html is sent as plain text how can i make the email appear as html to the receiver i m using django views py activate email html,0,46,57 trying to extract a string value between dots from a string column im trying to extract a default string value from a string column but without sucess this is the column with some string values what im trying to reach this is my unsucess code and the result could you guys help me i have a kinda difficult with regex and it just blow my mind when i have to deal with it,how can i call a user with pyrogram how can i call somebody using pyrogram i found phone requestcall and tried to do this but it doesn t work and throws the error attributeerror client object has no attribute phone i understand what it means but how can i call it in another way,0,73,52 list of every integer except with list comprehensions is there a simpler way to achieve this with list comprehensions i m new to them and currently trying to improve my coding basically in list you have all the numbers from to except thanks,groupby in pandas dataframe with multiindexing ps groupby with column as name i have tried creating dataframe with multiindexing resultant dataframe is now i want to use groupby with name i tried using level but not getting how to use column name could anyone help with this thanks,0,46,48 how to compare csv and write result to new csv using pandas i want to compare the sku of source and destination file and if destination sku matches with source i want to copy the meta title meta description and description of that row source csv destination csv merged csv my code is working now but if the number of lines changes increase then it throw error,how to apply a pandas series to a dataframe if i had a dataframe like this and a boolean series like this how do i apply this boolean series to the dataframe and make it like this,0,63,37 pandas for vs itertuples i ve dataframe with a lot of columns for example a xx a x b xx c yy etc all coulmns are integer dataframe df i need change value for all columns a i ve but it s not work for one variable example it is ok could you help me how do this for many variables,parametric pdf estimation histogram vs likelihood given a sample from a distribution and assuming it is gaussian normal distribution with unknown mu sigma the task is to find the parameters mean and standard deviation that describe it best what is the mathematical difference and why does it yield different results and if it is different why and when to use which method i think both are parametric and can be used in the same cases,0,57,75 iloc for cutting data for a spare set of columns by index i want to select only columns indices but not the following works fine but instead of passing every specific column index i am looking for a way that i can pass i tried but it doesn t work what is the best solution,how to delete take certain channels and categories and delete them discord py i want that when a user writes a command the bot deletes certain channels with certain names but i can t succeed error code,0,59,35 how to solve import error for azure text analytics import error for textanalyticsclient i am following microsoft official document for sentiment analysis however i am having import error to import textanalyticsclient this code cause error message like this from azure ai textanalytics import textanalyticsclient importerror cannot import name is rest how can i solve this error,keras save both protobuffer and weights in training callback with custom filenames i am trying to write a callback for my model fit procedure that if after an epoch ends the model improved saves me the weights and the model as a protobuffer preferably to something like tmp weights hdf and tmp model pb i use two callbacks for that mnist example below i m using tf and ls tmp gives assets keras metadata pb saved model pb variables weights hdf my questions,0,54,74 sorting hash numbers in using matrices in python i m working on project to check for copies between two drives and i got stuck on sorting the output i have now is filename hash location in two list called drive and drive the output id e like to end up with two text files with a list of the files that aren t in the other drive i m not sure how to go about this maybe i should use dictionaries,how to loop in python api with restriction on limit and can provide offset i am new to python api i need help in calling api data from python where we have limit of rows per page yes off course we can apply offset but i am looking for a loop to extract complete data below is the python script sry i am new and not having much experience in writing the script,0,78,74 how do i count every time a member sends a message discord py i want to store the amount of messages each user has sent in a json file so everytime a user sends a message to their amount in a json file then they can use a command to see how many messages they have sent im unsure how to do this as i am very unfamiliar with writing and reading to files,map values from dictionary s list to a string in python i am working on some sentence formation like this i would now need all possible combinations to form this sentence from the dictionary like can we also make this scale up for longer sentences example this again provides all possible combinations,0,74,51 how to update column value in postgres table from python based on condition i have postgres table alpha with following values alpha my connection string i want to update the active status to expired based on two conditions expected output how could the update query written from python for postgres,setup py is not install dependencies i am trying to create a command line utility that can be installed via pip install git and i am testing locally with python setup py install when i test this locally it installs fine and i can invoke it from the command line but i get a modulenotfounderror no module named dependency error the github url appears to be correct based off of the documentation here specifically git running pip install git actually works as well so i feel confident that the url isn t the issue project structure any pointers here would be appreciated,0,49,100 valueerror at admin services blog add blog objects need to have a primary key value before you can access their tags i m trying to create a blog by the admin panell but i m not able to save can you please help model py for some reason when i m trying to save the tags and the data i m getting this error,find numpy array with don t cares in a numpy array i would like to find a numpy array with don t cares like where is the don t care and find it in arrays like and return the row index s and for the above sample the a array are normally around rows shape note the b array can have don t cares any where or none examples,0,55,69 itertools permutations not working when repetition is above why does python itertools permutations not work when repetition is above,calculate average the letter length of a phrase with one function i did this programming to calculate the average letters of a phrase do you think this program is responsible for all texts and do you have a better offer thanks,0,19,41 how to split dataframe randomly into given ratio according id i have a dataframe with two columns how can i split according column id in a ratio randomly so with id despite occurring values it only counts as with ratio how to split data into sets train validation and test does not help in this case so possible output df would be another possible output of df could be also just for clarification,shuffling a classification timeseries data i am working on a time series binary classification problem where each of my rows represent a single person i got n consumers and the columns are daily measurements from a single variable that i got from him k measurements for each consumer then i need to detect if someone has commited fraud or not flag or a small example here the way my dataset is now the first rows are made up of consumers who committed fraud while the rest of the rows are made up of honest consumers i have seen that i shouldn t shuffle my columns and that i need to use something like timeseriessplit to split my train test sets but is it ok to shuffle the rows in my dataframe or to be more precise do i really need to do this will it help with training my model,0,78,151 creating separate dictionaries with a list of values in it i have a dictionary like this i want to create the following dictionary out of it that means each list of values should have a separate sub dictionaries wherever list of values are given,pandas resample to return nan when all values are nan i m using resample to sum my data into hourly blocks when all input data for the hour is nan resample is producing a value of instead of nan my raw data is this i want my output to be this but instead i m getting this this is the code that i m using to get there it s a little more complicated than it needs to be for this example because i use it to iterate through a list of column names at other points any clues on how to get this to work i ve had a look online and all the options seem to produce nan if any value in group is nan rather than all values like i m after,0,44,131 is there a better way to select rows from a pandas dataframe based on multiple conditions i m trying to select rows from a pandas dataframe based on multiple conditions the code looks like this is there any better way in terms of code readability to do the same thing,how to compare dates from mongodb object in python i am trying to work out the difference in years between a mongodb object and today s date the mongodb object looks like this i have the python code that works but what i want is a mongo query that can add into the find line i know the logic behind it is but how do i write this as a mongodb query in python mongodb type,0,49,75 read first column of xlsx file create txt files than put second column data to corresonding txt file i have xlsx file estimated rows and columns for example i want to use the first column station as txt file names and second column feedback as data how can i achieve this,parallel job processing with azure service bus queues i have an azure service bus queue with rest api requests for database ingestion jobs for this i have a requirement to create task workers to complete each job asynchronously as given in the below diagram i want to process these messages in parallel will celery work for this is there any suggestion on what i can choose to complete this thanks in advance,0,54,72 how can i programmatically get an element from the drop down menu on this web page i retrieved this html with a web scraper i want to extract the element for the second option a class c menuitem link href lists members import id import contacts a how can i do this i have this code so far but it doesn t work,calculate relative frequency of bigrams in pyspark i m trying to count word pairs in a text file first i ve done some pre processing on the text and then i counted word pairs as shown below aspire to to inspire inspire before now i want to report the most frequent pairs sorted by here s what i ve done so far i think i m relatively close to the result i want but i can t figure it out i m new to spark and dataframes in general i also tried any help would be appreciated edit here s a sample of the frame dataframe,0,53,104 is cx oracle compatible with python i need to upgrade to the latest version python but i already have a cx oracle version running along with a python is cx oracle compatible with python or do i need to also upgrade the cx oracle to the latest version thanks,web scraper behind authentication i am a novice programmer trying to accelerate the data analysis process by automating the conversion of ict files to csv files i am trying to create a python program that easily converts ict files from nasa s earthdata website into csv files for data analysis i am planning on doing this by creating a data scraper to access these files but they are behind a user authentication wall the data sets i am planning on accessing are found at this link here is the code that i collected from and added to send the data to log in my session this print function leads me to the html code for the login page does anyone know how to access the data on the other end of the login through python,0,55,136 using click in a shell script that has a hy program in a here document how can i convert the following working example of using click with shell python repl i think to hy when i use the following hy example with test sh name shadowrylander count i get when i should be getting normally i can use hy eof eof without issue,pandas merge values from one dataframe to another based on condition using fuzzy logic and fuzzywuzzy module i am able to match names from one dataframe with short names from another dataframe both these dataframes also contain a table isin this is the dataframe i get after logic is applied a new column matches is created which basically implies that short name from nd dataframe matches name from the first dataframe isin from dataframe is empty and isin from dataframe is present upon a subsequent match name from st dataframe and short name from nd dataframe i want to add the relevant isin from nd dataframe to st dataframe how do i get the isin from nd dataframe to the st dataframe so that my final output would look like this edit dataframes and their in their original form df df edit the fuzzy logic to get matches from the dataframes,0,67,149 driver find elements by xpath div data testid tweet gives no output i am trying to scrape tweets using twitter scraper i have tried a lot of solutions but it gives out empty list whole chunk screenshot it s same as that in twitter scraper github repository,skipping an iteration in a specific list when iterating through multiple lists this question is somewhat similar to this question but different in that it entails multiple lists i have three lists i am iterating through the list as follows i would like to add a condition which is expressed in the following pseudo code how could i accomplish this is there a function in itertools that could be used to accomplish this,0,40,72 passing df to utility as parameter and trying to access the df in python i have created a data frame in test py and called a utility test py and passed the dataframe as a parameter to that utility when i try to use df rdd collect inside utility then it s not working getting error like variable doesn t have any parameter like rdd can you help me with how to read data frame inside utility for example test py test py,update with csv file using python i have to update the database with the csv files consider the database table looks like this the csv file data looks like this as you can see the csv file data some data modified and some new records are added and what i supposed to do is to update only the data which is modified or some new records which are added in table the first record of col is modified i need to update only the first record of col i e aa but not the whole records of col i could do this by hardcoding but i don t want to do it by hardcoding as i need to do this with tables can anyone suggest me the steps to approach my goal here is my code snippet,0,75,135 new entry in dataframe is deleting the previous entry in pandas in this code i m trying to generate water level data for a for every minute for a whole day then storing that data to pandas data frame but when i try to do so the new data in data frame deletes the previous one and at last in the data frame there is only one value left,how to find value at specific index in an array in a dataframe i have a dataframe with columns sri and sai each row represents a different location and these columns contain arrays of sri and sai for each location i want to find the index of the maximum value of sai and then find the corresponding value of sri for that index w here is a screenshot of my dataframe called avgt i m able to find the index of the max value of sai for each location row with the following loop but can t find the corresponding value at the same index in sri i get the error indexerror index out of bounds i think what i have written is finding the value at the index of sri rather than the index of each array within sri how can i fix this so that it finds the index of each array within sri for each location,0,68,157 tf math top k not accepting integers error k must be scalar got shape n t node topkv here is my code it is supposed to take in a tensor of shape none and then return the indices with the highest values using tf math top k function i am using tensorflow gpu then i am trying to run the tf serving using docker it throws the following error,python compare rows of csv file based on column conditions i have this csv file my task is to compare each row with all others filter it based on the age and height difference values and give the respective results the filters that i am about to use are the following filter check if the age difference is smaller than between all persons filter if filter holds then check the height difference only for the persons that filter holds not generally target print i have tried to use itertools combinations to access the columns is there a nicer easier or more pythonic way of doing such a thing here is what i coded so far,0,62,122 detecting whether build ext is building a python extension with debug information i have a python package that has a cython extension in my setup py file how can i tell whether build ext or bdist wheel were supplied with the debug flag i want to link against different libraries based on the debug flag,matlab python integration on apple silicon i installed python on my apple m using miniforge but i am not able to use a conda environment on matlab however if i use macs built in python version it does work i am not sure what to do so that matlab uses a specific conda environment,0,51,54 how to plot the cluster centers by using this k means clustering from scratch how can i plot the initial random cluster centers for k on the scatter plot in the photo photo for iris dataset,how to convert lmd file to csv flow cytometry data lmd file extension is often used for generating flow cytometry data but this couldn t be directly used for processing either in r or python is there a way to somehow convert it to csv or some renowned format,0,35,48 autoincrement for primary key not working in sqlalchemy i have attached my models above while inserting a user i get the following error i am using the following packages i went through the documentation and it says autoincrement is a default behavior for primary keys source i am probably doing something wrong thanks for helping out,changing color of squares in pygame i want to make simple program in which you can press squares on screen and they will change color but i can t find in documentation how to do it with pygame draw rect i don t even have an idea what is the name of the thing i want to do so if this is very easy i am sorry,0,57,62 creating website with button that executes python script my python program uses an input variable a number each day preferably i want to create a simple website with only input field number and a button which then executes the python script is there any easy way to do so i don t have any experience with making websites,how to create a file inside a gcs bucket from a python list i m using apache airflow dag in the dag i m using a python operator inside the operator my i m getting some data inside a python list now i want to save the data inside the list inside a txt file inside a google cloud storage bucket how can i do that i want to create a text file containing the li on a gcs bucket,0,59,76 python requests from window state i tried to extract the location from this url but it seems that the returned information is different from if open that url in browser my simple code is can someone explain me why my only guess is this information is in window state and im not sure how to deal with it thanks a lot,plotly express order label with a pie chart let s take this sample dataframe i would like to use plotly express to visualize this dataframe through a pie chart i ve built the following function and when i use it i got the following pie chart days are not ordered as in the dataframe i saw that there is a parameter called category order with bar charts to deal with this issue but not available with pie charts how please could i logically order the days in the label,0,60,90 elif statement unreached in python script in the following code the if statement is reached and runs fine the elif statement however seems to have no effect when the script is run when the conditions for the elif statement are met nothing happens and when i press return button twice the script just keeps going skipping the elif statement altogether my code,forloop over rows python dataframe i have a forloop that is changing the address format of over rows it works but it s taking a long time to run is there a way to make it run more efficiently,0,62,40 how to get the first and last date of the month with year and month in python in the below code from the month and year need st and last date of the month for ex month and year first date last date i tried with calendar but it simply returns,stop multiprocessing from going through entire list for function for bruteforcer i am trying to make a brute forcer for my ethical hacking class using multiprocessing i want it to iterate through the list of server ip s and try one login for each of them but it is printing every single ip before trying to make connections and then once all the ip s have been printed it will start trying to make connections then print a couple ip s then try to make another connection and so on i just want it to iterate through the list of ip s and try to connect to each one one process for each connection and try about processes at a time an example of the server txt file those are not real ip adresses,0,59,130 if statement with buttons so i have a problem im trying to make a program with buttons so you could choose something with buttons im running python i made the buttons customized them everything is good with the buttons now i want to add an if statement something like i tried adding that it just doesn t work all help is apreciated,can t change an inputbox content in kivymd i m trying to make a inputbox that starts a date picker and when you select a date it will appear in the box so i tyied like this and this is the code in the kv file when it starts everything is okay the inputbox starts empty as i expected but when i click ok button i get this error i have no idea why i m getting this error i tryied replacing the self root ids input box date text self birthday with self root ids input box date text string but nothing changes what sould i do,0,63,94 method object is not subscriptable i don t know which is wrong can someone help me where i got it wrong,how can i randomise the magnitude spectrum of an image whilst keeping the phase unchanged i am trying to randomise the magnitude component of the spectrum of the following image i was thinking of using numpy random rand for the generation of random values however i am not sure how to go about it is someone able to explain how i can proceed the following is the code to obtain the magnitude spectrum of the image attached,0,20,75 ssl connection error when trying to connect to aurora instance i m trying to run a python script through a cronjob inside my eks cluster when it tries to connect to my aurora instance it fails stating that i m using an unsupported ssl protocol unsupported protocol log trace any clue the aurora s mysql version is the python is and the mysql connector package is,boto get waiter does not stop and start instance correctly problem hello i m trying to stop and start instances in the same lambda function i m using waiters however the code above only stops the instance but doesn t start it back up as it does not wait for the stop please help me correct the code thank you code,0,66,57 can t deploy streamlit app on share streamlit io i am working with a simple ml model with streamlit it runs fine on my local machine inside conda environment but it shows error installing requirements when i try to deploy it on share streamlit io the error message is the following this is the requirements txt file for my model what should i do to resolve this error,database queries with select xxx from database where relay value from a string i m wondering about if it s possible to get data from a database with this query select name from fraleon where relay value from a string when i try to put in a string in the query it comes with a message that the column doesn t exists i have just started with programming so hope my question isn t to stupid i m trying to make an app where i have a qtablewidget and a qscrollbar where the value from the scrollbar is used to change to the next relay traceback most recent call last,0,62,111 how to save a entry widget tkinter as a variable im trying to make a application that takes in a url and in return returns that url back to be proccessed with tkinter but i have tried everything and its not working how would i do this i am trying to save the txtfld entry variable i tried passing that variable through but it wouldnt work thanks,warning fitimage when running kivymd when run kivymd app i get why do i get this warning code link convert toman to crypto with kivy,0,67,20 how do i merge items from a dataframe into a query i have a dataframe like this and want to combine these column into a query like this in python sel crd from t union select deb from t union select lon from t thank you,how do i count numbers of elements that belong to a product id and save them element wise in a list in python i tried this and many more things count for count elle in enumerate product ids,0,48,34 how to check if exe file is generating any errors when run i am generating a exe file through a python script the script runs fine but when i run exe file it is not receiving voice input properly i have used speech recognition and pyttsx modules for voice where can i see the errors that are present when i run the exe file,how to set a column value by fuzzy string matching with another dataframe i have referred to this post but cannot get it to run for my particular case i have two dataframes then i do the result is not what i expect can you help me with editing this code please note that i have millions of lines in df and millions in df so i need some efficiency as well basically i need to match people from df to people in df in the above example i am matching them on last name lname and first name fname i also have a third one which i leave out here for parsimony the expected result should look like,0,63,119 having issue while printing specific value from df in the above code i want to extract only the price which is for today but the value i am getting is n n is there any way to get the specific value while web scrapping,i don t know the cause and solution of keyerror i m a beginner what i used was flask and pymongo if you press the button it s like it should be but there is a key error at the bottom my python route code this is how i post from js function like movie title ajax type post url api like data title give title success function response console log response alert response msg window location reload i get an exception as below what i want is if it s like btn if you press the button it becomes,0,47,92 subtract one from last nonzero value in row multiple column i have created a dataframe with dates and the amount of days each month from a dataframe of arrival and departure dates this dataframe can be n columns long what i want to do is select the last column with a value that is nonzero and subtract basically looking like this afterwards i have tried using numpy with but this does not seem to work correctly with pandas,how to select only string non numeric columns when there are mixed type columns suppose i have a data frame with three columns with dtypes object int and float i need to replace the np nan with none which is an object since none becomes to null when imported to postgressql i think correct me if i m wrong none cannot be used in any numpy pandas array except for arrays with dtype object and so col above becomes an object column after replace now if i wanted to subset only the string columns which in this case should only be col i can no longer use df select dtypes include object which returns all object dtype columns including col i ve been working around this by using this hacky solution i m wondering if there are idiomatic or less hacky ways to accomplish this the use case really arose since i need to get the string columns from a data frame where there are numeric float or int columns with missing values represented by none rather than np nan another solution based on mayank porwal s solution below,0,79,177 how do we go about roles and ownership based authentication in flask login i need to segregate dashboards for different user roles how can we do it in flask login a user can have a single role assigned to it and each user of the role will be assigned to a different entity and it needs to access only that,error in python when importing sklearn cannot import name logger from joblib logger this is the error i get when i run the following command from sklearn metrics import accuracy score confusion matrix importerror cannot import name logger from joblib logger c anaconda lib site packages joblib logger init py i searched the web already to find a solution but nothing fits for example i tried to reinstall sklearn conda install c anaconda scikit but still get the same error any idea what the issue is here those are the docs under c anaconda lib site packages joblib logger,0,58,82 how can i random choice a question without the answer for a discord robot quiz game i just started learning how to code in python and i was wondering how can i randomly ask questions for a quiz without the answer that follows for example i d want the robot to ask what s the capital of france but without it saying paris questions what s the capital of france paris who painted the mona lisa da vinci ty,delete element from a list if it occurs in another list i posted my problem a little ago and i though i got the answer but still everything i saw didn t help so i have two lists and i want that if an element from list is present in element of list delete the element from list but till now i didn t find how to achieve this so for example i have those two lists so i want to check if list elements contains list elements if so delete it so here for example i would like this output for a result lst i tried to do like this but it won t work as the index will move after deleting element if someone could help thanks,0,79,132 how to handle large labels text got cropped in python barchart i have this data and i plotted bar chart but the labels for my bar chart i rotated them to degree as labels are large but even after rotating at degree the text got cropped you can see in figure below how to figure this out,kivy issue with recycleview data when under screen new to kivy and having an issue with recycleview when it s used through a screen if i set the screen to start off with self manager mainwidget for testing then the data gets loaded ok but when setting it correctly to screenmanager self recycleview is always nonetype and crashes when i try to set self recycleview data i m assuming it s some sort of reference issue as when i load it using on parent with mainwidget it works going straight to mainwidget using myscreenmanager results in error file c path to main py line in on parent name name name name name name name name attributeerror nonetype object has no attribute data process finished with exit code main py thelab kv navigation screen manager py,0,61,120 python net how to run python script from file py how to run py files and call function by using python net library i have tried below code but it is not running main py file when i try to run from string it is working,typeerror not supported between instances of future and int i use future functions of python to download data however i cannot download because of an error not supported between instances of future and int could you please suggest to me a solution,0,43,44 what is the equivalent of side effect for a property mock in unit test i want to mock a property to return different values in order like when you use side effect on a magic mock right now i m doing this any idea how to mock it properly,find the top countries having the highest gdp per capita in each year produce the following table this is how my data looks like i want the output as follows this is just the sample output here is the image of the ouput i have tried this so far i don t know how to replace columns with the country name,0,47,60 remove n character in a list without breaking apart every letter i am trying to remove n from the end of each element in a list imported from a txt file here is the file i am importing here is the code i am running here is the output here is the desired output when variable newlist is printed,in telethon how can i verify if chataction was only from my group channel when i am not sure if my group channel is private or public for now i am assuming e chat takes a specific url of my group channel either it s public or private and works as a filter and if any event like a user joined or left in my group channel it will print in the console,0,59,67 problem with code not being able to go to else block i just want to be able to move onto the else block if the length of the list is greater than person as of course what i say to if only one person is coming will not be appropriate to say if or more are coming,numpy d indexing of a d array with known min max indices i have a d numpy array of false booleans and a d numpy array containing the min max indices of values in the first array to change to true an example and i want the following result how is this possible in python with numpy edit i would like this to be performed in one step i e no looping,0,59,70 beautifulsoup find an item by string in html with regex consider this case with following html i d like to get the item with billing address in it html my code it returns no item but what s wrong with it i ve searched for similar issues but cannot find answers which can help me in this specific case,convert pdfs to jpegs and move the converted jpegs to their respective subfolders i wanted to convert all my pdfs to jpegs from a parent directory has or sub folders and place the converted jpegs in the respective sub folders from where they were picked for conversion below is my code i used for converting pdfs to jpegs could someone please help with a way how i can move them to their respective sub folders from where they were picked,0,57,78 calculating standard error does not give expected result i want calculate standard error of vector and i don t understand why it doesn t work let s consider vector calculating standard error of mean is just to calculate standard deviation and divide it by square root of length of vector however when i calculate this by function i obtain completely something different could you please explain to me why i don t unsterstand why this difference occurs,azure python function underscore are not working in routes hello i am creating an azure python function with an post get route in the unc path like i create therefore the following code function json in the previous version i used indicator alpa based on but with the alfa datatype the underscores are not working after searching on the internet i found the stackoverflow post underscore in url not working with attribute routing it was based on c but the code was still working but still result in a page not found init py my question is what do i need to change so the so underscores can support in the route of the endpoints manny thanks erik,0,73,117 django pip freeze requirements txt not getting the exact packages installed in the virtual env django pip freeze requirements txt not getting the exact packages installed in the virtual env rather it s getting all the packages i have ever installed and it s kinda not what i exactly wants let me show some image of whats happening there are still more packages below please what can i do,how do i implement dynamic dependent change of dropdown select options using python flask and sqlite good day i m really new to programming month s and i m trying to add last feature for my course final project in my html page i have select containers first container has data from tuple object in my app py and rest options data is coming fom sqlite database query i want this options to be dependent of each other no matter what option will be selected first by user to give you more of an idea what i am talking about all options are tied to weapon type this is a web app for managing inventory for an online game this type column is present in each table used in query and represented as for ranged weapons for melee weapons and for both types so how i understand it i need to make a json request after one option is being selected and return it with new query result back to html in order to process new data with javascript but what next when new option will be selected and reduce variants i m totally lost here since my javascript experience is only with bootstrap copy paste i hope i explained everything clearly and would really appreciate some example how to do it thank you for your time my python code my html code,0,67,232 unsingning a signed value django rest i am using web personal sign nonce web eth coinbase callback to sign nonce at the front end but i am trying to build the backend in django rest using this to unsign the signed nonce but getting an error error does anyone have any ideas about how to unsign this nonce,select first image of image foreign key in django template i want to select first image of an object property set i created a property model with a foreign key to an propertyimages model how do i access the first image of the property object set all in the template i don t want to do it in the view function since this should be in the base html file the code,0,53,68 raspberry pi fatal python error initsite failed to import the site module with no system changes just a reboot my raspberry pi buster python installation does this when the python command is run i m unable to uninstall python using apt get because that same error gets thrown partway through the uninstall process any idea how to fix the error or remove python so i can re install it,how to make date a column in dataframe i have the below dataframe and i am trying to display how many rides per day but i can see only column near penn is considered as a column but date is not why doesn t it consider date as a column how can i make date as a column of pre pandemic df new,0,67,59 error c program files x microsoft visual studio buildtools vc tools msvc bin hostx x cl exe failed with exit i was trying to install mujoco and run a simple script which is however i encountered the following error c program files x microsoft visual studio buildtools vc tools msvc bin hostx x cl exe failed with exit code python version gym version i had downloaded the microsoft visual studio build tools and restarted the system but doesn t seem to help any help is appreciated,convert markdown title to anchor in python i m trying to convert a markdown title to a slug http safe name what is a slug here s my attempt example is there a better way e g using a reliable published library to do this note i don t want to render the whole text i just want to know what the name will resolve to i m concerned that python s definition of non alphanumeric might differ from markdown s definition the compression of repeated dashes and leading trailing dashes is another area where more precision would be nice,0,68,91 finding last column name when two columns have max value in one row python this is my data frame when i am using df idxmax axis the output i am getting is my desired output is please help me in finding the column name of max row when two rows contains max value,stanza throws keyerror feat dropout i am using the cltk library to do nlp with ancient greek i recently upgraded python from to and since then whenever i try to do even the simplest things e g the quickstart code i get the error keyerror feat dropout the stack trace tracks it to site packages stanza models tokenization trainer py line i ve seen one instance of the same error and tried the solution there but got nowhere i would appreciate any help,0,51,76 randomly select layer in tensorflow model i want to use different layers with specific probabilities in my network layers are the following classes and the network is like below each time i run the code below i get the same output but i expected different ones is there any way to implement this,virtual key media stop not working in windows vk media stop xb python this code will successfully stop any media playing whether its chrome or windows media player etc on windows but after updating to windows it no longer works i have tried on different windows computers and i get the same problem if i change the virtual key to something else from the microsoft list of virtual keys like vk media play pause xb play pause media key it works in windows did microsoft change something for this feature in windows,0,53,95 is it possible to have different commands for different prefixes in discord py is it possible to have different commands for each prefix for example one command for and another command for for example someone does foo the bot responds with foo but another person does foo the bot responds with bar,how can i combine two almost same functions but return different output efficiently i have two functions which are almost same in a main function for a simplified example i know i could have combined func and func as and the main function becomes but i think it s really expensive to add if statement in a large number of loops and i would rather repeat func in func and leave both functions in the code i wonder what the best way is to combine func and func together by considering the running time and code re use efficiency,0,53,97 i have to print the directory of main directory error is filenotfounderror winerror the system cannot find the file specified as i have to print the list from the output of dir main e g c users xyz abc mno,how to kill a windows subprocess in python when it expects a key but simply doesn t react to it through stdin i am trying to kill a subprocess that expects a key press q in the terminal in order to stop gracefully this executable has two modes of running tried both i have tried spawning the subprocess with subprocess popen command parts where command parts is a list with the executable and it s various flags i have added the following arguments to the popen constructor in multiple combinations i have tried sending to the stdin of the executable the following strings i have tried communicating with the executable in the following ways none of these attempts results in the executable gracefully shutting down and just lingers forever as if nothing happened on the stdin observations update i tried using a sample c program that waits for q and then the script i tried to use to run it is the output i get is what could be the cause for this is this something windows specific is it something that python can t handle properly what other things could i try,0,35,186 drf serializers orderitem set all i was following serializer tutorial and came across some code that i did not understand its function what does the order item function do the snippet was from the serializer class below,how can i iterate through a list of images and display them in tkinter so my goal is to create a sort of slideshow within tkinter i have a list of images like images png png i want to be able to iterate through the list and display each image in a tkinter window the concept is simple and as follows i have managed to iterate the images using a button press however i do not want to have to click a button as it is meant to imitate a slideshow i also attempted looping a function but the time sleep function does not delay in the correct way because of how tkinter behaves i managed to achieve the above using mostly source code from here and i would appreciate a little hand achieving the above my code i also attempted to use after however it did not display each image it skipped from the first image to the last straight away with the compounded delay,0,35,167 how to stop visual studio from referencing netframework version because latest version of vs doesn t support net earlier than i am making a simple python command line application i also tried to change from the application tab of project but the problem is the application tab doesnt exist shown in screenshot below i just want it to reference to the latest version of net how do i fix it error no application tab,most efficient algorithm for merging images i am looking for the best algorithm to solve the challange i faced i have a list of k lists where each list contains n elements every list can contain different number of elements except and i want to get all combinations of each element from each list starting from first one with each element from following lists so the combination must have k number elements and the each element inside the each combination must be in the same place as the nth number of the list where this element came from list of k lists where each list contains n elements for example for the list combinations are i should also say that the elements are images and i combine them using image alpha composite img img from pillow library so i have to create temp image that is a result of combination of two images and then i have tocombine it with the next image creating again temp result and then again combine the temp with next image and so on i am looking for the most efficient way to do get the combination using python thank you in advance,0,73,192 python making changes to key value of list of list im sending input payload from postman to my flask service like this reading data in flask service i want to make changes to input variable so that my final list of list becomes like this so i want to rename name key to packageid and remove other key values like rebootrequired how should i go about it tried some tricks but was unsuccessful,how to know if specific set of character is present or not in regexp in python in python i want to make temperature converter which automatically recognize which temperature value is given and convert into other i need to know if some specific set of character is present or not by using re module my code is here on the second line i want to know if c f k any is given that must occur one time only,0,71,79 how to import install dependencies packages from a global system environment to a virtual environment i have installed my needed packages dependencies in the global system environment instead of my virtual environment virtualenv because i have used the command pip install package name outside of the virtual environment so i want to know how can i make a list out of them and install them in any of my virtualenvs,elementnotinteractableexception in selenium using python i m trying to learn selenium but i stumbled upon a error i can t seem to fix elementnotinteractableexception the code gives an timeoutexception i have read various stackoverflow posts and tried the answers but none of them worked i m just trying to enter a few words in the search bar from youtube anyway here s the code,0,69,60 how to stack d array on an existing d array python i m trying to stack array a below a such that i get array b with the following shape this was my attempt but np stack requires the same shape,how to filter multiple rows based on rows and columns condition in pyspark i want to filter multiple rows based on value column ex i want filter velocity from channel name column where value value and i want filter temp from channel name column where value value below id my pysaprk df expected df i tried for channel name velocity and it is working fine but i dont know how i can do this for multiple channel name like velocity and temp below is code also let me know if this is right way to do or how i can do that,0,39,102 uwsgi importing and pylance pylint if i use import uwsgi on my application i get an error on pylance because uwsgi is only available on runtime is there a way to make this module available to linters like pylance pylint for now i m using pylint disable import error but that does not silence pylance and it still does not offer any autocompletion,python freeopcua server how to know number of connected clients i have successfully set up a freeopcua server and it communicates well with clients but now i would like to know how many clients are connected to my server is there a method or workaround to know how many clients are connected to a freeopcua server,0,60,55 is it possible to have different commands for different prefixes in discord py is it possible to have different commands for each prefix for example one command for and another command for for example someone does foo the bot responds with foo but another person does foo the bot responds with bar,python speech recognition if speech not recognised i am a portuguese high schooler so sorry if i dont make myself very clear but i will try my best to explain my problem so for this project i need to make a program that recognises speech and do what is told to do but if the speech is not recognisable i want the program to try until it finally catches what is being said however i dont really know how to do that since this error keeps appearing error here is the code if anyone wants to help,0,53,96 iterate the arguments in shell script arguments sent as a list from python file i have tried below in my shell script i want to loop through the list that i passed but the above code prints param list not the hi life jam hello can someone help me with this requirement,word in string exists but not recognized i have a df that contains a column that has a description i used the following code to extract specific words and create as you can see the word exists but pandas applies otras instead of corona any advice,0,55,46 how to make list the elements of a list i have to make a list of the elements of a list i have the list n and i want to create i can do the first one using map list n but what about the others also if i want to create a list for each couple of elements like how can i do that,read a value from the url in django i m trying to read the value of a url and add it to the models in django basically if i have the following link my site com special event how would i be able to catch the last part of the link the and save it as an entry for my models for context i am trying to do a raffle on my website and when someone scans a qr code it will send them to my site and the end of the link will be a random number that i will use to raffle so in this case a person s raffle ticket would be so far i have this code the model and the view i tried doing it this way i also tried to add an int parameter to the url like this any help or even just point me in the right direction would be greatly appreciated thank you,0,63,158 the price from get ticker is different from the market i m trying to improuve my python script on the binance api now i have seen that if i get the price of a symbol with the api get ticker and then try to buy or sell at market price the prices are very different the difference is about is there another api to get the market price,different query results for local server and production server without changing the code and updating the display order of pictures on my production server django postgresql bootstrap nginx uwsgi has changed see the picture before now i can t reproduce this problem on my local server with same backup code in django orm i have this result reboot nginx postgresql didn t help what could have happened and how to fix it,0,66,61 weight which is but so code should take weight but it does weight i am currently working on my python course and i have some code here however when i print the result i am getting ground shipping why is this is greater than and less than so it should be multiplying by not,difference between function and function i see my question is why use len function without parenthesis in but use it with parenthesis in what is the difference between the two i see this kind of occasion a lot where using a function with and without parenthesis can someone explain to me what exactly is going on thanks,0,74,59 how to store the contents of a dictionary in a table using pandas there is a dictionary with the following format how to use pandas in python the format of this dictionary when put into an excel sheet looks like this,sqlite icu for windows i know questions like this have been asked a lot and trust me in the past several weeks i have read everything i could find but i cannot find a way to use the sqlite icu extension for python on windows it works flawlessly on linux like a lot of the things i tried i obviously tried installing tru pip and that failed i tried different python and pip versions and that failed so i looked up into the error and the setup py of the pip package and found out it fails bc i don t have pkg config on my machine that is all fine but i don t know shit about libraries on windows on linux it is easy you just apt install what you need and when you need to compile something it just works i tried manually compiling the extension on windows and i got a dll file actually one using cygwin and one with msys but when i try to load them in python i get an error sqlite operationalerror the specified procedure could not be found btw compiling it using gcc on linux and then loading the so on my linux machine works flawlessly i think like with a lot of python extensions coded in c i should compile it using msvc but i cannot find a way to make that work if anybody knows how to do it pls help me or if you have compiled it before pls share the dll file with me at this point i am so desperate i would literally load any dll file you give me as long as it works thank you to anybody who read thru and even more to anybody chimes in,0,41,287 valueerror dimensions must be equal but are and with input shapes i have an error in my code and i ve done read the documentation but it still error how this error can be fixed code and here is the model summary here is the code to fit in training data and i got this error valueerror in user code,taking user input and using it in another script i m developing a python script to enter some corporative websites and extract the data that i need so i have two kinds of scripts the first one is to do the automation process and the second type is the parent script in which i use runpy to run the first kind of scripts and tkinter simpledialog askstring to ask the user their login and password the problem that i m facing is that i need to store the user s input that i gather in my parent script and use it in my automation script this is my parent script as you can see it just stores the user s input and run another script below is the another type of script that is located on path to my automation script i m trying to import my parent script variables login and password but as a user i have to fill the tkinter dialogs two times i think that the first fill occurs because i run the parent script and the second one it s when the parent script runs the automation script and thus it re run the parent script to do the variable import is there a better or right way to make it work effectively,0,63,210 how to split strings with double letters python i have been thinking about it for a while now and decided to ask for your help for instance i have a string abcdefggarfse or abcdeefgh my problem is that i would like to split these string at that point where the letters are doubled abcdefggarfse abcdefg and garfse abcdeefgh abcde and efgh thanks a lot,python round to remove trailing zeros the code below is used to find the x using gradient descent and the problem here is that the final result of req is and when i round it it results in how can i round to get or instead without using any other module,0,68,55 drop rows based on column values in dask i am using dask to read a large csv file i wanted to drop a few rows based on one column value if for that particular column the row value is empty i want to remove the entire row i tried using dropna however i got this error so i used drop instead but then got this error i don t understand what should i use to execute the desired operation help,how to get good source code in odoo to be able to use with selenium i m trying to scrap my odoo s inventory pages to be able to get all the pictures already in the db more than so i wrote a python script using selenium it works like a charm but not on my odoo s pages the fact is that on odoo s inventory pages i think the source code is genreated by ajax or js or something else so when i try to scrap it i won t have the good source so i cannot get the elements i really don t want to have to download the images and names by hand if someone know how to capture the good source code could you please tell me python code from what i ve found in chrome inspector a page at will have in preview section the following datas and in each record there is is there a way i could get the id and name fields from python,0,79,174 filenotfounderror errno no such file or directory after copying pathname i copy pasted the pathname from the folder i want to extract images from this same exact code was working before but now i get the error message i held down the option key whilst in the folder and clicked copypathname on mac so it cannot possibly be a non existent path folder,kivymd kivycamera class is initializing without being called this is my first time asking a question here so please bear with me i m trying to make a camera app using opencv and kivy i managed to do it but my problem is that the camera is being called right away even if its not on the right screen i suspect this is because of my init class in kivycamera but i dont know any other methods to do it what i want is that the camera will only initialize after pressing a button here s my main app and here s the kv file thanks i really think i just need to get rid of init but i dont know any alternative way,0,61,121 read input buffer in serial communication using python i am having fast read write i o so writing is fast and i can t read all data that are sending from one com port to another let s say i am sending the data hello from com and receiving llo from com how can read the buffer input and what should i change in,how to calculate volume of irregular shapes in python i have an irregular shape and want to calculate its volume in python i have seen this solution but i could not figure out how to code it in python i also uploaded a figure showing my irregular box black lines are parallel and figure is in d i have the cordinates of points of the corners as numpy array for this simple point the volume should be m but in reality my shapes are much more irregular i very much apperiate if anyone can help me to calculate the volume of such shapes in python,0,60,107 how do we find specified numbers in a random generated list in python i have created a random list here how do i get numbers that smaller thn desired decimal number like and add them to another list,code stops all withdrawals even when its not supposed to so i was supposed to implement a piece of code that prevents a user from withdrawing money from their savings account more than once a month but unfortunately i have run into a wall and cannot figure out how to solve this my code prevents withdrawals even if the only transaction was a deposit any help would be appreciated to note each and every transaction has a unique id that is mostly identical but increments itself thank you in advance,0,42,90 python reading file not working through tkinter file chooser when i run the code and select a file it doesn t output anything putting the file location manually in the code still outputs nothing and the txt file definitely has content,how to process every nth element in each of this list of lists i have a list of lists that looks like this i want to process the nd element of every list inside this list of lists such that it is replaced by elements created by adding to it it will look like this how can this be done using python thank you,0,40,67 pandas reindex return nan i want to reindex dataframe s rows by specific column let s say that dataframe contain column colx that s mean i need call method df set index colx consider df head is when i reindex it the output when call df head i expect the result is note df was created by df pd read csv foobar csv,call python def function in nodejs i run a python script in nodejs it works but i want to stay open and then call the def function from nodejs several times how can i do that nodejs test py,0,50,40 using datetime strptime with microseconds valueerror unconverted data remains i m trying to convert this date into str using the following code but i get the error valueerror unconverted data remains i don t know how to deal with the microseconds any help to use strptime with that date format would be more than appreciated thanks in advance,load multiple files to multiple arrays with for loop and pandas i have an unknown number of txt files and each file contains two columns for numbers i am trying to make a python script that loads whatever it finds in that directory and create numpy d arrays for each column automatically here s my attempt in which i don t know how to update the names of the arrays and how to pass them to numpy what i need are a bunch of x y x y etc where i can gather them in a dictionary for further manipulations thanks,0,59,99 how to refresh an stdout in python hello and thank you in advance for your help in fact i have a progress bar with various options that i would have liked to see refreshed instead of spending my time clearing the console so i would have liked to know if there was a way i looked everywhere to try to understand but i do not understand how i could do it in my case thanks in advance,how to get ride of equal column in our panda data frame i have three data frames with sizes of df df df in my columns despite the different columns name there are similar data values all the columns in each three are equal but when i using for example although it must create the same output column but it convert the df df df how i can get ride of this,0,77,78 creating website with button that executes python script my python program uses an input variable a number each day preferably i want to create a simple website with only input field number and a button which then executes the python script is there any easy way to do so i don t have any experience with making websites,python how to count how many if else statements exist i want to count how many if else statements are in my function my code looks like this where the x is there should be the number of if queries if else in this case there are queries it should serve that if i create another if else query within this function i don t have to change the warning at the bottom of the script is that even possible i m using python,0,59,81 python valueerror invalid variable py version nodot plat i am trying to install on cmd windows this library i get this message please read the complete error message here,virtual key media stop not working in windows vk media stop xb python this code will successfully stop any media playing whether its chrome or windows media player etc on windows but after updating to windows it no longer works i have tried on different windows computers and i get the same problem if i change the virtual key to something else from the microsoft list of virtual keys like vk media play pause xb play pause media key it works in windows did microsoft change something for this feature in windows,0,26,95 question about python string q how can i fix this i m taking a python intro course and couldn t solve this problem make this string correct and store it in a variable named q any help would be much appreciated,i have a data frame that id like to filter on the column that id like to filter the column contains data from two different sources id like to normalize this data we collected some data a certain way and the other rows of data contain data that was collected another way there are rows that contain and nothing over i would like to multiply these numbers by to match up with the others and remove the comma from the numbers above,0,49,88 python cv draw contours and fill black is ignoring perimeter iam trying to remove objects from the image using the following method however as can be seen from outcome image there is a residual fine colored line around each object although i have dilated my image the lines are still present is there a way to remove those lines original image outcome image,find duplicate values in list of dictionaries i need to find dictionaries in a list that have the same key value and create a new list in which only the first dictionary is kept example list duplicate key value to iterate over should be second so in the example the first and third dictionary are the same i have tried looking at find duplicates in python list of dictionaries and python list of dictionaries find duplicates based on value but i can t find the exact answer i am only looking at one key value the dictionaries will always have the same keys expected output,0,63,101 random function that choose only the available spots how to pick an available spot value in an array i need a function that always finds an available location,why is this code throwing an error in pandas i m trying to solve this problem on stepik the dataframe with the name my stat contains columns session value group time n users in the variables n users we replaced all negative values with the median value of n users excluding negative values of course here s what i wrote but i get this error how can i fix it,0,30,64 python beautiful soup get correct column headers for each table the following code gets player data but each dataset is different the first data it sees is the quarterback data so it uses these columns for all the data going forward how can i change the header so that for every different dataset it encounters the correct headers are used with the correct data,invalidargumentexception invalid argument error using selenium and pandas scraping urls reading from a csv i was trying to scrape a website where possible urls are in csv so after reading it through for loop to call my method where i would open the url and gonna scrape the contents of the site but due to some reason i am unable to loop and open the urls here is my code error on console i am getting csv file have following format,0,64,81 how to catch a string based on a subsection of it i have multiple strings in a list each list is a link in a string format i have some strings whose style is the following mailto newsletter dcda dcda com some of these strings change in the part they have different addresses i want to find a regular expression that can capture the whole text based on the mailto part,use astype to fix year month day in python i want to convert a number of columns into the relevant types i understand that i can do astype but when i was converting datetime type column it s less straightforward i know i can use pd to datetime to fix the year month and day i am just wondering if there s a way i can do it within astype or am i using astype too far in this case i guess i just wanted to bring in everything into one go expected output,0,68,90 is there any way to boost matrix multiplication using multiple gpus i want to multiply two huge matrices size is more than rows and columns i run the task on a server that has several gpus let s say rtx gpus their ram size is gb apparently the matrix cannot fit in it so i cannot use cupy array directly here is my idea here are my questions note,pybind conflict with getmodulefilename i am using pybind to let python call an existing c module library the connection is through however in the c library getmodulefilename visual studio is called to to determine the physical path of the loaded module as it is run in c but when i call the library from python jupyter notebook through pybind the physical path of python exe is returned how can i configure or change to make sure the physical path of the c library is obtained the c code is like this lib h lib cpp the pybind interface code direct cpp the pybind setup file setup py to build python setup py build the python code calling this library py run app py after the run python py run app py in the logging txt the loaded module is c python exe what i want to see is the physical location of the module,0,70,139 issue with django json response i have issue with json response messages values gives me user id instead of username how to get username here is my code,how can i read uploadfile in fastapi i have a fastapi endpoint that receives a file uploads it to s and then processes it everything works fine except for the processing that fails with this message my simplified code looks like this how can i read the contents of the uploaded file update i managed to isolate the problem a bit more here s my simplified endpoint if upload is true i get the error if it s not everything works fine it seems boto is closing the file after uploading it is there any way i can reopen the file or send a copy to upload fileobj,0,26,105 python docx how to set font spacing how to set font spacing in python docx or how to add element to w rpr w rpr w spacing w val w rpr,scrapy notimplementederror scraperrspider parse callback is not defined i am new to scrapy i was seeing a tutorial and implementing a spider but this error always keeps up coming please help i have tried everywhere but i can t fix it this is the error i think this is my code,0,24,50 sns set style command is not working on my code please assist i tried using seaborn package in my code to scatter plot complex numbers but i am not getting any output even after calling sns set style please help,i made a python script to easily find a square root but i can t stop it i made a python script to find the square root of a number and prints out the result so far but it uses an infinite loop and i cannot stop it does anybody know how to stop it when it has printed out the correct answer several times i am looking for a stop condition i can stop it but down know when to stop it here is the code,0,35,86 how to clip a polyhedron using a plane in python i want to split a parent convex polyhedron d using a plane d into child closed convex polyhedrons how to do this in python an illustrative example is shown in image below,numpy matrix red dot path visualization i have a numpy matrix fill of on each iteration a go along the principal diagonal putting instead of see just i want to display a numpy matrix with red dot square in the principal diagonal i want also see the same matrix updated in each position at runtime instead of display n different matrix,0,43,63 python function to combine many dataset without listing them all i wanted to write a function to combine over datasets without actually listing them all ideally having a function to take in one at a time and combine the previous one at the end it accumulates all datasets i am not sure how to recursively accumulate them how should i create this function thanks,group data by a given range im looking for an algorithm to get different means for different values example i have the values so the output should be and,0,65,36 how to delete a specific element from a numpy nd array i am working on nd arrays whose dimensions can vary i want to delete specific elements from the array given its index like i am expecting to get the result as i have tried numpy delete but this flattens the array,solve two simultaneous equations one contains a python function on the below map i have two known points a and b with their coordinates longitude latitude i need to derive the coordinates of a point c which is on the line and is kilometres away from a first i created a function to calculate the distances between two points in kilometres then using the slope and the distance the coordinates of point c should be the solution to the below equations then i try to solve these two equations in python the error is typeerror can t convert expression to float i may understand the error because the get distance function is expecting inputs as floats while my x and y in eq are sympy core symbol symbol i tried to add np float x but the same error remains is there a way to solve equations like these or do you have better ways to achieve what is needed many thanks,0,50,156 issue in navigating aspx pagination using selenium i would like to scrape this url to iterate over pages and get their content that s what i have tried and i get pages out of specifically the visible page numbers in the url how to paginate all pages in this url,parallelise a multi arguments python code over just one argument i have a python function requiring arguments i would like to run it in parallel but keeping the arguments from b to g fixed and iterating over a the solution i found so far is to run it as a sub function and i then run is there a way to do this using just my fun hope is clear,0,51,70 datetime datatime strptime date y m d adds for different dates when i try to convert a string into a datetime i get different results for different dates does anyone know the reason code,mouse position of propertygrid event i would like to implement a context popup menu for a propertygrid and offer property specific commands e g export item the menu would pop up when clicking on the name field i do not intend to change the popup menu that is readily provided for the value field e g copy paste functionality propertygrid offers an event wx propgrid evt pg right click this lets me extract the pgproperty information name value using however this does not offer any location of the mouse event as wx mouseevent would how can i determine the x y location to open a popup menu on the name field of a propertygrid the menu is essentially defined as,0,30,103 integer divisions hey guys i wanna make this problem but i made a mistake guess i want to find the integer divisors for the number n entered there is a two condition first n must be between and second if n number is equal to zero i want to print zero as output,keras imagedatagenerator not handling symlink files i am trying to train a densenet model on chest x ray images using tensorflow keras and using imagedatagenerator for augmentation i have directories of files containing symlinks to the images that i believe is set up in the correct format for imagedatagenerator train normal abnormal val normal abnormal however when i call model fit it throws filenotfounderror errno no such file or directory train normal png which is a symlink file flow from directory follow links true did not solve the problem also calling os islink with that path returns true in addition calling imagedatagenerator returns found images belonging to classes found images belonging to classes any suggestions code below os path islink os path join os getcwd train normal png true,0,56,118 hello i was trying to integrate a hemisphere using scipy dblquad function and its not working my code is and the error i get is it is because the root is negative so it contains complex numbers is there something i can do so it works properly thanks a lot,declare function params outside function to reuse in python i have a function that works like a real champ i want to wrap this function in another function and pass through the args is there a way to declare the function args outside the function to reuse them in another function how i wish it would work i have searched for it but i only did find a lot of information about global used variables,0,50,75 is cx oracle compatible with python i need to upgrade to the latest version python but i already have a cx oracle version running along with a python is cx oracle compatible with python or do i need to also upgrade the cx oracle to the latest version thanks,attributeerror clients object has no attribute is authenticated in django restframework i want to implement a custom two layer of global authentication i e first every request must have a client id and bla bla after that request must have user authentication services like access token and refresh token when i want to implement the first layer it rais following error i m using i m getting the client id from the client request header and validating it as like my setting py config file is like this my client model as follow data in database table,0,55,92 python different output when casting the recursive call with str function i want the result to be of type string so i tried to cast the recursive call with str function when returning a result of type int the function below works fine output but when casting the recursive call to str str n factor n i got a different result output what am i doing wrong,splitting a dataframe not based on a string but a value in a column i have a dataframe cut from a much larger dataframe i need a way to split the dataframe into separate dataframes based on the value column the rows with in the value column and the rows with in the value column need to be split up the best end goal solution is to have one name with the and be separate columns in the same dataframe my idea so far is to split the two and combine them so the data is side by side all tracing back to a single name,0,69,110 combine two columns with comma delimited strings into one column with joined unique lets say i have a dataframe as following i need an output as,how to get row number and specify tooltip from another columns in that row the problem is that i can t iterate through whole dataframe and for each cellwidgetitem in specific row in column specify tooltip from another columns in the same row above code works and does show whole dataframe in qtablewidget and below code works for extracting text from several columns and settooltip for cellwidgetitem from row and column but when i get more than one hundred rows it would be such a long code to copy and specify manually for each cellwidgetitem from row etc the tooltip i tried this code below to get it work but unfortunately i can t nothing happens but it passes so that it has no errors please give me a solution thank you very much,0,26,135 how i can set id in django rest framework json api response i am using django rest framework json api then i want to set id in the response i know the response gets id from django model instance but if i set the instance to the serializer the id will be null,inputs at the same time can t be read i am just starting with python when doing a tutorial i did exactly what the guy said and in the beginning it worked but then it didn t anymore it is as if the first line becomes the input of the second input if i run each input line seperately it works though i m working on vsc,0,51,65 how to rename part of a filename represented as string in python script if i have file names falcon cpp falcon cpp falcon cpp and many more then how should change all the file names in that specific directory to code cpp code cpp basically how i can replace just a suffix of all file names in single code,interpreting predict proba results with class weights in svc i want to perform probabilistic binary classification my dataset is imbalanced thus i use svc with some class weights assigned to each class after fitting svc to the test dataset i use predict proba to get the probabilistic classification results however svc predicts training examples as with probabilistic classification results higher than i think the default threshold for predict proba is i wonder that in case of using class weights does default threshold chage automatically ex the predicted label for result of predict probaba function is,0,53,96 i d like the browser to display data from to in white python from selenium import webdriver from webdriver manager chrome import chromedrivermanager from selenium webdriver common by import by from selenium webdriver chrome service import service from selenium webdriver common keys import keys from selenium common exceptions import nosuchelementexception from selenium common exceptions import i think something is missing,how to find the last true position of the group starting from the first position to be true faster i have a dataframe and the demo is generated by generate data i wrote two methods sort data and sort data is there a faster way my code is as follows the result i respected is,0,46,53 unable to exit python script in docker with a while true and run with u option file dockerfile file test py commands unable to exit the process with ctrl c on ubuntu any help would be appreciated note if i use the cmd in dockerfile to cmd python test py without u option then there are no outputs and using docker with docker compose fails to attach,create a matrix from two columns i m trying to create a matrix from two columns within an excel sheet the first column is a key with multiple repeating instances and the second column references the different values tied to the key i d like to be able to create a matrix of all the values in the second column to reference the number of times they are paired together for all the key instances and i d like to turn this sample dataframe into essentially using column a as a groupby to segment each key then making counts of the relationships encountered as a running tally can t quite figure out how to implement a pivot table or a cross tab to accomplish this if that s even the best route,0,62,127 how do i convert this json to dataframe i have a json that i am struggling to convert into a python dataframe the json takes the following form ultimately i want to achieve the following table i have tried pd read json but i always get an error mixing dicts with non series may lead to ambiguous ordering,group together consecutive numbers in a list i have an ordered python list of forms how can i group together consecutive numbers in a list a group like this i tried using groupby from here but was not able to tailor it to my need thanks,0,55,46 remove a set of words from a list of text i am trying to remove a list of words from a list of text but output seems like its not getting removed please help me in the removing the text from the list expected output,python applying condition on after decimal point in dataframe column i have a dataframe which contains a column like below i have to apply condition after decimal point those conditions are it will replace and it will replace how can i do it properly thanks in advance,0,45,52 push rejected failed to compile python project django heroku it is my first deployment i am trying to push my django project into heroku but it is saying push rejected failed to compile python project i have tried changing the python lower versions but no luck any help would be much appreciated thanks here is my cmd output my pipfile py source url verify ssl true name pypi my pipfile lock my procfile,instead of printing each element in tuple python prints letters i try to create a validator by getting data from mysql after getting data from mysql i have a list containing tuples but when i tried to printing elements in tuples instead of printing elements from the tuple my code printed the letter of each of them here is my code here is the output i have account admin password and account admin password thank all of you so much edit when i use only for loop i get tuples,0,74,95 match column names using re compile with or operator i have list of columns names and i built def function to match columns names with prefix xrf and suffix ppm but the result comes only with the xrf pc would you please help to get names xrf pc and xrf ppm code,how create a subtask in jira automatically in case of build failure in bamboo i have an automation test project in bamboo for each build failure i need to create a subtask in jira how i can achieve this goal through automation is it possible to write a shell script for this case,0,47,53 how to filter edited messages in telegram ptb i need to detect whether a message was edited in a specific group chat could it be similar to what i have already written down here test forward handler messagehandler filters chat test sender filters edited message forward to group if there is a way to filter edited messages am i able to use it as a string to lower and split,how to keep special characters together in word tokenize i have nlp problem that involves some coding assignments such as fn point extract isolate r and when i use word tokenize the assignment is split like this fn point extract isolate r i did the following how to keep as one word since it is an assignment operator in c programming language,0,63,56 counting relative frequency in pairs a strips mapreduce i am new in python and i want to use mrjob package for countind relative frequency of pair words i wrote below code but it doesn t make correct output can you plz help me with my mistakes f A B count A B count B count A B a count A B,how to access rows of df depending on values of another column in another df i have a df and a temp df that has more rows and more columns some are common than df i want to get the p col values from df into temp df in the rows with compatible values between the two see screenshot below so expected output would be the following df this should not be as hard as i m finding it i understand that dataframes thrive for these kind of stuff but i have been stuck for quite some days so any help would be much appreciated,0,52,102 import information to classes from a txt file my issue is that information in the txt file is has columns and the space between columns is not the same here is the sample i need to somehow import info into the class i created here is the class i tried strip split didnt work if anyone has sugesstions i would be extremely grateful,format string with special character i have some string with special characters and i want to remove these characters it works but when i have special characters like future core just breaks so i tryied other way and works but now have a joined string i wanted something like future core lapix carry me away extended mix with spaces like the first attempt someone can help me i need these returns from code sabai with lve nevve falling for you official music video and future core lapix carry me away extended mix,0,65,93 why settingwithcopywarning is raised using loc i have checked similar questions on so with the settingwithcopywarning error raised using loc but i still don t understand why i have the error in the following example it appears line i succeed to make it disappear with copy but i would like to understand why loc didn t work specifically here does making a conditional slice creates a view even if it s loc edit pandas version is,trying to plot data onto video but opencv videowriter produces empty file no prior solutions work i m trying to open a video read in a frame draw a data curve on it then save that frame to a video file the input files are mov formats from a variety of cameras and i would really like to avoid converting them before this the code runs without errors but returns an empty file i m using matplotlib because i haven t found any way to plot data curves onto a video file in opencv i found something called plot d but i can t find any examples of successful codes nor can i even call it so i gave up i ve tried fourcc codes of xvid divx and mp v and lowercase mp v all without success i ve looked at every other question like this on here and none work for me,0,77,146 i am receiving this error when i run my flask app i have even installed wheel then flask bcrypt how do i resolve the following modulenotfounderror this is my init py file i am trying to hash user passwords in my other file using bcrypt following code is init py then the snippet of the code invoking bcrypt this is the error reviewed after thanks in advance,how to import python files from within a notebook when the files are in another directory i have a folder structure that looks like and in my notebooks i want to run but of course that results in the error so far i found i could do this by first running but that is breaking some functionality in vs code what is the right way to do this update i m finding that running this in my notebooks and then importing my code as is working much better but still happy to learn of any better approaches,0,65,96 program to download pdf from google using google search i code a program which you give him the topic you want to download pdf of it but it s not working well so could anyone help me with that the error message is here,binary classification but only one class gives results i am trying to train a neural network i have two classes precision and recall for one of the classes equals all the time here s the code for the neural network here s the training loop after training the precision and recall of one of the classes equals and the other one is pr and recall is there something wrong with the data i self collected the data and i can t understand whether the problem is with the data or something is wrong in my code,0,43,98 expected str bytes or os pathlike object not dataframe i tried to load embedding file for parts of speech analysis with nlp but it shows what s should i do,return a message and put in a new column after compare values in a dataset using pandas i need to see if the values in column deathrate is lower than and return balanced if isn t return urgent and put all this in a new column humanitarian help i tried this first,0,27,52 how do i copy an error line from logfile to another file using python i m developing a script that should scan a night run log file this script should print the whole lines that the word error is shown there into another log file named analyzer which will going to create during the script running the output is an empty new log file without the willing lines the code is developed on python and i linked it to here,how to see the celery messages in redis i have a celery worker running redis as a broker starting the worker processes gives me this this is what i can see in redis right after starting the celery workers even if i set a long timer on my tasks sleep the tasks will take seconds to run but i still don t see anything in my redis container mget key returns nil for all keys above i was expecting to see messages incoming in form of id or something into redis i can see messages if i use sqs as broker but not for redis,0,79,105 pandas idiomatic way to stash rows filtered out of dataframe what is the idiomatic way to split a dataframe into two by a condition or put another way to filter a dataframe by a condition but keep the filtered out rows in a new dataframe i was thinking i could filter the original dataframe for the inverse of the filtered out by condition rows using the tilde like this,create a variable path using glob glob and os path join in python i am using python and would like to know how to create a variable path to locate a file based on a year folder that changes i have the following file path this code gives me the correct files with the word notes in the name however there is a folder and a folder and i want it to change dynamically based on today s date i will have a variable b that gives me the year based on today s date assuming that the path before the year folder is the same when i try to add the variable b for the year using os path join it gives me nothing what do i need to change in order to make it work,0,70,133 latency in spark streaming job databricks which sources from an azure iot hub i have been using a spark streaming job using python on databricks to load sources from an azure iothub however i noticed when we have a large number of received frames the job comes long so we have latency knowing that when we look at the metrics the cpu and memory are not used at of their capacity,how to install and import openmp to use it through numba i am building a program using numba in python and i need to use openmp as a numba threading layer i am struggling to get it up and running i have visited the following sites i have pip installed intel openmp however the following code causes import errors obtaining intel openmp appears as a package when i run conda list what am i missing here additionally if i try anything like causes could anyone please help i am relatively new to python and numba so there might be key concepts i am missing this is my first post ever so apologies in case some requirements are not met thank you,0,72,120 uwsgi importing and pylance pylint if i use import uwsgi on my application i get an error on pylance because uwsgi is only available on runtime is there a way to make this module available to linters like pylance pylint for now i m using pylint disable import error but that does not silence pylance and it still does not offer any autocompletion,how to decrypt files with random nonce iam encrypting multiple files using chacha poly and using kdf for password i can encrypt files but how do i decrypt with random nonce the function says never reuse nonce but then how i do decrypt using random nonces if i reuse nonce for file encryption then how safe is it similar question has been asked but the solution wasn t good eg code is there a way to save the nonce and retrieve it for decrypting also wanted to know if chacha poly is a good enough encryption,0,60,93 kivy numeric keyboard on text of the text field i am trying to add numeric keyboard in ui which will be display as clicked on the text on filed but some how numeric keyboard not show in the ui i use numeric json file to open the numeric keyboard as per the kivy documentation json file and link is here is my code below,how can i copy ml model s training results to specific folders i have created a machine learning model that classify cats and dogs from a dogs vs cats database it s a huge database i apply this code and it gives me output as a photo and a text like this there isn t any problem till this point as an another different example it can show like this so my problem is i would like to copy these photos to the files if it is bigger than percent for example if it says like this i want to copy this to cat folder this folder doesn t exist before if it say like this i want to copy this to dog folder this folder doesn t exists before as well i am really stuck at this point any ideas thanks for all of your comments,0,64,143 how to display image writing an html code in jupyter notebook enter image description herewhere am i going wrong i want to view output the stack overflow image from ipython core display import html display display html img src stackoverflow jpg alt stackoverflow com width height result is a broken image icon,inserting json data from python into sql server i make a call to an api via a python script to retrieve data i store this data into a json file using please find below the contents of the json file i have tried extracting the values onto a table in sql server but to no avail it is not recognising this as valid json and getting the error message json text is not properly formatted unexpected character q is found at position all i would like is to extract only the values in the data array into a table as seen below enter image description here any help would be greatly appreciated thank you,0,46,116 could not resolve pypdf this error is showing to me when i am importing pypdf on visualstudiocode code editor and trying to create a gui using tkinter this is my first gui code and i am still learning i am having error in importing pypdf the code is it s also showing error in the pil one and i can t configure them out the error app py c users downloads,create a variable path using glob glob and os path join in python i am using python and would like to know how to create a variable path to locate a file based on a year folder that changes i have the following file path this code gives me the correct files with the word notes in the name however there is a folder and a folder and i want it to change dynamically based on today s date i will have a variable b that gives me the year based on today s date assuming that the path before the year folder is the same when i try to add the variable b for the year using os path join it gives me nothing what do i need to change in order to make it work,0,67,133 pandas number of unique distinct characters in a string how do we calculate the number of unique characters in a string in pandas dataframe i have data in column like this i want to add another column which mentions the length of unique characters in each string expected output so far i have tried however the above code gives me this result please help,how to use tf gather similar to the numpy slicing i have a list of indices representing the rows and columns that i d like to access when i use them as r c i am able to obtain the corresponding elements in a numpy array i would like to perform the same operation in tf and am using tf gather i have tried different commands but could not manage to get the same results as i do in numpy,0,63,77 python how to create a function to get a data from url and send it to other location asynchronously i tried to understand the asynchronous programming so i made a small async function the function i made is that it reads contents from multiple websites and send them to certain urls asynchronously i wrote a async function something like this is the approach i take correct or do i need to consider something different,obtain a square similarity matrix from a list of words i am trying to compute a similarity matrix from a list of words of k elements i am using a wordnet similarity using sematch tool with a few words i am using this line of code wns matrix wns word similarity w w li for w in words for w in words the thing is this code is ok with a few words but with k words would be a very long process like more than a day is there a lean and faster way to compute a square matrix k x k of this similarity scores without create a list of list as i am doing i tried this solution but still it is really slow i hope you can help me,0,74,130 can i download and split video with python i made some script to download and split the video into smaller clips but i have a problem python can not do with space and i can not rename a video before downloading it but if i kept the title in the original ffmpeg can not read it because in the title of the video are splits,how to import method from one package to another for the directory structure below below is the directory structure where i am having trouble importing modules let s say there s a method foo in b c b py which is to be imported into a a py however when i try importing foo as shown below i get an error saying an alternative way that i tried was using relative imports like this but again i get an error saying how exactly should i import foo from b c b py into a a py,0,65,87 running a for loop in javascript through python selenium i use javascript to collate data from an html page via selenium however i cannot run the javascript portion from my computer via selenium py cause python only offers the driver execute script string of a script whereas i have a multi line for loop which won t execute with these commands the loop as you can test this won t work with the standard driver execute script let value,how to create a new textfile with specific requirements i have been stuck on a program for a long time and could really use some help i have a text file that contains results for people which i have to use to work with on this program each line corresponds to the person name followed by results the content of the text file is given below i need to make a program that writes some text like the example below for each person into a new textfile output link of output as screenshot how could the flowchart look for this program,0,70,104 error comparing dask date month with an integer the dask map partitions function in the code below has a dask date field where its month is compared to an integer this comparison fails with the following error valueerror the truth value of a series is ambiguous use a empty a bool a item a any or a all what is this error and how to fix it,how to convert beautifulsoup output to a python dictionary also need advise on the type of database useful in managing large data in python when i run the below python code using bs i receive the data which is already in dictionary format how to i convert it in python dictionary or dataframe in python html head head body pre style word wrap break word white space pre wrap futuresprice iv lotsize optionchaindata calldelta calliv callltp callvega putdelta putiv putltp putvega strikes index x index y name calldelta calliv callltp callvega putdelta putiv putltp putvega strikes index x index y name calldelta calliv callltp callvega putdelta putiv putltp putvega strikes index x index y name calldelta calliv callltp callvega putdelta putiv putltp putvega strikes index x index y name calldelta calliv callltp callvega putdelta putiv putltp putvega strikes index x index y name calldelta calliv callltp callvega putdelta putiv putltp putvega strikes index x index y name body html,0,61,66 systemd service taking a long time to run i am having service running as background service in ec instance but it taking a long time to start a new one or restart a service refer to image i reboot ec and a service restart at but at the a service print the first log here is my service config file in etc systemd system please help,how to group by date and apply a formula to each group i have the following df i need to group the data by date not date and time and apply my group formula to each date this is how i did it but instead of grouping by date the records seem to group differently because i see the same date duplicated in the result the var values come from my original df,0,68,72 is there any vectorized way of check string of column is substring in pandas i have a series of pandas and i want filter it by checking if strings in columns are substring of another string for example and then i want to get series which is series of substring hello world as below maybe there are some ways like apply or something but it doesn t look like vectorized things how can i make it,discord py help catgories ok so i am making a discord bot but when i type k help this message shows up and i noticed the no category thing up there and i wondered if i could make a category for commands,0,74,40 how can i close the visual studio code window with a python command i was writing a python script and i got the idea of making a line of code that closes the visual studio code window is there a way to do this with just python commands or do you need an other language for this,is there any way to vectorize a rolling cross correlation in python based on my example let s suppose i have two arrays that represent pixels in pictures i want to build an array of tensordot products of pixels of a smaller picture with a bigger picture as it scans the latter by scanning i mean iteration over rows and columns while creating overlays with the original picture for instance a x picture can be overlaid on top of x in four different ways so i want to produce a four element array that contains tensordot products of matching pixels tensordot is calculated by multiplying a i j with b i j element wise and summing the terms please examine this code computing a single pixel is very easy all i need is the starting location coordinates within a from there i match the size of the b and do a tensordot product however because i need to do this all over again for each x and y location as i m iterating over rows and columns i ve had to use a loop which is of course suboptimal in the next piece of code i have tried to utilize a handy feature of tensordot which also accepts tensors as arguments in order words i can feed an array of arrays for different combinations of a while keeping the b the same although in order to create an array of said combination i couldn t think of anything better than using another loop which kind of sounds silly in this case note tensor size is the sum of two tuples which in this case gives yet regardless even if i produced such array it would be prohibitively large in size to be of any practical use for doing this for a x picture could probably consume all the available memory so is there any other ways to avoid loops in this problem,0,58,315 dataflow python pickeling issue i have written a simple dataflow program that takes input from a pub sub topic and calculates the fibanacci number for that integer however my dofn is not able to pickle the custom function fibonacci which is giving me errors when running on dataflowrunner can someone help me in telling me what i am doing wrong below is my pipeline code,how to open the cv window inside a tkinter window i found on the internet this python code for counting people with the open cv library i would need to open the window that opens with cv inside a tkinter window in order to then add the commands for the settings this is the code from github how can i make the two opencv windows open inside a tkinter window,0,64,71 resampling with origin end day i don t understand what origin end day does the docs give the following example the docs explain origin end day like this end day origin is the ceiling midnight of the last day so as far as i understand the line should be equivalent to however passing the timestamp ts index max ceil d produces a different result i m looking for an explanation for this discrepancy and maybe a better general description of the end day argument than the docs provide edit i m using pandas,join rows with same index and keep other rows unchanged i have this data frame i want to get this merge the column text with the same index in column join and reindex id and paraindex rest without change i used this command it only merges the row with the numerical index in column join and exclude row with non index so i changed to this here it merges all rows based on index join but it considers row with index nan as one group therefore join them also to be group however i do not want to join them any idea many thanks i also used this it looks better as it has all columns but no changes,0,79,119 how can i generalize this code in python i have a code that i want to generalize in python and all i want is to seperate this output to send each line in a unique mail thank you in advance here s my code,dictionary within a function passing values to another function i am having an issue with my code i am relatively new at coding my issue is that i am trying to take the dictionary seatingorder populated in the waitlist guestlist function and then pass those values if there are any to the staff function so that i can display them in a drop down and modify them i can t seem to find a way to do it and any help or even a point in the right direction would be helpful,0,43,89 this sends the message from one side to other side but cant send from other side so in this code i used replits database extension and channel ids is a list of channel ids now the thing is if server sends a message server receives it but if server sends a message the bot sees the message but never sends it to server,join request in django between three tables and display all attributes i have three models i want to write a request that looks like this select from b c a where b id a c id a where a id a and display all the attributes of the two tableshere is what i tried to do it does not work how to write the join and make to display all the attributes of the tables,0,66,67 having trouble getting brownie in vs code i ve been trying to get brownie in my vs code but i keep getting errors i followed these steps and nothing has worked the pipx won t work so i tried pip install eth brownie this is the error i get below,beautifulsoup web scraping soccer matches for today i m very new to python and trying to webscrape soccer matches for today from the fox sports website unfortunately i keep running into issues with attributeerror nonetype object has no attribute find all and can t seem to get the teams for that day this is what i have so far,0,47,59 how to efficiently subset from a cell pandas i have a following problem in a column agent string is a long string like this i need to create a new column typ browser where will be the last word of agent string or chrome if the word chrome is in agent string i came up with this solution which is unfortunately very slow because i have rows is there something faster,how can i add qradiobutton widget to qtableview in pyqt i am creating a tool that that will have a search option after searching i am creating a dataframe and displaying it in qtableview i need to show a radio button against each row in table view radio button will be the first column in table view i have found table view method setindexwidget but not sure how to implement it i have columns in tableview membernumber firstname lastname once i will select radio button against my st row and click on show data button it should show member number in msg box below is the code which i have written till now,0,68,114 issue with tensorflow tensorflow transform beam on windows running the below code on my local win machine and facing errors imported the below packages python windows tensorflow transform snapshot of error can anyone help with this,python function to convert camelcase to sentence case i want to convert my camelcasesentence to sentence case example string sarimchaudharyismyname so the output of this should be string sarim chaudhary is my name,0,36,33 beautifulsoup scraping the specific href that has a class that it s repeat at least twice i have to extract from different web data sheet like this the section with url of website the problem is that the class vermell nobullet than has the href than i need its repeat at least twice how to extract the specific class vermell nobullet with the href of website my code output that i have output that i want,create a repeating pop up window tkinter i need the popup function to open a window every seconds and close after the user has clicked a certain button however when testing this i wasnt able to click the button on the popup window,0,73,43 how can i add a comma or separator when scrapping results using beautifulsoup i m trying to generate my scrapping result based on the following syntaks the result is when i add text the results i have is how can i convert it to,python not creating new file headers when it does not exist i want to write a new csv file with headers if it does not exist and append row data to it not sure why the following code doesn t add the file headers append works fine,0,43,46 proper c type for nested list of arbitrary and variable depth i m trying to port some code from python to c the python code has a function foo that can take nested lists of ints with variable list depth for example these are legitimate function calls to foo what should the method signature s be for a c method that can accept this kind of argument,how to disable only one thing from user input and keep the others running for seconds let s say you are making a game and it has an input that asks you what do you want to do i want to make a timer so the user cannot use beg command for seconds but still be able to use other commands i ll probably add more commands btw i couldnt do indents here the website page went downward but imagine the while true loop and ifs has correct indent,0,65,89 can t import name sync playwright from playwright sync api on macos and ubutunos i m trying import playwright framework however i faced an issue as below i ve installed the playwright by command below then run script however it still didn t work do you have any suggest for this issue thank in advances,tkinter cannot edit entry widget after nd selection i ve made a simple gui for placing objects in robodk via a python script using tkinter essentailly the user selects an object using the btnselect button which then updates the entry widgets with its coordinates x y z then euler rotation the user can then edit the entry widgets then select the move object button or btnmove in the code to move the object to the new position however when selecting an object for the second time the entry fields cannot be edited without selecting a new object,0,48,96 python rest api put method throws i have following python code here when a put request is made to update user data it throws while it works fine when a get request is made to retrieve data for a single user can someone see what is wrong with put i would really appreciate it i saw this project online to learn automation but i got myself stuck with this error,button click is not fetching the correct v model value of combobox i am trying to get the value of a combobox on a button click and process the value in the button click handler however the combobox v model seems to be updated correctly only after the button click handler has exited here is what i did code below is there a way to retrieve the combobox content with a button click immediately after input note when enter tab is pressed before the button click all works but not if the button is pressed immediately after input in the combobox,0,73,99 iterating list to create df i have a variable class list that comes from a post request api in graphql that looks like this how can i iterate thru this list and create a dataframe that looks like this i need to create the df like this because i will merge with another df also i m curious what s the need of this list organization like a list of lists list of dict thanks in advance,how can i return values from a recursive function i have my code which does a quick sort on a list of values this throws the error i have the inner function because i want to return both the original list and the sorted list how can i fix this,0,75,50 how to replace string in dataframe on specific column and row in this dataframe i want replace zw or zw to i mean delete it at one data row index is p column is countries i searched about it but i can t find any method to set column and row i found something like but this method remove all zw in countries column desired result is not desired result is,pandas dataframe set categories the inplace parameter in pandas categorical set categories is deprecated i have following statement in my code which now generates a warning as d python python lib site packages pandas core arrays categorical py futurewarning the inplace parameter in pandas categorical set categories is deprecated and will be removed in a future version removing unused categories will always return a new categorical object res method args kwargs how am i suppose to write to avoid this warning and future errors thanks in advance,0,70,72 pandas how to do groupby with conditions in pandas dataframe i should do groupby country and product and value column should contain count id where status is closed and i need to return all the remaining columns output format sample i tried the below code is there any better way to approach this,os rename and listbox callback the purpose of this app is to rename every file to a certain number then a new window opens up and i want the code to add a star at the beginning of the file that the user chooses the problem i m having is at the line it gives no errors or any input it basically does nothing as i mentioned it above i want it to add a star at the beginning of the name that the files has,0,51,87 how can i create a requirements txt in google colab i have already tested the following pip freeze requirements txt saves all packages in the environment pipreqs returns an empty file i need a compilation of all imported packages with the corresponding version how can i do this in google colab without getting all installed packages,return function and from file type and import issues on pycham i am currently learning to build a racing game with pygame and assets from techwithtim on youtube url it seems like problems are happing secondly my main file is not recognizing versions python pygame pycharm community edition hope to find a solution soon from a young inexperienced programmer,0,57,61 problems with installing modules in python visual studio code i want to import some modules in my virtual environment like flask pandas matplotlib etc but the problem is that the terminal returns me the following issue i ve never had any problems with it and yesterday it worked perfectly does someone knows what to do,numpy array of dimensions indexing and sum i have a doubt there is an efficient way to sum all neighbors of a numpy matrix without using several conditions this is an example when i run m it returns me and not an error so if i want to add to all neighbors of a value i need to use a lot of conditions because i can t just use m because in this case and in the other cases of the corners it returns me just a false neighbor,0,55,92 how to import install dependencies packages from a global system environment to a virtual environment i have installed my needed packages dependencies in the global system environment instead of my virtual environment virtualenv because i have used the command pip install package name outside of the virtual environment so i want to know how can i make a list out of them and install them in any of my virtualenvs,how to fix streamlitapiexception expected bytes got a int object conversion failed for column value with type object error streamlitapiexception expected bytes got a int object conversion failed for column value with type object traceback file users temporaryadmin streamlit app v streamlit app v main py line in module st line chart df problem i m quite new to this and got quite excited with this first streamlit project off mine the file runs fine with i don t include the pandas data county county names but the list of strings stored in county names is quite crucial to representing the data in the graph any help in what to do would be highly appreciated thank you enter code here here is my code,0,69,109 python sockets and requests i m a beginner in python and i d like to know what the difference between socket and requests modules in python is i m sorry if this question format is bad if this may be due to the fact that i do not know exactly how different protocols of internet work then i will be grateful if you share the relevant literature so that i myself look for the answer to my question can you give examples,is there any way to extract the dtype conversion functionality from pandas read csv i have the following dataframe where all columns are of type objects my goal is to infer the real type of each column and convert i have found a workaround and saved it as csv and then loaded again is there any way to use pandas read csv type conversion functionality without the need to save and load the file here is what i am doing to make it work only when i am using this workaround pandas read csv infers right the strings like and as integers i have tried convert dtypes which turned all the columns to strings and infer objects that did nothing also,0,79,118 breakng the hash i have to break hash codes and find their number but my code is not working these are the hash codes in a csv file my code and my result is,unix ms timestamp pandas index plotting polygon io data with mplfinance i am pulling data from polygon io and it returns time as a unix msec timestamp as below afterwhich i am having trouble converting this to a index that is useable by mplfinance that is expecting typeerror expect data index as datetimeindex i have the following code where i have the placeholder function from unixtime which i have yet to define,0,39,68 question with type conversion in python but when i use str on line i e the above code works as i want to know i ve already converted the string to int in variable age then why do i have to convert variable age after years to str if my age variable is int and age after years has int inputs to begin with and i am concatenating int with int inputs,how to append all sheets in multiple excel files into one excel file not consolidating or combining them into one sheet i want to combine multiple excel files sheets into one excel file with multiple sheets without changing any formatting basically it is to append all sheets in multiple excel files into one excel file with multiple sheets for example file with sheet file with sheet sheet file with sheet sheet outcome would be file with sheet sheet sheet sheet sheet as one excel file here is a code the code works but it re writes the sheets so i am losing all formats is there another way to append all sheets into one excel file without consolidating them or losing the formatting thank you,0,68,123 accesssing corsair com with python selenium is it possible to access with selenium in python without getting blocked by corsair when i try to load the page in selenium it keeps giving me this error message what i tried to bypass it is changing the user agent to a random one which didn t fix the issue this is my code,importing gensim in python valueerror numpy ndarray size changed may indicate binary incompatibility expected from c header got from pyobject i am simply doing the following import statements but i keep getting the following error i have tried updating my numpy package as per this answer to the latest at the time of this post but i still keep getting the same issue update it seems like there is a bit of incompatibility between gensim and apple s m processors as per these github issues opened in the official gensim repository this issue specifically shows my exact issue with it,0,59,101 how to merge more than one dataframes with each other all these three dataframes have same number of rows while i do merge with concat function original dataframe get s deleted and it s only have car and car whenever i am adding car car to car dataframe all the contents get deleted and replace with car car,replace occurences of a numpy array in another numpy array with a value i have a d numpy array i also have a second d array i want to replace all occurences of the elements of the second array with so eventually my second array should look like is there a way in python numpy i can do this without using a loop i already checked at np where but the condition there is only for example where element value and not multiple thanks a lot,0,54,88 round all index to min in pandas datetimeindex i know about round ceil floor functions this rounds to the nearest minute interval what i want is that each is rounded to minutes in the case of round will be rounded to and to i would want both rounded to the datetime index,vscode doesn t recognize modules i m using python as the title says apparently vscode doesn t recognize several modules that i already installed on my macbook for example and the error message says also it says the same thing on requests but not on tkinter i tried sudo pip m pip on both terminal app and vscode terminal but the outcome is still the same how can i fix this,0,60,68 randomly select layer in tensorflow model i want to use different layers with specific probabilities in my network layers are the following classes and the network is like below each time i run the code below i get the same output but i expected different ones is there any way to implement this,replace multiple id values by name values in a dataframe s single column by iterating through i have these two dataframes one for product file and one for category file from csvs product file csv category file csv expected output as csv code so far i believe this is obviously not the correct code or even the approach is incorrect as i am still new and still learning python pandas i may have a feeling that i need to iterate in the category id column in product csv to get the values that are separated by commas then do a replace or something i have explored index map split and replace functionality in pandas but unfortunately haven t worked it out i am sure this is simple thing and is there already an efficient approach to solve this problem hopefully thank you,0,53,141 selenium useragent i want to open google using the following code is working but i don t understand following line why mozilla and mac os x is there a shorter version with just the standard code,using lambda function to split a column in a pandas dataset i am doing a udemy tutorial on data analysis and machine learning and i have come across an issue that i am not able to understand fully the dataset being used is available on kaggle and is called csv i am supposed to create a new feature in the titles column there are reasons departments specified before the title code these are ems fire and traffic use apply with a custom lambda expression to create a new column called reason that contains this string value for example if the title column value is ems back pains injury the reason column value would be ems when i do this for the first row in a column in works but the issue is when i do i am trying to do this to remove all the in the title column i get the following error attributeerror series object has no attribute split can you tell me what am i doing wrong here,0,35,173 how can i add a comma or separator when scrapping results using beautifulsoup i m trying to generate my scrapping result based on the following syntaks the result is when i add text the results i have is how can i convert it to,how to add approval workflow on atlassian bamboo plan i m deploying a bamboo plan with different stages the first stage detects whether trigger arrives from either dev or prod environments if env is dev plan can run without problems if env is prod i would need an approval step after first stage that pauses the plan build sends a notification to admins and awaits for their approval how can i add this feature,0,43,74 authenticate google cloud storage in python using workload identity federation is it possible to use the oidc method of google s workload identity federation to authenticate my python application s google cloud storage package i want to do something like this this gives the following error valueerror this library only supports credentials from google auth library python see for help on authentication with this library,regular expression in python to split a string based on characters that begin with and end with i have strings that look like this desired output current code so id like to split the sentences based on characters beginning with an add symbol and ending with a colon as these are the way all languages are encoded e g en es fr nl etc,0,59,67 using variable controlled logging level in python logger i want to write a function that will get the requested logging level from the user i e something like can this be done,python openpyxl adding cell value to column p if match between column a list and tuple list background i have a list of values in column a which differ from worksheet to worksheet i wanted to identify a subset of values to be matched and if a match was made between lists then the script will add the value from the tuple list to column p and moves downwards per value see picture script output problem the script kind of works accept if the value in tuple is not found the column a list then it creates an empty cell in excel and moves down to the next cell see picture excel output questions script,0,30,118 how to match a pandas dataframe column consisting of a list i have a pandas dataframe whose column is consisted of a list for example i want to select those rows that are a but if i run this code i get an error valueerror lengths must match to compare same to code df df col a what proper code should i use to achieve this,python script is failing with connection aborted connectionreseterror connection reset by peer i ve similar issue as many of you but cannot get this resolve i m producing a self executable file that is running fine on my virtualbox linux and but when i m trying to run it somewhere else on other linux servers i m getting the below output my post constructor looks like could you pls advise me where exactly i need to look for it is there multiple issues that i m struggling with many thanks mario,0,67,87 can not connect to kafka using acl in docker docker compose i am tryting to set up kafka with acl in docker docker compose i am not able to connect with my python example script i am using the the script of dicrectcsd docker compose yml kafka server jaas zookeeper server jaas zookeeper log kafka log python producer example script error message of python script would you help me and point me in the right direction to solve this problem please thank you so much simon,giving input such that it reads the exact dataset among the others tkinter i have a certain number of datasets and i ve given numbers to each of them as the names let s consider datasets so the names are csv csv and so on i m trying to give an input here the number name of the dataset so that my code reads and works on that dataset how do i make that possible i ve done something like giving input and changing it into a string and using pandas read csv string csv but the code s not working can anyone help out,0,79,97 flask mail how to add multiple files to message i want to add several files like attachment but i can not understand how my code now looking like,how to append data in to the dataframe the code is working fine and give me the image link but i want give name image image and so on to get output like these as you seen in picture,0,27,38 blacklist some domains from requests sessions in python i am using request sessions and i want some of the domains to not form a session pool is there any way to do it also is following the correct way to do it,problem with custom language in pytelegrambotcaptcha i have tried many time to set a custom language for my captcha bot but when i put the text or any else function equal a string i got an error attributeerror nonetype object has no attribute text doc,0,42,45 pandas split column of unequal length list into multiple columns in python i have a list of codes in one column his name course code that i would like to put each code is a new column can you guys please give me some guidance how to do that thanks,find all possible paths using networkx how can i find all possible path between two nodes in a graph using networks this is the result but i want all possible path so for e g start b a c a end,0,50,35 webscraping problems returning a error on google collab i can t quite understand why this is returning a error would expect it to return a error i m trying to scrape yahoo finance for stock prices,find path of a file which is not in the current directory and access the files in that folder one by one python i have questions here i just want to find the folder and then i want to load the csv files found in that folder to some other location note i am using macos,0,37,58 jsondecodeerror expecting value line column char when scaping sec edgar my codes are as follows i could run the exactly same codes last year but when i ran it yesterday the warning popped up jsondecodeerror expecting value line column char why how should i solve the problem thanks a lot,pandas populate new column with list from matches on column value i need to create a new column that establishes relationships between entities in a delimited list any delimiter works except a comma dataframe the final result should be i need to create the members column by finding all matches in member of but returning the name then populate a list that ends up in members would np where be a good place to start,0,56,76 index a list array in python i have a list of size data and i wanted to refer to an element located at index so for this i tried to run following line of code here len is an integer with value even with this simple statement the python intepretor throws following error at other places i got following error for a similar symptomn typeerror slice indices must be integers or none or have an index method,inserting json data from python into sql server i make a call to an api via a python script to retrieve data i store this data into a json file using please find below the contents of the json file i have tried extracting the values onto a table in sql server but to no avail it is not recognising this as valid json and getting the error message json text is not properly formatted unexpected character q is found at position all i would like is to extract only the values in the data array into a table as seen below enter image description here any help would be greatly appreciated thank you,0,79,116 camelot not detecting table within table i have observed that camelot is not detecting nested tables in the sample document i have in the image attached i m getting only one table extracted as whole is there anyway using which we can detect the inner tables as well,arima fitted values and plot values are different i want to store the estimated values predicted by arima model i am unable to view the values model predict and model fittedvalues is giving me the wrong values model plot predict predict is giving correct view on plot while my fitted values are showing in order of thousands model fittedvalues,0,47,54 runtime error when using pytorch convolutional model i m trying to develop a covid classification model the images dataset i used is of shape torch size when trying to run my model i m getting this runtime error message as shown in the image any help to understand and fix the issue please this is the code,how to un exclud directory in pycharm i am trying to un exclud directory in pycharm someone know how to do so,0,56,20 how do i make matplotlib only display the last graph i copied some code from a website because i m too new to python to understand matplotlib and pandas but i needed something to simulate markov chains and visualize them the problem is the code displays every graph for every iteration of the markov chain and i have no idea how to only make it display the last graph,how to merge python io streams into a single iterator but maintain which item comes from which stream the desired functionality is something along the following which should output something like this in real ish time just to be clear running the same program from a cmd will output using p sp popen program arg stdout sp pipe stderr sp stdout will merge the streams but there is no way to distinguish between them using itertools chain will obviously put all lines from one after all lines from the other my only semi working solution involved threads pushing to a collections dequeue and the main program reading from it but this approach seems to mess up the order of multiline blocks written to the stream at the same time i e an exception like might be printed like to avoid the xy problem the end goal is to send the output over to a client in real time using fastapi responses streamingresponse and that client needs to know what is stderr and what is stdout if using a websocket makes this easier that is also ok,0,68,176 set a maximum to the instantiation operator of a class python i want my code to return a error if the user enters a to high instantiation operator like this but i don t just want to print out an error i want the console to give an error out,invalid literal for int with base in my views after it worked a while i m keep getting this error invalid literal for int with base from the views in my django project after it worked for a while here is my views py looks like and here all the message models py please help me i m beginner in django,0,50,59 how to draw multi line color in python i have problem i want to draw multi line color diagram in python i don t know how can i do that my data frame like this etc my script is and this plot is like that how i can solve this and draw multi line plot,plotting with matplotlib trying to conserve my scale order i have the following list these have associated values i wish to plot these values using plt scatter however when plotting the xscale etc is obviously set to be in order and thus looses the specific meaning i m attemping to broadcast i wish to keep this order while plotting is there a way to do this i have plotted like this but its not doing it how i wish,0,54,80 field clashes in django orm i have some problems with django orm i have three classes transaction py payments py and when i trying to do migration i have this error as i understand the problem related to inheritance and its specific in orm but i m not sure,binary search but it doesn t search the upper part of the object list im trying to create a code that searches an item from an object list but it only checks the lower part of the list if i try to search for the items in the lower part of the list it gives good output but when i try the higher part it doesn t do the job code class desired output output any help will really do,0,46,78 why does this snippet of code return one answer but sometimes two new python programmer here i m trying to make a rock paper scissors game and i m wondering why this code returns usually one answer but sometimes two i m trying to make it print one answer for choices and one for choices many thanks in advance,python selenium deal with an angucomplete element i have a selenium task at hand and the input element i m trying to send keys gives me an elementnotinteractableexception figured that my input resides in an angucomplete element well i m not new to selenium but can t find a solution for this so appreciate any idea or instruction for this angucomplete placeholder searchfields pause set focus tpfocus selectedobject tpselected titlefield label inputclass form control form control small matchclass highlight api tpapi disable disablesearchbox stockdetails stockdetails class ng isolate scope div class tp re angucomplete holder tp width div id fulltextcontainer style display none class symbol info tp etc div input id txt search class search box tp co tp pa rl tp re tp bo bo type text placeholder onmouseup this select autocomplete off div id auto list container class auto list container tp bg tp co tp bo tp bo tp width angucomplete dropdown style min width px display none div style display none id loading class tp h tp pa rl angucomplete searching div div style display none id norecord class tp tp pa rl angucomplete searching div div id list dropdown div div div angucomplete,0,57,126 python sockets and requests i m a beginner in python and i d like to know what the difference between socket and requests modules in python is i m sorry if this question format is bad if this may be due to the fact that i do not know exactly how different protocols of internet work then i will be grateful if you share the relevant literature so that i myself look for the answer to my question can you give examples,run a flask application with gunicorn i m trying to run a flask application with gunicorn i m in the process of understanding how gunicorn works and this is the thing i am not understanding i have the following code with a function i am running i am running the following gunicorn command gunicorn w app index after it starts i m getting an internal server error and am presented with the following typeerror to my knowledge i am not passing in any arguments or parameters but am still getting this any advice on how i can fix this would be helpful,0,79,99 an error occurs when installing pylibmc via pip opensuse tumbleweed distribution hello when i attempt to install pylibmc on opensuse tumbleweed using pip i get the following error the distribution has just been installed,how to get a rolling mean with mean from previous window i am desperatly searching for a solution with pandas maybe you could help me i am looking for a rolling mean with consideration of the previous mean df looks like this now using the rolling window mean function i would get something like this i would like to consider the mean from the first calculation like this where thank you in advance,0,34,71 csv file data replacement i have many csv files which looks like i need an short function with that i can overwrite the cell in the data section from data to something like test data i need to replace a big amount of cells in csv files with that method maybe i can read the line line in the file and save it as new one so i knew it s definitely done,how to split data into train and test while stratifying on labels and preventing the same entity from appearing both i have a dataset like a graph below i want to split it to train and test stratified on labels at the same time i don t want the same player to appear both for example when i split it train test train label label test label label,0,71,80 loop to match dictionary keys from list append dictionary with associated data in other columns i want to loop through my data and population my dictonairies with event value and their corresponding xcordadjusted and ycordadjusted dataframe my work output,request could not be satisfied error when web scraping in python i have been working on a project that scrapes data from colligate baseball websites in order to create a database that will automatically update itself during the season most universitys baseball statistics pages have a table set up like this one i have been able to create a scraper to get all of the data that i need from tables like this however there are some teams out there whos websites look like this i have not been able to succcessfully scrape this kind of table and i cannot figure out why it will not work my code for this is below after running this code with beautifulsoup pandas in python and i print the soup of the html i get this mess that always tells me to try later or request access and i am just not sure how to go about getting around this issue thanks,0,39,163 django context not passing in html template i am not understanding where i am doing mistake i am trying to passing context in my html page but why context isn t passing see my code views py urls py html see my terminal result where all object printing from context why i am not seeing any object in my html page where i am doing mistake,how do i capture normal output and something like segmentation fault with python i m trying to write a python program to mark score a c program the c program to be tested is supposed to output something like here is the code uploaded by a unqualified student which outputs i tried the following python code to catch the output and error neither stdout nor stderr catches the output how do i capture something like with python,0,63,75 it used to be legal to add a string and a bytes together in python in which version was that changed some time ago we used to be able to do this now it is not allowed any more which version of python was it that disallowed this way of adding string and bytes together,why does my reverse linked list function mutate the global variable linkedlist the following is my code when printed out linked list is displayed as none however after calling the function reverse list once and then printing linked list again it seems to be mutated and became none could anyone explain the reasoning behind this example shown below,0,55,63 livelossplot keras plot per epoch i m trying to plot a cost function and accurancy function in keras however when i want to play with my times of epoch for instance times i will get plots in phyton which i have to delete the n epoch plot before the n epoch plot will be presented i would like to have one figure where i can see all the epoch times once my code,python read csv by column header dynamically with hash key v i try to parse in python several csv file from several zip files to inject in graphite timeseries db i already posted a topic here how to parse one csv file manually but now i m trying to parse several csv from several zip files csv files are composed as follow this is my script i can list csv but the line bellow bug many thanks for help,0,77,78 how to convert a string with comma separated values within a list in python hi i m relatively new to python and not quite getting a resolve for the mentioned issue i have an input list abc def asd trp faq expected output list abc def asd trp faq please help in achieving the same,python how can i asynchronously save the pil images for asynchronous file saving i can use aiofiles library to use aiofiles library i d have to do something like that how can i asynchronously save the pil images even if i use image tobytes function to save it with file write data the saved image isn t correct so how can i asynchronously save a pil image,0,46,62 how to rename part of a filename represented as string in python script if i have file names falcon cpp falcon cpp falcon cpp and many more then how should change all the file names in that specific directory to code cpp code cpp basically how i can replace just a suffix of all file names in single code,update with csv file using python i have to update the database with the csv files consider the database table looks like this the csv file data looks like this as you can see the csv file data some data modified and some new records are added and what i supposed to do is to update only the data which is modified or some new records which are added in table the first record of col is modified i need to update only the first record of col i e aa but not the whole records of col i could do this by hardcoding but i don t want to do it by hardcoding as i need to do this with tables can anyone suggest me the steps to approach my goal here is my code snippet,0,53,135 running two tensorflow trainings in parallel using joblib and dask i have the following code that runs two tensorflow trainings in parallel using dask workers implemented in docker containers i need to launch two processes using the same dask client where each will train their respective models with n workers to that end i do the following the problem is that i don t know if the entire process is thread safe are there any concurrency elements that i m missing,python elasticsearch aggregated query i am struggling to get an aggregated response based on a query for example in kibana visualization after creating a table with the aggregations and query i need i can view the request by going inside the visualization and inspect view requests request this gives me the entire request structured like this how can i obtain the same dataset that is displayed in kibana visualization with the api i tried translating the api request fields to the es search function like this but the data is not aggregated correctly like in the kibana visualization another strange behaviour is that if i completely remove the aggs from es search it gives me the same dataset note i am using elasticsearch module,0,79,126 how do i restart the function i m trying to print random integers each time the button is clicked and the function is executed however i only get the same result unless i restart the program here s my code so how do i do this,creating two lists derived from an analysed dataframe i am in the process of creating a function that can check multiple conditions of my dataset and then return two lists list items to perform x list items to perform y sample data ideal outcome error when running my code so far,0,44,53 syntax error in random number generator in python x heres my code im getting a syntax error on the question raw input not sure why im using a mobile python app that i think runs on x because of the raw input main works fine im not sure what the questions problem is im still learning python so if anyone could explain thatd be great,why python multiprocessing always generate same random values i am using pool map to process my function there is a random value added in the function but i find the result from each process is the same how can i generate different random values for each process this is an example i want to have different values,0,64,57 drop rows based on column values in dask i am using dask to read a large csv file i wanted to drop a few rows based on one column value if for that particular column the row value is empty i want to remove the entire row i tried using dropna however i got this error so i used drop instead but then got this error i don t understand what should i use to execute the desired operation help,how to get rid of queryset tag when getting the data on my template from the database django i m having a bad time figuring this out through searching different stackoverflow question but i m using a function based view to make my day simplier but when i m retrieving this single data from a database and showing only one record using slice it throws beside it a tag which commonly see when we test print in our terminals but how exactly to get rid of this here s my code snippet where when i call tutorial title slice it should only call one latest record which works flawlessly but there is a queryset tag beside the shown data,0,79,116 when would i prefer to run a job in static allocation vs dynamic allocation i ve read the docs in foundry for what the differences are between the two but i m wondering in what circumstances i would want to apply the static allocation profile to my build to prevent my executors from being preempted are there any other things i should watch out for when running in dynamic allocation mode,how to use conda update n base conda properly i have two very simple questions regarding updating conda i e when updating one of my environments with conda update all i get a warning my setup comprises a base environment and two actual work environments say env and env the latter two environments are kept up to date with conda update all issued within each of those environments the base environment was only generated in the installation process of anaconda question should one run conda update n base conda on the command line of the os linux prior to activating any environment or should one activate a particular environment or is the environment out of which this command is issued irrelevant question after running conda update n base conda from out of whatever environment as determined by the answer to question would a subsequent conda update all issued within one of my two work environments env install or update any additional stuff only as a consequence of the previous conda update n base conda ps i find many questions on stackoverflow regarding conda update conda but they don t seem to cover this one,0,68,195 unable to exit python script in docker with a while true and run with u option file dockerfile file test py commands unable to exit the process with ctrl c on ubuntu any help would be appreciated note if i use the cmd in dockerfile to cmd python test py without u option then there are no outputs and using docker with docker compose fails to attach,why i m getting this typeerror i am trying to create a getprefix command which changes the server prefix i m using an sql database to store prefixes i am getting the following error when i send any message in a server not only bot commands my code my database code the first time i ve tried this it worked perfectly with the same code i was able to update custom prefixes for servers in the database without any errors,0,62,77 i am trying to do a rotating screen python prank info i want to make the program rotate continuasly unless a spesific keyboard button is presed the thing is nothing happens when i press the button p for exapmle or whatever button i press i will be glad if someone can help,stuck in writing python list reduction program i am stuck in writing the python code for below problem can anyone help to find the issue with the code is much appreciated list reduction you are given a list of integers l having size n and an integer k you can perform the following operation on the list at most k times note that after such an operation the list is changed and the changed list will be used in subsequent operations you need to minimize the sum of all elements present in the list after performing at most k such operations input format output format print the minimum possible sum of all elements in the list at the end after performing at most k operations code expected output,0,53,129 i am not able to store the output in variable help plz this is my code to find gcd of a given number ie eg if a then gcd of gcd if a then gcd but i am unable to store value in b i e b it doesent store plz help i want to get sum of all b as answer how to do that i am begineer in coding,count total inside cpu instructions issued in python i need to test the performance of code that will be objective and roughly the same across all machines timing code does not work since it s tied to your or mine machine specs but counting instructions issued by a cpu does with minor differences i can use strace in linux but my god its slow and i just want total not individual calls say this will execute at different speeds on different machines bear with me imagine a more complicated algorithm but the amount of operation done is the same ios this is important because if you have a faster computer you won t notice a millisecond that might take seconds on my machine is there a way to count of cpu instructions done since in python i m asking because i want to know if a refactor will x my cpu instructions thank you,0,78,153 how can we split an xml with lxml i am looking for a good way to split the following xml into pieces in this occasion two and i am experimenting with the code below but it does not seem very elegant are there better ways to achieve this many thanks in advance for your help,how to define static class to read feedback messages in flask application we are implementing a flask application we shall have json file for feedback messages with key value pairs the keys will be some constants and the values will be actual messages and then during the runtime the actual messages will be read and displayed i would like to define a class which reads the json file at the start of the application and method which returns the actual message based on the key i implemented the following in a feedback messages reader py but i do not know whether and how much this is correct and is the best approach also i define the config at the end of the class because if i put it at the beginning like this i get error class already defined line so i would like to get advices which is the best approach to implement this,0,55,155 how to save images from url into mongodb using python i have used wikipedia package to get a list of image urls from any wikipedia page now i want to save all the images from the images variable to a mongodb in a collection named images is there any way to do it as there are multiple images can they be saved in a list format,dynamically setting class attributes which point to descriptors i have a function which gets data from a spreadsheet and processes the data into a dictionary the init method iterates over the dictionary to set class attributes where the attribute name is set based on the employee name i want this to store my descriptor class employee with the same design i aim to create another descriptor to handle access to employ details where said descriptor will be assigned within the employee class for testing i have created a class attribute for managementsystem william which works as expected but accessing an attribute bob instantiated using setattr behaves differently i have some understanding as to why this may be but have not been able to find a solution to this problem thank you for help as always,0,66,137 how to append a list in python based on condition i am having trouble in appending a list following is the code the output when it should be can someone help me what went wrong and also can someone refine the code with less code thnx,maya setting frame range programmatically with the render setup api i am trying to set the start frame with the rendersetup python api in maya like this for some reason the value gets translated in how to set it to the proper value,0,46,47 real tme keras rl dqn predictions hello everyone i followed that tutorial to train a dqn agent everything works now rather than make a random choice i want to use the dqn without having to do something like dqn predict but i did not find that in their documentation can you help please,python create wheel from existing c extension our build pipeline spits out an so pyb python extension through pybind as a step in the pipeline i need to package the extension as a wheel for easy distribution through pip i am trying to come up with a setup py that takes the existing library and does not rely on re compiling the binaries through the setup py so i really don t want this it would require a major rewrite of the devops scripts when having a folder structure such as a very basic setup py can create a functioning wheel python setup py bdist wheel unfortunately the wheel is missing the important python tag and platform name etc my module py none any whl vs my module cp cp macosx x whl setting python tag and plat name works setting py limited api does not however through research i found that overwriting the distclass adds the correct tag again but the root is purelib is set back to false this unfortunately creates a broken wheel when installing through pip as it puts the binary in a my module data purelib folder overwriting the is pure seems to be ignored also what else can i do to wrap my pre compiled python libraries to wheels for distribution without rewriting lots of the build pipeline,0,53,196 i can t create a form with password password in django error unknown field s password password specified for user i have no idea why it doesn t work as documentation says documentation my forms py my views py urls py,networkx and matplotlib how to access node attributes and show them as annotation i m trying to get the on hover to work for this networkx matplotlib graph but i m getting a key error issue i want to create a node with the key name as a string and have that as the label however it looks like the on hover function that gets called breaks at the xy pos node section here s some output of what some of that looks like code below error it looks like it s trying to find a key with a number instead of a letter that s why i m getting a key error but i m not sure as to why i can t get it to accept a string instead,0,34,121 python regex groupdict with repetitions of groups wondering if there is a function such as match groupdict that catches repetition similar to match captures function when i run this code i get what i would like is something like that is there a function to do so or should i just do it by hand myself,jinja s template operators how to use function without printing it on web site page so here is a part of code line is the point where i want to know how i can pop one item out of the list on each iteration escaping printing it on web site page,0,54,49 python not clicking in game or webbrowser i am making my own autoclicker but its can not clicking i try all alternatives which ones in stackoverflow is there a any helper please my code i am trying the click here it s solved it is about other games anticheat blocking,test failed unsupported operand type s for int and tuple i keep having a problem in my code coming back as test failed unsupported operand type s for int and tuple i am a super beginner who is not very good at coding so i cannot figure out what the issue is here is the full code i am making a simple icmp pinger program thanks everyone for your help this is my first question here so please let me know if i need to edit anything,0,50,87 using python how to change dimensions and aspect ratio of svg file iam trying to change the dimensions of svg file in python using the following code however the aspect ratio is being kept according to input file how do i resize an svg in python according to new dimensions newwidth x newheight and their corresponding aspect ratio newwidth newheight,add precision recall curves to plot using a function i have a dataframe with precision and recall for many classifiers each one ran with different values of the confidence threshold i would like to create a matplotlib plot in jupyterlab and add a precision recall curve for each model since the list of models may change in the future i would like to do this with a python function instead than hardcoding the model names in the matplotlib code i wrote something like but i get an empty plot with the message also note that in my code i tried to plot the precision recall curve of a single model but actually i would like to add to the same plot the precision recall curves of all models included in the dataframe can you help me,0,57,133 drop rows based on column values in dask i am using dask to read a large csv file i wanted to drop a few rows based on one column value if for that particular column the row value is empty i want to remove the entire row i tried using dropna however i got this error so i used drop instead but then got this error i don t understand what should i use to execute the desired operation help,problems with npy to nii gz conversion i m trying to convert a npy image to a nii gz image i m having various problems even though i m following instructions correctly this is the code i m using about the image float this is what we got when we print the shape and dtype image that shows the error and the image s information,0,79,63 discord py url as function doesnt work i am making a bot which has image processing commands from discord it used to work perfectly and when i switched to i get these errors but the problem is docs tell that from member avatar url its member avatar url but the url as function does not work either what should i do,pandas sort dataframe correctly with german umlauts upper lowercase and numbers i have this dataframe all strings i want to sort it so that german umlauts are correct also lowercase and numbers are correct here is my code to generate the dataframe and result the result is almost correct but the numbers are sorted in the wrong order should be before how can i fix the number sorting while maintaining all the other characteristics,0,57,75 python get env from finished subprocess python so i have a subprocess like so now the subprocess itself is modifying the env and i wanna know how can i get this modified env from the process the example is using export however i run a script which may change or add other env variables so i d like to get the whole env,relatedobjectdoesnotexist at profile user has no customer i have created the user customer model i migrated the model to syn with the database however i am getting an error of user has no customer click to profile page through but after adding profile code for every user i am getting the below error here is my code,0,62,58 is it possible to place playlists generated with spotipy into a folder i m trying to use the spotipy library to generate playlists based on my recent listening history i ve been able to successfully create playlists using user playlist create and then added tracks to it using user playlist add tracks however i like my playlists organized into folders and would like to do this automatically rather than having to manually move things anyone able to do this,raise extractorerror could not find js function r funcname youtube dl utils extractorerror could not find js function na we have logged in as hutao error signature extraction failed traceback most recent call last file c users administrator appdata local programs python python lib site packages youtube dl extractor youtube py line in decrypt signature func self extract signature function file c users administrator appdata local programs python python lib site packages youtube dl extractor youtube py line in extract signature function res self parse sig js code file c users administrator appdata local programs python python lib site packages youtube dl extractor youtube py line in parse sig js initial function jsi extract function funcname file c users administrator appdata local programs python python lib site packages youtube dl jsinterp py line in extract function raise extractorerror could not find js function r funcname youtube dl utils extractorerror could not find js function na caused by extractorerror could not find js function na,0,72,88 extract the first dimention of numpy array based on condtion on the rd dimention suppose that i have numpy array with dimension x y z and i would like to extract the x and y dimension on a condition on the z dimension for example if z how could i do that,vertex ai viewing pipeline output i have followed this tutorial to create my first scheduled vertex ai pipeline to run every minute the only thing it does is prints hello any greet string and also returns this same string i can see that it is running because the last run time updates and the last run result is success every time my question is very simple where can i see this string printed and the output of my pipeline,0,52,78 most efficient pybullet getbasepositionandorientation vector conversion what is the best way to convert the orientation from pybullet getbasepositionandorientation to a vector in xyz axis representation in python i could only find limited documentation so far on this issue thanks for any insight,how to find percentage after group by in pandas i want this to be in a form where i get kept broken and f p p for each amount bucket example desired output current output how do i achieve this unstack did not work,0,40,44 how can pytest enable print in src code here s my code in module py in test module py if i run pytest s test module py then i can see printout bbb but i can t see printout aaa actually i also tried to import logging to play with logger also no luck so basically my question is when triggering pytest how can we see printout from the src code,how can i structure this dataset for analysis visualization some columns contain lists instead of single values python pandas question how can i improve either my method expand traits posted below or the data structure i am trying to use i estimate the runtime of my solution to be a few hours which seems like i went very wrong somewhere considering it takes minutes to collect all of the data and possibly a few hours to transform it into something i can analyze i have collected some data that is essentially a pandas dataframe where some columns in the table are a list of lists technically formatted as strings so when i evaluate them i am using ast literal eval column if that s relevant to explain the context a bit the data contains historical stats from league of legends tft game mode i am aiming to perform some analysis on it in terms of being able to group by each item in the list and see how they perform on average i can only really think of doing this in terms of tables something like df groupby by trait mean to get the average win rate for each trait but am open to other ideas here is an example of the dataset the total records in the table is approximately doesn t sound like much but my original idea was to basically unpivot the nested lists into their own record my idea looks a little something like due to the number of items in each list this transformation will turn my records into a few hundred thousand another thing to note is that because this transformation would be unique to each column that contains lists i would need to perform it separately as far as i know on each column here is the current code i am using to do this to the traits column which takes my computer around mins to complete also pretty average pc nothing crazy but equivalent to intel i gigs of ram is this approach logical or am i missing something here i can t imagine this being the optimal method i also might have gone wrong somewhere in my expand traits method,0,64,370 why is my answer not rounding to two decimal points using the round function in python below is my code what is wrong with the code where it wont pick up the round i searched stack overflow and it seems right based off search results but something is off i got the correct answer but my answer is displayed incorrectly should be assuming the bill is tip would be and people split the bill,python make csv from array of dictonaries choose the keys from another list we have one list which will have the key that value need to select the list is the actual data is expected data and we want to convert it to csv i have tried the below way but not working,0,78,53 generator object preventing list comprehension i am trying to turn a string into a list of words then into a list of word lengths for example i think i should be able to do this using list comprehension for example but when i do i get typeerror object of type generator has no len i can t figure out where the generator object is and why it s incompatible with list comprehension any tips suggestions appreciated thanks,why total keeps equalling help me please i am new to python right here i m trying to get the value of x y and z from input and calculate the total but total keeps equalling please help me thank you so much,0,74,45 flake fails in tox testing environment below is the failure message on running tox i don t see this exact error reported on any forum any guidance here would be of great help i m invoking the tox in slim buster docker container installed the required dependencies pip install tox flake black pylint error my tox ini file,how to save one row from dataframe i have a problem with writing row by row to output from dataframe i write my own solution but it s too slow so maybe there is a builtin solution for this problem the goal is to write dataframe s rows separately to the output my code is it possible to make this faster thanks in advance,0,56,62 how to pcolormesh rgba array with d x and y i have a rgba array img with d x and y like this according to this question we can pass any array to plot and set the color using img however it just changed the edgecolors i want to show it like axs imshow img,response when i use requests to make a post request my core code is as follows the variable url is my own website which is based on django i know i can use csrf exempt to disable csrf but i don t want to do that however it return response when i use requests to make a post request i wish someone could tell me what was wrong with my approach,0,53,71 python selenium find element angular printscreen i tried to read this line but it doesn t work does anyone have an idea how to do this,why do you run other lines of codes of a python file say test py when you are just importing a piece of test py from somewhere else say main py i have two python files one is main py which i execute the other is test py from which i import a class in main py here is the sample code for main py and here is the sample code for test py finally here s the output when you execute main py from the order of outputs above you can see that once you import a piece of a file the whole file gets executed immediately i am wondering why what s the logic behind that i am coming from java language where all files included a single class with the same name i am just confused that why python behaves this way any explanation would be appricated,0,27,138 can t order data frame by index pandas df value counts i have data frame with a month column whose count i m trying to calculate using the following method this method returns i want to use the tolist method on this dataframe but want to order it and can t figure out how to order the dataframe by month that is etc any help would be much appreciated,google maps direction api python vs javascript i am facing this weird problem i ve been using the google maps apis using javascript the whole while and now had to use google maps api using python for some reason the issue i m facing is that i get different data in js and python for the same source and destination to be specific i am not getting the path variable in the response json when using python google maps the data i get using python the data i get using js as you can see the path is missing i am using python googlemaps direction api i also tried using request module and using the google direction api using https links but still the received data is the same is python supposed to behave this way or am i doing something wrong any help is appreciated,0,69,143 different results of np var in python vs dolphindb python dolphindb why are the variance results returned are different,influxdb time range query i am trying to form a sql query for the below condition in where clause but it is giving an error influxdb query which i am trying and it is giving an error is as below but above query is giving badrequest error could you please help me to correct this query,0,18,56 error when using tf data dataset from generator i am trying to make tensorflow dataset using tensorflow from generator i am quite sure that i have made a python generator that work perfectly fine but when i tried to pass it to from generator i always got an error this is the piece of code that i use to create the dataset but when i run it it always produce error,python moving values in numpy array to bottom i have a numpy array that looks like this the size can be changed by altering the row num and col num variables during the program the array may look like this i am trying to make a function to move number down the bottom like gravity so once the function has run the array would look like currently the code inside my function looks like the print statements are working so the condition is being met but it does not change the array,0,65,91 what is the name given to a value that is inside a variable as someone who just learned the python basics this might be a weird and stupid question but i got confused also please correct me if there s mistake thanks in advance,how to prefill input box with future date in django template i am trying to prefill an input field with a future date in a django template how could i set it so object table expiration date default is prefilled with datetime now plus days,0,43,41 python regex groupdict with repetitions of groups wondering if there is a function such as match groupdict that catches repetition similar to match captures function when i run this code i get what i would like is something like that is there a function to do so or should i just do it by hand myself,how to move a character to another column in the same row in a pandas dataframe i got stuck trying to clean a dataframe similar to this one i need to keep only numerical values in the column eos and move characters that appear in it to the column test to indicate that an additional test is required for that course this is because some of the values have a before the actual number such as course and some have only the as the value such as course the dataframe was created using camelot to extract those values from a pdf table what i need is to take this out of this column and add it to the test column instead is there an easy way to do that,0,54,135 how to register a pyrogram account i m trying to signup on telegram using pyrogram library here s the code i used i get below error pyrogram errors exceptions bad request phonecodeexpired phone code expired,how to run python script with third party libraries on computer without python i am doing coursework and one of the important requirements is to create a bat file for scripts the bat file should run the script i took this step until one thought struck me code bat file in my code i use many third party libraries including for creating an interface let s assume that this script will run on a computer without python is it possible to somehow write a bat file that would check for the presence of python and third party libraries and in their absence would download them has anyone done something similar could you suggest how this can be implemented,0,27,115 combined if and while how to break out of all nested loops when if condition fulfilled how can i write python script to combine whiles with ifs and break entire nested loop if condition met i have read other topics but i cannot get script working how can i wrote this script to exit or break all nested loops when if condition is met script,ctypes calling go dll with arguments c string how to pass a string as argument from python to a go dll using ctypes go code compiled on macos using goos windows goarch cgo enabled cc i w mingw gcc go build buildmode c shared o dist perf nlp dll python code out working solution python,0,62,43 how to convert a string to a number where number is embed in further string hi i have a string like this and i am trying to convert it into something like this b and doing something like this and getting error valueerror invalid literal for int with base,i have list of list in that i want to make a list from list before empty list i want like that using python,0,52,24 python tkinter grid not working with classes how do i change the position of the buttons with the grid system i had it working without classes when i run the program it ignores the grid settings i want to use the grid system but it doesn t work this is how it looks now but i want something like this thanks in advance,dataframe slice after every nth column in python my dataframe has rows and columns and i need to slice the dataframe such that all slices chunks are of a size each so i want a since after every nd column finally i want to append all these slices one below another so i get a final dataframe of size any help will be appreciated,0,63,74 python replace string in each line i m trying to replace each zzz with a number there is no output at execution and the file content remains the same here s what i have,plotly subplots issue with specs value error i am trying to plot subplots with secondary y axis with plotly subplots but no matter what i am trying still getting this type of error valueerror the specs argument to make subplots must be a d list of dictionaries with dimensions x received value of type class list secondary y true secondary y true secondary y true thank you for help,0,32,68 how can i set layout size in streamlit is it possible to set height and width in streamlit layout i know that there is possibility to set layout wide and centered but its not enough for me map is too big when i use wide too small when i use centered when i set a size folium map there is a blank white space between layout and map i would like to set this size without blank spaces wide centered,why am i getting only hashes per second i was trying to crack a character long password but even after minutes it showed no progress so i decided to find how many hashes am i finding per second the following code need to crack the password which is zzzz h is the hash given by crypt while s is the salt and hashing algorithm used this is hashes but the time taken to crack the password is minutes and seconds which is extremely slow i know that single threading isn t ideal but isn t it still very low,0,79,103 selenium python how do i fetch only the first element with href with the following code i am fetching links i need from within some items but for unknown reasons within it there are two identical a tags with the identical contents how can i fetch only one of them,fillna is not working in pandas dataframe i have a dataframe where some columns have nans values but when i try to replace it by zero values with fillna it doesn t work i m not getting any change why,0,50,38 how can i set a variable from a function called through a button i wanna do something like this this but via a button something like the above code doesnt work obviously thanks,implementing dice lose i would like to implement dice lose like this from dice loss for keras py the only problem is that in most unet implementation y true have channel while y pred have channels for example for classes because y pred is represented by hot vector is there away either to convert y true like y pred or vice versa or make the output of unet as channel like y true,0,33,67 why is there no indexerror thrown and why the output is an empty list when the index required is larger than the length of list the following list x has only a length of and the max index would be shouldn t it be throwing a index error instead of an empty list the output is,how to build a customizable and changeable python module inside an executable i ve built a project with python in which a module of functions can be changed by the user more specifically functions can be added or deleted inside this module by other processes in the application now i have just converted the whole project into an executable file using auto py to exe to run it through a console window instead of running it through vs code for instance i can t change the module if it was not added as an additional file in auto py to exe rather can the application use this module if i do add it as an additional file my question is how can i turn this project into an executable with the possibility of changing this module by the program itself,0,57,132 what is the way to add a text after user input while user adding it in the input in python i would like to make ask the user for any data and put a text after the user input in the execution like below number of persons input how many persons console the screen to be in same step user adding the answer and how many persons persons,replace all occurrences in a string by another string i have this string i m trying to replace all p n x by x n for example would return,0,69,25 convert multiple string elements list to a list with single element split by comma using python i have a list with string elements lst h e l l o and i want to convert it to a single element list but split by the expected list will like this how could i do that,error in airflow even though my task s have actually completed error could not serialize the xcom value into json hi all so my dag actully runs fine all the outputs are working but airflow s ui does not change to succes and fails due to the following issue reading online and i have come across these and that xcom push will be deprecated in airflow version im just not sure how to actully set this up can anyone share any insight full code error in airflow,0,56,88 don t understand why map returns iterator makes code to fail i have some code that does in python it works fine but in python i debugged and delete table id range function is never called i know that map returns now an iterator so i changed the map to become a list with and only adding this the delete table id range function runs i don t understand why is this happening can somebody explains,filter for duplicate requests when i access the api often i get the same answers these requests are duplicated in telegram messages how do i filter out the duplicates my json file key id is unique my telegram messaging function scheduled once every seconds,0,70,45 can not connect to kafka using acl in docker docker compose i am tryting to set up kafka with acl in docker docker compose i am not able to connect with my python example script i am using the the script of dicrectcsd docker compose yml kafka server jaas zookeeper server jaas zookeeper log kafka log python producer example script error message of python script would you help me and point me in the right direction to solve this problem please thank you so much simon,how to splice a dataframe into smaller tables and save each table to an excel sheet here is a table i would like to create mini tables from this table and save each mini table as a sheet in excel file the first stage should contain columns age and eye second fortune food and the third job and kids this is what i ve attempted but it doesn t make much sense,0,79,73 pass multiple arguments to concurrent futures threadpoolexecutor i m trying to run a function with arguments using concurrent futures threadpoolexecutor function how do i pass x and y as the two arguments values for this function i found various answers but they all mentioned complex cases and solutions can someone provide a simple line solution for this without changing the function itself,integrityerror at authentication addprofilepic unique constraint failed authentication userprofile user id i am working with a blog project where i am trying to add profile picture of the user whenever i submit the picture it gives me unique constraint failed authentication userprofile user id views py models py forms py here comes profilepic html but the server shows me this unique constraint failed authentication userprofile user id where is the problem thanks in advance,0,59,59 json decoder jsondecodeerror when reading from a file hello i am trying to read data line by line from a file and then parse that data into json each line is something like this however even though it is all valid json i get the error here is my code does anyone know how to solve this or what is causing it,how to detect a cycle in a dictionary i have the following dictionary with the first number being the node followed by a tuple consisting of a neighbor and then the edge weight some nodes have multiple neighbors and weights dictionary how would i use depth first search dfs to detect if there is a cycle or not the dictionary will be changed frequently for testing purposes so some may have cycles and some may not i am new to python and do not understand how to implement dfs to check for a cycle or not i have the following dfs code and then i call the function dfs visited dictionary but i get the error keyerror i also am unsure how to use this code to detect for a cycle or not,0,60,164 generate excel file from list of nested dictionaries i have list like this simplified version the structure of the excel file should be like this can someone help i am lost with pandas,change the element in a list of lists differently alternating every nth time i have a list of lists containing information about days in a month e g i would like to iterate through the list of lists setting the element id to a for the first five then b for the second five and continuing that alternation for as long as the list of lists might be i am struggling to get the syntax right using a for loop,0,32,79 trying to read a pdf in python using from pypdf pdf import pdffilereader my temp open hw pdf rb returns an error when run saying hw pdf could not be found even though it s in the same folder as my python code not sure how to go from here,how to find list sum of series in python i have series containt value is list and this list containt index of the nd series i ll call it s and s how can i find sum of s list base on s list without using for loop the output i want like this thanks,0,46,57 extracting span tags using beautifulsoup i am trying to extract span tags using beautifulsoup the code is giving no output tag tr td romina td td span class comments span td tr please help me thank you,how can i find whether my output fits the criteria or not write a function processorders orders list int sizes list int to determine whether or not each of the given orders can be fulfilled here orders is a list of positive integers where each integer represents the length as requested by that order sizes is a list of positive integers not necessarily ordered from small to large representing the individual rod lengths that this store carries your function must return a list of booleans where the i th element indicates whether or not the i th order can be fulfilled in the above example the store carries rods of lengths the order of cm can be fulfilled because the store sells cm rods also the order of cm can be fulfilled because the store combines cm and cm rods the order of cm can be fulfilled because it s the order of cm can be fulfilled because the store welds together two cm rods i have tried to do this but it doesn t work what changes do i need to make edit any combination should work,0,27,185 ethereum pre defined gas price in web wallet is this possible im trying to find a way to setup a fix gas price gwei in my metamask probably this is not possible in metamask but is there any way to force that or maybe there is any web wallet which offers that functionality,python pandas in person class i have a person class that have method admin sign in and log in but in csv file every object i make saved with header and index do you have any suggestion to manage it,0,57,42 unable to parse string actl as at position this is another error i am getting unable to parse string actl as at position what is meant by this error is this the right fix thank you,how to write a python string to a c struct s char member in python i have a c struct passed from c to python and i want to change the content of a char member in python little c compile to so file create the struct and call the struct member function callfunc in little py little py littleoperation py if i deirectly assign python string to c struct char member little memberstr paralist para the address will be changed i tried ctypes memset the address remains the same but the char member not changed at all why is ctypes memset not working,0,36,99 how to loop a list until all items in a list are matched with user input then stop the loop with bingo message for bingo game in python my list items should be matched with user input when matched all numbers a message should show bingo and loop should be stopped,scrapy runspider how to use different settings i have the following working spider as a process so i can start the spider with python xyz py but how can i use the other informations settings from the settings py eg robotstxt obey false autothrottle enabled true autothrottle start delay etc and how can i make the output to json in that way so the output get overwritten when i run the program now the data is allways appended to the existing items json file when i run a spider with scrapy runspider i would use o or o to overwrite or not overwrite the output file but how can i do this here,0,50,113 two different graph ticks parameters on y axes from one table considering below table my question how can i modify the right side y axis ticks parameters to price red so that it represents the numbers of price column as well as the title,edit columns based on duplicate values found in pandas i have below dataframe if data in no is duplicate i want to keep only one fee and remove others should look like below i actually have no idea where to start so please guide here thanks,0,44,46 row and column wise data insertion using two dataframes below are the two input dataframe df and df values of a a a from df should be filled by looking non zero values of b b b of df the intended output is,how can i fix a traceback most recent call last error in a pulp constraint i am trying add constraints to this linear optimization problem using a for loop the constraints are x a x b x c x d x a x b x c x d etc the traceback error occurs on the first run of the loop and i am struggling to figure out why any help would be greatly appreciated,0,39,76 argparse input range function i need to pass a function in command line and parsing with argparse how can i do that eg python program py params a range b range i ve tested parser add argument p params type json loads but when i try to launch cmd python program py p a range returns this error error argument p params invalid loads value a range,vectorize calling numpy function on third dimension of array i have a d numpy array data where dimensions a and b represent the resolution of an image and c is the image frame number i want to call np histogram on each pixel a and b combination across the c dimension with an output array of dimension a b bins i ve accomplished this task with a nested loop but how can i vectorize this operation i am confident that the solution is trivial nonetheless all help is appreciated,0,62,87 html form in django returns none i am trying to save this html form in my table in the database but i am getting none error i have been on this for some hour please any help will be appreciated please how do i fix this the is the html order html i created here is my views py the js file,python tracking change in values across multiple columns i have a certain scenario where i have a dataset with historical records and need to be able to flag if the latest entry for a certain id is different than the last entry for example here is an example snapshot of starter df which i want to look like where entries without change are deleted and entries with some type of change in any of the given columns are different and the most recent record is kept according to most recent date i have tried this code df df df id a b c close date duplicated false but realized that this does not fully capture all cases of this condition is there an easier way to compare if the latest entry is different from the previous ones per id edit what if the table were to have a mix of integer and string columns how then would i be able to check if the last two entries for each id are the same and if they are to delete all instances of that id,0,60,183 problem with generating random terrain pygame i want to make simple game with randomly generated terrain but i when i move the terrain instead of generating terrain randomly it generates terrain at max height which is i am begginer in pygame and this bug is irritating me code thanks,how can i get the names in this html code by python i want to get both of names justin cutroni and krista seiden without the tags this is my html code that i want to get the names by python i used beautifulsoup but i don t know how to get deep in the html codes and get the names,0,50,60 building is diagonalizable with numpy i m practicing about numpy library beginner and i want to create a function that decide if a given square matrix is diagonalizable it seems that the next function returns true for every matrix and i m wondering why is that happening any help will be appreciated,question about tensorflow tile with a tensor of dimensions i m trying to understand the following thing from an implementation of a paper i m currently reading in tensorflow if i have a tensor x of shape then i create a new dimension by doing ending with a new tensor of shape then i do ending up with something of shape reading the documentation for tf tile i still don t understand what is it exactly doing in this case am i replicating the new dimension for times and if yes what is exactly placed in the new dimension by tensorflow what am i exactly replicating,0,52,106 round up to the nearest multiple of python how do i round up to the nearest increment of say i have and want to declare b as taking a as an input and rounding up to the nearest,generate pandas dataframe column from list of lists of indexes using list comprehension here is the function i wrote to apply to each row of a df here is df when using i want to get however i get error adding to df col solves the problem but how should i rewrite use list of list of indexes function to be able to apply it to the whole column,0,42,64 how to select only the last n days every month in the given pd datetimeindex for example if n what i want is the point is that i want to select only from the given pd datetimeindex,how to negate multiple filter condition at same time example i have a dataframe like i want to filter multiple condition with negation firstname james lastname smith or firstname robert lastname williams my required output should be i am using something like this but its not working,0,35,53 py operand type s for or pow list and int help simple neural network with only numpy the code returns an error code output values types more i need a correct finction to classificate output in values up to or down to,how to get a rolling mean with mean from previous window i am desperatly searching for a solution with pandas maybe you could help me i am looking for a rolling mean with consideration of the previous mean df looks like this now using the rolling window mean function i would get something like this i would like to consider the mean from the first calculation like this where thank you in advance,0,44,71 doing print enter text end sys stdin readline does not work properly in python something weird happened when i did this output here input excluding quotation marks means that input happened on that line why does the code run as though my code was debian ubuntu python any reason s for this,dask set column astype not working for me i m stuck casting dask columns to a particular data type for the sake of simplicity i ll provide the details for a single column pehrecid a column of floats i ve confirmed that all the values are numeric here s a summary of what i ve tried set the dataframe dtypes i passed in a dict and get the results i expected when i do print df dtypes i get pehrecid float pehaccrualcode object so i ve succeeded in setting the dtypes explicitly cast the column to float with this df pehrecid df pehrecid astype float when i try df to parquet foo parquet engine pyarrow i get valueerror could not convert string to float pehrecid when i try print df head i also get valueerror could not convert string to float pehrecid so it seems the issue is with dask not parquet the files i m working with are sometimes too large for pandas but not huge in this case i m actually experimenting with a fairly small file to get the basics right,0,48,166 add bash script to crontab via bash script i would like to add date with filename to my bash script which would be added to crontab file via script the problem is entry in crontab file is already having the date appended but my requirement is to have the date command in crontab actual requirement i have also tried to add escape characters but didn t seem to work,how to import method from one package to another for the directory structure below below is the directory structure where i am having trouble importing modules let s say there s a method foo in b c b py which is to be imported into a a py however when i try importing foo as shown below i get an error saying an alternative way that i tried was using relative imports like this but again i get an error saying how exactly should i import foo from b c b py into a a py,0,70,87 unable to ravel a numpy array i have a numpy array x np array and i wish to ravel it to this i tried this but it didn t gave any results as the shape was still instead of what am i missing,python create project structure and import packages i am novice to python i need to create project structure where i need to call the packages files inside my testproj directory s main py file could you please let me know how to call the functions f and f inside main py,0,51,48 send private direct message with bot i m going to send someone a message from a bot the following code snippet is what i wrote to do that when i type sendpm it will ask for an id and then for a message to send when i do this i get this error attributeerror bot object has no attribute get user info,python cannot install tensorflow my pc is bit and python version is i installed tensorflow as following does anyone know how to solve it let me know if further information is needed edit i also tried anaconda as follow but the problem is that in anaconda prompt i can import tensorflow i use python in visual studio when i open python file in vs it seems different with anaconda prompt do you know how to make it also work in vs,0,59,85 loop through functions in a class in python i have the following simplified code i want to loop through every function in the class states of course will return name state is not defined but i hope it gives an idea what i try to achieve,requests exceptions missingschema invalid url no schema supplied full code is stated above full output is stated below i have never ever seen an image link like only with backslashes not this and bs recommends me to use that and i dont know how to solve this error typically followed automate the boring stuff with python book same code as from that book but shoots this error when i try to scrape the site thanks for any help,0,46,79 how to print out the one keyword that was matched by method any keyword in string simple question how do i print out the exact keyword that was found and made any turn true using s returns index number or whereas i d need the exact keyword that triggered it source is a long string source code keywords is a list,problem with django app deployment to heroku i ve got a problem that i can t find a solution i ve already tried to deploy to heroku with mysql and postgresql and i ve always had some kind of a error the app works just fine in local environment the log psql is running on local and silk is installed when i tried with mysql i also encountered a connection problem i am following every steps every time but i can t locate the problem,0,59,80 how to pass variable to html emails sent from python i have this python script i want to pass a variable like first name age links from this python script to html template test html access and format them into html something like,get session value from django form i have forms one is the main one and the other one opens in a modal window i need my second form to get the company session value aign emp id however i don t know how to send this value when i call my form from the context first form py second form py request session aign emp id is the value that i would like to obtain the point is to get to obtain the value of the session from my second form view py context mayoresprintform mayoresprintform is where i need to send my session value template html i would really appreciate if you help me with any suggestions,0,41,108 one liner for matrix and vector square sum given a matrix an a vector with the same number of columns step sum step squares step sum of squares i m currently doing this is there a more efficient way of doing this,selector xpath get returns all elements after xpath target here is my html code that i m pulling from then i m using scrapy selector i then use xpath to select an element but it also returns everything after the targeted element i m expecting it to return,0,44,43 defining month days to show number of days in each month i m taking a crash course intro to python and stumped trying to define month days to print the number of days in each month in a sentence saying month has x days this is what i have come up with so far but i am not sure how to define month,python subprocess module changes date format im using this command to get the timestamp in epoch time of a request i was using the bash command date and it worked for me but using this python cmd i obtain the date in another format bash bash output python python output any idea how to solve this issue,0,60,59 how to expose classes in subdirectory to scripts in parent directory i am trying to create a python package looks like this within train py i would like to import modela like from models import modela rather than using from models model a import modela is this possible many thanks,python can t evaluate derivatives at a point i use jupyter notebook how come this does not work when i want to evaluate the partial derivative at the point p when i type f p p i get the answer when i type f x x y i get the derivative of f wrt x then when i type f x p p i get this error,0,47,59 how to change the theme of folded code in spyder is there any configuration to change the gray highlighting when the function is minimize,array mean iteration my question pertains to array iteration but is a bit more complicated you see i have an array with a shape of what i want to do is find the mean of the arrays i will show a simple explanation of what i mean a np array when this code is run you get an array with a shape of what i want is for the mean of each row to be found and returned returned should be an array of with the same rows and naturally a column of please explain the code and thought process behind it thank you very much,0,24,111 cant get hello world in django i have python version and django version url in project name home url in app name hello views in app i tried running server with and without adding hello in setting py still i get only default page stuck from days,pysimplegui one line progress meter does not return false when pressing x on windows in the docs of pysimplegui it is stated that the function returns true if either the cancel button is pressed or the x button in the windows titlebar however it is only working for the cancel button in version mwe am i missing something,0,51,56 python screencapture set window traceback most recent call last i am getting an error executing this code traceback most recent call last file c users jamie poredski downloads piano tiles bot py line in screencapture set window file c users jamie poredski downloads piano tiles bot py line in screencapture contours hierarchy cv findcontours thresh valueerror not enough values to unpack expected got,weird results obtained while solving a set of coupled differential equations using a sparse array in python i have tried to no avail for a week while trying to solve a system of coupled differential equations and reproduce the results shown in the attached image i seem to be getting weird results as shown also i don t seem to know what i might be doing wrong the set of coupled differential equations were solved using newman s band here s a link to the python implementation python solution using band and another link to the original image of the problem in case the attached is not clear enough here you find a clearer image of the problem now what i am trying to do is to solve the same problem by creating a sparse array directly from the discretized equations using a combination of sympy and numpy and then solving using scipy s spsolve here is my code below i need some help to figure out what i am doing wrong i have represented the variables as c ca c cb c cc c cd in my code equation has been linearized and phi and phi are the trial values of the variables cc and cd,0,51,208 adding a string before and after a word in text in python i have list of entities and a text like this text i am krishna i am from bihar i want to be a data scientist i want results like please help me with code in python to get this result,useful design patterns for creating a neat python web app we decided to refactor our code as almost every new feature was implemented as a form of a hack would to get some tips on what design patterns would be useful to have in a web app things like factory or facade don t suit i feel those are more suited for libraries and not a web app the gist of the web app is that it is a sort of translator that understands a user s queries and creates large queries to our dbs it s a sort of search service we have a ton of features and configuration that keep stepping on each other s functionalities and we have to add ugly hacks to overcome them hoping to have a good base that lets creating long complex chain of rules easier to modify,0,51,141 django model importerror attempted relative import with no known parent package i m making a small django app and i just want to make some tests over the queryset of my model however when running code outside the manage py runserver environment i get this error error as already said this works perfectly when making views i can import my article model and create articles from the admin dashboard my app structure looks like this,problem with generating random terrain pygame i want to make simple game with randomly generated terrain but i when i move the terrain instead of generating terrain randomly it generates terrain at max height which is i am begginer in pygame and this bug is irritating me code thanks,0,74,50 how to get only the last folder and filename of a path how can i get the last folder and the filename of a path in python i am doing is there a simpler way,how to use guizero slider to change global variable python i m quite new to programming and i am trying to control a dc motor with a raspberry pi i m trying to use a guizero slider to change a global variable motorspeed however if i run the code the motor will only run on the initial variable set thank you ever so much,0,35,62 not able to scale the roi in opencv python i am trying to build a program that detects hand movements in a selected region of interest but the rectangular selection i perform does works or it gets unscaled the hand detection also starts working randomly at a few points any help would be appreciated,text games i have few problems with the one i am doing for school and would like a little help at the bottom is the error i am getting when running traceback most recent call last file c users alcsj pycharmprojects sample sample py line in current room dict str rooms starting room keyerror starting room,0,54,49 how to get every value of a key of a json file with multiple dicts how to get every value of a key of a json file with multiple dicts i want to extract every value of username key data json this is what my code so far but it gave me this error keyerror username main py,derivative on python hi i make some derivative program on python but the result isn t same as what i expected this is the result as what i want to be i want x to be equal to and here s the code the result is how to solve this problem thankyou,0,56,54 excel using python do all users require python i m interested in creating a tournament template in excel using python but i don t expect all my users to have python installed is there a way to achieve this or is there some other easy to use gui that would be suitable for something like this i ve looked at addins using pyxll and such but they seem to require all users to have them installed,command not found discord bot so i am making a discord bot with multiple command but only the one on top seems to work i would really appreciate it if you could tell me what is wrong,0,71,37 how to select columns from multiindex pandas table in a custom order how to select columns from multiindex pandas table in a custom order in this case how can i have quantity to come before price without the use of ascending false as well as the size to be in the order medium large small desired output creation of dataframe i have tried to use dataframe loc however i have realized loc does not maintain the specific order,sql select list of columns i want to pass an str or list argument and want that sql knows how to treat it example of list col date date date date and at the end i want to have dataframe date date date id does anyone knows how to do it please,0,78,50 getting recaptcha result from ebay sold page scraping i m trying to get some information from the total sold page of an item in ebay because the api request for that is not available anymore i ve tried both bs beautiful soup and selenium but getting recaptcha result and not the page s content itself any help with that issue thanks,why plot python different with matlab and even excel im trying to read data from scv file and plot them reading process easily worked but by plotting is full missed up i have tried that with matlab and even excel both are plotting correct but in python i have problems it seems like that plot photo with python plot photo with matlab i would be thankful for your help,0,58,69 what does a mean in python array what is the meaning of in a python array the code below is what it was written like please help me,calculate mean intensity for equivalent rows having same h k and l enter image description here i would like to calculate the mean intensity for those rows which have equivalent h k l by equivalent i mean h h and k k and l l these three conditions need to be satisfied then these rows are equivalent and i need to get the mean of their corresponding intensities in new column for example the first shaded rows are equivalent so calculate average and type it in a new column next to each,0,31,92 return previous row value based on id column to find differences between current row and previous row i am new to python i am having a problem trying to look up previous row values based on id and timestamp in a python dataframe can anyone please advise how i should derive the solution below is a simple example for example id timestamp sapstock laststockdate laststockvalue,vscode not recognizing python import and functions can someone let me know what the squiggly lines represent in the image the actual error the flags up when i hover my mouse over the squiggly line is import pyspark sql functions could not be resolvedpylance i m not sure what that means but i m getting the error for almost all functions in vscode can someone let me know how to resolve it,0,75,68 edit confluence page via python script i need to access a confluence page via python script and change all use windows strings to use linux strings i can use want use this command inside of script,how to filter double type rows in a dataframe i have a dataframe that has an age column in which only integer values are possible however for some wrong reason it comes with double values in this column and i want to filter those rows out anyone can help me how to filter rows based on double type in a dataframe using python age output age,0,34,71 data insertion not reflecting in mysql database i was trying this post how to speed up python csv read to mysql write to speed up my data insertion script i modified based on my database config but after running the script it runs without errors and data not updating in table please refer to tick mark code snippet in that post above find my code here can you tell or an updated code why it is not updating,change line after saving web crawled data from beautifulsoup as txt file i had set code to crawl headlines from the website and tried to save headlines into txt file i wrote the following code the result of print h text was the headlines were sorted by lines however when i checked the text file the result was the line was not separated as expected i had tried to split it by recalling the text file and use split method which did not work is there any way to recall this file and split it with lines or save it as separated at first,0,78,103 tensorflow tf function fails if function is called with two identical arguments in my tf model my call functions calls an external energy function which is dependent on a function where single parameter is passed twice see simplified version below here if gamma is passed only once or if i do not use tf function decorator but with tf function and passing same variable twice i get the following error is this expected behaviour,how to write read serial port with multithreading using pyserial i m currently running into a problem with trying to write to a serial device using pyserial i want to be able to continuously update my terminal by reading the port and handle serial device writing on a seperate thread meanwhile also be able to send a command via user input on the main thread everything runs as expected except for that when i send one of the commands cmda or cmdb the serial s output that i m reading does not change this is expected behaviour as the commands being sent alter the state of the device which in turn changes the device s output that the serial port is reading with all that said it seems that the device is not receiving the command i am sending even though the code continues to run with no exception and all functions seem to be executing as written here is my current code a serialmonitor class that can read the serial port and print out a specific amount of bytes once finding a set of syncbytes and the main thread,0,71,185 python how to transpose the count of values in one pandas data frame to multiple columns in a second data frame i have data frames df and df i want to add columns to df named group a group b and group c where each counts the number of repetitions of each group in df according to the id column so the result of df should be likes this,how to annotate bar plots when adding error bars i have a dataframe dictionary like this in neat format i want to plot stacked bar graph with error bar this dataframe dont have information about standard deviation but i have another dataframe of standard deviation suppose there are two dataframe mean and std i tried this code but the bars are not being stacked properly i am also looking a way to write value on each bar segment to increase the readability of plot edit solution is to add first two list in bottom while plotting third one but i am looking for an elegant way to do this and also how to write values on segment of bar edit i came to this but now i am looking way to write text i tried this but i got this error edit this error is because of yerr std df but i also want to keep error bars,0,68,158 generate instance in column with duplicates in pandas input expected output need generate instance for duplicates in the column,python dataframe to csv unicodeencodeerror charmap codec can t encode characters i use the following code to save roughly scraped profiles from a dataframe to a csv profiles to csv r c users alexa desktop profiles csv index false header true encoding cp inbetween the script stops giving me the following error message the csv file contains roughly profiles which were successfully written into the csv before it breaks does anyone know how to solve this traceback most recent call last file c users alexa pycharmprojects cameo main py line in profiles to csv r c users alexa desktop cameo profiles csv index false header true encoding cp file c users alexa pycharmprojects cameo venv lib site packages pandas core generic py line in to csv return dataframerenderer formatter to csv file c users alexa pycharmprojects cameo venv lib site packages pandas io formats format py line in to csv csv formatter save file c users alexa pycharmprojects cameo venv lib site packages pandas io formats csvs py line in save self save file c users alexa pycharmprojects cameo venv lib site packages pandas io formats csvs py line in save self save body file c users alexa pycharmprojects cameo venv lib site packages pandas io formats csvs py line in save body self save chunk start i end i file c users alexa pycharmprojects cameo venv lib site packages pandas io formats csvs py line in save chunk libwriters write csv rows file pandas libs writers pyx line in pandas libs writers write csv rows file c program files windowsapps pythonsoftwarefoundation python x qbz n kfra p lib encodings cp py line in encode return codecs charmap encode input self errors encoding table unicodeencodeerror charmap codec can t encode characters in position character maps to process finished with exit code,0,19,165 count the values per key in tuples i have an input data like this i would like to identify the counts for each key i have tried multiple ways as below but it did not work the desired output should be,modulenotfounderror no module named inject i m having trouble with running a test through pycharm here is the full traceback i already have installed inject and when i try to install it again it says when i do the pip list i can see inject being installed in requirements i m using a virtual environment,0,41,54 pandas calendar issue this code for custombusinessday works fine output however when adding an optional calendar as in date functionality it produces the next business day even though today s date dec is not a holiday according to a specified calendar below output,in pandas interpolate between two rows such that the sum of interpolated values is equal to the second row i am looking for a way to interpolate between two values a and g such that the sum of the interpolated values is equal to the second value g preferably while the distances between the interpolated values are linear equally sized what i got is and i want to get to this the function pandas interpolate unfortunately does not allow for this i could manually create sections in these columns using something like numpy linspace but this appears to be a rather makeshift solution and not particularly efficient for larger tables where the indices that require interpolation are irregularly scatter across rows what is the most efficient way to do this in python,0,45,129 loop to split a large dataframe to small dataframes df is a dataframe with columns a b c a b c a b c i want to split that df data frame into small dataframes df df df df to have a b c as columns df to have a b c as columns df to have a b c as columns the number in the name of the dataframe df should match with its columns a b c i tried getting the error is it possible to do this in a single loop,how do you remove an item from a dictionary by its index value i am trying to create a high score system for my game but only want to display the top high scores i used a dictionary to store the scores and the names of the players i want the program to remove the first score once there are more than items how do i remove items from a dictionary based on their order i tried to use pop index like so however i get an error anyone know why this happens i found a solution,0,76,98 iterate the arguments in shell script arguments sent as a list from python file i have tried below in my shell script i want to loop through the list that i passed but the above code prints param list not the hi life jam hello can someone help me with this requirement,python variable right n characters i m trying to return the right n characters based on how many characters are right of a specific character in this case it is the sign everything looks like its working except the last line where i m trying to set the number of characters to return by using a formula gives me the below dataset kitty nan kitty nan,0,55,85 subsetting the data i have dataframe with columns as shown here i want customers id who have visited page b from page a by ignoring other pages and dates like in the given data id visited from page b to page a ignore any other page in between expected output,label elements within a group in numpy i know how to label elements of one input array like the followings now there are two input arrays including group and value arrays a label resets on the first element of a new group it is if the corresponding value is otherwise it starts from how could i do it without spliting arrays or iteration,0,50,66 print pandas series vertically aligned when printed with another string i have a pandas series which should be printed with a string the result of the following code does not look pretty result what i want would it be possible with a simple code may be a possible solution but not perfectly what i want,pass input value to dialog and send to screen i have the following code where i would like to be able to click on the navigation drawer select status under users input the name and then be sent to a given screen with the current user now populated main py navigation drawer py questions you can toggle commenting on the two on release below to see the issue,0,55,63 how to efficiently filter create mask of numpy array based on list of tuples i try to create mask of numpy array based on list of tuples here is my solution that produces expected result output mask problem is that with bigger data array and increasing number of tuples in filter vals it is getting slower it there any better solution i tried to use np isin data filter vals but it does not provide result i need,modify global variable in a function and display it in tkinter edited i want this code to open a window and print message something like this hello elloh llohe lohel ohell hello but the program just display the initial message hello and that s it what should i do what should i change,0,70,55 keyerror during handling of the above exception another exception occurred i have this error adding this line brings up this error i think that it s a data type problem data df id cont data df apply lambda row row product name row hour shift strftime y m d h m s axis hour shift is a datetime and product name equipment are object,how can i make a variable for each person in my discord server with python i am making a game for my discord server and i need every member of the discord server to have their own number of coins therefore i need every member of my discord server to have their own variable for their coins if anyone knows how i could do this that would be a huge help thanks,0,45,72 how to return whole object on data insert instead of id in mysql flask i would like to know how to return the whole product data object like this instead of this only server py file code insert new product function code anyone please help me with this,weighted loss in crossentropyloss combination of weightedrandomsampler and subsampler i wanted to implement class weights to my class classification problem tried by just directly adding the weights which gives me an error when passing my model output and the labels to my loss the error so i print dtypes and change them to float but it still gives me the same error i also tried to change it to float but it tells me that tensor object has no attribute float,0,45,84 data visulation problem with bar plot and it s axes i have a problem i will show it you with pictures and tables my dataframe is like above and graph is like below the code is above i want to show the same values in one bar for example mgros sokm and bimas same values how can i show it one bar and one xticks as with all three names one under the other,why am i getting only hashes per second i was trying to crack a character long password but even after minutes it showed no progress so i decided to find how many hashes am i finding per second the following code need to crack the password which is zzzz h is the hash given by crypt while s is the salt and hashing algorithm used this is hashes but the time taken to crack the password is minutes and seconds which is extremely slow i know that single threading isn t ideal but isn t it still very low,0,73,103 getting a keyerror python when trying to add a new key to a python dictionary in the next code i m getting a keyerror when i m trying to add a new key to a dictionary i am getting this keyerror,how do i make turtles stop at certain line so i ve created a simple race game with turtle graphics and i have one issue there are racers they all start from y and when the first one hits the finish line y i want of them to stop and declare the winner i haven t written that part yet afterwards this code doesn t do what i wanted it to do though sometimes they all stop after of them passing the finish line sometimes none of them passes the line and they all stop i m relatively new to python and discovered turtle days ago can anyone tell me where did i do wrong i want to finish this asap and move on to better modules,0,39,126 add links internal pages of pdf file with python i have a python routine that builds a pdf file of around pages i would like to add something like an index page with links to pages inside the same file i would like to know if that is even possible,ball doesn t bounce of screen edges in pygame i m building a pong game in python with pygame for some reason the ball in the game doesn t bounce off the walls screen edges sometimes it bounces off the walls once or twice and stops i don t know why that happens could someone check my code to see if there are any errors,0,51,62 how do we go about roles and ownership based authentication in flask login i need to segregate dashboards for different user roles how can we do it in flask login a user can have a single role assigned to it and each user of the role will be assigned to a different entity and it needs to access only that,tabnet classifier predictions returning and values i m trying to build a classification model with tabnet i want to output probabilities of s and s that would be value between and i successfully trained the model but predict function is returning only s and s and i don t know how to check probabilities can you help me out here is the code that i m using,0,58,68 remove duplicate files python can anyone help me out with currently i have text files each file is kb but there are files that are similar or nearly identical how do i remove duplicate files it s best to use python i have a way but it s not good i count the words in the text then compare sorry my english is not good,can not make detailview render data hello guys i m new with django class based views i m learning what am i doing wrong it suppose to render ids but it does not url py views py html,0,65,35 pytest create sparksession i need to test my spark project using pytest and i dont understand how to create a spark session i did some research and came up with however when running the test i get attributeerror function object has no attribute format what am i doing wrong,how to access items from ndarray with dtype object how can i access data inside a numpy array with dtype object the following raises an indexerror,0,49,24 getting noreversematch reverse for for user with keyword arguments username not found pattern s tried p username w i have tried to look at similar questions but can t seem to get a way around this bug noreversematch at groups reverse for for user with keyword arguments username not found pattern s tried posts by p w models py views py,modify python class to filter files new to python how can i modify the class to filter files in the folder with a string right now it returns all files in folder containing the content folder which could be millions of items the following works however i would like to isolate files that contain a specific string for example isolate all files that contain v frame the class that works requires a modification to filter file names that contain v frame i am learning python and just can t seem to come up with the solution hope you can help suggest a change to the class or calling method,0,53,101 how to save df to csv to a preferred location rather than desktop i am trying to save df to csv file to a preferred location but getting the following error the system cannot find the path specified however when i try to save it on desktop it works can anyone pls suggest what am i doing wrong here,lazy mapping between integers and arrays permutations without generating all the permutations i want to generate a mapping between a set of integer arrays and integer values in python e g for n size of the array and m array item range i want to have one way to do this is to use the itertools product and do the following and b will be and i can have the mentioned mapping e g however in my case the n and m and storing such a dictionary entries will take more than gb i want to know if there is a lazy way of generating each index of the b everytime i want to access that without generating the entire dictionary,0,55,120 how to add a header to an existing csv file without replacing the first row what i want to do is actually as it is written in the title i want to enumerate the columns which initially doesn t have any column names but when i run the code it replaces the data in the first row for example example csv what i want what happens after running the code is there a way to prevent this from happening,trying to learn comprehensions want to create and populate a dict with list comprehension without knowing the keys first from a dataquest question the keys it s supposed to find are so it s a short list it d be easy to cheat and just use the four items as in the list comprehension at the end but there has to be some way to just iterate through a generated list of keys for larger data,0,77,77 add quotes to each word of string in column of pandas dataframe i have a pandas dataframe something like below i want to add double quotes to each word which does not already have it also replace with word and my final dataframe should look like below i am using python for it can anyone suggest a way to do that,python plotly adding px objects to a subplot object so i m trying to combine two plots into one i ve made these plots with the plotly express library rather than the plotly graphs objs now plotly suggests using fig make subplots rows cols and then append trace or add trace however this doesn t work for express objects since the append trace expects a single trace how can i add a express figure to a subplot or is this simply not possible one option i ve tried was fig data but this will only add the first line data entry rn my code looks like thanks in advance,0,64,97 ive been working on this mini project in tkinter i ve been doing this project using tkinter and i ve made an if statement that says if the answer that the user put is cs print out a label says correct else print wrong and i ve tested it but it keeps saying its the wrong answer when i type cs so can you help me please,writing and then running a python file using python i have written a python code in a file suppose file py in which i am writing a python file with incrementing index like file py the index is read and saved in a index txt file and incremented throughout the code my question is if i uncomment the line os system and run the code is it safe or some kind of memory issue will be there also what happen if i can control the index in that case is it ok thanks in advance,0,64,92 scraping data page attributes from web page i want to scrape all the products from this site which does not have a pagination button the products load automatically when you scroll my script can only scrape the first products i realized that the products load dynamically in a data page attribute of the div tag i want my script to keep changing the data page value and load the product but i dont know how to do it,set simple markdown script in python i am trying to use markdown with python but i am having trouble i get the error can t concat str to bytes which is a common question for example here i tried different arrangement of changing to bytes or back to string but i still can t get it to work instead i just get a slightly different error but the whole theme is str and byte compatibility i d appreciate any help,0,78,77 using standardscaler for multiple columns i want to use standardscaler only on certain columns however my code resulted in error here is my code output,how to properly use a function and it s syntax in python currently i m working on a basic text game you can choose which weapon to fight a wolf who s health is driven from a dictionary same goes for statistics of the weapons you can choose from now what i was trying to do is set it up so i do not need to repeat the same code code for the whole damage idea and i wanted to write it down in a function so i can call back the function for each weapon type and save on space and have less code it would mean a lot if someone could show me how to do it and or any suggestions to my code and how i can make it shorter without using a lot of object oriented programming would mean the world thank you for anyone helping or just reading this and taking the time of their day,0,25,159 how to fix indexerror string index out of range python i am trying to make a parser for my text adventure i used a text file called test txt i keep getting indexerror string index out of range how can i fix this parser py test txt,opengl vbo can run without error but no graphics the following code should draw a cube each time it is called error code print blocks is in the mainloop if i use glbegin and glend it can be drawn normally but after i use vbo no graphics will be displayed i don t want to use shaders i don t need them also how can i bind colors array to vao,0,45,66 regular expression in python to split a string based on characters that begin with and end with i have strings that look like this desired output current code so id like to split the sentences based on characters beginning with an add symbol and ending with a colon as these are the way all languages are encoded e g en es fr nl etc,exec python script and mock missing modules i am running a execfile on python script but in this script there are calls to modules that i don t have i would therefore like to replace them with fakeobject mock i have this instruction but i dont have mymodule mtest core and i want to replace ccore object with a fake object containing the initialize method i tried someting like this with myfakeobj is a python module with a fake def initialiaze method but i have this error modulenotfounderror no module named mymodule mtest mymodule is not a package how can i do this,0,67,98 i get none for validation form django here is my code for validation and whenever i print password i really dont understand why password is printed properly and password is none i get none can anybody explain to me why this happen,calculation of gradients i write codes for calculating gradients of real valued function but the result is not desired one for example gradient of f x y x y at should be but in my codes it is where do i misunderstand here gradient is a vector whose i th component is given by f x x xi h f x x xi h f x x xi h f x x xi h,0,42,68 integrate facial recognition model trained in python in advance java projects i want to develop a web based voting system in java the system has facial recognition and otp verification i have a a facial recognition code in python and the model is accurate how can i implement facial recognition in my web based voting system,typeerror unhashable type numpy ndarray python image classification using tensorflow and keras i try this sample code for image classification the terminal pop this i try to check the data from the pred with output im not sure why because the data is from set of an array im new with this and im using python can someone help me,0,56,59 remove certain word from string the program need to remove vowels from word i tried something but don t know why it s not working code,how do i manage deletion with multiple foreign keys to the same table in django say i have a model with a things table and a table of relationships between the things called thingrelations it should not be possible to delete a thing when there are thingrelations that point to it this is how i m trying to implement that how do i automatically delete a thing when there are no more thingrelations pointing to it,0,24,75 how can i concatenate pytorch tensors or lists in a distributed multi node setup i am trying to implement something like this for nodes each node with gpus i tried to get a sum of these but what i want is a concatenated version like this or is also ok with me is it possible to achieve this from torch distributed,mock api call in model signal django i am new to django and unit tests so any feedback is very helpful i built a small integration with a third party to create a matching account in their system whenever an account is created in our system i do this on a signal in the model class the signal is simple and looks like this when i ran our tests it created thousands of accounts in this third party s system so i discovered mock we have a bunch of tests that create companies and i was wondering if i have to add this to every one of them mock patch apps accounts utils build request return value my question is at which level should i mock the response and just return for the new integration id can i do it at the model level or do i have to do this for every test case we have,0,62,150 typeerror planet got an unexpected keyword argument name i used python shell to run i get the following error typeerror planet got an unexpected keyword argument name how do i correct this error,python return average on unique values based on multiple columns i have a data set that is looks like this and there are instances in which there are multiple duplicates ex gone girl is repeated twice i am not proficient at python so i don t have any code at the moment and have tried looking all over stackoverflow but my objective is appreciate any help,0,33,64 extract euler rotation from matrix using maya i am trying to extract the rotation of an object based on these values i am not quite sure how to do that properly i found a few solutions online but none worked for me since all values used on those examples were a bit different from the one above does anyone know how to extract that using python openmaya i would appreciate any help thanks in advance,pandas dataframe set categories the inplace parameter in pandas categorical set categories is deprecated i have following statement in my code which now generates a warning as d python python lib site packages pandas core arrays categorical py futurewarning the inplace parameter in pandas categorical set categories is deprecated and will be removed in a future version removing unused categories will always return a new categorical object res method args kwargs how am i suppose to write to avoid this warning and future errors thanks in advance,0,74,72 one liner for matrix and vector square sum given a matrix an a vector with the same number of columns step sum step squares step sum of squares i m currently doing this is there a more efficient way of doing this,python excersice lists sums i have this excesice given a list l we indicate with x the generic element of l and with x the element in a symmetrical position to x write it down a function examine list which receives a list l of positive integers of even length and returns a boolean in in particular the function returns true if and only if for each element x of l the sum of the values of x and x is greater the sum of the values of the elements positioned between x and x note that when x and x are adjacent the sum of the values of the elements positioned between x and x can be assumed equal to zero example if l then the function returns true because my code is this i have created the sum list who create a list of sums of the array my problem is the nd function sum gives me always thid error,0,44,169 python docker container not building i have a repo which runs python on a docker container recently i have a purchased a new mac and on this new workstation this container is not building successfully when i try to open it with remote container plug in from vs code this is how the setup py file looks like the issue seems to be something related with scipy cython and lapack how should i modify the dockerfile so that the build completes,finding impulse response of the block diagram i have the following block diagram and each subsystem i need to find the overall impulse response for n the individual impulse response for each subsystem was found as shown then i performed the following convolution and addition to find overall impulse response but i got the following error not certain how i should incorporate the range of n values considered,0,79,68 how to avoid splitting data by index level when writing to parquet with pandas here is my simple code to write to parquet using pandas this is what df is supposed to look like some more details on the columns when i read the parquet files in my directory in pyspark my cosine similarity matrix ends up splitting on a auto generated index level with the way it s split i won t be able to leverage my cosine sim matrix,how to install postgres extension with docker on django project i want to add full text search to my django project and i used postgresql and docker so want to add extension pg trgm to postgresql for trigram similarity search how should i install this extension with dockerfile in shared my repository link docker compose,0,76,52 unable to install beautifulsoup package for python using pip on ubuntu i was trying to install beautifulsoup in order to learn web scraping i was using pip to install bs package for python but i am unable to install it any help to resolve the below traceback error note i am using wsl ubuntu,groupby and pivot pyspark dataframe on many columns i am new to spark and want to pivot a pyspark dataframe on multiple columns there is a single row for each distinct date rank combination the rows should be flattened such that there is one row per unique date the real data has feature columns and the ranks go from to for each date the desired output i have a solution that appears to work for my trivial example but the memory usage is so extreme that i can t use even th of my data without getting memory errors,0,58,101 attributeerror type object has no attribute get extra actions i have a small web app and i m trying to develop an api for it i m having an issue with a model i have called platform inside of an app i have called userplatforms the same error attributeerror type object userplatformlist has no attribute get extra actions models py api views py api serializer py api urls py,how to display a geometric object from python code in a rmarkdown document i would like to have a point displayed like in this tutorial in my rmarkdown document after knitting reproducible example with this code i only get the following output shapely geometry point point object at x eea b how can i have the image of the point displayed instead also i am interested to display it in the viewer plot pane,0,56,69 python how to link a filename to a memory file the memory file will be an input of another program not python so a file name is needed,wed scraping with beautifulsoup not returning values hi i m very new to scraping been trying to do a project have been following the instruction managed to pass the error by using user agent etc which eventually gave me code but the code from the start is not returning a value for the productlist i cant figure out why as i cant see any error in the code any help would be much appreciated,0,28,78 python re match exact string with pattern string block emp string block reg re match d d d string returns block emp the above regex works correctly reg re match d d d string returns block here the excepted output for string is null but the regex returns block this regex will not match the full pattern and returns only what matches in the string how to match the string excatly with this pattern thanks,copy data from multiple excel files to existing file on specific sheet i would like to copy the data from multiple excel files and paste it existing excel file my problem is that i would like to do the same above mentioned operation on multiple files for example if in the load attachments is the file named pb orders november xlsb i want to apply the same code to that november file and so on what ever month name file has,0,63,79 is it better to make custom registration with editing django usercreationform class or make it on a new table and class i wanted to make a django authentication but i was confused about wichone is better is it is better to edit the venv lib site packages django contrib auth forms py file and make my custom form and edit db on venv lib site packages django contrib auth models py or it s better to make my authentication system with model and views and forms on my application,save outlook attachments with python every monday i receive the attachments with the slightly changed subject title constant part of the subject title is pb report and will have the monday s date for example i received email this monday with subject pb report last week pb report and so on i would like to implement the getlast in this code in order to get only the newest sent report also how do i tell python to search the subject which starts with pb report and dont look at the rest of the title i tried wildcard as save attachments pb report but did not work i also have the alternative code but when i run this code i never get the result nor error it takes,0,72,128 adding comma to bar labels i have been using the ax bar label method to add data values to the bar graphs the numbers are huge such as how can i add commas to the data values using the ax bar label method i do know how to add commas using the annotate method but if it is possible using bar label i am not sure is it possible using the fmt keyword argument that is available,i can t create super user postgresql and django i am doing a project with django in which i try to change the database from sqlite to postqresql when i try to create the super user i get this error settings py models py the project works normally when i turn on the django server the problem is when i try to create the superuser from the terminal i am not sure if the problem comes from the connection between the postgresql database with the project or if it is some problem of migration of the models created and loaded in django s default database sqlite it would be excellent some help thank you very much,0,73,113 error pg config executable not found when install psycopg in centos i am install psycopg in the centos using this command but shows error like this i have already install postgresql devel using command dnf install postgresql devel y and install successs why still could not install the psycopg,any way to invoke this windows volume up down window through python any way to actually call this windows volume window through python i know that i can use pycaw to change the volume itself i ve done that already i need help to call this one,0,48,45 is there a better way to select rows from a pandas dataframe based on multiple conditions i m trying to select rows from a pandas dataframe based on multiple conditions the code looks like this is there any better way in terms of code readability to do the same thing,getting error message while runing code in pycharm i m trying to run a code that will draw a love image using pycharm but i get an error that i seem unable to fix please i need help with this what am i doing wrong i get this error while runing the code below in pycharm i don t know what am doing wrong,0,49,62 deleting first item in python dict using indexes i am working with dictionaries and i would like to delete the first item of the dictionary is there any way to do that using indexes,extracting ip address from a file in python and counting how many times the ip shows up i have to use a text file and extract the most frequent ip address and count how many times they come up i had to fix the spacing for the code to be edited i hope this is ok and you are able to run it i have stuck on this for a while and i thought i was calling the functions too,0,34,80 what does a mean in python array what is the meaning of in a python array the code below is what it was written like please help me,python selenium take screenshots and save as pdf for windows opened with document write i m using selenium with python in jupyter notebook i have a number of tabs open say tabs with all elements already finished loading and i would like to cycle through them and do things in the code below i focus on the screenshot requirement but would also very much like to know how to save it as a pdf this code enables looping through the tabs however if i try to add a driver save screenshot call as shown below the code seems to halt after taking the first screenshot specifically png is created for the first tab with index and it switches to the next tab with index but stops processing further it doesn t even cycle to the next tab edit i modified the code as shown below to start taking the screenshots from window handles instead of as i don t really need the screenshot from but now not even a single screenshot is generated so it seems that the save screenshot call doesn t work after even the initial switch to window call edit i ve found out why my code is hanging no matter which method of printing to pdf or taking screenshots i m using i mentioned earlier that the new tabs were opened via clicking on buttons from the main page but upon closer inspection i see now that the content of the new tabs is generated using document write there s some ajax code that retrieves waybillhtml content that is then written into a new window using document write waybillhtml for more context this is an orders system with the main page with a listing of orders and a button next to each order that opens up a new tab with a waybill and the important part is that the waybills are actually generated using document write triggered by the button clicks i notice that the view page source option is greyed out when right clicking in the new tabs when i use switch to window to switch to one of these tabs the page printtopdf times out after seconds i suppose so my refined question should be how to use page printtopdf to print a page in a new window that is generated dynamically with document write without timing out one approach i tried was to do this referring to this question but the problem is this is too aggressive and prevents the code from logging into the ordering system and doing the navigating filtering necessary to get the browser to the point where i get the orders listing page with the waybill generating buttons i e the original setup in this question edit at this point i ve tried something as simple as just getting the page source of the dynamically generated tabs long after they had completed rendering and i can see the content on the screen not using headless for this stage of the debugging and even this itself is throwing a timeoutexception so i don t think it s an issue with waiting for content to load somehow the driver is unable to see the content it might be something peculiar with how these pages are generated i don t know all the methods suggested in the answers for taking screenshots and saving pdfs are good i m sure for otherwise normal windows with chrome the view page source remains greyed out but i can see regular html content using inspect edit using chrome s inspection function the page source of the dynamically generated page has this html structure curiously view page source remains greyed out even after i m able to inspect the contents edit finally figured it out when i clicked on the button for generating the new tab the site would make an ajax call to fetch the html content of the new page and document write it to a new tab i suppose this is outside the scope of selenium to handle instead i imported selenium wire used driver wait for request to intercept the ajax call parsed the response containing the html code of the new tab and dumped the cleaned html into a new file from then on generating the pdf can be easily handled using a number of ways as others have already suggested,0,31,704 python misinterpret keyboardinterrupt exception when using lingoes i want to write a python program run py that always runs and only stops running when ctr c is pressed this is how i implement it wrapper py run py however when i hold left mouse and select text in the terminal that is running wrapper py this event is understood incorrectly as ctr c then the wrapper py stop running run py my question is how to prevent reading mouse events as keyboardinterrupt in python unix thanks terminal,background task in flask that write to database i want to build a flask app that reads emails from some email address and shows those emails on a route here i want to have a background task that fetches all emails and writes them to the database and i want it to run continuously in the background i don t want to run this task when someone requests a route fetching emails and displaying them should be totally independent i think multiprocessing should work but i don t know how to start two separate processes one is for fetching emails and writing them to the database and another one is for the flask app that shows emails from the database is it possible to do so please help me just give me a demo with multiprocessing where one process is running in the background that writes to the database and another one is flask app the example can be anything it doesn t need to be fetching email anything that writes to the database on a separate process and flask on another process that read from the same database thanks for reading this long thanks a lot,0,78,194 how can i use enumerate function in python i have a code snippet like this let s say i have data in the test data is this for loop goes from to or from to,how do i delete text when i press a button tkinter so i am trying to make a script that can by the click of a button choose randomly an even or an odd number and then tell you if it was even or odd but i can t make it delete the text after i press the button so it just puts the text below sry if my message is unclear enter image description here image link,0,39,80 how to arrange pandas pivot table columns how do i arrange the columns of a pandas pivot table for example for the pivot output how can i have d and e swap positions and how can i swap the large and small positions edit i am looking for a solution which allows for a custom order that would work for other instances,plotly dash output a specific number of checkboxes from slider input i m trying to output a specific number of checkboxes in plotly dash based on input from a slider the aim is that a user will select a certain variable from a dropdown box and a value from a slider which will then return a specific number of checkboxes based on the slider showing the variable s values at the moment the code works fine for one checkbox but i can t seem to find a way to loop through list of components in a div and when i output more than one checkbox i receive a callback error stating the expected length was and received a greater value instead my current code is thank you in advance solution,0,62,129 how to create dictionary from map class i m trying to introduce escape characters in a dictionary my dict filled with strings including symbols in both the keys and values i know i can do this by using but how do i reconstitute the dictionary doing this gives the error is there a proper way to get the map class back into a dictionary,from python to create an alarm in zabbix could you please tell me how can i create an alarm from a python script in a zabbix system i have a python script in which a certain function is processed and at a certain point i would like to create an alarm in the zabbix system when a certain condition is created in the script i also have a mail server i was thinking of creating a separate mailbox for zabbix to this email address i will send a letter from python and the zabbix system will receive this letter process and create a problem is such functionality possible,0,62,108 why the view of some photos read by cv imread and plt imread are different i have some photos taken by uav and i find that the view of some photos read by cv imread and plt imread are different one of them is upside down rotation but most photos are the same why,filtering out elements in a weirdly structured list in python i have a weirdly structure list of the format i want to filter out relevant words that are in a list relevant words from mylist could anyone point me in the right direction as to how to do this,0,51,48 how can i make it so my discord bot mentions a specific person when they type so i m putting this in a cog i want to make it so that if the author is a specific person and they type anything the bot will mention them and reply i m not too sure if i m supposed to use ctx author mention in this context and i m fairly new to how cogs work in discord py,how do i remove lines that are repeating and contains certain words from text file i m trying to remove repeated lines and lines containing certain words from scraped data i searched for various codes but they are not working this is the code only the first part works that removes repeating lines this is the links txt file i want the output to be thanks for your help,0,71,68 select every hr timestamp record based on condtion in pandas here i need to fetch the records if food value is not nan and next hr of timestamp row,merging list with nested list i need to cross join for want of a better term lists between them they represent a tabled dataset but one holds the column header names the other a nested array with the row values i ve managed the easy bit which strips the column names out in to a list without typename but just thinking how to extract the row field values and map them with column names is giving me a headache any pointers appreciated thanks columns as provided records as provided required result,0,30,97 getting extra numbers while handling big numbers in python i tried why i am not getting how do i obtain the real result,tkinter radiobuttons not selecting properly i m trying to make a small tkinter program to calculate the area of shapes and volumes and i ve made a main py file area volume calculator py and two libraries area py and volume py the main program s radio buttons work fine but when i create the second window from area calculator i can t seem to get radio buttons to work properly when it opens the last radio buttons are selected already i can still select an option but self choice get always returns the default value which is i don t know how to get it to work can anyone help me get the radio buttons to work properly any and all help is appreciated main program area py library,0,23,118 fix invalid geometry in geopandas how can i fix invalid geometries in a geopandas dataframe from i can see have invalid geoms i have attempted using shapely to understand what might be the source of invalid geom using which throws the error edit adding data,how can i setup visdom on a remote server i d like to use visdom for visualization of results in a deep learning algorithm which is trained in a remote cluster server i found a link that tried to describe a correct way to setup everything in a slurm script i use my ip and to connect to the remote cluster server i have the following lines of code i got this error how can i run my plotting script on a remote server how should the command line of python code be in my slurm script how can i store the plot and move it later to my laptop using scp command,0,45,113 pyqtgraph how to get mouse click position correctly i prepared correct onmouse moved function and it shows correctly coordinates of my mouse but when i clicked somewhere python prints coordinates of my window not of my plot i tried to make it the same like for the onmousemoved but it doesn t work i also tried to use mouseclickevent scenepos instead od mouseclickevent but it also doesn t work,struggles with converting a dbf file to pandas dataframe i m attempting to work with the canadian radio station dbf files made public here i d like to read specifically the fmstatio dbf file into a pandas dataframe i ve tried the two commonly recommended dbf packages in python when using simpledbf i only get the column names when using the dbf to dataframe function i also tried dbf on pypi i m able to read the dbf file into a table and get the following information on the table but when trying to convert into a dataframe i am unsuccessful error i receive might anyone have insight as to the best way to go about working with this kind of dbf file in pandas many thanks in advance,0,66,125 python selenium find element angular printscreen i tried to read this line but it doesn t work does anyone have an idea how to do this,assigning multi dimensional numpy array to a pandas series i have a numpy ndarray of shape i already have the desired series index names of len my index i want to create a series in which every index is associated with one of the rows of my x numpy ndarray works but i believe that there is a better faster way that i am unaware of,0,27,62 creating new dataframe by indexing column i just can t seem to connect the dots on this i m trying to do something similar to this question i have a dataframe that takes the form and i m trying to create a dataframe that looks like this i don t want to set the specific parameters so something like df loc df origination q orig balance sum wouldn t work for me,pandas dataframe compare columns of different sizes in different dataframes i m trying to compare two dataframes df df my goal is to find any matches of df mass with df mass pos i really liked this but this throws a value error i think that this is because these dataframes have a different number of rows is there a way to overcome this,0,64,62 solving system of coupled equation using rk method i am trying to solve the system of coupled differential equation but i got following error can any one resolve this problem dy m c p m c c p y y u l a s y ta typeerror float object is not callable,create a repeating pop up window tkinter i need the popup function to open a window every seconds and close after the user has clicked a certain button however when testing this i wasnt able to click the button on the popup window,0,40,43 how to solve installation error of pyodbc on ubunutu i am trying to install pyodbc on ubunut lts and get the following error installing gcc via apt didn t work since it is not available for installation i currently have gcc compiler installed i tried installing python dev python pip as described in error installing pandas profiling with pip on ubuntu and but it didn t solve the issue any help is greatly appreciated,how can i create a script to launch my python web app in command line i have a python flask web application that runs in command prompt and i would like to create a script for automatic launch of this application every day or to be exact i need the script to launch the app then wait a day terminate it and launch it again immediately its because my database is updating every day and if i dont restart the web application the changes won t transmit in it i have no clue on how to write a script for windows command prompt these are the commands for launching my web app for terminating i use ctrl c can somebody help me with this problem,0,73,123 token second team not found and default index is not set error in torchtext function this is my code the function work well for train set but for test set returns this error runtimeerror token second team not found and default index is not set does anyone know what is wrong,replacing characters with some restrictions i have a list of strings in python and i want to create a function that perform many replacements some of them are one solution that comes to my mind is one of the issues is there a solution that respects these two conditions obrero agricola is mapped into obrero agricola o something is mapped into o something it fixes o if it s mixed with other words,0,49,72 inserting list to tables column postgre i am trying to normalize some data that i retrieve from an api but it doesn t seem to work any pointers ok after some corrections it returns how do i overcome this my approach might be wrong altogether because the table i am retrieving the data has about m rows but how could i make this one work,valueerror when using keras imagedatagenerator i m trying to run this code from i ve tried using a few different version of python even tried it in a ubuntu virtualbox but i still keep getting this error i can easily fix the warning by removing generator but i can t get this code to work can anyone help fix this issue is there a way to test the directory iterator to see if that is the problem,0,65,75 module does not have the attribute subprocess detached process this ought to be a very simple question from the documentation there s a constant used in the subprocess package run function subprocess detached process here s a more detailed programn that proves the python version number yet i get with this program i agree that it looked like a version problem but it seems that i ve conclusively demonstrated that it s something else,how can i create link button in nextcord this is the link button i want this is my code error,0,66,20 zip folder using python without changing directory i want to zip a folder at x location to y location i have written code for it this is my code i don t want to change directories can i pass path of the folder i want to zip and path of the destination where i want to store that zipped folder is this possible using python,can i run unittest pytest with python optimization on i just added a few assert statements to the constructor of a class this has had the immediate effect of making about tests fail rather than fiddle with those tests i d just like pytest to run the application code not the test code obviously with python s optimization switched on o switch which means the asserts are all ignored but looking at the docs and searching i can t find a way to do this i m slightly wondering whether this might be bad practice as arguably the time to see whether asserts fail may be during testing on the other hand another thought is that you might have certain tests integration tests etc which should be run without optimisation so that the asserts take effect and other tests where you are being less scrupulous about the objects you are creating where it might be justifiable to ignore the asserts asserts obviously qualify as part of testing i d like to add more to some of my constructors and other methods typically to check parameters but without making hundreds of tests fail or have to become much more complicated,0,66,196 how can i get geopy to read addresses from a data frame i m testing this code i keep getting this result however if i pass in an address like this below it seems to work fine result i must be missing something simple here but i m not sure what it is,how can i split string between group of word in python how can i split the value and value from this string my str a href default html target top value a a href browser html target top value a i try to this but it s not work,0,51,37 install uwsgi on m monterey fails with python i installed python via pyenv and then created virtual environment with command python m venv venv which python returns users my name development my project venv bin python then pip install uwsgi fails with following error any suggestions,importing modules to greengrass containerized lambda in python for raspberry pi os i worked on python script that includes sqlite and serial it worked well when running them on barebone raspi os however when i tried to use them on containerized lambda i get these errors lambda runtime py failed to import handler function main function handler due to exception no module named serial and lambda runtime py failed to import handler function main function handler due to exception no module named sqlite the question is how do i import these modules along with my code it seems absurd to be that greengrass sdk uses sqlite but i can t use them in my own lambda function any helps i can provide more details if needed,0,40,116 drop rows based on column values in dask i am using dask to read a large csv file i wanted to drop a few rows based on one column value if for that particular column the row value is empty i want to remove the entire row i tried using dropna however i got this error so i used drop instead but then got this error i don t understand what should i use to execute the desired operation help,how to only show the final result after adding or multiplying all natural numbers it has been a week since i started to self study python and i tried making a program that adds or multiplies all natural numbers and the problem is i want to only show the final result of all the sum or product of all natural numbers how do i do it,0,79,65 how can i overwrite excel sheet by win com in python i m trying to overwrite excel sheet data from a file to b file for this i m using pywin i finished about copy but this code made additional sheet to destination file basically two files are almost same so i wanted to copy at same sheet on destination file but copy function in pywin make automatically before or after active sheet how can i overwrite it,for loop in python why does this return not does anyone know why does this return and not but when i do not indent the return statement it gives me this is my code,0,75,39 convert the dataframe into time intervals from timestamps my dataframe looks something as follows i want something as following where total action is the frequency of of a action here are the time intervals could be in string format no issues there i have tried looking at pd grouper but that also isn t helping much,how can i scrape json value from key i am trying to scrape odds from betting site i am pretty new to python and i need some help some kind of odd id is stored in key b so basically for every match in this json file if match contains key b with value i want to scrape value of key g and store it in my list gg in key g value is odd that i want to scrape but if match doesn t contains key b with value for that match i want to append only one time to list gg with this command i can scrape odds but i don t how to append to gg if match doesn t have b oddid,0,55,126 how fill the missing values in the dataframe as ffill function needs nan none which are not in my dataframe as in the question above is there any other way to do it because i care about not using values np nan input dataframe output,how to go about doing blob detection on non circular objects no thresholding binarising i am working with galaxy images and i would like to use blob detection to identify the galaxy that is in the center of these images and then mask the pixels outside of the blobs i have used cv and skimage s blob detection modules but they only return circular blobs this would actually be fine as long as the galaxies are fully contained within the circles but the issue is that the blobs tend to be smaller than the actual size of non circular blobs e g oblong shaped ones example of blobs being too small blob detection results vs actual galaxies i have tried gaussian blurring are there any implementations methods for me to be able to get blobs that also match the shape of the galaxy if possible i would like to avoid thresholding methods my code right now just a basic use of the packages edit as cris luengo suggested here is code that will allow you to download similar galaxy images to use in python,0,43,179 django use urls with same ending i ahve a django project with the application web api and the following url configuration main project urls py application web api urls py the web api param summary endpoint works but web api param item summary does not work and returns a status code if i change the param param item int id summary to param param item int id whatever in the web api url py i get the desired results i have tried using url regex without succees any ideas on how to solve the problem thanks in advance,transferring files from a subdirectory i have a subdirectory update and i need to move all files and folders from it to the current directory removing all files and folders from the current directory the problem is that there are a lot of subfolders in the subdirectory and i can t figure out how to move them all,0,74,57 store formatted strings pass in values later i have a dictionary with a lot of strings is it possible to store a formatted string with placeholders and pass in a actual values later i m thinking of something like this the above code obviously doesn t work but i m looking for something similar,how to loop in python api with restriction on limit and can provide offset i am new to python api i need help in calling api data from python where we have limit of rows per page yes off course we can apply offset but i am looking for a loop to extract complete data below is the python script sry i am new and not having much experience in writing the script,0,51,74 python selenium disable chromedriver log message in cmd i can t disable chromedriver logging message devtools listening on ws in cmd i ve used some methods like but the message devtools listening on ws still appear in the cmd my code,how to integrate ns module with pycharm i m new to the ns and i was trying to integrate ns to pycharm cause i m familiar with pycharm it seems that ns is installed correctly on my machine running waf python works fine but when i use waf shell there are some modules it couldn t find such as ns application etc so when i try the solution on this page add waf libraries to pycharm it doesn t work too could anyone help me to solve this issue i would really really appreciate it by the way the file i test was the sample from ns ns root source example tutorial first py,0,40,102 how to use tf gather similar to the numpy slicing i have a list of indices representing the rows and columns that i d like to access when i use them as r c i am able to obtain the corresponding elements in a numpy array i would like to perform the same operation in tf and am using tf gather i have tried different commands but could not manage to get the same results as i do in numpy,identify lines of speech which contain words from a list using pandas i have the following dataframe and the following list which contains keywords i would like to generate an output which shows both the speaker and line no associated with them for each time their speech contains at least words from the keywords list i have tried iterating through each line in the dataframe to see if there was at least keywords present however my code only returns the last line below is the code i used the expected output for this particular case should be in a similar format whereby the first value is the line no which contains speech which has at least keywords and the letter is the person,0,77,126 continuously updating pysimplegui window i am creating a program in which i want to update values continuously after click start until user clicks on stop button i want values to keep updating i use for loop for testing like basically after the loop complete running it update the value directly last i value i also use time sleep to keep track of it but didn t work,loop counter behaving unexpectedly i am having trouble understanding why the counter variable even though incremented within the nested loop is not having any effect on the number of times the parent loop runs the code below gives the output when the increment inside the nested loop is supposed to stop it from executing the second and the third time is the i inside the nested for pointing to a different i,0,65,75 how to regulate number of ticks plot i have a dataframe with shape there are two columns value and date i want to plot it with date on x axis but since there are days there i want to keep only ticks on x axis i tried this but plot looks like this how to fix it,unable to run vscode s debugger with dockerized django project every time when i run a debugger there happen many things but not what i expect i m running a project with docker compose up checking the localhost if backend backend is okay it s down what s funny the container is running because i m attached to this with vscode s remote containers the debugpy library is installed the first approach to run a debugger end with such info in debug console and it s down backend is also down second try and it s down but backend is up i m able to login etc the third try ends with such an error connect econnrefused any tips code manage py the local docker compose yml and the launch json,0,61,119 need values to unpack in for loop got in django after updating my project from django to django i am facing this issue need values to unpack in for loop got let us consider my views py as how could i solve my issue,segmentation fault core dumped while trying to print numpy and pandas objects in python via cygwin i am simply trying to run python interactively in cygwin but whenever i try to print out a numpy array or write a pandas dataframe to a csv file python prints out to run numpy pandas i installed with cygwin set up exe i d like to emphasize that python prints out the message it s not an error message apparently the problem arises whenever i do something as simple as the following in cygwin terminal but it doesn t happen when i do this printing the first element of the array nor when i do this print another numpy ndarray of integers i am unfortunately not an expert in any way any help or discussion is greatly appreciated you guys thank you i found another equipment in which numpy runs ok and decided to downgrade the dependencies i know of listed above and it still does not work please have in mind that no version of python y runs numpy same error do you know what other package could be causing this issue do you think it would work if i downgrade cygwin itself,0,51,198 filtering data by multiple value sql i like to query filter some data with multiple value using sql query but i got nothing from it here is my code thanks in advance,python how to transpose matrix from x to x how to transpose from x to x matrix from existing output results,0,31,22 find the maximum out of dictionary or tuple i am trying to find the maximum value in tuple and dictionary and right now i am doing it using loop but i really want to change the code from loop to list comprehension just as one liner code here is the dictionary that i have and from which i need to extract max the max should be student,how do you handle graphql query and fragment in python i am trying to query using the requests library but am having trouble i suspect it s to do with the handling of the fragment but i m not sure when i run the code i get response here is my code thanks in advance,0,67,54 problem based on service request from nyc open data here is small portion of my data in dictionary format i want to find the day that has the highest number of complaints the output should be like this produce a table for the number complaint type in each day of the week do this analysis only for the top most frequent complaints can anyone help me with this i am new to pandas and python,dictionary within a function passing values to another function i am having an issue with my code i am relatively new at coding my issue is that i am trying to take the dictionary seatingorder populated in the waitlist guestlist function and then pass those values if there are any to the staff function so that i can display them in a drop down and modify them i can t seem to find a way to do it and any help or even a point in the right direction would be helpful,0,76,89 decorated function return type remains original when called directly defining a decorator that takes callable int and returns callable str seems to not be understood by mypy is there something i can do so that the return type of foo is not its original return type but the return type specified by the decorator edit simplified the example,telegram bot commands visible for admin to use is there anyway that telegram bot can set commands that is available for administrator only because i wanted to implement a function that only admins of the telegram bot can use not for other users,0,58,43 python wrong ip address detection reading this how do you determine if an ip address is private in python i wrote but that s not correct this is a public ip address how to fix this,store factorial of large numbers in python array i want to store factorials of numbers in range to but as the factorials for larger numbers are very big my program is running out of space is there any way i can store them in a array my code with this approach i am only able to store factorial till can anyone suggest any other approach or how to store big factorials,0,35,74 backend youtube dl py line in fetch basic self dislikes self ydl info dislike count keyerror dislike count i have the below code that has been used to download youtube videos i automatically detect if it s a playlist or single video however all the sudden it is giving the above error what can be the problem,json data not appearing in qtablemodel i created a table using qml i wanted to add json data inside the table the problem is that i can only see the last row of json data for e g if i added a new entry then i can only see that entry not the pervious ones main qml table py main py i don t know why it s showing only the most recent results i could understand if it showed me the first result which would most likely indicate that i need to use a loop any help would be appreciated,0,48,95 why f refer to attribute when m refer to method does anybody know why f refers to attribute when m refers to method i mean why don t use a to refer to attribute,operationalerror no such table users profile in django i am trying to create an extend user model but when i start the server i get an operationalerror no such table users profile here is a structure of the project views py forms py models py how to fix it,0,33,331 python files not executing on server i have installed python on root created python app folder inside public html directory running this py file but it is rendered as plain text in browser htaccess any solution,not able to select any of the options from select using selenium and python according to this tutorial i should use this but i get this error i think its not working since the elements show up after the usr clicks the box but i have no idea how to get around that to select the element with selenium ultimately i am trying to target this box i don t know if its because of the old selenium syntax getting deprecated or not any help would be greatly appreciated,0,34,87 how to check if a python script has been copied accessed on windows i was wondering if there is a python module that essentially allows for checking whether your python script has been accessed copied and which user has done it from a shared resource more of a curiosity as most google searches have shown results relating to checking if a file copy is complete and not necessarily if a file has been accessed copied and by who thank you,i am having trouble getting multithreading working in my python project i am having trouble getting the threading to work in my code if i take the threading out the for loop appends the menu txt to menu for my homework i need to change this so that it is working with a thread this is what i have so far but i keep coming up with an exception module object is not callable i feel like i am close but i am missing something this is itemclass py this is guimain py maingui menu this is menu txt the exception being thrown source c users neodr desktop pythonclass lesson lesson project guimain py stacktrace file c users neodr desktop pythonclass lesson lesson project guimain py line in current frame t itemclass item,0,77,116 select first image of image foreign key in django template i want to select first image of an object property set i created a property model with a foreign key to an propertyimages model how do i access the first image of the property object set all in the template i don t want to do it in the view function since this should be in the base html file the code,request files get is empty in a django project for a project i would like to use two files loaded by the user via two inputs to apply an external script my problem is that i get an error because django doesnt seem to be able to locate these inputs so i have an empty object instead of the file here are my codes home html views py urls py architecture and the error specifies that f type is nonetype i want to point out that i tried to put f request files file and it sends me that file is not found raise multivaluedictkeyerror key if anyone has an idea i cant solve this problem i feel that everything is fine besides i performed the same kind of function on another project and that works perfectly so i dont know thanks,0,68,136 rear diagonal sum in the matrix i want a matrix amount that can be in any size for example x or x etc but reverse my problem with for loops along with if not working well would appreciate help for example the result is the function gets an initialized matrix with values and size,tkinter copy to clipboard via bind control c shortcut clipboard is empty when closing program but via tkinter context menu everything is normal in a custom entry i have a context menu with the function copy the selected text which is performed by pyperclip when executing the copy to clipboard function from the context menu everything works fine the selected text is copied to clipboard when i close the program the text remains on the clipboard and i can paste it into any other application but when i run the same copy to clipboard function using the keyboard shortcut control c the text is copied to the clipboard normally but when i close the tkinter application the clipboard is erased how to solve this example,0,61,122 flatten a dataframe that is pivoted i have the following code that is taking a single column and pivoting it into multiple columns there are blanks in my result that i am trying to remove but i am running into issues with the wrong values being applied to rows start current desired,assigning topic probabilities to each document in anchored topic model using python i was interested in to run anchored topic model a k a corex topic model and successfully ran it using my data set but when i assigned topic probabilities to each document i found that those probabilities became almost either or for example see the simplified output i was wondering if this result was natural to get i understand that lda and corex are based on different model where lda is a generative model and corex is a discriminative model which means that sum of probabilities doesn t have to be for each document my question is not about getting the sum of probabilities above but whether these extreme probabilities were normal to get when running corex topic modeling i searched for example codes related papers and other materials but couldn t find any example codes which showed their derived topic probabilities for each document instead i found the code here where the author converted these probabilities to binary so there s no way to infer how the original probabilities were like prior to binary conversion,0,52,187 azure cognitiveservices speech api error while using with aws lambda i am trying to use microsoft speech to text api azure cognitiveservices speech in aws lambda in aws lambda i am using docker image public ecr aws lambda python when i run the the code i am getting the following error i tried to solve issue by following but still getting the same error,problem in extracting text from xpath using selenium in python i am using selenium to extract data from the following page page url www miami dadeclerk com cef citationsearch aspx click on folio click on the first one i have used the following code to extract certain information the result coming is as follows here all the data that is under lblcitationheader is coming under status and total due for that i had extracted their xpaths when i am entering the above in the code the following error is coming i understand xpath is used to locate the element and not text however i am not being able to locate the section in which the text is stored and return it image for reference the data s i want to extract are status total due issuing dept lien placed,0,55,134 zip folder s and take the name of folder i m trying to make this code which take the content of each folder in directory and add it to zip one by one with the name of folder i did made this code but i m blocked with just add file by extension in zip,how to arrange multiple items in the same row after using columnconfigure global columnconfigure coming off of this question everything works great as is however in my own program i intended to use multiple columns and the moment i do so things get dicey i am trying to center multiple items in the same row but it doesn t really work out the code looks like this i am aware that erase throws an error if go is used twice beforehand but this is irrelevant as this code is merely an example case of my actual problem before adding self columnconfigure weight the go button was essentially centered but the erase button was pushed to the far right of the screen after adding it they are equidistant from each other and both sides now that is to be expected for equally sized columns and i already had a solution that worked before by setting columnspan of the largest entry to a high number i could then place other items relative to it with precision in this example the screen filling data has columnspan i can then place things in columns equal to their percentage distance across the screen setting go to column and erase to column achieved exactly what i wanted with them both near center after the data was written but in my actual program the data is written before the screen is loaded so it looks normal but it stopped working after i did columnconfigure now setting it to that places them both at the far right of the screen i need columnconfigure to maintain the dynamic text wrapping as seen in my previous question so i m wondering how to work around this one possible solution is to manually configure all columns but surely there is a better way or at least a way to do that that doesn t require lines of code,0,52,317 how to get an ec instance cost in python i launch an instance stress it s cpu and delete the instance using the aws cdk this takes a couple of minutes and i m looping over instance types for benchmark purposes how can i get that instance s loop cost programmatically aws cli or boto i have the instance id,issue with compiling a class with numba in a seperate file i am having trouble using the jitclass decorator with numba to compile my python code and before anyone tells me to read the docs i have but have no idea where in them to look so if you are going to tell me that please direct me to a specific point in the numba documentation please an example of what i have right now if you try and run it you need to use the o flag to get it out of debug mode this represents the set up i have and reproduces the error that i get this is the error file paths redacted with it appears to be complaining about strings but i don t understand why i saw another post that said i needed to use encode to format strings but this doesn t appear to be my issue i have tried taking out the try except blocks and the initial print statement as well as i thought the issue could be related to the print statements but that does not appear to fix the issue any help is much appreciated,0,57,195 how can call function inside class view in django i have function that return some information about user device and i have one class for show my html and form class how can i use function in class this is my views py this is my urls py,adding line numbers to text widget using tkinter i have text box my text on gui at location i want to add lines numbers to this text box using bryan oakley code here my code code is not displaying line number it is displaying just text how to display linenumbers in text box thanks in advance,0,47,55 why do i get an error when trying to access the first two columns in an html table output,sphinx rtd docs dropdown only works post click i have created an rtd themed documentation for my package using sphinx and sphinx rtd theme the index rst is as follows and the src file is roughly following this idea the html theme options is also as follows in conf py the problem i m expericing right now is that the drop down s are not working correctly they don t show up in the sidebar unless i click on an item that should have a dropdown button near it and after i click on the sidebar link i will go to the next file which is an opened dropdown what i would like to do is that i want to have the dropdown option since the first item this is clunky and unintuitive,0,19,124 how plot multiple dictionaries of dataframes by columns python pandas i would like to plot multiple dictionaries of dataframes in the same figure with subplot i can draw a dictionary of several dataframes on the same figure but i can t add another one the figure must be,click event on network s node using pyvis on jupyter lab i am working on a project in applied data analysis and was trying to add a click event to some precise nodes in the network g i found some poor documentation on this topic and tried to implement this in my code here below is a simplified example trying to make node open a wikipedia page when eft clicking on it through a json file read as options or interaction the url is automatically opened without even having to click on the node and clicking n the node doesn t do anything it seems that jupyter just ignores my interaction and click hierarchy i am stucked and ask for your help thanks a lot,0,49,124 importerror cannot import name albertmodel from transformers bert summarizer i m trying to summarize some text with text summarization with bert by next steps first installation of secondly import summarizer and theni got a importerror like that cannot import name albertmodel from transformers my reference,how to convert nested json in csv with pandas i have a nested json file k rows which looks like this i am trying to create a csv so that it can easily be loaded in a rdbms i am trying to use json normalize in pandas but even before i get there i am getting below error jsondecodeerror extra data line column char,0,45,66 why can t i install the trumania package on my macos vscode i m trying to download trumania by using npx degit realimpactanalytics trumania trumania trumania in my terminal mac but it doesn t work i get this message all the time and it doesn t work in visual studio code this is the error i get in vs so i m not sure what i m doing wrong here can anybody help me out please,valueerror found array with dim estimator expected when using numpy arrays i have two numpy arrays and i am preparing x np stack temp temp axis which looks something like this i have another variable y which is also a numpy array i am trying to run the randomforestregressor model where however it is giving me this error,0,68,59 can you remove measurements g kg ml etc from a pandas dataframe i am doing some pre processing for a data set on one particular column title i have already removed numbers and punctuation but also want to remove measurements as well the measurements are not in a separate column they re in the title column return and the dataset column,how to properly initialize a child class of xgbregressor i want to build a quantile regressor based on xgbregressor the scikit learn wrapper class for xgboost i have the following two versions the second version is simply trimmed from the first one but it no longer works i am wondering why i need to put every parameters of xgbregressor in its child class s initialization what if i just want to take all the default parameter values except for max depth my xgboost is of version no the full version that works as expected no the trimmed version that no longer works here is the traceback,0,59,105 could not import to postman when i import a folder in postman it will be an error like following picture can everybody help me,how to render a ttf glyf to a image with fonttools i want to render a glyf of a tt font into an image numpy array this are the vertices how can i draw the glyf to an numpy array i found glyf draw but i don t found a tutorial or examples how to use it i also do not found any informations about the pen concept edit i found a way to render text with pillow that is a good start but i need more control of the final result there glyf shut be centered and in a size that does use the space in a more efficient way i am also interested in the gridlines f ex baseline and others edit i found some hints in this question how to get the font pixel height using pil s imagefont class there are two lines that mark to points on the y axis but as you can see there are characters going down one line and characters are overlapping in the x direction as you can see on the j and a i still need more control of the final result,0,24,184 typeerror can t round symbolic expression i wrote a function that computes the value of the derivative when passing arguments but when passing a function with abs the results are symbols instead of floats however the result i need to round to decimal places and i can t figure out how to fix it,django template not receiving context object i m trying to implement a simple sign up form and slightly tearing my hair out for some reason the view doesn t seem to be properly passing the context object i pass it regardless of what it is here s my code urls py views py registration signup html forms py i ve confirmed it s i m sure this is some stupid mistake but i ve been tearing my hair out over this any help would be greatly appreciated,0,53,76 how to create a file inside a gcs bucket from a python list i m using apache airflow dag in the dag i m using a python operator inside the operator my i m getting some data inside a python list now i want to save the data inside the list inside a txt file inside a google cloud storage bucket how can i do that i want to create a text file containing the li on a gcs bucket,join list into string by preserving quotes if present example expected output i have tried but it gives is there a hint for a way to do this,0,76,28 how to separate columns with special characters in pandas python my data file contain some characters that can not be defined from keybord to set as separator is there anyways to read this data in proper way my data looks different in txt file but when i pasted here it looks like but i have also attached original data here data to read data i simply tried by this way is there better way to do that,filtering a list of strings the problem has the following parameters write a function called only a that takes in a list of strings and returns a list of strings that contain the letter a this is code i am trying to use i keep getting as a result,0,77,49 python docx modify docx file normal text type to header i have a docx file of the following format i would like to use the docx python docx library to modify the docx file so that every plain text header number is converted to word header format so that i can create a table of contents of all the headers the file contains around headers so it is very big is this possible with the docx library,modulenotfounderror no module named inject i m having trouble with running a test through pycharm here is the full traceback i already have installed inject and when i try to install it again it says when i do the pip list i can see inject being installed in requirements i m using a virtual environment,0,78,54 python pandas how to read csv file by block i m trying to read a csv file block by block csv looks like blocks start with no and data rows follow many thanks for help,matrix multiplication with scalar without numpy i simply want to multiply a matrix with a scalar and have a correct output my code works but it updates the old matrix with the new output i ve used slices as copies but i can t seem to get it to work numpy is not allowed for this i simply want to run this code multiple times on the same matrix and get the same output everytime output should be instead it s,0,34,114 how to make a loop that keeps cheking if theres a certain class hello i m trying to make a loop that keeps searching for a class with buy and if it finds it needs to refresh until it can t find it anymore and then it runs the rest of the code i m using selenium and python help would be much appreciated thanks in advance,is it possible to add this kind of default value to caesar cypher python here is a basic function call i would like to do as you can see below in the signature i would like to have the default value in s be the length of the string passed in for convenience is it possible to do this in python or some version of this,0,64,66 scapy error scapy exception can t attach the bpf filter i found a wifi scanner written in python on youtube direct github script link but i m having an issue with bpf filter as scapy error scapy exception can t attach the bpf filter script output i installed scapy and am running this code by python on m mac any ideas,concat dataframes based on keys in dictionaries i have number of dfs with their keys i concat them based on their keys expected output,0,57,24 how to get a rolling mean with mean from previous window i am desperatly searching for a solution with pandas maybe you could help me i am looking for a rolling mean with consideration of the previous mean df looks like this now using the rolling window mean function i would get something like this i would like to consider the mean from the first calculation like this where thank you in advance,how do i create a qr code in python without saving it as an image i am trying to make qr codes using python on a django applicaiton using this code now this function is called when i click on a generate qr code button my problem is that i would like the qr code to be displayed on a new tab on my browser instead of it being saved as an image as i only need to print them on paper at that moment and i have no need to keep the images thank you for your help,0,71,100 is there a way to re order duplicate index so that they appear cumulatively i have duplicated a dataframe using the below portfolio rtns loc portfolio rtns index repeat though i want to go from this to this how would i go about doing this sort index and sort values did not seem to offer much help for duplicates,package libffi was not found in the pkg config search path docker i would like to install some django packages including django rest auth and django allauth these packages are able to be installed in my local venv but when building and running docker containers they give exit code with the errors package libffi was not found in the pkg config search path,0,50,59 objective function does not converge using gekko i tried running this code but the objective function diverges even when i raise the maximum of iterations raised it to and still didn t find a solution any help is welcome the code the error,python how to reference two string variables and insert a list element in between how can i append the string constructed to a list here is a txt file semi colon signifies start of file here is the code i have now the goal is to write the first line of middlephrase txt to a new txt file named newphrasefile txt then append the following two lines in middlephrase txt to the newphrasefile txt this is the desired output a new txt file being written with content,0,43,85 how to change the size of a plot with a legend my legend gets cut off if i change to it looks like this but i want that the plot stays the same size it just should go longer vertically so that the full legend will be shown what can i do,click event on network s node using pyvis on jupyter lab i am working on a project in applied data analysis and was trying to add a click event to some precise nodes in the network g i found some poor documentation on this topic and tried to implement this in my code here below is a simplified example trying to make node open a wikipedia page when eft clicking on it through a json file read as options or interaction the url is automatically opened without even having to click on the node and clicking n the node doesn t do anything it seems that jupyter just ignores my interaction and click hierarchy i am stucked and ask for your help thanks a lot,0,52,124 localizing rows from a dataframe i working with a dataframe which has columns but i m only going to use three of them in my task which are named price retail and profit and are like this my goal is to find the lines where the prices are lower than and sort by the biggest values of profit how can i make it,python how to generate two new columns in a pandas df based on the order of the values i have the following table as input and i need to generate something like this pos when sorted by x and pos when sorted by y are based on the location in the sorted dataframe by each of these columns,0,63,50 getting noreversematch reverse for for user with keyword arguments username not found pattern s tried p username w i have tried to look at similar questions but can t seem to get a way around this bug noreversematch at groups reverse for for user with keyword arguments username not found pattern s tried posts by p w models py views py,hdf file reading speed slowing down suddenly i am trying to iterate through a hdf file the file consists of a series of timestamps and for each one there is a variable number of players from which i want to obtain data the file is quite big though there are over k timestamps and i observe that the time taken in getting players list data timestamp keys suddenly increases a lot after some hundred iterations from about second to about i have no idea what might be happening and how to work around it,0,53,94 how can i make this loop works i feel dum cuz i was trying to make a simple loop for a matrix to show differents solves and i couldn t fix the index of the array foa i am using the jupyter notebook with sagemath and i receive that,how to add two values from the same columns so i am looking to add values from a dataframe column and write the result in a second column column is given column will be my result what i want to do is column column column column column column,0,49,54 get element range in list and swap i want to swap element list by range in python my code is and my output is but what i want is swapped by list index range,ordinalencoder object has no attribute missing indices i was able to train the model and deployed the endpoint successfully in azure however when i was testing the endpoint it gives me the error below in my model i was using sklearn pipeline with ordinalencoder running on sklearn version a portion of the code is as below been trying to debug but it is difficult if i do not know what does the error mean can someone please advise thank you so much for your help here is the test data which i passed into the test tab of the azure endpoint,0,34,101 i can t close images from list using close from pillow i opened images with image open and stored them in the d list images but now i m trying to close all the images using close function and the code compiles but it doesn t close the files,drop a row in a tensor if the sum of the elements is lower than some threshold how can i drop rows in a tensor if the sum of the elements in each row is lower than the threshold for example since the sum of the last row is smaller than i need to remove it and get the tensor i know how to use tf reduce sum but i do not know how to delete rows from a tensor something like df drop would be nice,0,45,88 i want to make a timer for a variable to reset the value while the loop continues python,snowflake connector for python doesn t work in lambda function update i have gotten past the unable to find snowflake connector issue but now it appears that when i build the lambda function some of the dependencies that the connector relies on cannot be resolved even though i can see them in my virtual environment running pythonpipbuilder resolvedependencies build failed error pythonpipbuilder resolvedependencies cffi wheel cryptography wheel sam build has failed command did not exit successfully exit code has failed command did not exit successfully exit code any ideas why it would not be able to resolve these two when it can resolve the other modules in my virtual environment original question i am working in pycharm and trying to connect to snowflake from lambda i have installed the snowflake connector in the project s virtual environment i have other packages that i can access from the same lambda without an issue when i try to use the this one i get this error indicating that it cannot find the package errormessage unable to import module app no module named snowflake connector snowflake is not a package errortype runtime importmoduleerror stacktrace i tried adding a python file to the root of the project and tried the same code and it was able to connect without a problem so that tells me the the snowflake connector is installed correctly and that lambda just cannot find that one package can anyone help me resolve this issue,0,18,243 persian words are mixed with english this my code my photo result how can i fix that english words merged with persian words but i don t want that to happen,highlighting date range in matplotlib i am trying to highlight a section of the plot using this code the format is should be matplotlib pyplot axvspan xmin xmax ymin ymax kwargs as per the documentation here could you please advise how can i get the values for y min and y max i am trying to make the plot look like this interpreting multiindex datetime,0,30,62 set a maximum to the instantiation operator of a class python i want my code to return a error if the user enters a to high instantiation operator like this but i don t just want to print out an error i want the console to give an error out,doing print enter text end sys stdin readline does not work properly in python something weird happened when i did this output here input excluding quotation marks means that input happened on that line why does the code run as though my code was debian ubuntu python any reason s for this,0,50,48 advent of code day part characters not added to variable in python this is my code and my output doesn t even look like its right i think the and aren t being concatenated to the variables output i don t think i can add the line txt file but you can visit the advent of code website yourself and check out day part s input advent of code day,what is the appropriate input shape for a d cnn based network i am having trouble passing the appropriate input shape to a cnn based network with a conv d layer initially these are my train shapes my train data is reshaped into windows x train number of features window size number of windows y train one labeled column that is also windowed i then calculate some recurrence plots from this data i will then have these shapes x train rp referring to my images y train remains unchanged i pass these two to a conv d based cnn with model add layers conv d kernel size activation relu input shape and i get this error data cardinality is ambiguous x sizes y sizes make sure all arrays contain the same number of samples i tried many combinations of shapes but in vain what am i doing wrong edit this is the model definition using,0,77,161 transform pandas dataframe as per the image below please help me understand what will be the best way to do the transformation of pandas dataframe in the image shown below excellent very good good just okay poor input output,database queries with select xxx from database where relay value from a string i m wondering about if it s possible to get data from a database with this query select name from fraleon where relay value from a string when i try to put in a string in the query it comes with a message that the column doesn t exists i have just started with programming so hope my question isn t to stupid i m trying to make an app where i have a qtablewidget and a qscrollbar where the value from the scrollbar is used to change to the next relay traceback most recent call last,0,51,111 do python files need to be converted into an exe to run on users computers will a python file run on a random user s computer just fine or do i need to convert it into an exe first and then send the exe file to the user thank you,python numpy array of numpy arrays as object i have some np arrays i want to concatenate them as objects in an np array i want to obtain coordsall this is my code coordsall is now but i want two objects in my output array like many thanks,0,49,48 i was creating a discord music bot on repl it and this error keeps showing someone told me to install asyncio and so i did it seemed like some of the problems were gone but it still has an error pls help,how to increment an iterator while iterating skipping some entries i iterate over a list and on some conditions i would like to skip a few elements a typical example are lines in a file that i output then do not output the ones between specific lines and finally output the rest an example of what i would like to achieve the code does not work as expected what i was expecting on the output are to then nothing between and and finally the exception i get is typeerror list object is not an iterator i thought it was is there a straightforward way to skkip iterator entries,0,41,114 converting chars in d list to int values python i m trying to convert this maze to this is there a quick way to do convert the char values to ints i don t know exactly what i need to be searching for also what is the best way to traverse this,using apply function works however using assign the same function does not i am a bit stuck i have a working function that can be utilised using apply however i cannot seem to get it to work with assign i d like this to work with assign so i can chain a number of transformations together could anyone point me in the right direction to resolving the issue this works this does not work typeerror expected string or bytes like object is this because assign does not provide an axis argument so perhaps the function is not looking for the right thing having read the documentation assign states you can generate a new column so i assumed the output would be the same as apply axis,0,50,123 add second elements of a list based on equality condition on python let s say i have a list like this i want to sum the elements that have the same st element and get something like is there an easy way to do that in python,unhashable type dict error in memoize decorator i m writing a memoize decorator but i get a unhashable type dict error when trying it on a simple example here is my code and here is a simple function created to test my decorator i end up with this error i tested just in case if my python was working properly with not in which resulted in the correct output true any help would be appreciated,0,48,77 keras preprocessing number of samples i have been utilizing the keras preprocessing method keras preprocessing image dataset from directory here is my x and y train batches i wanted to know if there was a way to collect an equal sample size for each class below you can see the number of sample images per class in the target directory,i get none for validation form django here is my code for validation and whenever i print password i really dont understand why password is printed properly and password is none i get none can anybody explain to me why this happen,0,55,42 rename none in a list under pandas column let s say i have the following dataframe i would like to replace none value in the column with none but it seems i couldn t figure out it i used this but not working,how to predict with affinity propagation in python i am trying to train and predict with an affinity propagation model for the first time here is my code however when i run this i get the following error am i misunderstanding how affinity propagation works with prediction i want to be able to feed my trained model new data does the number of dimensions i e length of each sub list need to be the same as the trained data,0,41,78 detect when a specific url is copied to the clipboard how can i detect when the text copied to the clipboard has certain text i need to run a script whenever i copy a specific url to the clipboard,error proxy next proxy pool stopiteration i am trying to run a script and it has a standard url for proxies which allows the script to run fine once i add my own proxy url i am getting the error error proxy next proxy pool stopiteration my url is in another file and i can also link that if needed code is below if anyone can help that would be great,0,39,69 how to get without using the return statement class inside function variable value it is my code i can not even use the database i need get without using the return statement class inside function variable values erorr,any way to invoke this windows volume up down window through python any way to actually call this windows volume window through python i know that i can use pycaw to change the volume itself i ve done that already i need help to call this one,0,37,45 how to get list of mean values of sale for stores,image not moving pygame when i try to fire my knife in my game it doesn t work i am not very experienced in pygame this is my first game that i m making it worked the first time but now i try to call a new knife in a function and it doesn t work i have tried a lot but it won t work here s my is my code,0,12,67 progress pie chart subplot with percentage i m trying to make a donut chart with percentage of completion below is my code actually with this code it worked as i want but now i want to make it with subplots and i change my code as below but i still cannot find a way to show percentage of completion like first dash can you give me a suggestion thank alot here is the first dash here is the second dash,letter turns yellow after a diagonal line in python i don t understand the file is saved with that letter and it turns yellow tho it only happens with some and when it turns yellow it ruins the code and the video doesnt pop up,0,79,44 how do skimage morphology remove small holes and skimage morphology remove small objects differ both of these methods are included in the scikit image library for python i m trying to extract certain objects from images and ran into these two methods in a senior dev s code written for the same purpose i have read the documentation for both skimage morphology remove small holes and skimage morphology remove small objects but i can t understand what difference these two methods pose when they are run on a ndarray containing an image,can someone please tell me why my code sometimes still prints out empty spaces as part of the generated password i know this is nowhere near optimal code but i m new to this so i just wanted to make it work the generator works by creating a list of empty strings there are banks of characters that can make up the password the while loop makes it choose what kind of character to place and also which of the type it should place at the end the list is joined together and printed out as a string,0,72,98 how to get python resample function to count unique values i would like my code to count the unique values not all of the values together data sample output of the current code what i want to return my current code,typeerror a bytes like object is required not io bufferedreader while passing file in the request parameter i want to pass xlsx file as one of the request parameters file as below but when i am passing a file like above i am getting this exception or error in python typeerror a bytes like object is required not io bufferedreader can anyone help on this,0,41,62 how to create multiple columns efficiently in pandas dataframe i am trying to add around columns in a dataframe having around k records using certain conditions however its taking a lot of time can someone provide time efficient solution for this sample code is like this,counting number of binary substrings of length with one unique element essentially i m given two lines of input the first line is an integer length of the substring presented in the second line of input consisting of only gs and hs similar to s and s an example input is for which the answer is the answer is the number of the original string s substrings of length or greater that only have one g or one h this g or h is lonely and for the above sample the substrings that meet this criterion are chars chars and chars while i think this is technically correct there are no constraints on n so i am timing out for test cases where n and such i have a time limit of seconds per test case how do i work around this thank you,0,48,148 scipy bvp solver for four differential equation systems i am trying to solve this systems but i get error i have to definition y d because y in the equation systems but when i did this program cant solve if i say y d y then program run equation system that have to solve is like this can scipy handle this unfortunately i get the following error message,question about with radiobutton using tkinter in python basically my question is inside the cake class when i run the code and choose an option in the the second window it doesn t open a third window named receipt which i don t understand why when i choose the third option carrot cake and submit it should print self choice get the enter the if statement of the submit function but it doesn t it automatically goes to the else statementthis is the output i m getting any help would be appreciated,0,67,86 python extract specific values from dictionary i have the following dictionary i want to extract values of k a k a k a in a separate list similary for k b k b k b and so on until the end how do i do it can anyone please suggest a solution,thread stops all code for some reason python i have a small loop that starts threads but for some reason the loop stops after it starts the first loop and not continues to start the other threads for some reason it doesn t go to the print loop finished all threads created,0,43,52 getting extra numbers while handling big numbers in python i tried why i am not getting how do i obtain the real result,module not found after installing whl package locally i installed a whl package locally using pip now when running the package appears with the relative version installed i checked if pip is linked to the right version of python i used and this is the answer when running python on the shell and i try to import the package this is the answer also in python when i run the package name module in fact does not appear so what is happening i have also and python version and to be sure if it is installed in other versions i made the same thing in the shell and no one could import the package or locate it also i tried to install the whl file with then in the output of the package name is there but again could not import into the shell of python or even locate it when running again,0,23,153 superimposing plot over errorbars in matplotlib i am trying to superimpose a plot over my error bars i have searched online and this seems to be the method to do this i am expecting the plot to look the way it does however with thin black lines running between the thick colour lines,how do i stop the code running the remember function every time i use speakremember function i have this code for a remembering system whenever i trigger the speakremember function and it gets the data from the remember it ends up running the remember function i think the error is here toremember remember but i don t see why it would run the other function if anyone knows if this is a bug or just human error please tell me there are no errors,0,53,84 remove urls from search result based on word list and from visited urls text file and write in files i am doing a google search using from googlesearch import search i get urls based on my keyword and i store that in a variable and then i have to filter the urls based on keywords and from a text file that has visited urls from the last google search thank you in adv,only django request body contains data not request post i am using forms in django and trying to get the get the data back using request post but this returns an empty dictionary for me querydict when using request body however i get the raw data back how can i get the data from request post as well because i do not want to work with raw data the console output of the print statements are put in comments next to them forms py views py blank html,0,75,81 unable to access context object in html page rendered in django the below view function send news object to html page but html page gives no result blank page below is the model html page,program print numbers which sum is highest program go through the list and print number which digits have the highest sum i have an idea of getting digits of numbers and saving it to a list and doing the same for the next number but in other list then compare these two lists and print the number with the highest list i tried something but it don t work how i wanted it prints in code are for test purposes,0,34,78 typeerror schedule translation missing required positional argument event i m new to python and therefore i can t figure out what the problem is when i try to call the function def schedule translation event an error appears in the function def ex button typeerror schedule translation missing required positional argument event p s i commented out the def do translation function because google issues a ban for frequent requests,django cms unexpected keyword argument providing args i have installed a vanilla django cms on a new server i installed all requirements it all went fine up untill the point where i wanted to migrate to the database postgres so this is what i did traceback anybody got an idea did i miss something thanks for your time,0,63,57 pip install does not install local module package from setup cfg i have the following pipfile and setup cfg and when i perform pip install e it installs the packages under install requires but not the local package pipfile setup cfg when i run pip list i can only see the following but i cannot see my cli package,insert first row to each group in pandas dataframe i have a large csv file containing the historic prices of stocks this is a small sample of it now on each day there will be an update for this data and i want to append them to the data above the updates look like this what i want is the dataframe below my current approach is using this code by tweaking the above approach i can achieve what i want but since i have million rows in my database i was wondering if there is a faster way other than using sort values update by looking at the feedback from the comments and the answers i concluded that sort values is efficient and alright to use the accepted answer is using it too,0,56,132 how to remove a tuple from a list of tuples on variable condition i have list of tuples that needs to stripped based on condition from separate variable when appenv non production i want to remove entire production tuple while when appenv production only production must remain,setting item to numpy array with numba doesn t execute and it doesn t raise any exception when i search for a solution of why the code below doesn t run i always conclude that it should just work i am essentially trying to speed up the colouring of rgb images using numba i get that the problem is with setting the item into the brushoverlay array because if i simply get the item and print it it works just fine i thought it could be a static type issue but all arrays are float dtype what am i missing thanks,0,48,98 how to save images from url into mongodb using python i have used wikipedia package to get a list of image urls from any wikipedia page now i want to save all the images from the images variable to a mongodb in a collection named images is there any way to do it as there are multiple images can they be saved in a list format,return to pysimplegui main window loop after matplotlib event triggers another window function i have a pysimplegui window that contains a matplotlib bar graph i recently added an event to it that allows the user to click a bar and access a function based on the bar s label this works great until i follow up with a click in a non matplotlib area such as my psg buttons after doing some testing it appears that this issue only happens if i call a new different window function as a result of the on click event function running in my example here if i remove another window i don t have an issue click printing the names of my bars or hitting buttons in psg the problem is that i need to trigger other windows and be able to return to a functioning main window what am i doing incorrectly thanks in advance,0,66,147 hi i m trying to connect two nodes from different classes and for some reason it s giving me this error neo j exceptions cyphersyntaxerror code this is the function that connects nodes from different classes the nodes exist def lives inrelationship name num lives inrelationship chandler the exception neo j exceptions cyphersyntaxerror code neo clienterror statement syntaxerror message invalid input expected allshortestpaths or shortestpath line column offset match chandler person name chandler apartment number merge chandler lives in,download attachments from outlook using win com module i would like to download multiple attachments from outlook i have this code at this moment but have this problem in this pic you see that attachment variable has problem code,0,67,38 how to plot combo line plot using different x value intervals but same range dataset sample for the monthly sales and semesterly sales my data set and nd,pytorch binary classification rnn model not learning i m working on a binary classification task with pytorch and my model is failing to learn i can t figure out if it is a problem with the model or with the data here is my model the model consists in two rnn layers with a batchnorm in between then a dropout and the last layer i use softmax function with two classes instead of sigmoid for evaluation purposes then i create and train the model this is the output when training the model and this is the loss per epoch for the data each of the features in the input data have a dimension of and the targets have dimension either or then i add the sequence length dimension to the input data for the rnn layers distribution of the target classes i can t figure out why my model is not learning the classes are balanced and i haven t notified anything wrong with the data any suggestions,0,28,170 join dataframes matching a column with a range determined by two columns in the other one with pyspark i have a df on the left like this one and another one on the right like this one and i need to join the rows when the id of the first table is between the range of start end of the second table the output should look like this how can i achive this result with pyspark,sarimax rolling window with exogen variables at the moment i am trying to build a sarimax model in python with exogen variables unfortunately i am getting this error cannot perform reduce with flexible type,0,76,34 problem connecting to mongodb atlas using python i have a problem connecting to mongo would appreciate help thanks and error,pretrained model error collections ordereddict object has no attribute eval i m using the pretrained resnet model and i have to use in this project this model with pretrained weights which gives,0,20,31 iterating list to create df i have a variable class list that comes from a post request api in graphql that looks like this how can i iterate thru this list and create a dataframe that looks like this i need to create the df like this because i will merge with another df also i m curious what s the need of this list organization like a list of lists list of dict thanks in advance,replacing a character in a string but it duplicate this is a line of code i create that will replace a with a character from a string output but when applying the same rules for the duplicate character o in word output i know what the error is but i m stuck at creating a solution for this type of problem this is some more output in the same situation output,0,75,71 jupyter notebook error schur decomposition solver error i am getting an error while using sarima model for energy consumption project below is the code and error if anyone have any solutions or suggestions they would be greatly appreciated code error python version statsmodel,getting duplicate links for images in scraping with beautifulsoup i am scraping a prestashop website where i want to get a list urls for all images of a product however i am getting duplicate values all links repeat themselves i have tried creating a dictionary to remove duplicates but it does not seem to work also i can t seem to remove the span tags from the reference number unwrap does not work it keeps returning none attribute which is confusing because all products have a reference number i have tried turning the result into a string but it does not let me here is the code,0,47,107 how to remove double quotes from csv file when i open the generated csv file there are some unwanted double quotes in the column track uri that i cannot remove please can you tell me how to remove them the code of the program is here here is a screenshot from the output file,text preprocessing for nlp but from list of dictionaries i m attempting to do an nlp project with a goodreads data set my data set is a list of dictionaries each dictionary looks like so the list is called reviews there are k of these dictionaries in my dataset first question i am only interested in the elements rating and review text i know i can delete elements from each dictionary but how do i do it for all of the dictionaries second question i am able to do sentence and word tokenization of an individual dictionary in the list by specifying the dictionary in the list then the element review text within the dictionary like so and then applying sent tokenize and word tokenize like so but how do i apply these methods to the entire data set i am stuck here and cannot even attempt to do any of the text preprocessing lower casing removing punctuation lemmatizing etc tia,0,53,156 how to run a python interactive shell in an docker operator what i would like to do is run a docker image in a dockeroperator while inside the container i would like to spin up a python interactive shell for a py file and run a method inside the file is this possible in one operator,pygame screen dosen t close i m a macbook user and i have just recently started learning programming games using python my issue is that every time i try to close the screen it doesn t close when i point the cursor to the screen it turns to a circle cursur so usually i just press force to quit on the snake icone in the dock so how can i fix this and make the screen close just by pressing the close button i m using python thank you,0,56,87 i run command django admin startproject dr it shows zsh command not found django admin i run command django admin startproject dr it show zsh command not found django admin how to solve this problem i also unintall django and reinstall and update pip,pivot a pandas dataframe wherein the values of dataframe become indexes retaining the columns and new df value are the list of original index so given a dataframe of the format how to get the following result without requiring to create a one hot encoding to create a d numpy array and later dot product expected result,0,41,57 after sorting dictionary the output is not the same i have a dictionary which contains some racers as shown below i want to put the key values which are name and surname and time which calculated in seconds sort them in ascending order output is there a way to make the sorted dictmedal look like dictmedal output also is there a way to put a comma between name and city,how to create a list of days of the week of the current month in python i am pretty new to python and i am working on my third project a calendar generator in excel using python so i stuck on creating a function that would return a list of the weekdays monday tuesday wednesday of the current month i thought that maybe i could do this using for loop and slicing however it doesn t work and most likely i will need to use datetime and calendar modules here is what i have now i would be super grateful if you could provide your thoughts on how to do this in the most basic way,0,69,115 how to get without using the return statement class inside function variable value it is my code i can not even use the database i need get without using the return statement class inside function variable values erorr,timestamp binning mechanics when resampling i m not quite clear on how bin membership in dataframe resample is determined example actual output expected output reasoning i expected pandas to create the two bins and the timestamp to fall into the first bin while and the remaining timestamps should fall into the second bin edit i just realized that using hours instead of days yields the expected result why i m using pandas,0,37,74 getting none while reversing list in python the code is quite easy but its returning none i do not know why can someone please correct my code,pandas making a dataframe with a repeating column having the two vectors below i am trying to get the desired output without a for loop desired output any assistance is appreciated,0,27,31 extract all values from div but individually in the above code the div with id maincontent updaddratios contains some values which i want to extract individually such as eps earnings debt etc i am not able to find a way to do so symbol i am using is sbin,stack geotiff images while retaining individual bands i have two images with and bands respectively how do i retain each image s individual bands after merging the code above will result in merge image with bands i want it to be bands that is image bands image bands bands,0,48,57 mfi indicator from talib python library doesn t return any value im using binance websocket stream to get kline data im trying to get data or values from mfi money flow index to automate some trades i tried other indicators such as rsi and it worked,python firebase realtime database set method promise i am new to this trying to get response on successfully adding data to firebase real time database from python successfully added but unable to get promise response unable to find documentation also can someone help below is my code for set the data,0,44,50 add only number from two string of data i want to make a list from the following data such that money from strings with same name and bank is added to get expected output,valueerror time data does not match format y m d h m i m new to coding and cant figure out where i m breaking the valueerror keeps coming up but i cant seem to figure out where i m breaking,0,34,36 pydantic validation issue when using pagination with fastapi here is my code snippet when i specify page pydenticmodel in the response model it generates an issue with paginte because it s not the final response type the pydenticmodel correspond to new items and not items returned from paginate note i don t want to use page any in order to keep a good a swagger docs,how to find parent tabpage of widget in pyqt i found code for finding child widget top widget findchildren widget type but i couldn t able to find command for getting parent widget i created qtabwidget with multiple tabs in each tabs i have some widgets i want to highlight tab page of given widget element i created one code to achieve this and it is working but i feels this is not straight forward can you suggest better solution to achieve the same,0,60,80 calculator division by zero error how do i fix that division by zero error how do i fix that zero zero error how can i implement it into the calculator function in math you can t divide by so in my calculator i want to do the same thing show the user message that it s impossible,tkinter make a frame hide to the right with smooth fading animation i made a simple program where the main window has a frame hideout which will slowly move out of the screen but it doesn t work what is wrong here,0,56,42 i m having a problem with a loop in python so im trying to make a code that takes an number input from the user and with that input it will display a x number of other inputs to fill in data to be writed it down on a txt file but i can t really make it stop showing even with a if x f break im still learning python and got this far with my little project,error locating div aria label with xpath selenium so i m trying to find a way to make sure my bot doesn t get confused and click on the following button again it uses span to detect text when it has already followed that particular user i am trying to detect that if a user is already followed the bot should skip him through another method which is if the bot finds the following text on the user s profile turn on tweet notifications that means the user is already followed because there will be a bell icon button present on his profile the issue is i fail to detect that text button what am i doing wrong here s the code twitter code the error stacktrace,0,78,121 python inspect member variable comments how do i inspect the comments of a python instance variable i ve tried any thoughts,how to debug the identation levels in a python program i ve just started learning python i m using mu editor and i can t get past the first if statement i click run then enter joe and it keeps asking me who are you am i correct in entering this input in the run section or should it go in the repl or text editor section,0,20,64 how made cross validation with python hi i made a neural network and i need to do a cross validation i don t know how made that specifically how train or made that if someone knows made that please write or give me some indications here is my code some recomendation for training or validation would be helpful,replacing characters with some restrictions i have a list of strings in python and i want to create a function that perform many replacements some of them are one solution that comes to my mind is one of the issues is there a solution that respects these two conditions obrero agricola is mapped into obrero agricola o something is mapped into o something it fixes o if it s mixed with other words,0,56,72 how can i define certain value to its key with equal sigma index i want to set the transition of start state s value with the key of sigma in dfa dictionary if the certain indexes of sigma equals with the value of transitions for example i want to set if sigma weach is the value of a in transitions then set the values of zero in a as value for key sigma,word count with timestamp in python this example is extracted from structured streaming programming guide of spark i need to create a table with every word and its input time the output table should be like this how can i do it i think the line marked with line to modify is only the line to modify,0,75,57 page not found the current path register register didnt match any of these on running server browser show i am trying to save the the data into database on submitting the form the browser show page not found error and and some wrong address while i am rendering the homepage on submitting the form views py file urls py file,python how to solve ssl sslerror ssl ca md too weak i ve got a huge problem with authorization of my api request i m using python for setting up the client i have code as follows then i used code below to get the client no error till this step and finally i ve tried to send my request like this r client service searchcompany params search here i got error like this with openssl i ve generated new cert as the output i ve received two files key pem and mycert pem with command certifi where i found location of my file cacert pem and pasted into it the content of file mycert pem unfortunately the error still occurs could anybody explain what i m doing wrong,0,59,111 group data by a given range im looking for an algorithm to get different means for different values example i have the values so the output should be and,how to store multidimensional array in cassandra and hive so i am following this example in this example an embedding matrix is being generated in following secti how can this be pushed to cassandra and hive i have tried following query statement create table schema upcoming calendar embedding matrix list frozen set primary key embedding matrix however that gives me following error invalidrequest error from server code invalid query message invalid non frozen collection type for primary key component embedding matrix similarly i wanna send that to hive as well any help on what data type would be used in cassandra and hive would be great along with more efficient way of sending it to the db currently i am pushing data like this statement insert into schema upcoming calendar embedding matrix values s embedding matrix,0,36,129 python misinterpret keyboardinterrupt exception when using lingoes i want to write a python program run py that always runs and only stops running when ctr c is pressed this is how i implement it wrapper py run py however when i hold left mouse and select text in the terminal that is running wrapper py this event is understood incorrectly as ctr c then the wrapper py stop running run py my question is how to prevent reading mouse events as keyboardinterrupt in python unix thanks terminal,error installing a django project attrributeerror module collections has no attribute iterator i am trying to use this project but i have an error in the process first of all i am cloning the project using this command after that i am changing directory and go to installing the requirements change directory again to go into the manage py for migrations then migrate and here is the error attributeerror module collections has no attribute iterator enter image description here any ideas to solve the error thank you in advance,0,78,89 how to avoid auth page using google drive api with pydrive i m automating uploading files to google drive using pydrive i m trying to avoid the authentication page that shows google every time i authenticate with the api i ve read some blogs about it but i dont get anything clear,interpreting multiindex datetime i have the following code what can i do to interpret the multiindex dates as the x axis in more readable year and month format such as in a format like strftime y m a similar question was asked here renaming months from number to name in pandas but i am unable to see how i can use this to rename the x axis any help would be appreciated,0,49,71 unable to access context object in html page rendered in django the below view function send news object to html page but html page gives no result blank page below is the model html page,how to group rows in pandas without groupby i have the following pandas dataframe and i am trying to group animals according to their class i know i can use groupby to get a faster result however i was thinking if there was a way to replicate the groupby function by iterating over the rows i have been trying to use the following code but it doesn t work and i can t find another method the output should be something similar to this code out,0,34,84 apply pd get dummies on string type columns of pandas dataframe i have the following dataframe all the dtypes columns b c d are of type string if i call df df convert dtypes and then call pd get dummies nothing happens but when i call it on just one column of the dataframe it works why is this happening is it a bug,type error with operations with dates datetime package i have this code i get this error typeerror unsupported operand type s for or pow float and datetime timedelta i m interested in the number of the days not with the hours,0,59,39 filenotfounderror in subprocess check output i want to connect and use the functions of adb in a python environment in the terminal adb is connected well as shown below to use this in the python environment subprocess check output was used i wrote python code as below i got an error as below in my opinion subprocess check output does not seem to be able to import the path environment variable how should i solve it,split input data and have one array output i would like to split an input data to an numpy array but i got a separated elements in array not as one array with all elements as the following,0,70,39 while true statement looping in python hello i am new to programming and i have discovered a problem i am building a calculator and i am trying to use an else statement to keep the loop going incase the user enters something they shouldn t however when i do this the printed statement keeps on looping how can i fix this,python bool compare vs string compare which is faster i need to process a very large csv file during the process the first line needs some special attention so the obvious code would be to check for the value in the csv line but that means a string compare for every line around another option would be to set a boolean and let the boolean compare come first in an or expression both options are below i ve checked that in an or expression the second part is not evaluated when the first part is true the boolean is initialized just above the for loop and set in the if statement when the extra processing is done the question is is the second option with the bool compare significantly faster no need to convert to so different question than,0,60,135 when using rembg in python to remove image background how can i turn on the alpha matting here is shown how to do it using curl here is my code also from the same website blockquote,how to display data of relative foreign key in django html page i saw may answer but i don t know why in my page its not working can anyone help me to find the mistake model views py after importing all school html i wanna display multiple image of school i have inlined in admin how we can get all the images that foreign key to schoolmodel,0,36,64 how can i make a square with a specified circumference and add margin i am trying to make a square path of a specified length i made a function and if i put then i get a x matrix how can i add a margin of s of eg fields thickness like this,how to fix typeerror order must be str not int i am using rd party code to process some files which is written in python the erroring code is this not sure how i should be fixing it but this is running on python,0,56,45 generator object preventing list comprehension i am trying to turn a string into a list of words then into a list of word lengths for example i think i should be able to do this using list comprehension for example but when i do i get typeerror object of type generator has no len i can t figure out where the generator object is and why it s incompatible with list comprehension any tips suggestions appreciated thanks,backpropagating multiple losses in pytorch i am building up a cascade of neural networks and i would like to backpropagate the main loss back to the dnns and also compute an auxillary loss back to each dnn i am trying to figure out what is the best practice when building such a model and how to make sure that my losses are computed properly do i build a single torch nn module and a single optimizer or do i have to create separate modules and optimizers for each network also i am likely to have more than three cascaded dnns approach a approach b this would creating a nn module class and optimizer for each dnn and then forwarding the loss to the next dnn i would prefer to have a solution for approach a since it is less tedious and i don t have to deal with tuning multiple optimizers however i am not sure if this is possible there was a similar question about backpropagating multiple losses however i was not able to understand how combining the losses would work for the distinct components,0,74,182 declare function params outside function to reuse in python i have a function that works like a real champ i want to wrap this function in another function and pass through the args is there a way to declare the function args outside the function to reuse them in another function how i wish it would work i have searched for it but i only did find a lot of information about global used variables,python plotly image how to save image to a iobuffer and read it back python matplotlib image is saved like but for plotly image the same code showing error like any solution for this,0,75,35 pandas number of unique distinct characters in a string how do we calculate the number of unique characters in a string in pandas dataframe i have data in column like this i want to add another column which mentions the length of unique characters in each string expected output so far i have tried however the above code gives me this result please help,i can t create super user postgresql and django i am doing a project with django in which i try to change the database from sqlite to postqresql when i try to create the super user i get this error settings py models py the project works normally when i turn on the django server the problem is when i try to create the superuser from the terminal i am not sure if the problem comes from the connection between the postgresql database with the project or if it is some problem of migration of the models created and loaded in django s default database sqlite it would be excellent some help thank you very much,0,63,113 error using selenium python unable to find class in html source code i m learning how to use selenium i was doing some testing but got this error selenium common exceptions nosuchelementexception message unable to locate element layout layout base my code the source code i m trying to find using find element what am i doing wrong,confusion matrix valueerror classification metrics can t handle a mix of binary and continuous multioutput targets can anyone fix undersampling confusion matrix error from the line undersample cm confusion matrix original ytest undersample fraud predictions i think the problem is from the import or original ytest and undersample fraud predictions the picture of the error here,0,51,45 how to set working directory using python script in abaqus i can t find any python command related to set working directory in python reference guide in abaqus is there any way to set working directory using python script in abaqus,can i call a function in both create and update in modelserializer hi im fairly new at this and trying to implement my code using the dry principle so im calling a function say for create update password in modelserializer s while creating or changing the password for this i have to override create and update in modelserializer and create update password in both of them im not doing any extra functionality in any of them them apart from calling this function so is there any way that i can invoke this function in create and update without overrding it ill really appericiate it if anyone can give any suggestion below is the code example thanks you,0,40,112 change the values in a column using pandas i have this csv i want to reset all the values in the table count to to change the values is there a way to do it without mentioning to replace and setting the value directly,using super with multiple inheritance the code is quite self explanatory i want to call both class a and class b init methods code output i want to use super instead of explicitly stating i am unable to find any resource for the same need help the following does not work,0,44,50 how to separate columns with special characters in pandas python my data file contain some characters that can not be defined from keybord to set as separator is there anyways to read this data in proper way my data looks different in txt file but when i pasted here it looks like but i have also attached original data here data to read data i simply tried by this way is there better way to do that,outerjoin which returns all joined rows in right table if at least one matches a condition i have two mysql tables itemvariants do not necessarily need to exist for every item i intentionally and explicitly do not want to add foreign key constraints i d like to select item list of item variants with item variant item id item id with either item updated at some date or any one of item variant update at some date a query like doesn t work because if i have item with var var and only var updated at matches the condition var won t be included in the query results i ve also tried doing a second aliased outerjoin for the filtering using the non aliased table for the selects but this returns too many results is there a standard solution for getting all variants if at least one matches the condition,0,77,134 how to create multiple columns efficiently in pandas dataframe i am trying to add around columns in a dataframe having around k records using certain conditions however its taking a lot of time can someone provide time efficient solution for this sample code is like this,prefetch query with relational conditions django i m trying to make a request that prefetch all the data to reduce the amount of requests to my database i m using the prefetch related method and the prefetch object class to tell what to load in the same request code models i have multiple base pairs in my database that have a relation on to an exchange see above my issue i would like to add a filter to the prefetch related objects that uses a value contained in the connection i e exchange id of the prefetch like this as connections is a set multiple values i want that the following connections wallets currency base pair retrieve the base pairs related to the connection currently fetched i read the documentation and couldn t find any solution using prefetch highly decreases the request time s instead of min another way here django is reusing cache from the previous connections queries of the loop so it is very fast however the cached base pairs are mixed in the results because django forgets about the filter queryset i pass to the prefetch instance it clearly seems to be a bug with django so i m looking for another way to achieve this,0,48,195 python progress bar for non iterable process i m using this notebook where section apply documentclassifier is altered as below jupyter labs kernel conda mxnet latest p tqdm is a progress bar wrapper it seems to work both on for loops and in cli however i would like to use it on line this is an iterative process but under the bonnet how can i apply tqdm to this line code cell,discord py have one check have two different error outputs so i have gone through and added different functions to my discord bot i am working on making it to where a function if used incorrectly can have two different error outputs depending on the users permissions for example when i use the command clear as a server admin i have it to where i will get the error please specify an amount of messages to delete because the command should be used like clear amount but when someone that is not an admin runs this command i would like for a different error to populate for example a normal user tries to use clear i would want the error output to say error you do not have permissions for this command but i am not able to figure out how to apply two different error outputs to one function command whenever i go onto the normal account and do command clear it populates please specify an amount of messages to delete when i would only want that error output for admins i only want for the output error you do not have permissions for this command to show when a normal user tries to use an administrative bot command,0,67,210 how to construct a nested dictionary while taking user input problem i want to construct a nested dictionar with user entering key and values in python below is an example of the dictionary here series name char name and wishlist is entered by the user also user can add multiple char name for particular series example,finding lowest common multiple using numpy for more than two inputs so i would like to find the lowest common multiple of or more numbers in python now i understand that in numpy you can just use np lcm but the function is only restricted to two inputs the question is how do i find the lcm of or more integers using the same lcm function in numpy,0,53,69 how can i fix a traceback most recent call last error in a pulp constraint i am trying add constraints to this linear optimization problem using a for loop the constraints are x a x b x c x d x a x b x c x d etc the traceback error occurs on the first run of the loop and i am struggling to figure out why any help would be greatly appreciated,how to count the number divisible by n in given range a to b for multiple cases c in python so basically there are multiple cases that need to be solve by counting the number that divisible by n in given range a to b for example there are cases case has a b n case has a b n but on one condition that the input must be like this the output will be like i have this function for reference my explanation is bad but i just don t know how to make it more clearer i hope someone will understand and enlightened me about this problem thank you,0,76,113 removing any characters after a comma in a column python i have a column in a df like so i want to know how to remove the comma and following characters from elements in the column that have it so new one like this i know i can rename each element individually but i d like a way to do this at once for the whole column thanks,apache kafka setup consumer error json decoder error extra data line column char the consumer bin kafka console consumer sh bootstrap server kafka topic my topic works and i can see the logs as t z ts uid ciaup fxwzqyssoh id orig h fe f eff fef a id orig p id resp h ff fb id resp p proto udp service dns duration orig bytes resp bytes conn state s missed bytes history d orig pkts orig ip bytes resp pkts resp ip bytes however with the consumer code listed below i am getting json decoder error extra data line column char which seems to be an easy error related to parsing the data which has each log starting with the date time as shown above meaning the consumer gets the first log but cannot parse it easy enough yet it seems i cannot get around it as this is part of the kafkaconsumer object if anyone can give a hint or show how to do it it would be great thanks and regards m,0,67,126 error c program files x microsoft visual studio buildtools vc tools msvc bin hostx x cl exe failed with exit i was trying to install mujoco and run a simple script which is however i encountered the following error c program files x microsoft visual studio buildtools vc tools msvc bin hostx x cl exe failed with exit code python version gym version i had downloaded the microsoft visual studio build tools and restarted the system but doesn t seem to help any help is appreciated,variational autoencoder typeerror i am trying to implement a vae for mnist using convolutional layers using tensorflow and python the code i have is the loss function is defined as follows which gives the error typeerror traceback most recent call last appdata local temp ipykernel py in train autoencoder training hist model fit x x train y x train batch size batch size shuffle true validation data x test x test anaconda envs tf cpu lib site packages tensorflow python keras engine training py in fit self x y batch size epochs verbose callbacks validation split validation data shuffle class weight sample weight initial epoch steps per epoch validation steps validation batch size validation freq max queue size workers use multiprocessing r callbacks on train batch begin step tmp logs self train function iterator if data handler should sync context async wait anaconda envs tf cpu lib site packages tensorflow python eager def function py in call self args kwds with optionalxlacontext self jit compile result self call args kwds new tracing count self experimental get tracing count anaconda envs tf cpu lib site packages tensorflow python eager def function py in call self args kwds this is the first call of call so we have to initialize initializers self initialize args kwds add initializers to initializers finally at this point we know that the initialization is complete or less anaconda envs tf cpu lib site packages tensorflow python eager def function py in initialize self args kwds add initializers to self graph deleter functiondeleter self lifted initializer graph self concrete stateful fn self stateful fn get concrete function internal garbage collected anaconda envs tf cpu lib site packages tensorflow python eager function py in get concrete function internal garbage collected self args kwargs args kwargs none none with self lock graph function self maybe define function args kwargs return graph function anaconda envs tf cpu lib site packages tensorflow python eager function py in maybe define function self args kwargs self function cache missed add call context key graph function self create graph function args kwargs self function cache primary cache key graph function anaconda envs tf cpu lib site packages tensorflow python eager function py in create graph function self args kwargs override flat arg shapes arg names base arg names missing arg names graph function concretefunction func graph module func graph from py func self name self python function anaconda envs tf cpu lib site packages tensorflow python framework func graph py in func graph from py func name python func args kwargs signature func graph autograph autograph options add control dependencies arg names op return value collections capture by value override flat arg shapes acd record initial resource uses original func tf decorator unwrap python func func outputs python func func args func kwargs invariant func outputs contains only tensors compositetensors anaconda envs tf cpu lib site packages tensorflow python eager def function py in wrapped fn args kwds the function a weak reference to itself to avoid a reference cycle with optionalxlacontext compile with xla out weak wrapped fn wrapped args kwds return out anaconda envs tf cpu lib site packages tensorflow python framework func graph py in wrapper args kwargs except exception as e pylint disable broad except if hasattr e ag error metadata raise e ag error metadata to exception e else raise typeerror in user code train function return step function self iterator c users arjun anaconda envs tf cpu lib site packages tensorflow python keras engine training py step function outputs model distribute strategy run run step args data c users arjun anaconda envs tf cpu lib site packages tensorflow python distribute distribute lib py run return self extended call for each replica fn args args kwargs kwargs c users arjun anaconda envs tf cpu lib site packages tensorflow python distribute distribute lib py call for each replica return self call for each replica fn args kwargs c users arjun anaconda envs tf cpu lib site packages tensorflow python distribute distribute lib py call for each replica return fn args kwargs c users arjun anaconda envs tf cpu lib site packages tensorflow python keras engine training py run step outputs model train step data c users arjun anaconda envs tf cpu lib site packages tensorflow python keras engine training py train step loss self compiled loss c users arjun anaconda envs tf cpu lib site packages tensorflow python keras engine compile utils py call self loss metric update state c users arjun anaconda envs tf cpu lib site packages tensorflow python keras utils metrics utils py decorated update op update state fn args kwargs c users arjun anaconda envs tf cpu lib site packages tensorflow python keras metrics py update state fn return ag update state args kwargs c users arjun anaconda envs tf cpu lib site packages tensorflow python keras metrics py update state sample weight weights broadcast ops broadcast weights c users arjun anaconda envs tf cpu lib site packages tensorflow python ops weights broadcast ops py broadcast weights values ops convert to tensor values name values c users arjun anaconda envs tf cpu lib site packages tensorflow python profiler trace py wrapped return func args kwargs c users arjun anaconda envs tf cpu lib site packages tensorflow python framework ops py convert to tensor ret conversion func value dtype dtype name name as ref as ref c users arjun anaconda envs tf cpu lib site packages tensorflow python framework constant op py constant tensor conversion function return constant v dtype dtype name name c users arjun anaconda envs tf cpu lib site packages tensorflow python framework constant op py constant return constant impl value dtype shape name verify shape false c users arjun anaconda envs tf cpu lib site packages tensorflow python framework constant op py constant impl tensor util make tensor proto c users arjun anaconda envs tf cpu lib site packages tensorflow python framework tensor util py make tensor proto values np asarray values c users arjun anaconda envs tf cpu lib site packages tensorflow python keras engine keras tensor py array raise typeerror value to a numpy call which is not supported or you may be trying to pass keras symbolic inputs outputs to a tf api that does not register dispatching preventing keras from automatically converting the api call to a lambda layer in the f unctional model,0,68,503 python get x x data from json my json data looks like this for example data name stackoverflow i want to get the highlighted data but i don t know how to do it if i use print json singledata it works but if i use print json multiple datas then it does not works how can i get the multiple data,not able to access a customfield in jira rest api i need to get the timestamp of the duration an issue was made the transition into waiting for input state i tried to get this using custom fields using this url jira base url rest api field i found out there is a custom field for it which is as follows but when i try to access this customfield i get an error like attributeerror propertyholder object has no attribute customfield the code which i am trying is need help to access this customfield i am using jira rest api and using python,0,59,95 issue in installing python using pyenv in macos m arm tried to install python using the below command error i tried several combinations as mentioned in this issue thread but it is always resulting in the above error zshrc file,modulenotfounderror no module named tensorflow python keras applications i am trying to import but it gives the bellow error my tensorflow version is and keras version is,0,47,26 how to remove decimal numbers in pxbax pyplot how can you remove the decimals of a px bar plot with the library pyplot with the following dataframe i execute the next cell to crear a bar grapich with pyplot with the parameter text importe i am able to set the value on each bar but it has many decimal like how can i round those values the column of the dataframe is already round image description,prefetch query with relational conditions django i m trying to make a request that prefetch all the data to reduce the amount of requests to my database i m using the prefetch related method and the prefetch object class to tell what to load in the same request code models i have multiple base pairs in my database that have a relation on to an exchange see above my issue i would like to add a filter to the prefetch related objects that uses a value contained in the connection i e exchange id of the prefetch like this as connections is a set multiple values i want that the following connections wallets currency base pair retrieve the base pairs related to the connection currently fetched i read the documentation and couldn t find any solution using prefetch highly decreases the request time s instead of min another way here django is reusing cache from the previous connections queries of the loop so it is very fast however the cached base pairs are mixed in the results because django forgets about the filter queryset i pass to the prefetch instance it clearly seems to be a bug with django so i m looking for another way to achieve this,0,75,195 saving images in a loop faster than multithreading multiprocessing here s a timed example of multiple image arrays of different sizes being saved in a loop as well as concurrently using threads processes and i get these durations on my i mbp aren t threads processes expected to require less time to achieve the same thing and why not in this case,appending a sibling element after a child element in xml using element tree i have created a element using elementtree i want to append this element after a username i found username i wanted but not able to add element after that username my code there is no command sibling in elementtree how to add element after username that i found thanks in advance i want solution in element tree only not in lxml,0,63,74 append items in front to every list inside list of lists not to the back i have the following list of lists i would like to append item name to the front of the list such that it looks like this here is the python code i wrote to do this the code appends the items to the back of the list what i want is append to the front of the list i am using python,how to make spacy ignore new line characters when finding noun chunks i don t know why this happens a new line character i feel like should be ignored but outputs of doc noun chunks sometimes change when newline n characters are replaced with whitespace how do i make it so that spacy treats them the same or as if there is no newline characters it is too much hassle to just remove them needs some backlog work to trace them back to their original lines e g,0,77,83 python sqlite cannot make table name from variable value the id is value of how can i success this i want to make a table named by variable error,transform a list into a dataframe hi i am trying to have a pandas dataframe with data processed into a loop but i end up with a series here is my code and here is the results i was expecting a dataframe of columns with float values does anyone understand what i am doing wrong,0,30,55 how to implement kmeans clustering as a feature for classification techniques in svm ive already created a clustering and saved the model but im confused what should i do with this model and how to use it as a feature for classification this clustering is based on the coordinate of a crime place after the data has been clustered i want to use the clustered model as features in svm,is it possible to pass array containing userids to add to telegram group in single request i don t want to make many request so was wondering if it s possible to create an array of users i intend to push to my telegram group and make a single request,0,70,48 how to store spark streaming dataframe to mysql table am trying to read data from azure event hub and store this dataframe to mysql table in spark streaming mode below is the my pyspark code but am unable to store this spark dataframe into mysql table am getting an error like data source jdbc dose not support spark streaming py j protocol py jjavaerror an error occurred while calling o start java lang unsupportedoperationexception data source jdbc does not support streamed writing,how do i analyze this code for time and space complexity ideas for removing those,0,76,15 why does my reverse linked list function mutate the global variable linkedlist the following is my code when printed out linked list is displayed as none however after calling the function reverse list once and then printing linked list again it seems to be mutated and became none could anyone explain the reasoning behind this example shown below,duplicate analysis using conditions i am trying to do some analysis of the duplicates prior to drop all of them and keep the first or the last result i want to check the quality of the duplicates in order to keep one or remove both value i want to put some conditions if pic of the duplicates have a difference lower than in the pic column i want to keep one and the the value as a mean if it is higher than that drop both rows i am getting the following error i would need to iterate to do this analysis in the whole df thanks for the help,0,63,111 how to plot the cluster centers by using this k means clustering from scratch how can i plot the initial random cluster centers for k on the scatter plot in the photo photo for iris dataset,how did print a a pop change this code python prints does the pop before unpacking python prints does the pop after unpacking what caused the change i didn t find it in the changelog edit not just in function calls but also for example in a list display prints vs and expression lists says the expressions are evaluated from left to right that s the link to python documentation so i d expect the unpacking expression to happen first,0,35,92 installing http module in python not able to install http module in python warning discarding from command errored out with exit status python setup py egg info check the logs for full command output,make infinite loop pyrogram i need this part of script work infinitely send messages but it works only one time and then stops,0,37,22 how can we create object in desire database in rest framework i m creating project but that project is saving in the default database i want to create that project in other database i m using creatapiview i don t get it how can i use that using otherdataname in get serializer,looping through a filtered dataframe to see if a value is in a list column apologies for the vague title i m not entirely sure how to word it more correctly i have a dataframe like this which is created with this and the logic behind it is that each line is a customer record they can only ever save one product at a time which is why savedproduct has one product code but they can purchase multiple products which is why purchasedproduct contains a list what i want to do is so e g the product in line appears in line so preferably there d be a way to have both the first line s date and third line s date in the same row so we can calculate difference between the dates i thought a nested loop would do the job but i can t get it to work and there must be a more efficient way but the output is like this is there any way to do this better and also why is customerid producing nans when i have the output the print in the loop it works fine thanks for any help edit may have just figured it out using lists instead but if someone has a more efficient way would still be appreciated which has the following output,0,47,223 no module named pyfiglet fonts failed to execute script due to unhandled exception i have recently compiled a py file to an application and the py works fine but the application gives me this error no module named pyfiglet fonts failed to execute script due to unhandled exception then closes immediately the modules im using,why is my webscraper not detecting any changes i wanted to code a websraper with beautifulsoup and requests it scrapes the data of specifc columns of a specific table on a specifc table it scrapes it once waits a certain amount of time scrapes it again and then compares both scrapes if there is a difference it prints something has changed and if there isn t it prints no changes here is the entire code problem is it always says no changes even though i know that something had changed how can fix this,0,55,93 replacing characters with some restrictions i have a list of strings in python and i want to create a function that perform many replacements some of them are one solution that comes to my mind is one of the issues is there a solution that respects these two conditions obrero agricola is mapped into obrero agricola o something is mapped into o something it fixes o if it s mixed with other words,my naive bayes classifier works for my model but will not accept user input on my application i am trying to deploy my machine learning naive bayes sentiment analysis model onto a web application the idea is that the user should type some text which the application performs sentiment analysis on and then stores the text with the assigned sentiment in another column within the database to be called as a list via html later while the model and vectorizer work fine on google colab when i load the model to my application and try to run the user input through it it won t work i have gotten many error codes depending on the different solutions i ve tried the most recent is but when i try to fix this i get other error messages such as or or basically i don t know what i m doing and i ve been trying to figure it out for weeks my inclination is that the problem is either the format coming in from the user is not readable by the model or the vectorizer is not working on the input or maybe my whole approach is wrong and there are steps i am missing any help with this would be massively appreciated my model code looks like this after preprocessing and my application code looks like this,0,72,222 how can i integrate a line chart viewer in pygame i have an ai for a game in pygame and i want to create a chart to follow the evolution i need only the gen on x axis and points on the y axis i have tried this but i don t know how to make it fit on the surface in the game and not pop out as an individual window which will eventually stop the game any ideas,field clashes in django orm i have some problems with django orm i have three classes transaction py payments py and when i trying to do migration i have this error as i understand the problem related to inheritance and its specific in orm but i m not sure,0,76,46 python program times out when hitting this website why does this function fail to read xml from i can visit the url from my browser just fine it also reads xml from other websites without a problem the program times out every time ideas edit i replaced with the request header from the script with my browser header still no go,scope of object in custom python package i m trying to make a d graphics package i ve made many attempts of finding the best structure for this but i can t get it to work nicely this is the current not working setup i have the files init py scene py and polygon py scene py should init one single object this object has an array where polygons are suppose to be stored in a simple verison of this file looks like this polygon py defines some objects to be drawn circles cubes etc init py just imports the modules and some helper packages however if i try to use this package the scene file isn t scoped correctly i ve been stuck with multiple different architectures i can get this to work if i keep it in one file which doesn t seem ideal ideas to fix this or try a different architecture i would love your input,0,61,146 beautiful soup test if a div is children of a div is it possible to test with beautiful soup whether a div is a not necessarily immediate child of a div eg now i want to test whether the div with class aaaa and the div with class abaa are not necessarily immediate children of the div with class aa how can this be done of course the actual html is more complicated with more nested divs,python check if any of lists is not empty and if not do something with corresponding folder that is linked to that list so here i am trying to optimize some code i have code checks if any of lists is empty and if it is not corresponding folder that is linked to that list will be saved in external program so to make it more clear this is code so basically we will in this way keep in keep list only names that are linked to lists that are not empty what do you suggest any algorithm that can optimize this since now when i have only four lists it is easy to manually check it this way but better solution is needed please advice thanks salute,0,77,129 how to get a better view extract the values from acf plot i wrote the following code to get an autocorrelation plot of a time series that i have and the output is the following chart is there any way to zoom in on the initial values of the autocorrelation plot or at least get the values i need these to be a bit more clear to set the hyperparameters for my sarima analysis,virtual assistant only takes voice input one time i am coding a virtual assistant everything is fine it listens to my audio input and responses correctly but when i run the programme it only takes my command one time and the programme ends i can t figure out where should i use the while loop so that the programme continues until i ask it to end i tries addding while loops in different function but none seem to work,0,72,78 pytesseract manga text detector i want to detect text from manga i tried with pytesseract but it does not detect all the texts do you know any solution to increase the quality of detection of pytesseract on these types of images exemple not detect text sens is not detected currently i m just doing a detection without a specific setting,python create new column that counts the days between current date and a lag date i want to create a function that counts the days as an integer between a date and the date shifted back a number of periods e g df new col df date shift periods df date the date variable is datetime d as an example df report date shift and df report date and df delta the code below is my latest attempt to create this variable but the code produces incorrect results,0,61,80 triangle mesh generation of d objects using python hey everyone i m pretty new to graphics programming and i want some guidance or working samples i want to make any d objects but for starters i want to make a d cube using triangle mesh with given coordinates via python and export all the mesh in an obj file so i can load the mesh and view it in meshlab i would really love some guidance on this thanks,passing pandas dataframe to fastapi i wish to create an api using which i can take pandas dataframe as an input and store that in my db i am able to do so with the csv file however the problem with that is that my datatype information is lost column datatypes like int array float and so on which is important for what i am trying to do i have already read this passing a pandas dataframe to fastapi for nlp ml i cannot create a class like this the reason being i don t have any fixed schema the dataframe could be of any shape with varying data types i have created a dynamic query to create a table as per coming data frame and insert into that dataframe as well however being new to fastapi i am not able to figure out if there is an efficient way of sending this changing dynamic dataframe requirement of mine and store it via the queries that i have created if the information is not sufficient i can try to provide more examples is there a way i can send pandas dataframe from my jupyter notebook itself any guidance on this would be greatly appreciated this is the dictionary that i am passing,0,78,211 csv file data replacement i have many csv files which looks like i need an short function with that i can overwrite the cell in the data section from data to something like test data i need to replace a big amount of cells in csv files with that method maybe i can read the line line in the file and save it as new one so i knew it s definitely done,python how do i solve this i need a counter for each time my function is repeated i m new to python i m building code for my project and i need that every time my iniciobot function is repeated it s counted and shown on my tkinter screen i tried to do it using a global variable contagem but nothing happens how do i solve this if anyone can help me i appreciate it here is the call,0,71,76 custom range in numpy histogram trying to output histogram data using numpy i get the following output using above code the edges are automatically calculated is there any option to force the edges to be created like the example output like below maybe using range option like,how to convert bson to json on python im catching program packets and i got this bson gwaaaajjraadaaaau qaelqasex lo qgaeg jaaeaaaaa also i found a site to convert it to json but its on java script how to make similar using python site code,0,47,42 rabbitmq and celery subscribe to job done event i have a simple celery task py running with rabbitmq message broker and redis data storage and a listener py service with a trivial function i want to invoke add with a fire and forget style and let another service implementing on add handle results this is the diagram of the workflow how can i create a listener that subscribes to task completion events on celery s backend redis,dividing dataframes with different dimensions i prefer to use matrix multiplication for coding because it s so much more efficient than iterating but curious on how to do this if the dimensions are different i have two different dataframes a and b and i m trying to divide a through columns of b so the b dataframe becomes note i ve rounded random percentages but bottom line want to divide the monthly defaults by the total origination figure to get to a monthly default,0,71,82 am having a matrix multiplication issue with cvxpy updated code when i hit this line i get this error the original source code is from here,how to create multiple data frames in for loop i have a list of names i changed them to letters that correspond with values in a data frame column i am trying to create a separate data frame for each name containing that name s associated qty grouped by part number as you can see from the code each time it loops it writes the new loop data over the previous loop s data in df how to i iterate a new data frame name each time it loops so that i end of with separate data frames,0,28,97 dataframe slice after every nth column in python my dataframe has rows and columns and i need to slice the dataframe such that all slices chunks are of a size each so i want a since after every nd column finally i want to append all these slices one below another so i get a final dataframe of size any help will be appreciated,how can i strip the following values with numerous amounts of spaces in between each value in this txt file i am trying to strip relevant information from this txt file there are numerous amounts of txt files to strip from so creating a function or class or an ideal automated approach is needed to automate this task this is the txt file i am working with my goal is to strip the net cash cash sales less commissions net credit total net remittance primarily how should i approach this i have noticed that each value is separated after digit digit followed by amount of spaces this is the code i am using so far to create this txt file here is the expected output n n n n n n anything helps,0,74,134 a type guard function that st argument s attribute type is determined by the nd string key argument e g key dict then typeguard dict i tried to parse a json data into a python pydantic class object the problem is that the data is like i m thinking to make a type guard function check type and use it like below it will allow my ide to have better maintainability is it doable,django filter column with or statement i found a question very similar to this one but that one did not specify how to return a specific column and i have been trying combinations for the past few hours with no luck this does not throw me any errors but it does not return anything i am attempting to return that specific column from my models filtering on away team or home team equal to chicago here is the model i am attempting to pull from,0,69,85 composing arbitrary functions in python i am following category theory for programmers and trying to implement a compose function in python what i have currently is but this will not work because i don t know whether g args in compose will return an object which is an iterator or just a single return value is there a way to write compose in python without using isinstance,how to solve the error str object has no attribute whenever i m running this code i am getting the following error traceback most recent call last file c users ritvi ideaprojects object orienteted programing songs docstring py line in artist load data file c users ritvi ideaprojects object orienteted programing songs docstring py line in load data new artist add song album field year field song field attributeerror str object has no attribute add song,0,65,50 how can i integrate a line chart viewer in pygame i have an ai for a game in pygame and i want to create a chart to follow the evolution i need only the gen on x axis and points on the y axis i have tried this but i don t know how to make it fit on the surface in the game and not pop out as an individual window which will eventually stop the game any ideas,xarray assigning individual values to one variable dataarray ends up assigning to all variables dataarray i have a script where i create a big xarray dataset full of np nan and then assign individual values in a loop with loc i also tried with positional indexing doc i get something quite weird here is my minimal reproducible example i get my scalar assigned to all dataarrays although this simpler code works correctly,0,76,72 inserting list to tables column postgre i am trying to normalize some data that i retrieve from an api but it doesn t seem to work any pointers ok after some corrections it returns how do i overcome this my approach might be wrong altogether because the table i am retrieving the data has about m rows but how could i make this one work,shopping list program i am coding a program that simulates someone making a purchase in a grocery store i am displaying all the products and the price and i am prompting the user to input all the products they went to buy separated by commas i want the program to check if the input is in the dictionary of product and add it to the cart with the use of a loop before adding it to cart the program needs to check if the input is valid meaning if the item is in the list of products to buy when the user selects an item to buy i want the program to ask the user for the quantity of that item so how many of the item they want to buy at the samthen the program will calculate the total of all the products then calculate the tax value of the total and then return a subtotal that includes tax here is what i have so far i ve gotten most of it but the small changes that i mentioned above i can t figure out what to do i forgot to mention that asking for the quantity of the item and checking if the user input has to be done with a loop any input is very much appreciated please show the change of code thank you in advance,0,65,229 retrieve json from csv using python in desired format many thanks in advance i have been keen on collecting some insights on getting the below output from its corresponding input would like to see the table getting converted to a desirable format via using a python script as i have to work with a huge csv at a later stage any inputs are highly appreciated input csv used python code current output desired output json,how to take a screenshot in selenium and paste as a html page i am aware we can take screenshots using selenium but is it possible to save the screenshot as a html page can anyone please help,0,75,38 how to avoid dry when inserting dataframe within a class i have a following code example above works but you can see that i repeat block of code twice how can i create engine in the method vlozit df using self connection from init please thanks,why does it give an error when deserializing the plot the problem is as follows a matplotlib plot is created by mssql sp execute external script the code is at the end of the post after that the plot is serialized as the byte sequence and sent to python script then at the stage of graph back conversion the error occures runfile c users gamer desktop test g plot py wdir c users gamer desktop traceback most recent call last file c users gamer desktop test g plot py line in fig pickle loads tables i file c programdata anaconda lib site packages matplotlib cbook init py line in setstate for s d in self callbacks items attributeerror callbackregistry object has no attribute callbacks sql procedure code python code this way of realisation is used according to the article click as a result the plot should be saved like that enter image description here,0,44,125 docstrings python function when parameters are package objects like pandas dataframe i want to know how documentation a python function when one of parameters is a object of package for example a pandas dataframe i use this method but pycharm python ide doesn t understand it in pycharm it show this is it a standard way to solve this issue thank you,i installed brownie and after installation when i tried to see the version of it i ran into this error i am using macos if that matters importerror dlopen users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so symbol not found pygen send referenced from users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so expected in flat namespace in users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so i tried pip uninstall recordclass and re install it but couldn t fix the problem,0,60,57 sqlite math functions python after updating sqlite version it is possible to use the sql math functions if i use it in pycharm query it works well but i can t execute the query in python code then i got the following error message pandas io sql databaseerror execution failed on sql select log increase s from increase no such function log i execute it with the following code what is my mistake i don t see it,how to get validation set which has equal number of images for each class using tensorflow i m now using cifar dataset to train a model i d like to use of train data as validation data i used the codes below in the beginning it works good in some models but in some other models the validation accuracy can be way higher than the test accuracy i think the reason may be using train test split could not guarantee that validation set has same number of images each class so i tried to get validation set manually my codes are shown below but when i use this training set and validation set to train my models the accuracy is rather low so there must be some problems of this splitting method but i don t know what s the problem i d be appreciate if someone could help me with this problem,0,72,147 does anybody know why this error occurs in the folloving code valueerror invalid literal for int with base n int input enter any number i wrote the following code but every time i submit it to hackerank com a mistake is popping out what should i do to solve this issue valueerror invalid literal for int with base n int input enter any number,how to build a customizable and changeable python module inside an executable i ve built a project with python in which a module of functions can be changed by the user more specifically functions can be added or deleted inside this module by other processes in the application now i have just converted the whole project into an executable file using auto py to exe to run it through a console window instead of running it through vs code for instance i can t change the module if it was not added as an additional file in auto py to exe rather can the application use this module if i do add it as an additional file my question is how can i turn this project into an executable with the possibility of changing this module by the program itself,0,62,132 how can we create object in desire database in rest framework i m creating project but that project is saving in the default database i want to create that project in other database i m using creatapiview i don t get it how can i use that using otherdataname in get serializer,expected str bytes or os pathlike object not nonetype tkinter error i am trying to read the file with tkinter button basically when button press the function will read the files if the files doesn t exists it will show an error if its exits than it will continue but it throws me an error here are the codes the button error box,0,47,61 extract tar gz some integer in python i am trying to extract a file name with this format filename tar gz i have tried mutpile wayd but for all of them i get the error that is unknow format it works fine for files ends with tar gz i tried to change the name but still does not work here are what i have tried another way is thanks for your help in advance,any python trick for flattening a dictionary and sorting it all at once i have this dictionary i can sort it on start like this at the end of the day i need label start and end i know that i can access annotation in the loop and get to all the values i need but then i m pulling out the start point twice is there any cool python trick to unpack values from a dictionary and sort on one of them all at once,0,69,85 how can i create a matrix from a csv file that displays relations between certain objects i have very little experience in programming and i cannot understand how i can turn a csv file that looks like this to a matrix that looks like this using python,how can i create a script to launch my python web app in command line i have a python flask web application that runs in command prompt and i would like to create a script for automatic launch of this application every day or to be exact i need the script to launch the app then wait a day terminate it and launch it again immediately its because my database is updating every day and if i dont restart the web application the changes won t transmit in it i have no clue on how to write a script for windows command prompt these are the commands for launching my web app for terminating i use ctrl c can somebody help me with this problem,0,47,123 trying to count the emoji s from text i m trying to count emoji s in textlines these are tweets i tried different codes but they all return empty eg error i got emoji dict stays empty as well any ideas it would help me a lot,how to store all the output before multiprocessing finish i want to run multiprocess in python here is an example myfunction in the real case takes really long time sometime i have to interupt the running and start again however the results will only be written to the output file when all pool starmap is done how can i store the intermediate cache result before it s finished i don t want to change myfunction from return to to csv thanks,0,43,76 pandas not replacing the string correctly this my pandas dataframe result i want to remove the b from china and for that i ran the following code but the result was unsatasfying i also received the following warning what s wrong here,shade area between two curves with plotly py how can i shade colour the area between two curves in a plotly graph objs figure without at the same time plotting these curves say i have a pandas dataframe named df like this then i can plot both columns as curves in a dimensional coordinate system like so this gives the following output how can i render the area between the curves gray or shade colour them in any other way my use case eventually i don t want to plot the curves avg std and avg std anymore i only want the shaded area but the figure will contain other curves the shaded area will help to spot easily when those other curves leave the normal area,0,41,116 reading into an array but every time i read into the array it rewrites over it and only prints the last entered value i am new to coding i am trying to read into an array from a textbox but each time i enter a new value that value is set to and writes over the last entered value i am refering to the def submit function,convert dict type pandas rows into columns in pandas i have an intresting situtation my dataframe looks something like this i want to convert it into something as follows which looks like a pivot table in which old columns values also act as indexes i have tried to look into pandas pivot docs but nothing helpful was there,0,68,58 pandas data processing i have two data frames as follow df df i wanted to make three data frames using these two like this ndf ndf ndf my questions are is this workflow possible with python and pandas and what would be the best approach for that,parse json dictionary with python i have a json representation that looks like the following i tried to output just the vulnerabilities portion but the following doesnt work this prints out the whole results but not just the vulnerabilities,0,52,39 weight which is but so code should take weight but it does weight i am currently working on my python course and i have some code here however when i print the result i am getting ground shipping why is this is greater than and less than so it should be multiplying by not,force close when i m click the button kivy i typed some kivy code about the buying system until i pressed the button i made and the application suddenly force close and i don t know why can you help me my python code my kivy code,0,74,45 screen just opens for a second and disappears i just tried a code to draw a star in turtle graphics the code works in vs code but the screen just opens for a second and disappeared,how do you import pygame in sublime text on windows i ve been trying to use pygame on sublime text for the longest but every time i try to import it into sublime text it says that there s no module named pygame which is weird seeing how i downloaded it already i watched multiple videos about this but nothing i try isn t working,0,36,65 how do i determine if a given p x y point is located within the boundaries of an array below was my attempt i couldn t print out the accurate key if the point is within a part boundary the algorithm should return the part number otherwise the algorithm should return,how do we remove from the list so i am trying to read line by line from the text file using python and i got list of lists and i have to use the elements of the list to create dictionary so what i did was and what i got when i ran it is the list of lists but something different than what i wanted to get i got something like this what i wanted to get was something like this so how do we get rid of that inside the list i tried to use remove method but it did not work,0,49,108 pandas merge with dtype list i have two dataframe df df i want to merge them based on a as below such that the result is however because the dtype of column d is list which is not hashable i can not do it could you please show me how to tackle this problem,create child class from parent class same arguments i have a parent class parent and a child class child that forwards all initialization arguments to parent it only add a few methods given a parent class instance how can i best create a child class instance from it i though could add something like but parent doesn t have all arguments that are necessary to create another instance from it any hints,0,53,71 pygame ball movement flickering i have been trying to make a basic pygame code where the ball bounces around the screen and off your paddle the paddle movement is smooth but the ball flickers and is pretty choppy here is my complete code is this because of something wrong in my code that is running slowly or am i missing something,attributeerror session object has no attribute session i am creating an endpoint that will effect a reversal using fastapi with python i have an endpoint that takes in an id via post request calls a reverse function on the transaction model but i get the error attributeerror session object has no attribute session on db session add transaction i am not sure where this is coming from transaction model reversal model endpoint this is my deps db,0,61,74 having trouble getting brownie in vs code i ve been trying to get brownie in my vs code but i keep getting errors i followed these steps and nothing has worked the pipx won t work so i tried pip install eth brownie this is the error i get below,how to get the last line from json file which contains only tuples in each line can anybody pls tell me what way i need to use to fetch the last line from json file which contains tuples for instance deals json file contains such lines code after running this code it works fine but after the nd one it failed while trying to read the file and it s obvious i know how to do that using text file but have no idea how to read the last line in json which contains tuples,0,47,93 how to rename part of a filename represented as string in python script if i have file names falcon cpp falcon cpp falcon cpp and many more then how should change all the file names in that specific directory to code cpp code cpp basically how i can replace just a suffix of all file names in single code,not a valid xpath expression trying to use div aria label contains i m trying to locate div aria label containing following but i get the below error error code element i m trying to locate after following there is afifrah which changes as i use different links so i want to only locate the div aria label containing the text following what am i doing wrong,0,53,63 concatenate multiple csv files from different folders into one csv file in python i am trying to concatenate multiple csv files into one file about files all csv files are located in different folders however i have encountered an error while appending all files together oserror initializing from file failed here is my code,merge list of arrays into single array i have couple of json files in which i want to merge arrays based up on field number and write into a single json file i want to do this in python can some one please help me here sample input and output are provided below file file final output regards pks,0,54,62 iterating list to create df i have a variable class list that comes from a post request api in graphql that looks like this how can i iterate thru this list and create a dataframe that looks like this i need to create the df like this because i will merge with another df also i m curious what s the need of this list organization like a list of lists list of dict thanks in advance,dynamically setting class attributes which point to descriptors i have a function which gets data from a spreadsheet and processes the data into a dictionary the init method iterates over the dictionary to set class attributes where the attribute name is set based on the employee name i want this to store my descriptor class employee with the same design i aim to create another descriptor to handle access to employ details where said descriptor will be assigned within the employee class for testing i have created a class attribute for managementsystem william which works as expected but accessing an attribute bob instantiated using setattr behaves differently i have some understanding as to why this may be but have not been able to find a solution to this problem thank you for help as always,0,75,137 data migration breaking in production when using bulk update my application is deployed on digital ocean s app platform for django the database is postgresql the following data migration has run correctly in my local environment in production it starts but never ends running so the deploy is automatically cancelled this data migration affects more or less lines in the database,having troubles detecting when a certain audio plays from the desktops output i am currently writing a piece of software to detect whether a certain sound was played on a computer if true it would change a setting in a certain software so far i have this when i run the code i get two separate errors with these errors i have not been test whether it does detect or not would love your expertise on this,0,60,77 pygame ball movement flickering i have been trying to make a basic pygame code where the ball bounces around the screen and off your paddle the paddle movement is smooth but the ball flickers and is pretty choppy here is my complete code is this because of something wrong in my code that is running slowly or am i missing something,run multiple telethon clients i m trying to listen to multiple telethon clients but when i run the application i dont t get errors but i also don t recieve any updates if i run without asyncio just receiver run until disconnected everything works fine but only one client works i do it such a way entry point application worker i tried to run clients without any class wrappers but it also doesn t work,0,61,68 logging in main process when using concurrent futures processpoolexecutor any ideas on how can i get forked processes to log to main process my setup is like this,how to iterate over two lists in a specific order i have two lists i would like to create these new names and append them to an empty list the structure is the st item in list with st item in list and so on i only want these names this is what i ve done so far the problem with this it creates every possible combination of names between list list how do i limit my loop to only produce names i want,0,29,85 i can t install the numba package via pip enter image description here i can t install the numba package via pip i want to install the numba package but an error appears every time,python pandas replace nan with neighboring value i need to analyze a dataframe which bases on recorded data of an experiment each row of my dataframe resembles a measurement with given recording frequency since every measurement took a different amount of time there were lots of nan values i would like to replace now those cells to bring my dataframe to an equal number of entrys due to the characteristics of my measurement the value nan would mean a measurement of the value in the column left of it i was recording the position of an object when the object stopped moving the measurement was stopped as well for that purpose i iterated over each column and when the value is nan i wanted to replace it with the value left of it k is the number of columns u the number of rows i and v are running numbers of row and column i tried it with multiple commands e g pd isna df iloc v i but none of it works could you help me out thanks a lot,0,33,175 dashboard stopped working after i added a second user input i am trying my hand at creating a dashboard i have a public airline data to work with i need my dashboard to show a bar plot for the number of flights per month for an entered year and an entered airline somehow it worked with only one input for a year but it does not work with two inputs what am i doing wrong here thanks in advance,getting value error for int when posting dataframe values to psycopg i m trying to insert a data to postgresql from a dataframe like this but getting this error code my sql table was created like this,0,79,36 word isn t equal to wordlist readline even though it is here s my code not only does it not return the first value of the list but it also doesn t say that it found my word when it did i got my words txt file from github and the second word is but when i put that in it prints not even though it clearly is,how can i make this loop works i feel dum cuz i was trying to make a simple loop for a matrix to show differents solves and i couldn t fix the index of the array foa i am using the jupyter notebook with sagemath and i receive that,0,65,49 how to return last comment i have probably a small problem namely how can i extract a last comment when i use post comments all views if i tried use or last this dont work,beautiful soup test if a div is children of a div is it possible to test with beautiful soup whether a div is a not necessarily immediate child of a div eg now i want to test whether the div with class aaaa and the div with class abaa are not necessarily immediate children of the div with class aa how can this be done of course the actual html is more complicated with more nested divs,0,34,77 how can i use async await functions in flask with discord py i m trying to make a temporary api for a demo with flask once the request has been ran it s supposed to send a message in a specific channel of my discord server however when i try to run this flask give me the error runtimeerror install flask with the async extra in order to use async views how can i make this work here is my go,how to auto login with kakao google naver id in certain web site using selenium i m trying to make selenium login code of this website the selenium login keys get s error if i click each button they show the login tab for example when i click the naver login button and get xpath from devtools but while executing the code print s this error for all kinds of the login tabs message no such element unable to locate element id id i would like to know why they aren t working,0,77,89 python opencv cv videocapture freeze my code always freezes on me i m testing it on this code my configuration is raspberry pi python canon d this command works normally there may be a bug in the cannon d,implement the scalar wise row variant of the matrix vector multiplication using nested for loops i want to write a function matvec row variant scalar a x that implements the scalar wise row variant of the matrix vector multiplication where a is a d array and x is a d array it must use two nested loops and scalar wise access to the entries of A and x this is what i have tried,0,38,63 trying to convert a string to list and then identify if there are int elements in the list python i have a string that i have converted to a list but i am unable to coerce some of the list values to int,removing characters in a file and also making it neat i want to basically remove all the characters in delete list from the file line to what would be the neatest way to delete the words without making the code not neat i am not sure whether to open the file again here which i know would not be the right way but i can t think of a different solution any help would be appreciated,0,43,77 prime numbers between given two numbers in julia and python comparison see the python code for finding prime numbers between given two numbers lower and upper python output almost similar code in julia gives incorrect output see the julia code below julia output clearly and are not primes why does python code gives correct output and julia code does not any way to fix it using the same algorithmic logic,building a text based game in python area not defined i m working on a text based game in python and everything seems to be working except for the area which the player will travel to and collect items in when i start the game it goes through the intro which i left out and then shows me this error along with the player s stats item player location enter code hereline in player return area location item nameerror name area is not defined i don t really understand how to fix it i ve been trying to define area but i m still getting the same error,0,72,102 how to set mode reschedule in subdagoperator to get rid of deadlock i see in the airflow subdagoperator documentation link that using mode reschedule we can get rid of potential deadlock to my understanding it is not a param which can be be passed with list of other params if anyone has used this let me know how to incorporate it in subdagoperator,fillnan with multiple conditions and using n and n values with pandas i have the following data frame i want to fill the nan with different values depending on certain conditions so the wanted datatable should look like i was able to do the v np mean v v by the following command but i don t know how to incorporate the different conditions i tried using np select but i can t find a way to recover following and previous value and add them to the conditions thanks a lot,0,64,85 using discord py to send a message everyday at a specified time i m trying to make a discord bot that will send a message at a channel at a given time i found previous codes but they don t seem to work for me since they give indention errors i m not an experienced programmer and any answer would be very helpful,how to deploy a streamlit app to heroku within a docker container i recently started using streamlit which is definitely an awesome library for dashboarding and visualizing machine learning applications however my deployment workflow is currently docker and heroku i can t find simple documentation on how to easily deploy a streamlit app hosted within a docker container onto heroku therefore i wanted to document something simple i found here,0,59,69 can i put input in mindstorms while programming in python when i was programming in mindstorms robot inventor and decided to put an input in my code i bumped into this nameerrorthis is the error is it even possible to put an input in mindstorms,keep only letters and spaces from log file with python i have a log file that looks like this i read as a multiline string and i want to keep only letters and spaces and look like this i can do it with but i don t want to have to add all possible characters i was thinking something with isalpha and isspace or some regex,0,46,65 change the element in a list of lists differently alternating every nth time i have a list of lists containing information about days in a month e g i would like to iterate through the list of lists setting the element id to a for the first five then b for the second five and continuing that alternation for as long as the list of lists might be i am struggling to get the syntax right using a for loop,getting null in object of many to many relation object django i m saving an object with many to many relations in the database but when i m fetching it so so it returns me ids of that relational object but i want to the whole object instead so i have added a property in the serializer and after that it returns me the object name only and the value of it is null i don t know why it is behaving like this anyone can help views py serializers py models py,0,79,86 w dw vs w w dw in torch i discovered a torch behavior by accident today that w w dw does not strictly equal to w dw simple example attached below which outputs expected however if i replace w dw as w w dw it will say that gradient is no longer attached i am curious what might have caused this,how can i fix unknown label type continuous i have column comment toxicity csv file comment is string and toxicity is float comment column toxic comment i want to do feature importance with this code but i am gettin this error traceback most recent call last file c users hayyi spyder py temp py line in model fit x y file d spyderui miniconda envs spyder env lib site packages sklearn ensemble forest py line in fit y expanded class weight self validate y class weight y file d spyderui miniconda envs spyder env lib site packages sklearn ensemble forest py line in validate y class weight check classification targets y file d spyderui miniconda envs spyder env lib site packages sklearn utils multiclass py line in check classification targets raise valueerror unknown label type r y type valueerror unknown label type continuous how can i fix this,0,70,103 how do i append something to a list after an element not at the end of the list i have a list i m trying to work on a json beautifier without using libraries,error in python when importing sklearn cannot import name logger from joblib logger this is the error i get when i run the following command from sklearn metrics import accuracy score confusion matrix importerror cannot import name logger from joblib logger c anaconda lib site packages joblib logger init py i searched the web already to find a solution but nothing fits for example i tried to reinstall sklearn conda install c anaconda scikit but still get the same error any idea what the issue is here those are the docs under c anaconda lib site packages joblib logger,0,33,82 how to solve the duplicate integer issue in an array for the isvalidsubsequence array sequence question prompt for isvalidsubsequence how to solve this repeating s issue using my code,django ensure ordering of response data is newer first so i have some code below that returns posts that are newer than a post with post uuid given this is ensured because i force an ordered uuid scheme where each post is given a uuid in order of creation this is done with ulid i want to enforce that that the returned serializer data is ordered by post creation data with the newest best first or index and oldest being last how do i ensure this view py serializer py tried solutions doesn t reverse the list for some reason,0,28,97 how to split strings with double letters python i have been thinking about it for a while now and decided to ask for your help for instance i have a string abcdefggarfse or abcdeefgh my problem is that i would like to split these string at that point where the letters are doubled abcdefggarfse abcdefg and garfse abcdeefgh abcde and efgh thanks a lot,python websocket client i ve got a problem with websocket client that s my code and the output is everywhere the ones asking questions were told to uninstall websocket client and just websocket but i have tried that on many projects i ve even tried downloading and installing wheel from my desktop and i have no clue how to solve it could you help or just suggest what can i try,0,68,65 how i can replace backslashes in python i simply wanna replace the backslash but i can t i searched every where but nothing found i tried can any one help me pleas,linux tmp folder bad file im writring a python script that checks some permmission and if you have permmission it will open xfreerdp now i have a problem if i just write in terminal the xfreerdp command it will open this but if i use this python script it won t the error is that usr bin xfreerdp tmp mei cxde libz so version zlib not found required by lib x linux gnu libpng so but if i replace the libz so with lib x linux gnu libz so while running the python script it will work how can i tell what libz so copy in this temp file,0,32,90 permissionerror errno permission denied geckodriver exe i am writing a bot for instagram using instapy i need a lot of accounts so i use threads but i get an error ode if i call the code for one account everything works,create a list with a value in it using only pure functions python why this problem has no trivial solution is because i needs to be solved using only pure functions using only pure functions from python s functional programming page how can one create a list with a value in it if we d like to create a list with a value in it we d in code just do i do not consider to be to be a part of the functions we re looking at here since it has no signature and is not callable like any other function using only functions to do this is not so trivial one thought i had was to create a new list using list and then append values to it but list append is mutable and does not return a new or the list with the item in it what i really want to do is to turn a b c into a b c with above constraints other proposals has been made like creating my own pure function doing what i want and then just do map create list a b c to get solution but this is a custom made function and is not from any of the python package functions within as mentioned,0,41,207 creating new dataframe by indexing column i just can t seem to connect the dots on this i m trying to do something similar to this question i have a dataframe that takes the form and i m trying to create a dataframe that looks like this i don t want to set the specific parameters so something like df loc df origination q orig balance sum wouldn t work for me,design reason behind having some functions modify the object in place what is the design reason behind having random shuffle modify the list in place instead of returning a new one given that for instance str replace return a new string and could not be any other way given that strings are immutable wouldn t it be more consistent if random shuffle returned a new list,0,64,60 how to change language of date format i have parsed a russian date format as a string which is august i need to transfor it into a normal date stamp as i ve tried something like this but it does not work how can i do it,typeerror descriptor date for datetime datetime objects doesn t apply to a datetime date object so i am trying to convert a yyyy mm dd string into a english format as weekday ddth month year however i am having issue converting the string into a date format which i believe is yyyy mm dd here is my code i am getting a typeerror descriptor date for datetime datetime objects doesn t apply to a datetime date object error which i frankly can t wrap my head around any help would be appreciated cheers edit here is a working example using the calendar library although completely different it works,0,52,99 avoid y and x in pandas dataframe i want to do a left join like below but i m getting date x date y and date x and date y what i want is to replace the column if it exists df df expected resulting df i tried the code below but i noticed that my column id disappears from my columns,how to load string to a pandas df with columns names i have the following string that i read from file i want to create a df that looks like i tried but this doesn t work as expected it gives me df of columns it should be only columns with rows,0,57,54 how to fill matplotlib polygon regardless of point order i am trying to make the area shown below all green so far i use this but not the whole four sided figure is coloured it would be possible to fix the rotation of x and y in this specific example but in other times it would not work is there a way to fill everything between the area between given points regardless of any order of the points,setting the python recursion limit from the command line i d like to set the recursion limit from the python command line as part of a pipeline for grading scripts that are written by students let s ignore the fact that students shouldn t be using very deep recursion basically i want something like python studentcode py firstrunmycode sys setrecursionlimit so that the interpreter s recursion limit is increased to before running the student s python script one solution is to first prepend the code to set the recursion limit at the start of the student s file but there must be a more elegant way to proceed,0,76,101 r to python t test function conversion can someone help me transform this r t test function to python r code t test y mu paired false var equal true alternative greater,pybind send mpi communicator from python to cpp i have a c class which i intend to call from python s mpi py interface such that each node spawns the class on the c side i m using the open mpi library installed via homebrew and pybind the c class is as follows and here s the python interface spawning the same c i ve already tried sharing an mpi communicator using pybind but i m stuck at a long unhelpful error full message the error points to def set comm somecomputation set comm what is the cause of these errors and how should they be resolved update added answer below by using custom type caster as explained in this answer but is it the only way to go about it,0,31,121 increase height of select graphs in subplot i have the following code that produces the output below i would like the same exact output but i want to double the height of the bottom graphs while keeping the size of the top rows of graphs the same using my current code as a starting point is it possible to do so,how to split train data and validation data properly in k fold cross validation first as a non english speaker i am using a translator to solve my problem i ask for your understanding if the sentence is awkward and difficult to read i try to learn data through kfold cross validation however continuous errors occur in the process of dividing train data for kfold following code is my data set and every time i try to split train data and validation data error occurs i m not sure this will help but when i use this code trainx trainy x train ix y train ix this error message occurs keyerror none of int index n n n n n dtype int length are in the columns so i switched that code like this and this time model val acc evaluate model trainx trainy valx valy this code gets the error indexerror index is out of bounds for axis with size so i tried this code as well i sliced df use with train test split same index error occurs i want to split and put the data in the right way so that the kfold cross validation model recognizes my data and can run the model it would be very helpful if someone helped,0,63,221 pause and resume for tkinter pomodoro clock i ve been working on a python tkinter pomodoro clock about everything else works perfectly except for the resume button this is my code the pause function has some issues i can get it the stopwatch to pause but when resumes the stopwatch starts increasing and decreasing randomly help would be greatly appreciated,regular expression that does not accept string less than alphabets and also restrict numbers in the start i am working on the lambda function in python i want a regular expression that does not accept less than three alphabets the other thing it should not accept numbers at the start such as ss or s if a digit comes after the first word it should be acceptable for example my laptops not working should be accepted,0,59,78 what does a mean in python array what is the meaning of in a python array the code below is what it was written like please help me,for statement print times instead of flashscore scrape python i can t understand where is the error i m getting i have a file list of id matches then if i write a for to take each element then it output times eeach element instead of the total outoput is lines printed instead of the expected output should be line prints for every id match now i m getting x prints for each of them and i don t know why and this is example of what i get if i check only id match enter image description here,0,31,103 how can i store results from a loop in a dataframe i have the following loop creating kpi values for each of my subsets is there a way to store this in a nice table something like this with the sku value and sku scaled in the columns edit code used to create kpi function,how can i add a contidion to a query which is combination of python and sql i have something which i really don t know the logic of so i cannot imagine how to add what i want to the below query there are example fields that i created below select company is a multi select input parameter includes bmw mercedes audi etc company name is a column in my table select country is also a multi select input parameter that includes all countries in the world country name is another column in my table i just want to say that if i choose bmw from the select company parameter i want to see not all countries the only united states germany and spain can i add this condition to this query and receive what i want i have a deadline for tomorrow i really appreciate your help since i really dont know exactly what it is happening i may not give proper title or tags i am so sorry for that,0,56,166 how to solve this loop to print all the values it should print but it is only printing how to print both values,sort the json data based on value in python i have a following json as an output and further need to organize the json in descending order of the sal value please help me achieving the same,0,25,37 importerror cannot import name remote connection from selenium webdriver chrome when trying to import this library i get the following error environment,wrong output on python string to datetime so i want to read csv and make a plot for the data i use plotly candlestick to output stock data however some problems i met here very strange the output for dataframe that reading from excel is like this here i am using strptime to convert the data to datetime but the output is wrong you can see that was converted to why how can i get the correct result and i will need to use it on plotly candlestick function data sample if you need,0,20,98 fix invalid geometry in geopandas how can i fix invalid geometries in a geopandas dataframe from i can see have invalid geoms i have attempted using shapely to understand what might be the source of invalid geom using which throws the error edit adding data,python filter row with multiple columns conditions i have a csv dataset and i need to filter it with conditions but the problem is that the condition can be true for multiple days what i want is to keep the last true value for this condition my dataset looks like this so the code should give us the last entry for plane landing where city city and flight no flight no and company company as you can see this condition can be true for multiple days so if all the three conditions are true and summary contains airplane lands return the last true entire edited the desired output should look like the dataset below as shown above to delete row all three columns city flightno and company should be the same if any of them is different then both rows should be kept the logic of it condition if df summary contains airplane and land return the row condition frome the already filtered dataset if df city df city and df flightno df flightno and df company df company is true with days then keep either the last or the first so if returns rows with airplane land in the same city with same flight number runned by the same company on the th and th then one day row should be kept only but if it was on the st and th from the same month then keep both rows please help me find a what to apply all condition and keep the last true entrie edit keep first if condition are true in the next days input output,0,45,270 how to merge list of dictionaries by unique key value i want to merge list of dictionary provided below with unique channel and zrepcode sample input sample output,group line categories based on similar text from dat file into a list i am completely new to using csv i have seen answers based on line by line but i cold not find reading groups of lines i have a csv file containing for example the following data format below where the first line contains starting month and day from the second line i have data only on the last two columns say a and b what i want to do is to retrieve the data from below each starting and write them separately as a list of arrays with columns each the purpose for this is to be able to plot each array of starting independently here is the code i managed to write after several search please kindly help to correct me where i am missing it thank you in anticipation,0,28,146 how can i transfer data from the get which will result into deleting a textline from tkinter good evening everyone may i ask for help about this problem of mine about transfering data to delete a textline here s my code remove line sample txt the number from the right side indicate which line to delete i am trying to make a result by typing on an entry box a number which will indicate the line to be deleted,issue with object programming and files i was trying to write a code and check it with pytest i thought i did everything ok but i got a problem after writing this i want to check it with method of class person when i tried to use method id the function ends and i got the output my code example of line of people txt,0,76,64 outputting strings and function outputs in python i am coding a simple program to add all positive integers not greater than a given integer n my code the function works why does the line in the one line comment not work if i remove the hash tag it should there is a concatenation of four strings thank you edit the whole output,cannot handle a dataflow failed state after wait to finish i have a python script that run a beam dataflow jobs as code above i am trying to handle a case where dataflow job might failed which there will be a process in case its failed but after trying with both direct runner and dataflow runner the job ended at the exception i raised in the function but for the case if the job success it can handle the job status function e g job status done the wait until finish will return the final state of the pipeline so i think i can make use of this function to handle the failed job but its not working any idea the log shown in dataflow console show the exception i raised and its end like that without running anything in my if condition edit i found this from dataflow document that it the wait til finish handle non success like this not sure if there s an alternative to do this edit what my job actually did is to scrape a data from some website and push it to gcs the failed part is always on the scraping function where i somehow get by the website in which i have to fix it by running the new dataflow job manually i just want to use this to handle to start new job automatically when its failed during scrape the dataflow job will automatically retry for another times and the job will fail but once its failed it did not go into the if condition,0,63,255 find the best match in list of string i have i managed to get only the name using split to be and i did the same thing to end up with i wanna get the best match which is dexter new blood if you can add way for getting index as well,add filter comment in django i have a problem with adding comments only spaces or enters i don t know how filter that if the user sends a normal comment it is transferred to the current page but if send only spaces or enters it is transferred to the url comment this my is code models py views py urls py forms py post detail html if i send a comment with enters to spaces get this error,0,52,71 systemd service taking a long time to run i am having service running as background service in ec instance but it taking a long time to start a new one or restart a service refer to image i reboot ec and a service restart at but at the a service print the first log here is my service config file in etc systemd system please help,string formatting using a list i have a list of keywords from which i want to create a certain query named kdws i have a query suffix prefix and i want to return a string that starts with prefix and is followed by every keyword from kwds something like this i expect the returned string to look like this,0,68,59 leetcode getting stuck in while loop i m doing question leetcode substring with concatenation of all words i m getting right answer in pycharm but memory time is exceeding while submission of the code i think its getting stuck in while loop it s accepting when i run these variables or or but when i submit it s getting time limit exceeded with series of just aaaaaa time limit exceeded image the code,how to shutdown gracefully on keyboard interrupt when an asyncio task is performing blocking work update asyncio simply does what it s told and you can handle these exceptions just fine see my follow up answer that i ve marked as the solution to this question original question below with slightly modified example to clarify the issue and its solution i ve been trying to debug a library that i m working on that relies heavily on asyncio while working on some example code i realised that performing a keyboard interrupt ctrl c sometimes rarely triggered the dreaded i ve tried hard to make sure that all tasks that i spin off handle asyncio cancellederror gracefully and after having spent way too many hours debugging this i realised that i only end up with this error message if one of the asyncio tasks is stuck on a blocking operation blocking you really shouldn t perform blocking work in tasks that s why asyncio is kind enough to warn you about this run the below code and the debug console will tell you something along the lines of rest assured that the above call to sleep isn t the culprit in the library i m working on but it illustrates the issue i m running into if i try to interrupt the above test application within the first to seconds of it running the debug console will end up with a hefty source traceback if i replace await asyncio sleep with await asyncio gather task see the example code and invoke ctrl c i instead get a very neat shutdown sequence in my debug console can someone explain to me if this is by design i was expecting all asyncio tasks to be cancelled for me when asyncio run was interrupted while cleaning up after itself,0,69,291 how to save df to csv to a preferred location rather than desktop i am trying to save df to csv file to a preferred location but getting the following error the system cannot find the path specified however when i try to save it on desktop it works can anyone pls suggest what am i doing wrong here,customise polar contour plot axes style i am using gridspec to create a grid of polar contour plots in matplotlib to aid with the visuals i am trying the customise the appearance of the contour plots see this single polar plot as an example mwe below i have two formatting questions in mind how can i customise the r axis to show only and values how can i also make these numbers display in white when plotting multiple polar plots i am choosing to remove the axes and ticks on the other by using ax grid false ax set xticklabels and ax set yticklabels however a white bar along theta remains which i would like to remove see this image as an example of what i mean mwe,0,55,126 how to print many to many field models py forms py views py if i print print student objects all values than i see student s id first name and last name but i don t see in which groups they belong to how to print that,how to prevent binance connector from printing i m using binance connector from after defining key and secret logging information i need to run the last line prints the requested information but i need to prevent this is it possible to prevent this function from printing the retrieved information edit i found that i can retrieve the same information using this doesn t print the information however i would still like to know if there s some modification i can make to binance connector library so i can prevent it from printing the retrieved information because the library basically prints anything i ask it to retrieve and there s information that i can only get throw this library,0,34,112 how to collect all book categories with the help of scrapy i am new to scrapy and python and am having trouble understanding the flow from this site i am looking for how to gather all the categories of different types of books using scrapy then determine how many books are listed in each category and export the result to json format which software can i use vsc or spyder,django to use two filterview classes in one template i am creating a search form using filterview in the main window double click the input form in the search form in the main window to display the modal i want to display another filterview class in modal the class of these two filterviews is different in the model filter and form that they refer to how can this be achieved views py html templates,0,71,71 how to validate json with help of jsonschema i want to validate my json input my json i expected exception because job is not job how to validate this json,why converting numpy array into csv file show no attributes name but rather put the first row values as the attribute names i have a dataset that i handled its missing values using numpy the result was numpy array then i converted the array into a csv file but the dataset appears without the names of the attributes but rather they put the first row values as the attribute name how can i add the attribute names again example of the dataset after conversion,0,30,84 is it possible to have different commands for different prefixes in discord py is it possible to have different commands for each prefix for example one command for and another command for for example someone does foo the bot responds with foo but another person does foo the bot responds with bar,how to display a model data dynamically in html i have a model and in a function this model is updating i want to display this model s data dynamically so new values should display without refreshing the page how can i do it models py views py functions py setup wizard html all my function works fine when i looking the mylongprocess from django admin and refresh the page values are updating just i want to display it in frontend without refreshing,0,53,77 how to source or activate a virtual environment within an ipython shell i use ipython and the bookmark magic command but the limitation is that i need to exit the ipython shell to activate a virtual environment and then relaunch ipython is there a way built into ipython a third party package or a known hack to let me activate the environment without exiting the ipython shell,s mock in lambda handler test returning botocore exceptions clienterror i m trying to write a test for my lambda handler which uses boto to download a file from a bucket and store it locally because i don t want to actually interact with s in my test i created a dummy s upload event to pass into the function call i also used moto to create a mocked s bucket and put some dummy test data in it as well as a mocked iam user with s permissions i inject those mocked fixtures to my test as follows but when i run the test botocore throws an exception when it reaches this line of the code s resource bucket bucket name download file key file name filename temp file when i googled this error it seems that this has to do with missing iam permissions the policydocument i m using for my mocked user is the same as the actual policy i m using in the code so i don t see why it would be able to download the file in real life but fail in the test is there anything i m missing in my mocked user,0,66,177 change variable if request are not received within some time from each other i have an ajax function that is posing data in intervals of seconds to the class that you see bellow now what i wanna achieve is to set flag variable to when there is no post request within seconds of each other i know that there is elapsed but it returns time delta between request and response,list of namedtuples how to calculate the sum of individual elements say i have namedtuple is there any pythonic way to do a one liner sum of each summable or selected qty sell buy profit elements in the list expected result i know i can do following which takes lines of code but would like to replace the sums with something more generic which takes only line of code and then create x like using the sum of the individual elements in the list,0,73,86 how to update all cell values of pandas data frame without looping through i have a pandas data frame read from csv file as follows i need to joint the full path to the file name in the first column what s the best way to do it without looping through each item,python subprocess does not capture stderr of a pv command i need to run some bash script with python and show the output some of these scripts contains some pv command but from subprocess i am not able to get the pv output runnig this python script i simply get echo s outputs,0,53,52 how to check if exe file is generating any errors when run i am generating a exe file through a python script the script runs fine but when i run exe file it is not receiving voice input properly i have used speech recognition and pyttsx modules for voice where can i see the errors that are present when i run the exe file,read array of array with pyspark i have an array of arrays of numbers of the following structure spaces and line returns are preserved the size of the data is gb is it possible to read it as a dataframe of columns integer and double so far i have tried to read it as json creates only one corrupted record and as text it reads each line individually and i am not sure if the order of lines is guaranteed any ideas,0,63,84 how can i integrate a line chart viewer in pygame i have an ai for a game in pygame and i want to create a chart to follow the evolution i need only the gen on x axis and points on the y axis i have tried this but i don t know how to make it fit on the surface in the game and not pop out as an individual window which will eventually stop the game any ideas,reading filter query set in django framework i m very new to django i m trying to return the sum of total revenue attained by selling cars with respect to a particular site in django i have tried the annotate method to fetch the results i have written a query set using annotate this returns me a filter object users filters cars showroom filter object at x abba a and i m unable to read it i tried using qs count but it returns me the entire query set list can some one help me with a way to read this particular query set value,0,76,98 seems like gpu is not working in aws sagemaker studio lab i ve selected compute type as gpu and opened my project but checking the local devices it doesn t look like any gpu is deployed outputs how can i enable gpu usage in aws sagemaker,linear regression using pytorch i have classification problem i am using pytorch my input is sequence of length and output one of three classes i want to train linear regression model using pytorch i created the following class but during the training the loss values start to have numbers then inf then nan i do not know how to fix that also i tried to initialize the weights for linear model but it is the same thing any suggestions,0,44,82 putting cooldown to an interaction button i want to put a cooldown function to my interaction button this is my base code in this i want to make callback function to be executed every seconds per user how can i make it work as i intended,python firebase realtime database set method promise i am new to this trying to get response on successfully adding data to firebase real time database from python successfully added but unable to get promise response unable to find documentation also can someone help below is my code for set the data,0,47,50 get text from span class with beautifulsoup and requests so i tried to get a specific text from a website but it only gives me the error floor soup find span class text white fs px text truncate attribute value text attributeerror nonetype object has no attribute text i specifically want to get the floor price text my code,iterating gridsearchcv over multiple datasets gives identical result for each i am trying to perform grid search in scikit learn for a specific algorithm with different hyperparameters over multiple train datasets stored into a dedicated dictionary first i call the different hyperparams and the model to be used then i create an empty dictionary that should be populated with as many gridsearchcv objects as x train d keys via finally i create as many datasets as the existing keys reporting info on scoring etc via all is working perfectly in the sense that no error is shown except that when i inspect either the different gridsearchcv objects or the df grid results datasets i see that results are all identical as if the models were fit on the same dataset over and over again while the x train d and y train d dictionaries contain different datasets of course when i fit a model individually like results differ as expected i feel like i am missing something really stupid and obvious here anybody can help thanks,0,53,168 datetime datatime strptime date y m d adds for different dates when i try to convert a string into a datetime i get different results for different dates does anyone know the reason code,pygame screen not updating or filling with correct color trying to start a new pygame project very basic stuff just trying to color the screen currently the screen opens and goes white there are no errors in the console here is my code id be happy if it would simply show a green screen any ideas what my issue could be,0,30,61 nested for loop in python not workin with range i but working with range i this code is working fine this code is not running or may be taking a lot of time,redis get stuck indefinitely i am trying to connect to remote redis server using python for that i am using version redis but when i print redis get it is stuck indefinitely below s the code snippet this is working now had to add ssl true for my remote connections,0,35,47 how to read yaml in multiple row using python we are reading the yaml file with below code in python but its giving me rows x columns but i want it in rows row for my table and another for my table giving sample data below the code my new yml having below data,how to convert all floats to two decimal places regardless of number of decimal places float has without repeating convert code i want to convert all floats to two decimal places regardless of number of decimal places float has without repeating convert code for example i want to convert to to without repeating the convert code again and again what i mean is explained in the following section research this question is not about only limiting floats to two decimal points if there is less than two decimal points then i want it to have two decimal points with zeros for the unused spaces flooring the decimal or ceiling it rounding the decimal off this question is not a duplicate of this question that question only answers the first part of my question convert floats to two decimal places regardless of number of decimal places float has not the second part without repeating convert code nor this question that is just how to add units before the decimal place my question is how to convert all floats to two decimal places regardless of number of decimal places float has without repeating convert code i found two ways i can achieve the convert one is using the decimal module another without using any other modules however that does not fully answer my question realise that the code to convert keeps being needed to repeat itself i keep having to repeat the code to convert again and again sadly my whole program is already almost completed and it will be quite a waste of time to add this code here and there so the format will be correct is there any way to convert all floats to two decimal places regardless of number of decimal places float has without repeating convert code what i mean by convert is something like what dmytro chasovskyi said that i want all places with floats in my program without extra changes to start to operate like decimals for example if i had the operation it should be also float is a number not a function,0,55,371 nameerror name guild is not defined i want to make thing like when member join and bot join a guild i get information about members in guilds like id guild id warns and reason i have error like this,how to find unique key value from list of dictionary to create new list i have below list i have to create another list from the above list where producer and state are unique so the new list will look like to solve this i first get all the unique producer names and then compare the producer for each asset with the producer unique list only adding entries where producer state is unique but it looks like this logic is not working can anyone please suggest some good way to solve this thanks,0,39,92 automatic counter as a subclass of integer is it possible to create a class of integer where an instance of a certain class say automaticcounter will increase itself by some number say each time it is called this is what i have tried so far,lstm model samples timesteps features i am pretty much on day trying to understand the samples timesteps features pattern when it comes to training an lstm model say we have a time series t with the following two sets of input output will be calculated i get that the number of samples in this particular example is equal to however some things i ve noticed that work and can t understand why how are the following on the input of the let s say input output combination a set the model s input size as and keep the input as is b set the model s input size as and transform the input to the following format what is the difference between a and b correct me if i am wrong but it seems to me that in a i train the nn using a length input at a time while in b i train the nn by feeding it each input two triplets at a time furthermore how does this affect the nn maybe questionmark it has something to do with the concept of memory in an lstm model i am using the tensorflow keras api by the way,0,46,206 invalidargumenterror incompatible shapes vs i am building a object detection model with bounding boxes and after i build it successfully i would like to merge it with the vgg classifier i have googled the error but i still cannot debug it i know that the is my batch size and is my number of labels is my model s output below is my model data generator my model the error message is,pandas how to do groupby with conditions in pandas dataframe i should do groupby country and product and value column should contain count id where status is closed and i need to return all the remaining columns output format sample i tried the below code is there any better way to approach this,0,75,51 how to set working directory using python script in abaqus i can t find any python command related to set working directory in python reference guide in abaqus is there any way to set working directory using python script in abaqus,python ad column with average value for each row i have a dataframe which looks like this the dataframe contains the total values for each timecategory during one day now i would like to add a column to this dataframe which displays the average value for each timecategory during each day if i have rows for with date and with the timecategory and the total value equals i would like to have the average value equals the result should look like this i do not want to use group by because i need all rows including duplicates of my dataframe many thanks in advance for your help,0,40,112 document creation using google apis in python throws error in the following approach i tried to create a document and insert data into it approach error the file is getting created and the permission is also granted but unable to insert data in the file,pyhon list reverse slicing excludes st item i would like to go through on a list in reverse order using slices of the list but i am having trouble to have the st index item of the list on the output the output is missing the st item of the list it looks like just a shifting problem but i doesn t work as an index when i the only solution so far i could figure out is ugly output what i really wanted for me it looks like a design failure in python as in a reverse slicing there is no other way to have the st item of the list then leaving the field empty what is a problem when you have a variable there tell me how to do it better,0,45,134 how to put cookies in python requests i have a cookies like that how to put it in this link i tried it bu didnt worked,modifying udf in spark to create additional key column i have a dataframe that consists of rows of data and a column of xml that needs to be parsed i m able to parse that xml with the following code from this stack overflow solution this function creates a new dataframe of the parsed xml data instead how can i modify this function to include a column from the original dataframe so that it may be joined later for instance if the original dataframe looks like how can i include the id in each of the rows of the newly created dataframe,0,27,100 how to extract this dictionary using beautiful soup i want to get to variable last element of dictionary pasted below it s in another dictionary offers and i have no clue how to extract it,make python wait for external trigger i m trying to set up a sort of basic screensaver on a raspberry pi i m using python because i like it a lot more than bash the script uses popen to call feh and display a slideshow there s also nodered running on this pi and that manages the actions bound to a few gpio buttons i would like to intercept those button inputs to stop the slideshow i thought of ways so how else could this be achieved is there a way to bind a function to some external trigger,0,34,97 how to solve multiple sudokus in one file with python i am making a sudoku solver for school and one part of it is that it needs to be able to solve multiple sudokus in a file currently it can solve one at a time but how would i code it to solve multiple the file would be set up like this and we don t know how many puzzles there will be in the end thanks for any help,define different business hrs for different days in python businesstimedelta i am trying to calculate the business hours between various timestamps in python normally i d define the work hours as below however there are certain days that have different business hours than the rest in my case mon fri is while sat is i want to set this in a way that if i am calculating the working hours between say a date like it applies different working hours for the days in between as they are defined is there a way to do this in businesstimedelta and if not is there an alternative,0,79,105 difference of results between while loop and for loop when working with list i was trying to answer an exercise in a beginner s guide to python book i tried using the while loop first and got the right output but i experimented by using the for loop and got an unexpected output why the difference in results output incorrect correct output,filtering the image and converting to text gives wrong output in python i want to extract a particular text from an image and i already did some filtering in image but still i m not getting the exact text also is there any way to get a specific text alone from the image code for filtering the image and converting to text,0,61,60 how to join lists of ordered strings in python i have a list of lists of strings that are ordered i need to merge them into one list keeping the overall order intact in other words each list defines a relative ordering between elements and we want to return the global ordering for all elements for example input output there can be multiple solutions i am stuck on how to proceed,append from a string list until a semi colon in python how do i append from multiple string lists i don t know what are but i ll need to separate into new different lists using the semi colon as a separator in python for example if i m given the following string list i need to get the following results and append with the same logic and order when given a new string p s since there are no patterns in the list i ll be given i can t just use for the task which is what i ve tried,0,71,94 codespaces force python version i m having trouble installing a specific version of python in my github codespace with vscode i don t have much experience with docker so this is turning into a really frustrating experience here s my dockerfile it seems to always default to python how can i get it to install the latest version of postcreate sh postattach sh,identify lines of speech which contain words from a list using pandas i have the following dataframe and the following list which contains keywords i would like to generate an output which shows both the speaker and line no associated with them for each time their speech contains at least words from the keywords list i have tried iterating through each line in the dataframe to see if there was at least keywords present however my code only returns the last line below is the code i used the expected output for this particular case should be in a similar format whereby the first value is the line no which contains speech which has at least keywords and the letter is the person,0,60,126 how to create an animated line plot with ploty express i m trying to create an animated line plot to illustrate the price increase of different asset classes over time year but it doesn t work and i don t know why what i ve done so far output,how can i use selenium to wait for an element to be visible on a page but then move on to something else i m trying to scrape urls off of a web page and they re located inside of a rankings table which takes a few seconds to load what i want to do is wait until the rankings table finishes loading then grab it by its id and iterate over the elements this is the code i m using to grab the page and wait as far as i can tell the code is actually working up to that point i can visually see the table loading when the window opens but then it throws a timeout error note that the subsequent rankings and print statements are not executed so far as i can tell my current interpretation is that selenium is executing the wait command just fine but then times out because there s no further instructions given directly to it i e i m not invoking click on anything i ve rtfm but the selenium documentation is awfully sparse is there really no concept of waiting until an element loads then moving on to some other processing task do i have to interact with the element in some way and if so what would be the best kind of interaction given that all i really want is to iterate over the internal elements,0,46,231 join dataframes matching a column with a range determined by two columns in the other one with pyspark i have a df on the left like this one and another one on the right like this one and i need to join the rows when the id of the first table is between the range of start end of the second table the output should look like this how can i achive this result with pyspark,iterate from one key to another in an ordereddict i have an ordereddict in and i have two keys i know that one key is stored before the other key and i would like to iterate all items between the first key to the second key i don t want to iterate over the whole map because it s huge only the items between the two keys i have how can i do this,0,76,72 enumerate values in a column minimum reproducible example i then produce a length type column that is a combination of length and delivery type using this code the problem is that i wish to enumerate each delivery from for each delivery of the over so that it looks like this,how to substitute scaled column with usual columns in my dataframe i have scaled columns however how do i put them back into my data frame here is the code that i have my main data frame that i want to substite this columns with old one is train data,0,49,49 problem with modifying image pixel by pixel in pillow python i m running python and my code is the code seems to be correct according to the docs but it throws this error how can a color be a single integer,count number of occurence and sum according to condition of year i try to filter the data of the customers who have their first bill in then calculate their number of bills in and the result i try to find look like this i can t find a function to do this calculation any idea how to make it work,0,40,63 not iterating other links hello guys i am trying to parse ingredients from a website but when i run the code in the ingredients key in shows only one ingredient and not going through other ingredients thank you for your time the results are,why does tensorflow model fit work without target labelled data ground true data argument y passed in in the deep hedging sample code i am studying the deep hedging code and i am very puzzled why the model fit is called but only x is passed in model simple fit x xtrain batch size batch size epochs epochs validation data xtest verbose xtrain is of type list but not tf data dataset type without the labelled data y how can this model be trained the code of class deep hedging model is here,0,43,78 python unittest mock pyspark chain i d like to write some unit tests for simple methods which have pyspark code how can i mock the spark read part i ve tried this but it fails with this error py j py jexception method join class java util arraylist class org apache spark sql column class java lang string does not exist looks like the mocking didn t work as i expected what should i do with it so the spark read load returns the test dataframe that i specified edit full code here,accesssing corsair com with python selenium is it possible to access with selenium in python without getting blocked by corsair when i try to load the page in selenium it keeps giving me this error message what i tried to bypass it is changing the user agent to a random one which didn t fix the issue this is my code,0,76,59 how to set amount of hue levels in seaborn with the following code i can use seaborn s scatterplot to plot data with certain colors assigned to data values how can i set the amount of colors that get used in this example e g if i want to have only two colors used or more than the shown in the example,pandas generate column on group by and cumsum the task is to generate a column cur where cur cur pts until id contains same consecutive value it will continue iteratively nb initially cur contains by default sample dataframe expected output my code,0,61,45 get execution for given date here s some code i have which fetches the executions from a state machine which started on a given date however it seems inefficient to list all executions and then filter them is there no way to filter the executions without pulling all of them from aws,how to remove underscores from column names within plots i m working with data frames that have underscores as spaces in the column names as i understand it this is good practice so i don t want to rename the columns with spaces when plotting a correlation of the various columns with each other the column names are spelled out with the underscore in the plot i d like to be able to have a cleaner reading visual that uses spaces instead is there a way to modify the names that are displayed within plots such that i can replace all underscores with spaces and or rename the labels displayed in these charts to be something different more clear than the actual column names using both matplotlib and seaborn for my plots at the moment edit to add some more detail as to the source of why i m doing this i am building this data frame from an sql query the sql database has underscores in the column names so they get inherited here one useful answer below is to rename the resulting data frame to replace the underscores with spaces another i just thought of is to import the columns as more readable names when doing the query this also allows me to change the columns to be even more legible if i want by adding detail select table column name as column name but this leaves another question i have why is it important to not have spaces in column names in an sql database in theory i could just make it so the database has the spaces i want built in,0,51,269 pandas column into key value respectively i have a pandas dataframe similar to this my end goal is to have column to be the keys in a dictionary and then column to the values e g dict index s p marketcap any help is greatly appreciated i am quite new to pandas python and have been referencing this doc with no progress here is the code i have at the moment which is scraping the data,how to drop multiple columns by conditional index value how do you drop multiple columns by a conditional index value for example i d like to drop all columns that are greater than index number,0,77,35 python gtk new tab i m just playing with gtk currently but was wondering if someone has an example code of a window that has a notebook in it and with a click of a button or event it opens a new tab with a gtk for example entry in it and is accessible from further code i can t find any working code like that on the web or on this website,trying to learn comprehensions want to create and populate a dict with list comprehension without knowing the keys first from a dataquest question the keys it s supposed to find are so it s a short list it d be easy to cheat and just use the four items as in the list comprehension at the end but there has to be some way to just iterate through a generated list of keys for larger data,0,71,77 how to generate list of sequence number in faster way using python anyone can improve processing time to generate list of sequence number here is my code and it needs second please advise thank you,find which of the columns in postgis table are of type geometry and which are attributes i need to find all the columns which holds geometry values in a postgres table i am trying to make it work like this but i am not really sure that it will work all the time in my current implementation user defined may be present for other columns as well,0,38,66 rename none in a list under pandas column let s say i have the following dataframe i would like to replace none value in the column with none but it seems i couldn t figure out it i used this but not working,how can i read the error content outputs of mysql command executed from python bash fc rf mysql u source user name h source ipv addr password source db password when i use the following functions for the above command mysql warning using a password on the command line interface can be insecure mysql unknown os character set cp mysql switching to the default character set utf mb error access denied for user root pc mshome net using password yes i can t read the output is there a method you know of so i can read it,0,41,87 how to access json file in jupyter i want to access the json file and convert to it dataframe but show s invalid argument error is,running two tensorflow trainings in parallel using joblib and dask i have the following code that runs two tensorflow trainings in parallel using dask workers implemented in docker containers i need to launch two processes using the same dask client where each will train their respective models with n workers to that end i do the following the problem is that i don t know if the entire process is thread safe are there any concurrency elements that i m missing,0,25,79 i m unable to pass the variable value into ldap code to create an account i m trying to pass variable to create account in active directory but i m not sure how to pass it it is creating an account in the variable name not the value of variable,selenium save file to current working directory i have a website which i m querying after solving a captcha after solving the captcha my query downloads a pdf file my issue is that i cannot get firefox to download the file automatically to the current working directory without user interaction i also cannot figure out how to determine if the file already exists which would prompt my code to display either a dialog or a message here s my current code which does everything correctly until the file download popup usage python script py,0,47,92 how to set working directory using python script in abaqus i can t find any python command related to set working directory in python reference guide in abaqus is there any way to set working directory using python script in abaqus,create a list with a value in it using only pure functions python why this problem has no trivial solution is because i needs to be solved using only pure functions using only pure functions from python s functional programming page how can one create a list with a value in it if we d like to create a list with a value in it we d in code just do i do not consider to be to be a part of the functions we re looking at here since it has no signature and is not callable like any other function using only functions to do this is not so trivial one thought i had was to create a new list using list and then append values to it but list append is mutable and does not return a new or the list with the item in it what i really want to do is to turn a b c into a b c with above constraints other proposals has been made like creating my own pure function doing what i want and then just do map create list a b c to get solution but this is a custom made function and is not from any of the python package functions within as mentioned,0,40,207 syntax error when running python script from applescript i am new to applescript i just created an applescript to execute my python code but i am getting syntaxerror invalid syntax when i execute the applescript my python script works if i execute it directly from terminal what i m i missing here are the first few lines of my code the error is triggered by the nd line of the code,modulenotfounderror no module named inject i m having trouble with running a test through pycharm here is the full traceback i already have installed inject and when i try to install it again it says when i do the pip list i can see inject being installed in requirements i m using a virtual environment,0,71,54 how to merge multiple lists into but only those elements that were in all of the initial lists i need to merge lists of which any list can be empty that way so that only items that were in all initial lists are included in the newly formed list so now i need to make a list filtered with merged data from all filtered lists how should i do that,the object won t be deleted destructor is not called does anyone know about this problem i want to delete the object,0,74,21 pip install does not install local module package from setup cfg i have the following pipfile and setup cfg and when i perform pip install e it installs the packages under install requires but not the local package pipfile setup cfg when i run pip list i can only see the following but i cannot see my cli package,update sql db table columns using another column value i have this addresses table of my patients and one the column has as integer the number of days since i have last seen the patients i need this to be updated using the current date which is not a problem to get and another column value from the same table i was hoping i could do something like i m using python and sqlite any idea,0,56,76 from base encoded public key in der format to cose key in python i have a base encoded public key in der format in python how can i convert it into a cose key here is my failed attempt,how to invert dictionary with multiple values of each key i have been working on this forever i have the following dictionary i want to inverse the dictionary so that it will look like i tried this worked for hashable type but not unhashable type list maybe i can join the string of michael james lydia to james lydia michael so that it can be a valid key how do i sort the elements in the list michael james lydia and michael lydia james so that they are in alphabetical order before i join them this is a more achievable output,0,37,95 how to extract elements based on condition they contains a specific element i d like to extract all href from item list that also contains class list item pay count every item is encapsulated in a div with class box information and has an a some of the items has lists with class list item pay count at the bottom of class list score only these items href i try to scrape,matplot finance not plotting window properly i am using matplotlib finance mpfinance and am currently having weird intermittent plotting problems with it there are no tags for it within stack overflow so it s challenging to flag properly i had this code working earlier tonight and displaying the correct y labels axis and changed relatively nothing of importance within the code other than some syntax cleanup in the included picture for aapl it seems the secondary y axis is trying to plot however it s displaying as a of the total volume rather than it s own y axis with percentages comments should explain thought process this produces this plot this isn t displaying the proper plot removing addplot ap doesn t change this image however the same code with a different ticker dataframe works below they are in the same exact format which produces they are both pulling data mentioning that specific ticker from the dataframe and there are no nan s so i have no clue why it isn t working i am trying to get the dashed line on y axis the bottom of the lower box i guess i m struggling to figure out why the same code is not working for a specific plot and wondered if this type of issue was with my code of matplotlib finance if anyone has any ideas as to why this would be happening they d be greatly appreciated sample df,0,61,236 redirecting output of launchfile called from python i have a simple piece of code which runs a specified launchfile execution of the launchfile stuff generates lots of logging output on stdout err so the actual script s output is getting lost is it possible to somehow redirect or disable printing it on the screen,django given time zone month and year get all post created on that date in that time zone so i have this post model i want to be able to retrieve all posts that were created in a month year under a certain time zone my goal is to implement a feature where a user anywhere in the world let s say in pst can get all posts by another person from a certain month in their time zone so let s say user a is in est and user b is in pst hours behind est user b wants to see all posts that user a created in october of since the app will display posts in the time zone the user is currently in we send date time in utc then the front end converts to local time then the app should only send to user b all posts by user a that were created in october pst so for example if user a the user in est made a post at pm oct est pm oct pst and a post at am nov st est pm oct st pst then user b should on get both posts back because the nd one was made in november in est but october in pst model py so for example if a user creates posts in november in december of in pst then i have a view that takes month year and time zone and let s say the url looks something like post int month int year str time zone and the user pings post pst then it should return the posts from november how do i return all posts from a month and year in a time zone given time zone month and year note the tricky edge case to take into consideration is if they post on the very last day of a month very late depending on the time zone something like in utc could be because django stores datetime fields in utc what would need to be done is converted created to the given time zone then get posts from the specified month and year setup attempted solutions note main issue seems to be pyzt which takes in time in a very specific format amercian los angeles w e format this is rather than the abbreviated time zone format like pst,0,52,393 how to slice array by its index in d array in python using numpy i have written the following code if i input the following values this will give the following output but i want first row of matrix to enter as string values like and nd row of matrix as integer values like and then i want to get the following output,mock api call in model signal django i am new to django and unit tests so any feedback is very helpful i built a small integration with a third party to create a matching account in their system whenever an account is created in our system i do this on a signal in the model class the signal is simple and looks like this when i ran our tests it created thousands of accounts in this third party s system so i discovered mock we have a bunch of tests that create companies and i was wondering if i have to add this to every one of them mock patch apps accounts utils build request return value my question is at which level should i mock the response and just return for the new integration id can i do it at the model level or do i have to do this for every test case we have,0,63,150 can t install basemap package in linux i am trying to install basemap in linux system using pip install user basemap but i am getting the following error i don t want to install this using conda does anyone have any solution i am using python,how to extract all image urls from local text file i m new to python and bs i have a text file where each line is in the following format i want to extract the image urls from these lines using bs this is just a text file and not in html format the following code doesn t do anything and just hangs how do i fix this,0,44,66 pandas how can i replace rows in a dataframe i am new in python and try to replace rows i have a dataframe such as i have two question how can i replace nd row with th such as how can i put th row above rd row such as,how do i make variables available outside of functions in python and qt i have a newbie python qt designer question read a lot of info here on variables not being available outside their respective functions in python but most examples return a result to the called function not from another triggered event i have probably missed something as this is very easy to do in other languages as you can see in my example the functions are called from button clicks on the gui so the variable for the starttime needs to be available when the stop button is clicked this example should simply subtract one time from another and display the results in a label on a qt window any help would be appreciated,0,51,127 how to download all the href pdf inside a class with python beautiful soup i have around pages and each page contains buttons each button has pdf i want to download all the pdf s the program should browse to all the pages and download the pdfs one by one code only searching for pdf but my href does not have pdf page no to this is the website and below is the link,bitnami review board the python module subvertpy is not installed when adding repository bitnami review board the python module subvertpy is not installed when adding repository the python module subvertpy is not installed you may need to restart the server after installing it,0,77,43 how made cross validation with python hi i made a neural network and i need to do a cross validation i don t know how made that specifically how train or made that if someone knows made that please write or give me some indications here is my code some recomendation for training or validation would be helpful,trying to pull out names of lists which have a low value can t get logic to work trying to print out which days have less than hours i ve tried several different ways of making it work to no avail,0,56,40 does it matter in which order you use prefetch related and filter in django the title says it all let s take a look at this code for example when using prefetch related first does django fetch all the manytoone manytomany relations without taking into consideration filter and after everything is fetched the filter is applied imo that doesn t matter since there s still one query executed at the end thanks in advance,how can i access the aiohttp s request from a restrequest in minos i have a handling function decorated with the enroute rest command decorator so that my function receives a restrequest instance but i want to directly access the aiohttp web request to directly access to the rel url attribute how can i do that my current code looks like,0,68,55 message stale element reference element is not attached to the page document after returning a page currently i am creating a python script which go on and click on each exhibitors and return to same page and then click next exhibitors i write a code when i run my code i can go only first exhibitors then it gives me this error can someone tell me what is wrong here,error pg config executable not found when install psycopg in centos i am install psycopg in the centos using this command but shows error like this i have already install postgresql devel using command dnf install postgresql devel y and install successs why still could not install the psycopg,0,71,48 how to change a lower case to upper case using function i m trying to convert a input parameter to capital case,stopiteration when mocking base class of own class in a rather complex test scenario i need to mock the base class of one of my own classes and instantiate the latter several times when i do that my test errors with a stopiteration exception here s what my scenario boils down to in this respect code under test my class py test code test mock py test result i have debugged into the unittest mock magicmock class but i can t figure out what s going on in magicmock s execute mock call method i noticed that self side effect is a tuple iterator object and when next is called on that in the second test test mock it results in the stopiteration both tests run ok if i don t use the mysession subclass i e self session oauth session client client in myclass init method but that s just not how the real code under test works any ideas anyone,0,21,141 python multiprocessing basic can t pickle local object and ran out of input could anyone make me understand what is this error and what is going wrong and how to resolve it i am quite new to python and learning and wanted to implement some multiprocessing in the code so started with the basic approach of it my code is below,prevent chromedriver save password prompt selenium python using latest chromedriver and selenium in python the recommended arguments to be added to options are not currently working in of my machines tried all the answers listed here and here that according to docs should be correct i must be overlooking something that i cant find still get a prompt from chrome asking if i want to save the username and password and since its an automated procedure this is not needed according to all sources checked setting credentials enable service and profile password manager enabled to false should be enough any hints welcomed i tried using different methods to import options but none of them work,0,61,117 how would i find the current decibel level and set it as a variable i m looking to find the current decibel level in a room using a microphone and setting it as a variable i haven t been able to find any python code on this so i m very stuck it would be good if the variable could refresh every of a second but it doesn t have to thanks for your help,brownie error cannot load native module crypto util cpuid c brownie was working great yesterday today i get this error anyone have a solution ps c users philk demos web py simple storage brownie version info could not find files for the given pattern s traceback most recent call last file c program files windowsapps pythonsoftwarefoundation python x qbz n kfra p lib runpy py line in run module as main return run code code main globals none file c program files windowsapps pythonsoftwarefoundation python x qbz n kfra p lib runpy py line in run code exec code run globals file c users philk local pipx venvs eth brownie scripts brownie exe main py line in file c users philk local pipx venvs eth brownie lib site packages brownie init py line in from brownie project import compile source run file c users philk local pipx venvs eth brownie lib site packages brownie project init py line in from main import noqa file c users philk local pipx venvs eth brownie lib site packages brownie project main py line in from brownie network import web file c users philk local pipx venvs eth brownie lib site packages brownie network init py line in from account import accounts file c users philk local pipx venvs eth brownie lib site packages brownie network account py line in import eth account file c users philk local pipx venvs eth brownie lib site packages eth account init py line in from eth account account import file c users philk local pipx venvs eth brownie lib site packages eth account account py line in from eth keyfile import file c users philk local pipx venvs eth brownie lib site packages eth keyfile init py line in from eth keyfile keyfile import noqa f file c users philk local pipx venvs eth brownie lib site packages eth keyfile keyfile py line in from crypto cipher import aes file c users philk local pipx venvs eth brownie lib site packages crypto cipher init py line in from crypto cipher mode gcm import create gcm cipher file c users philk local pipx venvs eth brownie lib site packages crypto cipher mode gcm py line in from crypto util import cpu features file c users philk local pipx venvs eth brownie lib site packages crypto util cpu features py line in raw cpuid lib load pycryptodome raw lib crypto util cpuid c file c users philk local pipx venvs eth brownie lib site packages crypto util raw api py line in load pycryptodome raw lib raise oserror cannot load native module s s name join attempts oserror cannot load native module crypto util cpuid c not found cpuid c cp win amd pyd not found cpuid c pyd,0,72,205 use domain in act window odoo i worked with stock picking model i added a button in the form view when i click in this button i want to create a new record in helpdesk ticket model with domain of field product id same of list of products in stock move lines here is my code i tried it with domain but doesn t work any help please thanks,how to use conda update n base conda properly i have two very simple questions regarding updating conda i e when updating one of my environments with conda update all i get a warning my setup comprises a base environment and two actual work environments say env and env the latter two environments are kept up to date with conda update all issued within each of those environments the base environment was only generated in the installation process of anaconda question should one run conda update n base conda on the command line of the os linux prior to activating any environment or should one activate a particular environment or is the environment out of which this command is issued irrelevant question after running conda update n base conda from out of whatever environment as determined by the answer to question would a subsequent conda update all issued within one of my two work environments env install or update any additional stuff only as a consequence of the previous conda update n base conda ps i find many questions on stackoverflow regarding conda update conda but they don t seem to cover this one,0,66,195 python beautiful soup get correct column headers for each table the following code gets player data but each dataset is different the first data it sees is the quarterback data so it uses these columns for all the data going forward how can i change the header so that for every different dataset it encounters the correct headers are used with the correct data,pass value from operator to dag i have a bashoperator in my dag which runs a python script at the end of its run the python script creates a json as a report in case of failure i want to report this json to slack i have an on failure callback function which can push a message to slack however i have no elegant way to pass the json value to the dag currently i am saving the json to a file and then reading it from the file in the dag and reporting it i also tried storing it in an environment variable and getting it in the dag but is there a more direct way to pass this value to the dag preferably without saving it to a file or an environment variable,0,64,133 extract tar gz some integer in python i am trying to extract a file name with this format filename tar gz i have tried mutpile wayd but for all of them i get the error that is unknow format it works fine for files ends with tar gz i tried to change the name but still does not work here are what i have tried another way is thanks for your help in advance,fabric ask for password for ssh user on redhat even though i could ssh via terminal successfully no issue on centos on terminal i could ssh to the target server without password successfully the target server is redhat but using fabric i tried fabric and fabric both failed on waiting for password this is my test codes this is the result there is no difference if i explicitly set the key file we have another server which os is centos with the same settings we can ssh to the server without password successfully and can use the same fabric codes run the command successfully what is the possible reason,0,69,107 how to use python variables in a cypher statement when using py neo i want to get some path by using py neo but i didn t find the right way so i choose to use graph run when i run the statements below it will show error like this so how can i use the python variables in a cypher statement or is there a way to get paths using py neo statements,python oop how to organize situational code i m trying to organize a new python project that is going to pull data and display it on different templates the problem i m running into is for each template there are going to be different modifications transformations needed on the data that feed into the template for example my database may store information about trucks and i have different templates before feeding data into the templates i need to apply some custom logic to the data depending on the specific template for example i may need to apply a unique ranking system to the data depending on the template and then take the top or maybe for some templates i also need to grab different associated data like tires is there a design pattern or best practice that would help me handle this i could get by with an if switch like if template truck tires data custom truck tires logic data but i imagine there is a better way i m unaware of,0,70,168 flask join children in my problem let s say there is person which can have many addresses and each address can have one location is it possible to get a query where persons contain addresses which are joined with their location so when i loop persons i can access data from both addresses and location as one,accuracy and confusion matrix in cross validation i am training a model to solve binary classification problem usign scikitlearn and i wish to perform cross validation with folds as metrics i would like to get both the average accuracy and a confusion matrix over the folds so using cross validate i can pass multiple metrics to the scoring parameter according to this link i can def a function that returns the confusion matrix at each fold in that piece of code it uses x to predict some output through predict x but shouldn t a test set x test have been used instead and since at each fold a different test set is obtained from cross validate i don t understand how we can just pass x to both confusion matrix scorer and predict other question is clf svm here right,0,56,136 based word for battling and lemmatization all what is the base form of battling lemmatization results in battling where as i think it should be battle is my understanding of lemmatization wrong the same is for the word coming,python docx how to set font spacing how to set font spacing in python docx or how to add element to w rpr w rpr w spacing w val w rpr,0,39,24 if i have autocommit true for pyodbc connection can i assume i don t have to do cursor commits after an update or insert i have the example code below do i still need a cursor commit after the last line i am running against a sql server db host if that matters,lowest value subtract second lowest value within a group panda python groupby i have a df which i m able to get laptime difference between the lowest laptime substract and the remaining laptime within the groupby with original df i need to fill the value with the lowest second lowest value within the group however i can t find a solution result trying to get kindly advise thank you,0,52,68 builtin function or method object has no attribute choice and more python calculator answers py input py main py multiplications py start py i get the error below i am doing it in diffrent files so it will look more clean i tried everything but i cant fix it the error is in the import i think because the input choise seems to be the problem any help appreciated ty,how to remove edit element in xml file using python i have below xml file i want to remove path and also want to edit source source so it looks like below to remove the path i used below code it runs fine but not able to remove path what changes i should do to remove the path and modify source please help thanks,0,61,63 trying to get selenium to scrape table and click button i hacked together the code below to try to scrape data from an html table to a data frame and then click a button to move to the next page but it s giving me an error tat says invalid selector i see the table but i can t reference it any idea what s wrong here,cannot import threadsensitivecontext from asgiref sync upgrading django to i am currently upgrading a django site from to i am looking at the error messages and try to fix them one of the errors i got now was that i cannot import threadsensitivecontext from asgiref sync this was not an issue in django and i have not updated the asgiref library also since i took over this project i am not sure what it is used for have anyone experienced the same problem,0,64,85 how to get a column wise min of list of lists i have a list of lists i m expecting the output of min a to be but the actual output of min a is does anyone know why,calculating the average vector for each unique element in a list i have a list of the form that has a size of around it contains many duplicate entries there are actually only unique words in this list and so i would like to reduce this list down to a size of the number of unique words by taking the average vector of every occurance of that word for example my new list will have the form and will be of length how would i do this,0,39,91 how to calculate molecular weight of a molecule in python efficiently with less memory consumption here is my code to calculate molecular weight h o no co hcooh using predefined values of elements in a dictionary in the above else statement there is an extra step of subtracting the total from existing mass of element if a number is encountered after a letter how can i eliminate this extra check,insert first row to each group in pandas dataframe i have a large csv file containing the historic prices of stocks this is a small sample of it now on each day there will be an update for this data and i want to append them to the data above the updates look like this what i want is the dataframe below my current approach is using this code by tweaking the above approach i can achieve what i want but since i have million rows in my database i was wondering if there is a faster way other than using sort values update by looking at the feedback from the comments and the answers i concluded that sort values is efficient and alright to use the accepted answer is using it too,0,68,132 keyerror dictionary and input i am getting a keyerror the else block isn t working it keeps giving a keyerror when the input is something out of the dictionary however it should print problem please let me know if you know a way to fix this thank you,selecting random values from a pdf with scipy given the dataframe brick cp pd dataframe cp brick cp which corresponds to this distribution visualization i then create a normal function based on the values loc scale out pdf to which corresponds the cdf cdf finally i create the probability density function pdf ppf the aim is to generate a predefined number of random values taken from the pdf to do this i thought of generating random values in the range between and in the ppf and finding the corresponding value on the abscissae currently i do this in this way i would like to ask if there is an easier way of random sampling in scipy and if the method i am using is correct unfortunately i am a beginner thanks edit i also tried this method,0,46,138 why is my answer not rounding to two decimal points using the round function in python below is my code what is wrong with the code where it wont pick up the round i searched stack overflow and it seems right based off search results but something is off i got the correct answer but my answer is displayed incorrectly should be assuming the bill is tip would be and people split the bill,how do i check a list of prime factors to determine if the original number can be expressed the product of two digit numbers in python i m trying to determine if a digit number can be expressed as the product of two three digit numbers i ve factored the digit number down a list of it s primes in order from smallest to greatest with a break statement that shut s the process down if one of those primes exceeds the three digit size i m interested in i can t seem to formulate an algorithm that recombines the primes into all possible paired factors i can check each pair for three digit ness easily enough i m working in python if that makes a difference if someone can psuedo code or otherwise help outline the logical steps this is just the last step in a larger problem if you re interested in the full context it s euler project problem,0,78,156 python pandas iterate through list and map i m trying to make a simple script that should get the id of an item and get some stats associated with it and add it to the dataframe it returns nan and i don t know why edit i was comparing the integer stored in one dataframe with the string in the other one it works beautifully now,python a dictionary of dataframes merge all the dataframes to one big dataframe i have a dictionary of dataframes it consists of around dfs but for the simplicity of demonstration let s say i only have this is the dictionary it s a lot of weather parameters for a specific location for several days and it goes like that for locations or so i want to be able to merge all the dataframes from the dictionary that may not have the exact dates but all have the same type and number of columns to a dataframe like this i hope it s clear i really appreciate any help you can provide,0,64,112 for data driven test using robotframework is it possible to have more than one data driver using more than one datasheet i m currently doing a data driven test i created a test template that will use data from one excel file specific sheet for the input data is it possible that i import the data from more than one excel sheet in a single robot file,how to connect to azure data lake storage using presto on python so i need to use presto to connect to adls now i have read hive can connect to adls and presto can be used to connect to hive but i could not find a single article on how to connect to adls using hive using python thanks in advance,0,64,61 get mypy to recognise that object has attribute for example returns however we know that foo has attribute bar because we just asserted it is there any way to tell mypy this,how does a recursive function work in the example below the results i can understand the numbers through being printed but why do the numbers increase from times to times in the statements once num doesn t the function return meaning doesn t it get out of the function why does it keep printing statements through and why are the numbers increasing by the time it hits num i would thionk it would get out of the function and never reach the print command,0,33,92 import cv in python in vs code not working the python code i wanted to run the error code i am getting but if i type the exact same code in the terminal it works so far i installed python via command prompt and via microsoft store and currently i am running the verion i installed opencv in the command prompt i searched every forum i could think of but cant find a fix please help,loading mnist data from michael nielsen tutorial problems i have a bit of a vexing problem with loading the mnist data in the way specified by michael nielsen in his online book neural networks and deep learning he has supplied a set of functions such as load data and load data wrapper for loading the mnist data he utilizes this is what he has specified what i did was to simply create a class object called mnist loader that specified these function definitions as its arguments i e however when i run the code as he specified in his book i get the following error message i then tried to fork his github to my own github and downloaded his as a zip file and then i simply took the mnist loader py the module he created for loading the data and inserted it into my current working directory to see if it made any difference however it simply gave me the samme error message for further notice i have changed gzip open data mnist pkl gz rb argument to be my own working directory so this is not the problem i think i have no clue what else to do but i would like to overcome this small hurdle since his book is very interesting hope you can help cheers,0,77,209 attributeerror module privateschools views has no attribute homepage i am getting the error when try to run the server i had imported all the views from the three apps as below on the urls py have tried the methods below but the are not all working method one here i used views to map the urls this is method two in trying to solve it by trying to give the names,remove lines from jsonfile in python here my problem i got a json file that containe empty obj i would like to remove them from this json file and save it in a new json file here my json exemple called db origin json what i ve tried to do,0,70,48 how to compare two schema in databricks notebook in python i m going to ingest data using databricks notebook i want to validate the schema of the data ingested against what i m expecting the schema of these data to be so basically i have i ve seen similar questions but answers are always in scala,create lists using loops in python i ve been working on a webpage scraper and i would like to create separate lists containing different elements there would have to be more than a lists and i am trying to run that through a for loop i need the lists to be appropriately named according to the element in each particular iteration i tried using globals to achieve this but it only takes an int or a char and not a string is there a way to achieve this for an example if people john james jane i need lists named johnlist jameslist janelist below is what i tried but it returns an error asking for either an int or a char,0,53,123 how to get video data from webrtc server in python i have a problem i want to receive data from a webrtc server c and process it on python but i can t see any example for it anyone can help me,python type hint enum member value i m trying to constrain an enum to have all member values of only one type for example i want to be an enum with only ints in its members values therefore when i write mytypedenum member x value into my ide it recognizes that the type is indeed int edit this is obviously a simple example with int but i d like to use any type in its place,0,41,71 python search website in google that end with specific word i tried to search all websites in google that end with gencat cat my code output that i have the problem is that only a few websites are searched and also it takes some urls without gencat cat in them or repeats pages from the same site output that i want,read the data from a text file and reshape the data in python using pandas i need to convert the following text file into csv format using python pandas i have a dataset in the following format it is a text file and doesn t have header and i need it in a format like this here is what i have tried sourcefile name of the txt file rownumber which row value field is coming columnnumber which column value field is coming value actual data error keyerror none of index dtype object are in the columns,0,59,90 cloning existing python project anyjson setup command error i have this project shared to me via github after i clone and run this steps in pip install r it gives me this errors here is what inside the requirements txt already tried removing anyjson from requirements txt but still gives me error what am i missing here,how can i mark the return type of a method based on the type of an argument in the object s constructor so i have a simple wrapper class for making read only attributes of a class i use this elsewhere in my code to create read only parameters for example the problem with this is that when i access a attr its type is unknown meaning my editor can t get autocompletions or type information which could make it confusing for users of my code i understand that this is much easier to do using properties but due to the nature of my program doing that would result in hundreds of extra lines of repeated code as such is there a way of getting the type of the value in the parameters of readonly init so that i can explicitly mark the return value of readonly get as the same type i have tried using a typevar from the typing module and marking the parameter type with it and then letting it infer from there but the type just comes out as t init the other alternative would be to annotate exact types in subclasses of the readonly type for example but this feels sorta janky and would also quickly lead to repeated code if i had to do so with many types as such what is the best way for me to tell python the type of a variable given its type in a different function if it helps i m using vs code with pylance as my language server,0,55,253 python if else on one line with continue statement similar to suggestions listed here is it possible to do the same with the continue statement something like this thanks for the help,how to compute precision recall f and confusion matrix of multiclass problem with mobilenet i created a model for mask detection through the transfer learning of a mobilenet cnn for a multiclass problem nomask mask uncorrectmask below is the code i have a problem i would like to calculate the precision recall f and confusion matrix for my model but i can t figure out how to do it can someone help me i was able to easily calculate the accuracy and logloss,0,31,80 how to test aws elasticache instance locally aws won t let you connect to elasticache instances from outside of their network even if you set up security groups to allow traffic from your ip address all connections must originate from within their network given this constraint how can i test an application that heavily rely s on elasticache locally without creating a local instance,nosuchelementexception when using selenium after opening up a webpage webdriver can t find the name element here s the html source i used,0,62,21 how to request multiple file in fastapi i have a functionality where i need the user to upload multiple files images the length of the requested files can be dynamic as of now this is the body that i was requesting but i know this is not the ideal way,flask sqlalchemy create views with postgres i am using a flask sqlalchemy postgres database model with the following style my goal now would be to create a view which holds all tracks completed by users in plain postgressql it would look like this the user model would look something like this i can not any way to create views with the flask sqlalchemy module there is a sqlalchemy views module which i can not get to run in my flask app anybody got a good idea on how to model something like this any help ist appreciated,0,49,93 how do i get the previous second folder or the folder with a certian name i want to get a certain folder the name of this is certainname or it is two folder previous what i got what i want,tkinter button does not appear sorry guys i know that a thread already exists the button it does not appear any tips guys the screenshot func works fine but not the button i have to close it on my own error,0,40,41 type hint for a list of string with or more items in python i have a list which can be like this or in this case type hint can be list str or list optional str which is the appropriate type hint for this variable and why thanks,signing payload in js frontend using ec and validating in python i have a python backend that generates public private keys generates a payload then needs to get that payload signed by the client reactjs or pure js which is later verified the implementation in python looks like this imports generate keys sign verify what i need now is to load or even generate the pem keys on the client side then upon request sign a json payload that can later be verified from the python backend i tried looking into the usage of web cryptography and cryptojs but had no luck i m okay using another algorithm that is more compatible but at the very least i need the signing functionality fully working i also tried compiling python to js using brython and pyodide but both could not support all the required packages in simple terms i am looking for the following generate payload python sign payload js verify signature python any help advice would be greatly appreciated,0,44,167 calculator division by zero error how do i fix that division by zero error how do i fix that zero zero error how can i implement it into the calculator function in math you can t divide by so in my calculator i want to do the same thing show the user message that it s impossible,specify data port in ftp terminal or python i have to upload a file into an ftp server from a specific ip so i have to use ssh tunnels to connect to the ftp server for that i use ssh nl localhost ftpserver com root myserver com this way i can connect to the ftp server using ftp localhost and the command port will be to and everything works great until i want to use the data port i need a way to specify what port i want to use for data transfer in active mode to create another ssh tunnel and pass it through there i know it s by default but i can t assign my local port i need to use or something i need a solution for both the terminal command line and pythons ftplib,0,56,141 one liner for matrix and vector square sum given a matrix an a vector with the same number of columns step sum step squares step sum of squares i m currently doing this is there a more efficient way of doing this,how to make particular column values as upper case if i have a dataframe like now how do i make a and b column values as uppercase for single column for all columns or expected output how do we do it for two columns at once like we could do the single column one twice but looking for how to do for both columns,0,44,64 line chart of two numpy arrays matplotlib i m trying to plot a line chart using above arrays all the arrays are of same shape but still for some reason the line chart is coming out to be messy i m still a noob could anyone please tell me the mistake output,sqlite operationalerror no such table sqlite schema i am facing a weird issue in tableplus when i run the following command it returns table but same query does not work in python python code is given below error i am using sqlite,0,51,41 python boto float types are not supported use decimal types instead i m using python to store data in a dynamodb database and encountering the following error message when i try and write an item to the database my code items is a list of python dicts if i print out the types of the item to put dict they are all of type str thanks in advance for any assistance,why won t my imported function work in main here is the code i m trying to import to get it working for a project then there s my main where i set up functions to test if i m importing everything right my test functions work perfectly fine even returning everything perfectly the test function says hello and returns of course but the stat py file won t let me use returnhit it spits out an error the goes i m on replit btw,0,70,79 create a multidimensional array in python without additional library i have written above code this will create a n dimensional array with aliasing when i am mutating the list it will mutate everything e g aliasing problem click here,is it possible to implement a keras layer that always propagates a fixed vector to the other layers i m trying to develop a neural network architecture that has two inputs however i would like to fixate one of these vector inputs during training i know that this seems to be nonsense for most of you but i would like to know how to do this for testing a hypothesis it is clear that one way to do this would be to prepare a dataset where i simply repeat the fixed value in all instances that i would like however this seems to be a bad solution i would like to know if it is possible to implement a keras layer that receives a vector as a fixed parameter and always propagate it to the following layers in each training step when the other input would vary i m representing the idea in the image attached is it possible to do that,0,36,160 how to get every value of a key of a json file with multiple dicts how to get every value of a key of a json file with multiple dicts i want to extract every value of username key data json this is what my code so far but it gave me this error keyerror username main py,pivot wider pandas dataframe hi i m trying to pivot my data from long to wide in python i m getting confused by some of the other answers on here with a mix of people using pivot or set index and unstack and hierarchical indexing etc below is a sample df with columns and rows i d like to be able to pivot the data so that there is exactly row for every unique id which includes columns like jan sales and jan profit so sales profit would each have their own column for every month ideally it would look like this any help would be appreciated,0,56,110 numpy array length number of rows will not exceed the code above is used to generate the ohlcv market data array below excerpt and write it to a csv file the problem is that the number of array rows will not exceed how can this be resolved,i have to sort an array using insertion sort and using recursion without loops i have to sort an array using insertion sort and using recursion without using loops i have tried but it is not sorting anything here is my code output is same as the given array expected output is can anyone help me to find where the problem is,0,50,78 python my slider cannot work in figurecanvastkagg i try to design a simple slider in the following environment however it cannot work note i use jupyter notebook so i utilized figurecanvastkagg and tkagg note i referred to the following great discussion however it still cannot work python embed a matplotlib plot with slider in tkinter properly however the slider cannot work i mean i cannot move the slider no error pops out how to fix that thanks,import c modules from embedded python interpreter pybind in a shared object raises an undefined symbol exception update the same problem can be seen with some compiled stdlib modules this is not related to numpy i m removing the numpy tag and numpy from the title i m writing a shared object that is a plugin for a software that contains an embedded python interpreter the shared object launches an interpreter and the interpreter imports a python module to be executed if the imported module includes numpy i get an undefined symbol error the actual undefined symbol error changes in function of the python version or numpy version but it is always a struct of the pyexc family i ve simplified the issue to this mimimum example it comprises actually two files that i m compiling with this cmakefile this cmakefile compiles three targets if i run the issue main executable i get the numpy version on screen correctly if i run loader i get this error the problem is specific on linux not tested on osx while everything goes as expected on windows the code changes a bit reported here for completeness is there something that i m missing notes notes on update this appears not to be tied to only numpy if i import decimal a stdlib numeric class with a c module component i get the a similar error gives me,0,77,228 even if i send various methods to my django api server by postman my django api server always receives them only as get even if i send it with a method other than get my django api server always receives it as get what s wrong with this,iterate over a list and save values im trying to do that but i cant i have a variable that gives me values and i want something like that and the list is continuously filled and when it fills up it would come back and exchange the value for the first position and so on i m a recent programmer i tried several ways and i couldn t,0,47,66 get element by class requests html i m trying to scrape quora and get the text inside an element by it s css class for example the html around the question looks like this how could i scrape the thanks for the a a text inside of this this is what i currently have,how to delete the found match from a list i am trying to find out what values of list a is present in list b when the match is found it is stored in match variable what i then try to do is to delete that specific index in which the match was found from list b so that next if there is a duplicate value in list a it will not match the same place as previously but instead move on to the next place it finds a match however it seems that i cant get the index position value of list b deleted i have tried pop del and even remove can anyone help listnwsm holds following k p k p k p f g r g c x k p f b c b listbom holds following actually holds thousands of numbers but this is for example k p c b c b c b c x c b c x k p c b output gives me k p k p how am i getting duplicate index values when the value at position should be deleted after it has been saved,0,50,173 why i am having typeerror expected string or bytes like object django hello i am doing an app with django and i was using sqlite i want to migrate to postgres now but i am having this error i think something related to time but i really don t know how to solve it this is the full code of users auto i don t know how to solve it yet i tried somethings but doesn t work,merge two pyspark dataframe based on one column containing list and other as values i have two tables i wish to have the final table as please use this code for data frame generation i can make this work using loops but it will be very inefficient for big data i have this piece of code with loops for pandas data frame but now migrating to pyspark so need an equivalent in pyspark is there a better way to do without loops to get final table as shown above,0,74,87 printing with rgb background i know its possible to print rgb colored text like so but is there a way to print with rgb colored background cuz as far as i know there are a few kinda built in background colors for printing but i want to be able to use rgb codes and get the appropriate background color for the printed text is this possible thanks,python discord login and join server im trying to make a script which makes or more accounts to login and join a server what i have found is this so if you have any idea what i have to do i would like to know,0,66,47 changing fractional values in a column in python e g from i am fairly new to python hopefully i am able to explain the problem i have a dataframe where the values in a column are present as i want to convert these values to show just the numerators i e rating df rate dropna how can this be done,how to read parameters from a file when inside a class suppose i have a python class like this how can i read parameters from an external file inside this class i imagine it could be something like the following pseudocode such that i can do i d like the external alice txt file to be human readable so maybe something like this where the order of the parameters is not important until now i ve been doing this this is obviously very tedious to maintain when something changes inside the alice txt file,0,66,89 split horizontally python array manipulation how can i write a function named split which accepts three parameters a b c and then do the following i tried using hsplit and array split methods and then assign it to i and j but the output is not matching as given below actual output desired output,project id in error message is not the one set in gcloud config set when use google api client library i call the storage transfer api following the documentation this is my code before executing this script i ran the gcloud config list to make sure the project id was correct and that the environment variable google application credentials was not set but i see another project id aaaaaaaaaaa in the next returned error message googleapiclient errors httperror httperror when requesting returned caller does not have required permission to use project aaaaaaaaaaa grant the caller the roles serviceusage serviceusageconsumer role or a custom role with the serviceusage services use permission by visiting and then retry propagation of the new permission may take a few minutes details type type googleapis com google rpc help links description google developer console iam admin url type type googleapis com google rpc errorinfo reason user project denied domain googleapis com metadata service storagetransfer googleapis com consumer projects aaaaaaaaaaa,0,53,143 find all combinations with set characters i m new and i promise you i ve tried google for the past few hours but i must be using the wrong words and for that why i m here i m trying to find all combinations with some set fixed prefixed characters at in certain positions for example dt fg zr l m n q p characters to choose from,youtube subscriptions list scraping i want to scrap my youtube subscriptions list into one csv file i typed this code but i didn t finish coding yet i found this error file users hendy youtube subscriptions scraping py line in soup beautifulsoup source lxml file library frameworks python framework versions lib python site packages bs init py line in init elif len markup and typeerror object of type response has no len i don t know what s the problem,0,63,67 irregular spaces making pattern abnormal i have a pattern which i printed using below code code it prints the pattern below as output but my issue is with spaces when the n value is defined digit like the pattern is not printed properly expected output what changes do i need to make in existing code to print properly the pattern,how to solve error in passing variables to sql query i have a list of existing tables in database i need to update existing tables with csv files so what i have done is i have created temp tables in database and i have inserted the values from csv files to the temp tables in database then i have made two lists one list consists of existing tables and other list consists of temp table i created my temp tables with prefixed existing tables names ending with temp eg tablenametemp so that i can match with existing tables once i found the match then i will update the existing tables with the temp tables with matching primary keys if the primary key already exists the i will update the existing records else i will insert it as a new record to the table once all done temp tables are removed here is the code which i have done for a in list table if a temp in list temp when i execute this code i got the error like this the sql contains parameter markers but parameters were supplied hy i think this error is thrown when i execute the sql merge query and i really got no idea of how to solve this please help me,0,65,217 how to access json file in jupyter i want to access the json file and convert to it dataframe but show s invalid argument error is,how to filter a grouped dataframe by maximum values in each group using pandas i hope you are doing well in the current situation i ve the following dataframe as an input figure i ve created a new dataframe df by grouping by values like this figure as a result we ve got a similar dataframe as the following and i m struggling with the next steps i would like to create the following dataframe df from df groupby using only pandas functions and no numpy or at the minimum figure this dataframe df collects the maximum values of each group any tips thank you for your support stay safe,0,25,109 how to use loops with playsound in python i am making a morse code program so i need to use loops with playsound module to play the short and long beeps again and again the files are playing properly without a loop but when i add a loop i run into an error,val accuracy not increasing i m new to this technology so i was trying to build a model on image dataset i have used this architecture the accuracy and loss seems pretty good but not the validation accuracy i tried changing the parameters too yet no result would be helpful if i can get to know what s wrong with the val accuracy thanks in advance,0,53,64 mfi indicator from talib python library doesn t return any value im using binance websocket stream to get kline data im trying to get data or values from mfi money flow index to automate some trades i tried other indicators such as rsi and it worked,split string of key value into dictionary i want to create a dictionary from a string that have key value is it possible using dictionary comprehension if yes how,0,44,27 i was creating a discord music bot on repl it and this error keeps showing someone told me to install asyncio and so i did it seemed like some of the problems were gone but it still has an error pls help,how to use k fold cross validation instead of train test split for regression neural network we have developed an artificial neural network ann where we split our data into training and testing data with train test split as we want a better and more generalized estimate of our performance scores we would like to split data with k fold instead now we split the data into training and testing data with train test split how do we split our data with k fold instead and are we right in our assumptions that the performance scores will result in better and more generalized estimates if using k fold cross validation instead of train test split our main our ann prediction function making the regression ann model our function to generate performance scores our performance scores what we tried to reach our goal splitting whole dataset into x predictors y targetvariable utilize ann error receiving from using this function we are operating on mac monterey version tensorflow version keras version libraries,0,41,161 unknown problem with module using cv and mediapipe i have some trouble running the module on python this is my code it returns me the following traceback i m following a youtube online course for computer vision linked here at around the minute mark the module presented above is added i pretty much copied it and it doesn t work what s happening thanks and sorry for the long post,attribute error list object has no attribute split i am trying to split the links of the images what is wrong in my code,0,69,25 issues with logging in using python requests note i am doing this on a website which sole purpose is to be used for automation tests the credentials in the payload are the correct ones and when i look at what it prints i do not see sign out which i should see if it has successfully signed in,how to import python files from within a notebook when the files are in another directory i have a folder structure that looks like and in my notebooks i want to run but of course that results in the error so far i found i could do this by first running but that is breaking some functionality in vs code what is the right way to do this update i m finding that running this in my notebooks and then importing my code as is working much better but still happy to learn of any better approaches,0,58,96 how can i randomly assign powers to my heroes i m creating a hero game i ve created a dictionary containing magic powers my problem is how can i create a method that will randomly assign magic powers to of my heroes each hero get s powers without one magic power being assigned multiple times here s my code,min function with key parameter to search through dates is there a faster way i am using the following code to search through dates in order to find the nearest previous date in a list of dates i need to call this function quite a lot so i would like it to be as efficient as possible and at the moment it is taking something like microseconds to search through a list of dates and find the relevant one it does not sound like a lot but this does not scale well is there a way to make this function more efficient here is an example,0,58,110 error catching incorrect number of arguments requested when calling the function i get an interesting problem let s take such a function for example how we can handling this error in this case and in this case of course i mean handling this bug in the function body my attempt to intercept a typeerror is unfortunately invalid,how to go back to a list of choices so i m new to python just wanted to know is it possible to use something like goto in c i make a choice like this after him choosing the choice and getting what he chose how do i make him get back to be able to choose from all of the choices again thanks pretty new to python and just learning how to make a basic cmd app,0,59,79 can a specific class object fulfil a protocol consider a typing protocol that requires the a simple method foo int can class objects fulfil this protocol by defining classmethods now the call works but mypy complains is there any way around that mypy python,how do you sort column values in pandas to only include certain values essentially my program finds the person with the most yards per carry but finds the person with only a couple of attempts i m trying to filter out the rest of the players so that i only get people with above yards so far in the season all of the data comes from a csv file and so it has to be done thru pandas i m not quite sure how to filter out those players with less than yards output,0,46,94 how to split dataframe randomly into given ratio according id i have a dataframe with two columns how can i split according column id in a ratio randomly so with id despite occurring values it only counts as with ratio how to split data into sets train validation and test does not help in this case so possible output df would be another possible output of df could be also just for clarification,remove transcript timestamps and join the lines to make paragraph i can separately remove each line s timestamp i can also join the sentences if i don t remove the timestamps but i attempted to do these together removing timestamps and joining the lines in various formats but no right outcome i also tried various form of print join sentence rstrip n and print join sentence strip but the results is always either of below how can i remove the timestamps and join the sentences to create a paragraph at once,0,78,84 interactive geopandas positional argument location error i m not advanced in python and trying to make an interactive world map visualization using geopandas library whatever i try i keep getting this init missing required positional argument location error and really frustrated about it obviously i m missing something any ideas i couldn t add the error image directly but i added a link,convert a byte string to hexadecimal string in python i m working on a project with heavy usage of aws signature now my task is to find a way to send an sha hashed byte string to a client via json the given string looks like this yes i am using python that string is a product of encoding a byte string to utf then hash it using sha i don t even know how to call it but i need to somehow convert it to a normal string so i can dump it into json after conversion it should look like this note that the above string is not the result of conversion i just attached it so you guys can understand the issue better i have tried encoding it with base but i cannot decode it afterwards to put things simply i am pretty stuck here any help is very much appreciated,0,64,151 error using selenium python unable to find class in html source code i m learning how to use selenium i was doing some testing but got this error selenium common exceptions nosuchelementexception message unable to locate element layout layout base my code the source code i m trying to find using find element what am i doing wrong,this sends the message from one side to other side but cant send from other side so in this code i used replits database extension and channel ids is a list of channel ids now the thing is if server sends a message server receives it but if server sends a message the bot sees the message but never sends it to server,0,51,66 unable to install torch sparse package it keeps on running for infinite time,how to implement function to delete all items from cart django hey guys i made a website in django and it has a cart feature in it currently i ve implemented a feature that you can delete items but it only deletes them on by one i m stuck on how to get the feature to delete all items currently in the cart cart html cart urls py cart views py,0,13,67 error when converting tweet object to pandas data frame i have extracted tweets using the tweepy library in python however when i try to convert the list object tweets into a pd data frame i get an error message i have looked around and cannot find a solution to the problem help is much appreciated the error occurs when i try to print tweet df update,i m having a problem with a loop in python so im trying to make a code that takes an number input from the user and with that input it will display a x number of other inputs to fill in data to be writed it down on a txt file but i can t really make it stop showing even with a if x f break im still learning python and got this far with my little project,0,65,78 valueerror invalid color argument in my pygame code i wrote the code for my final project it s a code that makes a bouncing on the wall i wanted to make two balls so i created a class and created several functions but i think that my code is not working,pip install fails in dockerfile but is possible in container i have a rpi with bit base image for now i need to use bit so armv l architecture i want to run jupyterlab on it and do some data science i am also new to docker so please guide me gently for that i created a dockerfile jupyterlab and some other packages after i created a container from the image i cannot use matplotlib and pandas it misses libjpeg and some other dependencies i couldn t install after reinstalling matplotlib and pandas i finally can import them so why i cannot write this into my dockerfile but can run it inside the container in console this in this line i get an error here is are the build logs of docker i will also provide a pip freeze of the container with matplotlib and panday additionally installed afterwards maybe this helps these are some cmds i issued to partially solve the problem thank you for the time and effort,0,50,168 how can i generate a single qr code for multiple links by using python i am new to programming i am trying to generate a qr code by using python where i can access multiple sites using a single qrcode,how to identify minimum squared value of an entire pandas dataframe column by column i have a pandas dataframe like this how could i calculate the sum of the squared values for the entire column i am trying something like deviation df columnname pow sum in a loop but ideas are very welcome but also afterwards identifying the column that has the smallest of those sums and the actual smallest sum edit adding desired output desired output in this case would be,0,40,80 creating two lists derived from an analysed dataframe i am in the process of creating a function that can check multiple conditions of my dataset and then return two lists list items to perform x list items to perform y sample data ideal outcome error when running my code so far,create a function that can remove characters and multiply figures i need to build a function named format adjustment that can remove a character and multiply any value more than by also any negative values remain the same example dataset expected outcome for col would look like,0,53,49 send cross aws account message from lambda to sqs i want to send a message to sqs queue on another account ohio from lambda in north virginia account how can i achieve this things i tried so far created a queue in ohio and gave lambda role arn to the queue sent message from the lambda in north virigina got following error errormessage an error occurred aws simplequeueservice nonexistentqueue when calling the sendmessage operation,check whether pandas dataframe column contains duplicates within floating point precision i have a dataframe df of xyz points with columns x y z and classification all containing floats the dataframe was created by concatenating two other dataframes df and df all of the points in df are a subset of those in df but the two dataframes underwent different processing in different software all of the points in df have a classification of none of the points in df are of class thus in df there are points that are essentially xyz duplicates the number of these xyz duplicates is len df half of which are class i want to find these duplicates and discard those that are not class i say the rows are essentially xyz duplicates because floating point error has been introduced to many of the rows during the previous processing originally i tried this discarded all of the non classifed exact duplicates but missed the close in x y and z duplicates created by the floating point error i need to do something like df duplicated but with the behavior of numpy isclose so that values within a certain tolerance will be considered duplicates thanks,0,72,201 send mouse position every seconds pynput i am using pynput to send my mouse position every seconds i tried timing it this code doesn t work it crushes my program mid running the program send the location of the mouse using sockets any tips,jinja s template operators how to use function without printing it on web site page so here is a part of code line is the point where i want to know how i can pop one item out of the list on each iteration escaping printing it on web site page,0,45,49 how do we find specified numbers in a random generated list in python i have created a random list here how do i get numbers that smaller thn desired decimal number like and add them to another list,how to develop a delivery carrier in odoo i searched a lot about delivery providers in odoo i found some simple comments in the project source and some sampling modules in the app store does anyone know how to implement a new carrier this is the comment in odoo delivery addon i follow the steps but nothing happend,0,42,59 perceptron algorithm confusion i have this problem that i m trying to solve this is where i need to implement the function but when i try to use my formula but with my input code and run my asserts i get an operands could not be broadcast together with shapes apparently the assertions are correct so i m doing somethin wrong in my predictone function can anyone help,struggle to understand time complexity where do my reasoning fail i m a university student majoring in data science and we re currently discussing time complexity i could already code in python before my studies but i ve never payed much attention to time efficiency and i have never studied big o notation before it seems like in many exercises i m always close to the solution but my answer is never right take for example this python code say length of n is n and length of m is m my reasoning is the following if i m correct complexity should be o n m yet the correct solution is o n m can you help me understanding where my reasoning fails i m sorry if my question may seem obvious or naive i m not that experienced in thinking in complexity terms,0,68,131 reverse for db with arguments not found pattern s tried db p db id when i am trying to grab items from db html with the help of id it is showing an error i cant understand where is the problem please help me out venue html views py urls py another error occers hear it is showing page is not found because of this path db db id views db name db,multiple inputs in while loops how can i add all the lines of the input to the list this way it adds only the last line like,0,64,27 adding data to an existing json file without overwriting it the idea i want to add a json object to an existing json file but not overwrite the existing data in the file the uid object should come subordinate to uid after the existing uid xxx entries the problem no solution approach works as it should the append approach also returns the error attributeerror dict object has no attribute append the current code python code json file,how do i compare individual items in another list i m quite new and still learning python i need to know how to compare items in a list to another list output mc list is the students that did not attend class while the class list is the list of students at the school i would like to know how can i compare the names of the mc list to the class list and after that be able to pluck out the data from the mc list that has the same name so that i can know the classes that particular name took the new output should be if you are wondering where ab or aa come from it came from class list the represents over a few repeating names that have different class numbers and vice versa sorry if it is a bit hard to understand,0,76,143 how to convert the data from solana account info to readable txt or json with python i get the output image attached blxrjfggrq wzt l hj d actually longer than this image attached my guess is this is some base or something but i have no idea what it is or how to convert the data to readable format in python any help is much appreciated,irregular spaces making pattern abnormal i have a pattern which i printed using below code code it prints the pattern below as output but my issue is with spaces when the n value is defined digit like the pattern is not printed properly expected output what changes do i need to make in existing code to print properly the pattern,0,63,65 when importing into google collab typeerror str object is not callable using pandas in google colaboratory i am attempting to import a csv file named gifted csv using the following code df pd read csv content gifted csv i have ran the pandas library as pd but whenever i run the code it does not function and the following error appears enter code heretypeerror str object is not callable,python how to only keep specific part of cells in a dataframe i want to cleanup a source column of my dataframe at the end i only want to keep the part behind name what is the best way to do this for example row column id rtl nieuws name rtl nieuws row column id none name desired outcome row column rtl nieuws row column,0,62,74 how do i get the previous second folder or the folder with a certian name i want to get a certain folder the name of this is certainname or it is two folder previous what i got what i want,is there any way i can correct my username with telethon hello in python telethon is there any way i can correct or create new my username using telethon i looked through updateprofilerequest but there is no username,0,40,38 how can i create a script to switch between my arm conda and x conda i am on an apple silicon m macbook pro i would like to have a native arm python environment and an environment that runs on x architecture with rosetta i have installed two mini forge distributions both in the home directory miniforge for the native arm installation and miniforge x for the x installation,cannot upload html image to a website however local file url works fine before you say that it s a duplicate please read the entire thing i have the following piece of code however it says i have looked at various answers on stack overflow including this and also a few websites like here and provided full directory and a image on img bb but it all did not work here is my file structure note in pycharm there is a way to open a local file url and it works fine but python manage py runserver doesn t seem to display any of the images,0,69,102 error trying to generate some faces and store in another folder i am trying to use transfer learning to train an image recognition model i want to generate faces in one of my folders into another folder this is my solution however running the code above keeps generating what am i doing wrong,remove all different string on dataframe using fuzzywuzzy i want to remove all different string from a dataframe and retain all similar string for example i have this data the store that we need to compare above is the first row which is mcdonalds with that we need to remove other stores and retain all stores similar to the store we are checking here is the expected output the process will continue until it checks the taco bell by comparing string similarity i am using fuzzy wuzzy library if we compare two string and it gives similarity ratio then we tag it as similar string but how can i filter out the whole dataframe using drop from two string comparison to filtering whole dataframe,0,53,124 euclidean distance in siamese network i came across a code for siamese network in which the euclidean distance was calculated as in this code why are we taking maximum of the sum square and epsilon,nuitka error main py can t open file gen py i currently have an error with nuitka which i am starting to use i want to compile my script including a folder and its contents here is the command i use python m nuitka follow imports enable plugin tk inter onefile show progress include data dir c users user desktop myprogram datas datas myscript py but every time i ended up with this error and i don t have it when i remove include data dir am i ordering incorrectly or is this another problem thanks edit you must delete the temp gen py folder it will be re generated and problem fixed,0,34,89 a way to blit multiple buttons from a list with working alpha and color i wanted to blit several button choices depending on the number that a list gives but putting them in a for loop makes the alpha and fill function stop working is there a way to fix this or there s a better alternative to code multiple buttons starting code button and scene class the rest of the code,pyqt close window on right click sends the event to application underneath as well i have this app where i was trying to close window on right click event although the event works and my window is closed but the right click is also sent to the app that is present below my python app and therefore a context menu if present is opened for that app for eg if i have windows desktop screen below my python app the context menu of windows will be opened this is what i have tried i have tried using wa nomousepropagation but that is also not working,0,71,104 discord py music bot stops playing hi im having a problem with my discord music bot whenever i play a song after mins it stops playing and goes cilent,azure digital twin python api created twin of model but cannot retrieve it i have succesfully created a twin of a model using the azure digitaltwins core digitaltwinsclient with the upsert digital twin method returning an object like below printed as dictionary however when i try and get this model using the get digital twin method i get the following error what is happening how can i retrieve the twin i created,0,30,65 how to convert mid to mp using ffmpeg i have mid mid file and want to convert in mp format but it shows mid mid invalid data found when processing input here is cmd i m using ffmpeg i mid mid out mp,python atributeerror io textiowrapper object has no attribute encode i m writing a code that sends emails to a list of mails from an xlsx file i want the body of the email to be imported from a separate html file but i m getting an encode error when it reaches line htmlpart mimetext f html io textiowrapper object has no attribute encode here is my code,0,39,64 google translate in python when using this code from i get attributeerror nonetype object has no attribute group and i was wondering what is wrong the error seems to be on the result tra line thank you for any help,does anybody know why this error occurs in the folloving code valueerror invalid literal for int with base n int input enter any number i wrote the following code but every time i submit it to hackerank com a mistake is popping out what should i do to solve this issue valueerror invalid literal for int with base n int input enter any number,0,42,62 why does this snippet of code return one answer but sometimes two new python programmer here i m trying to make a rock paper scissors game and i m wondering why this code returns usually one answer but sometimes two i m trying to make it print one answer for choices and one for choices many thanks in advance,unable to install behave i am trying to install behave in my system for bdd practice in python while installing it i am getting below error i have installed git please help me out collecting git cloning to c users admin appdata local temp pip req build zprf rz error error winerror the system cannot find the file specified while executing command git version error cannot find command git do you have git installed and in your path,0,57,71 unhashable type dict error in memoize decorator i m writing a memoize decorator but i get a unhashable type dict error when trying it on a simple example here is my code and here is a simple function created to test my decorator i end up with this error i tested just in case if my python was working properly with not in which resulted in the correct output true any help would be appreciated,how can i send a sms in django i encountered a problem when trying to send sms using the smsc service in django project my celery task for sending email and sms email sends correctly but for sms i get that error function from smsc library what am i doing wrong thanks,0,77,52 when running python code my voice is not recognized i use this code to take from a youtube video but it doesn t work for me i run the code say something and nothing happens the program just keeps running information that may be useful windows pycharm python pyaudio i use a laptop in the menu hidden icons shows that the microphone is used by python when i run my code in pycharm when i run python m speech recognition,authenticate a user from local linux host using python script i want to authenticate a user from a local linux host using subprocess i have used this code and i doubt login is the perfect command to do because login command prompts for password and i want to provide the password upfront login man if not login then is there any other linux command through which i can authenticate a local user this is the output i am getting as of now,0,78,83 eval and extract field with pd series for multiple columns hi i have a bunch of json ish strings stored in columns as shown in a and i would like to extract the form field i would like to do this per row for all columns i can get it to work per cell with the code below but i am having trouble getting it to work on a dataframe scale any advice is welcomed thank you for looking cheers,how to avoid auth page using google drive api with pydrive i m automating uploading files to google drive using pydrive i m trying to avoid the authentication page that shows google every time i authenticate with the api i ve read some blogs about it but i dont get anything clear,0,78,49 how can i define certain value to its key with equal sigma index i want to set the transition of start state s value with the key of sigma in dfa dictionary if the certain indexes of sigma equals with the value of transitions for example i want to set if sigma weach is the value of a in transitions then set the values of zero in a as value for key sigma,telegram bot api python telegram error badrequest chat not found i want to create a bot to post my texts to a channel can anyone help me with the code this is the code that i tried but i got this error telegram error badrequest chat not found also i tried chat id and chat id and chat id,0,75,62 valueerror input of layer sequential is incompatible with the layer expected shape none found shape none hi i have the following error i don t know how fix the next error the error happens only in the last part when i want to predict the next day my full code is this,how to upload a large data set to a list in python i m trying to make word puzzles like the nyt spelling bee there are letters arranged around one center letter you must spell as many words as you can with only those letters each word must include the center letter at least once and be at least letters long i want to write a python program that will allow me to find all possible answers by taking a list of all the words in a standard english dictionary then checking if each element meets the criteria of being an answer the program will then return a list of the possible answers i have an outline for the code and i ve checked that it works by manually entering a small word bank but i don t know how to upload data sets into a python program or where to download a dictionary data base,0,55,156 python and code cli not working after updating to macos monterey i updated to macos monterey and now python is not working but if i run i am able to run it but when running code for opening a project in vs code it gives the same error i am not sure what to do so that it runs commands like code successfully,how to save python result as excel xlsx this code below read txt files and print the results but i need save the results as xlsx i searched the internet but i didn t get any solution can someone help me the data format in txt files is like this them are registration data from images uploaded to an e commerce,0,65,59 typeerror send login mail got multiple values for argument email i am learning celery reddis and trying to send email through celery i have created a task in which i have encapsulated my send email logic i am calling the send login mail function and passing the keyword arguments using delay am i using delay wrong i have tried using apply async but still couldn t make it work p,how to fix protonvpn typeerror init got an unexpected keyword argument log dir path i am using linux manjaro kde plasma when trying to run protonvpn from the task manager it fails to start and does not give any errors when run using the command line it outputs the following i have tried restarting and rebuilding which has not changed anything,0,62,59 how the following conditional statement works can someone explain me how this code works i really appreciated,how to check if a number in a list is a perfect square i have to check if in a list numbers are perfect squares with true or false but it doesn t return me anything what did i get wrong i m new in python so sorry,0,18,47 dask map partitions fails when dataframe contains date field the following code fails saying that field date doesn t have the month attribute because date type is series when its type is clearly a date what am i missing error is attributeerror series object has no attribute month,how to make a multiple if statements more pythonic and condensed i am writing a piece of software that checks the input to a function before passing it to a database to do this i need to check the type of data before i send it right now i am using different if else statements how can i condense this and make it easier to read thank you,0,46,68 split a string by list of character positions suppose you have a string and character positions these are intervals which cover certain words within text i e coding python and fun respectively using the character positions how could you split the text on those words to get this output this is just an example but it should work for any string and any list of character positions i m not looking for this text i j for i j in positions,add hours to workday in python i need the following script to compute the working hours from am to pm so that if i add hours it will be added from am the next day example if it is now pm and i add hours and the working day ends at pm the output would be hours and hs so far the script computes hours regardless of the labor restriction,0,76,89 two lines from different dataframes in seaborn s facetgrid i have two dataframes df and df i need to plot two lines coming from each dataframe in the same plot i ve been able to plot the one line but i don t know how to plot the second line i have how do i add a second line which is on the same scale but coming from df to g,visualization data train and data test from train test split with seaborn i ve a data which has row and i split it with train test split i want to visualization my data train and data test using barplot like this example how to do that my data github,0,67,45 round up to the nearest multiple of python how do i round up to the nearest increment of say i have and want to declare b as taking a as an input and rounding up to the nearest,runtimewarning couroutine command call was never awaited command i m having trouble with the error is here is the full code if needed thank you for your answer,0,42,27 how to get every value of a key of a json file with multiple dicts how to get every value of a key of a json file with multiple dicts i want to extract every value of username key data json this is what my code so far but it gave me this error keyerror username main py,apply multiple lambda functions with parameter in pandas i am finding the indexes of some values above certain cutoffs in a pandas dataframe so far i have achieved that using a series of lambda functions i have attempted to parametrize a lambda function to an arbitrary list of cutoff values however if i use the following results are not correct as all lambda functions have the same name and basically only the last one is present in the dataframe returned by apply how to parametrize these lambda correctly what would be a pythonic pandasque better approach,0,56,96 how to catch a string based on a subsection of it i have multiple strings in a list each list is a link in a string format i have some strings whose style is the following mailto newsletter dcda dcda com some of these strings change in the part they have different addresses i want to find a regular expression that can capture the whole text based on the mailto part,matplotlib legend mapped with colour i m really confused about matplotlib in general i normally just use import matplotlib pyplot as plt and then do everything like plt figure plt scatter plt xlabel plt show etc but then i google how to do something like map the legend with a colour and i get all these examples that include ax but there is plt legend and the example in matplotlib documentation just shows plt legend handles but doesn t show you what handles is supposed to be and if i want to do the ax thing then i have to re write all my code cause i wanted to use plt since it s simpler here s my code now i want to add a legend that just shows the colours the same as it is in my dictionary but if i do plt legend domestic cheetah leopard tiger it only shows domestic in the legend and the colour is red which doesn t actually match how i ve colour coded it is there a way to do this without re writing everything with the ax thing and if not how do i adapt this to ax do i just write ax plt scatter,0,68,183 creating a discretized version of an array i have a list that describes a profile such as the next one i need to create a discretized version of that profile give a step of time dt for instance the firs column of dat would be i need to assign the second value of the second column of data so the new profile would be something like this how can i do this,typeerror init got an unexpected keyword argument providing args i am creating a django website i was recently adding permissions search functionality using the allauth package when i attempt to run the website through docker i receive the error message file usr local lib python site packages allauth account signals py line in user logged in signal providing args request user typeerror init got an unexpected keyword argument providing args what is causing this error i know usually a type error is caused by incorrect models py files but i can t seem to access this file since it is a part of an external package urls py models py my settings py that handles allauth full traceback,0,72,98 h py driver issue on qiskit nature drivers while using the ibm quantum experience whenever i want to install any driver an error with the h py appears specifically the error is using default file mode other than r is no longer supported pass the mode to h py file instead does anyone have any solutions to it not sure which version to revert back to thanks,data structures array problem cannot find the first repeating item i am new to data structures and algorithms and i have a problem we have two arrays and i want to return first repeating item eg arr arr in the above case first repeating item is this is the solution if we use hash table but what i need is the solution in array and this is what i am doing but the problem is that it is returning is repeating but it is not the first one to repeat,0,61,105 are bare threads reusable i ve been playing around with threads the other day in python so generally a minimal code with threads looks like this this example shows a thread which is created run and joined to the main thread but after it is complete t can t be started anymore what is the point of such behavior and can we reuse threads instead of creating them every time we need to run something,getting multiple outputs from my dictionary when i need only one im having a little problem with only printing the corresponding abbreviation that is stored in a dictionary this is my output i only need the entered abbreviation key value not all the abbreviation not found outputs i hope this makes sense,0,73,52 how to download all the href pdf inside a class with python beautiful soup i have around pages and each page contains buttons each button has pdf i want to download all the pdf s the program should browse to all the pages and download the pdfs one by one code only searching for pdf but my href does not have pdf page no to this is the website and below is the link,matplotlib error i got an error message as in below i would appreciate if i can get response how to solve this importerror cannot import name artist from matplotlib c users user anaconda envs tf lib site packages matplotlib init py,0,77,30 using datetime strptime with microseconds valueerror unconverted data remains i m trying to convert this date into str using the following code but i get the error valueerror unconverted data remains i don t know how to deal with the microseconds any help to use strptime with that date format would be more than appreciated thanks in advance,python insert dict into sqlite i have a sqlite database where the first column is the id and set as primary key with auto increment i m trying to insert the values from my python dictionary as such i keep getting errors my latest error seems to imply it needs an id value cur execute insert into scrap values value sqlite operationalerror table scrap has columns but values were supplied do i need to supply an id number this is the db schema,0,59,84 name get ade k pairs is not defined so i m trying to make function for preprocessing dataaset in semantic segmentation but it tells me that my function is not define whereas is actually define on there my code is like this when i run that it always showing nameerror name get ade k pairs is not defined whats wrong with my definition because sometime it can get run and sometime it can t,how copy method works in pandas dataframe when i have dg df copy in pandas dataframe i know i have two dataframes where dg is copy of df but for df df copy does the new df overrides the old df i mean in the ram for df df copy how many dataframes i have,0,66,55 error trying to use keyboard and mouse control methods at the same time with pynput i m having problems because controller names match for both mouse and keyboard so try doing this but it is giving me this argument error that if i used them importing directly to each one it would not happen,python nested data objects type validation with dacite i have a question regrading nested data objects as suggested in other post creating nested dataclass objects in python we can use dacite package to create nested data objects this works on handling the data that we nested dictionary structure however i have a data type check function and type conversion function associate with the dataclass a in the example where i use inspect signature a parameters to get the expected type of the dataclass and check if data are in the expected type can we also call the signature of class a from class b or is there any work around on this thanks the type current type check code is something like this,0,53,121 adding a row in a dataset csv file through using pandas in python i have tried append method the code is right but its not doing anything my csv is too large to open i cant physically add there so please if anyone can fix my problem pls answer code error showing valueerror found input variables with inconsistent numbers of samples,comma seperated values in columns as rows in pandas i have a dataframe in pandas as mentioned below where elements in column info is same as unique file in column id all i want to get list elements as row for each file like,0,62,44 pygame invalid position for blit i am trying to make a game but when i run the code the game makes enemies appear on the screen it says invalid position for blit however i don t know where to put the blit otherwise i don t know what to do because i m still learning the code was fine before adding the copies not sure why that changed anything this is the full code,how can i have pip ignore all of the sub dependencies of a single dependency in a requirements txt file i m using python s virtual environment python m venv venv and pip with requirements txt i need to use a package python particle which has a dependency on a very old version of requests i want to use a more recent version of requests or later but because python particle is explicitly calling out requests i get an error when trying to use a later version of requests is there a way to tell pip that the user requested version takes priority alternatively is there a way to tell pip to do dependency resolution for all packages except one things i ve tried setup py pip override one of the dependency s sub dependency from requirements txt but when i tried that i still got the error the version of pip that i m using is the error message from pip,0,72,153 pandas groupby percentage of total and add subtotals similar to this previous post i would like to derive the percentage within each group but based on the sum of multiple columns and add subtotals for example given the dataframe below the ideal results would yield update it would be ideal to groupby both state and office id for situations where there are repeating values for office id column here is an example this should then yield,use fitsio to rename a fits file extension in python i am using the fitsio library trying to create a new fits file insert a table from a dataframe df and change a keyword however when i do that my first extension has no name i cannot figure out how to change the extension name right now i am doing the following,0,76,62 is it possible to add this kind of default value to caesar cypher python here is a basic function call i would like to do as you can see below in the signature i would like to have the default value in s be the length of the string passed in for convenience is it possible to do this in python or some version of this,python datetime dataframe add some dates if there are lack of dates than i want i have two data files and both have different periods of datetime as you can see below the first date is from to and the second date is from to if i want to make the date from to and fill the blank as np nan what do i have to do in the code if you know how to do it or any idea please let me know,0,66,89 for loop variable classes how can i make it work so the i in the for loop can be added to sq i so i can create multiple objects called sq sq sq etc enter image description here,what is the difference between why does config not work for canvasses i was trying to make a gui using python using tkinter i wrote the following code when i wrote this there was no problem which makes sense because when changing the attribute of canvasses you use itemconfig however when i did this it didn t work with the error code being for other widgets like buttons or labels etc config seems to work perfectly but why not for canvas widgets why is the canvas widget set as an int with my limited knowledge i just can t figure it out thanks in advance,0,37,103 make first row and first column as column header and row index respectively in a dataframe i ve a similar dataframe like the one below i m trying to make the first row and column as the headers of this dataframe i ve tried with this this generates the dataframe like below is there a way to remove the index header nan here,multiple instances of unique variables in dataframe column i m working with a pandas dataframe and have a column of dependant variables called class which consists of three classes y n and p however when i run i get i opened up the dataset in excel and tried using the filter to see how many unique variables were in the column excel says there are only the dataset is available here if it s of any benefit,0,60,78 pandas merge two data frame only to first occurrence i have two dataframe i am able to merge by pd merge df df on column name but i only want to merge on first occurrence in df any pointer or solution it s a many to one and i only want the first occurrence merged thanks in advance,why do we need to pre process image datasets refer to this complete guide on how to use autoencoders in python notice the author add after they loaded the mnist data why do they divide the image data by and why after that why do they reshape a d matrix into d thank you so much,0,53,57 python mysql this use of cursors works but is it correct i have the code below which selects some data from one table finds related data in another table updates the data in the related table and deletes the data from first table the use of cursors below works but not sure it is best do i need to define a new cursor x db cursor each time like this,don t get data from soup i created bs web scraping app with python my program return empty list for review for soup program runs normally it isn t problem with class,0,71,29 how to diagonally split a matrix in four parts i want to split a matrix in four parts from a specific index on the illustration below the index is the white square and i want to obtain four list containing the corresponding square blue green yellow purple squares on the diagonal are included with the ones on their relative right how can i do that,i have to sort an array using insertion sort and using recursion without loops i have to sort an array using insertion sort and using recursion without using loops i have tried but it is not sorting anything here is my code output is same as the given array expected output is can anyone help me to find where the problem is,0,66,78 get on optionmenu tkinter python how can i get the get to get the value at the moment of the click on the button the value printed always stays the one i ve set by default,iterate and update through folder of json files and update value in python i ve struck out trying to find a suitable script to iterate through a folder of json files and update a single line below is an example json file located in a path among others i would like to iterate through the json files in a folder containing several files like this with various information and update the seller fee basis points from to say and save would really appreciate the assistance updated with an answer due to jcaesar s help,0,37,91 formatting the float for series float datatype when trying below code get the error unsupported format string passed to series float how to solve this problem code tried here df a consists of values and its dtype is float how do i rectify this format error please help,how to combine variables from a column in only one variable i m working with a dataset from which i had faced the following situation my goal is to combine the simmilar variables from this column e g round and round oval and oval in only one variable how can i combine they,0,47,51 how to create square of walls via wpf in revit python i start learning pyrevit and here s the trouble i want to create a wpf where i may enter values then revit could would automatically construct a simple rectangular building i have already create a wpf but i m stuck in part where i need to connect lenght s value interface with python code enter image description here,how to save one row from dataframe i have a problem with writing row by row to output from dataframe i write my own solution but it s too slow so maybe there is a builtin solution for this problem the goal is to write dataframe s rows separately to the output my code is it possible to make this faster thanks in advance,0,65,62 how to convert mid to mp using ffmpeg i have mid mid file and want to convert in mp format but it shows mid mid invalid data found when processing input here is cmd i m using ffmpeg i mid mid out mp,how to print the output of variables in a dataframe this might be a very basic question but i am stuck with it for quite some time now i have four variables with some values and i want to put it into a data frame i am using the below code but not getting any results please help code details,0,39,60 trying to extract a string value between dots from a string column im trying to extract a default string value from a string column but without sucess this is the column with some string values what im trying to reach this is my unsucess code and the result could you guys help me i have a kinda difficult with regex and it just blow my mind when i have to deal with it,how to filter a list of words as likely candidates for a secret word given that i know certain letters so i ve been really struggling with this problem first of all let s lay out the basic rules that this python program must follow lingo is a popular word guessing game show on television the number of letters of a target word to be guessed is given and often also the first letter players then make guesses subject to these restrictions number of letters and possibly also first letter and the game tells them which letters are correct and in the correct place marked by a red square x and which letters are correct but not in the correct place marked by a yellow circle o we do not use superfluous yellow circles i e a letter is marked correct at most as often as it appears in the target word if not all occurrences of the same letter can get a yellow circle this way priority is given from left to right but of course red squares have priority over yellow circles first i needed to create a function compare that compares a guessed word with a target word the two inputs are string of the same length that entirely consist of lowercase ascii letters the output is a string of the same length consisting of the symbols x o and where x represent a red square o represents a yellow circle and represents nothing examples compare health teethe must return ox o compare rhythm teethe must return xx compare mutate teethe must return o ox compare teethe mutate must return o o x now i ve already successfully solved this part but the next part is where i am stuck a function filter targets targets guess results must be implemented this function must satisfy the following targets is a list or any other iterable of possible target words all words in targets must be of the same length guess results is a dictionary its keys are guessed words which need not be in the target list whose associated values are their compare results with a possible target it must return a list of target words in targets that actually do satisfy all the comparisons appearing in guess results examples suppose targets contains all english letter words obtained using the aforementioned word list and load function let guess results contain the results of the first two guesses in the example given guess results health ox o rhythm xx then based on these results we can see which words are still possible filter targets targets guess results will return the following list depths peitho seethe teethe tenths now my current program looks like this it is very dirty code in my opinion and i would really love to see some implementations that are right this code also still doesn t do what i want it to my reasoning was that if i convert the word or words in guess results it must also be able to take a single input as my code hereunder is taking with the mem list function to the xo format then store all permutations of this format in a list i can convert the words in wordlist to the format too i would then check for every permutation in the list if it matches the xo format of any word in the wordlist i am looping through then store all matches in a separate list i would then return that list as an answer i thought i was getting very close with this logic but i now can t seem to permutate in a way the leaves some characters in place and my current implementation would only work for a single word input in this single world example filter targets dw kasgelden o oox should return doorspoel doublures hoofdstel moordspel schildjes slurfdier thuisduel woordspel with dw being all the words with a length of this problem is driving me completely crazy and has consumed three days of free time already i hope someone can nudge me in the right direction here english wordlist i am using dutch wordlist i am using,0,73,676 valueerror time data does not match format y m d h m i m new to coding and cant figure out where i m breaking the valueerror keeps coming up but i cant seem to figure out where i m breaking,explode function this is my first question on here i have searched around on here and throughout the web and i seem unable to find the answer to my question i m trying to explode out a list in a json file out into multiple columns and rows everything i have tried so far has proven unsuccessful i am doing this over multiple json files within a directory in order to have it print out in the dataframe like this goal instead i get this in my dataframe example of the json i m working with the json structure will not change my end goal is to get the dataframe out to a csv in order to be ingested i appreciate everyone s help looking at this using python pandas python code below,0,36,133 can i use only try method in exception handling in python without use exception as e anyone can tell me about only try function is possible in exception handling in python because i want to use only try function not exception method,so i want to use ffmpeg with heroku but i keep getting the error that i dont have ffmpeg installed so i made a bot for fun on and its okay when i run it like on replit or my local pc but on heroku it wont work i did add the heroku s ffmpeg to buildpacks but it still give me the same error also the codes are available at github,0,42,73 how to draw semi infinite line ray in matplotlib we can draw infinite lines from a given point with given slope in matplotlib with plt axline is there a clean way to draw a semi infinite line or ray from a given point in a given direction preferably without having to calculate the axis limits for axhline and axvline we can use one of xmin xmax ymin ymax arguments to get a ray but axline doesn t accept these related questions,not able to scale the roi in opencv python i am trying to build a program that detects hand movements in a selected region of interest but the rectangular selection i perform does works or it gets unscaled the hand detection also starts working randomly at a few points any help would be appreciated,0,78,54 discord py client get user returns none with user id i keep getting a attributeerror nonetype object has no attribute send exception when i run this code i have tried the similar questions and they did not work,update legend when adding data to existing plot pandas i ve written a small python code to read covid statistics from ourworldindata org and plot a certain data series for a certain country it works as intended and plots the number of new cases in norway as a function of date in the example above if i change country and rerun it it will plot a new curve for the new country with a different color in the same plot which is what i want but there s a problem with the legend it shows the name of the last plotted country but the color of the first plotted country i would like it to show both with the correct name and color how can i do that the link shows a figure with the result when first plotting norway blue curve and then denmark yellow curve plot of new cases in norway and denmark,0,35,152 what data types can be exported as attributes when exporting to graphml with networkx i have a networkx graph with some list and dict attributes that the function nx write graphml doesn t accept as valid type for the export i couldn t find a function that would automatically ignore those attributes so i decided to create one myself i know that int float and string are accepted but i don t know if there are others and if so which ones,scrapy is ignoring part of the text i m trying to scrape text from websites using scrapy and build a dataset of text and some of its features for each element containing text i m saving the text itself element type and some other things it works fine for the most part but it s not scraping part of the text which follows nested element s input example output just an example in reality the output is saved to csv expected output just an example in reality the output is saved to csv part of my code responsible for scraping text how do i get second part of the text expect that an element can contain multiple nested elements and text itself can be split in more than just parts,0,77,127 append string to empty pandas column in a for loop the code uses an ocr to read text from urls in the list url list i am trying to append the output in the form of a string txt into an empty pandas column url text however the code does not append anything to the column url text when,connect python to mysql database how can i connect to mysql but my database is not localhost here my env i try to change the host to,0,56,28 error while saving optuna study to google drive from colab i can save a random file to my drive colab as works fine but when i use the official documentation approach of optuna using the code throws an error as,python function not accepting arrays as inputs this function works well with a single input as seen in example but when i want to run it using arrays as inputs it fails as stated in example i don t want to use a for loop to calculate the function for each element of the d l and b arrays because it is slow what i want to do is that the function has to use i th element of each array of d l and b as an input and calculate the results and give the results as an array which has the same size d l and b in the example the result should be a element array which is array but it is not working as i expected example gives valueerror the truth value of an array with more than one element is ambiguous use a any or a all,0,40,153 can you set a different json for every users in locust so i have a scenario for a load test where each spawning user post a different json in this case i spawning user this is the example json for post where site code should be different for every request and here is the example for implementing the task for each users how can i achieve this with locust,python pandas dataframe merge join tabels on different keys i have tables of following form my aim now is to merge all tabels together i would go the following way step merge df and df the result is ok and gives me the table in next step i want to merge it with df so i did make a step between and merge df and df my problem now the output is the column isin here is lost and the step produces an error is there an elegant way to merge this tabels together with key column isin and why is the key column lost in the second merge process,0,70,112 python selenium proxy doesn t change ip address i m trying to change my ip address in order to bypass crawl social data using this code but it doesn t works my ip address remain the same any sugesstion thanks a ton,how to output this json which is in the format below in discord the code works by the user inputting on discord cryptoupdate bitcoin i want the program to output the following without the speech marks and curly brackets click here for json response output on discord code,0,39,48 pil image save convert does nt maintain rgb color i am trying to save a numpy array as rgb image using pil image save but it the saved image is not rgb how do i save the image as rgb i am receiving the image as numpy array the link to original image the link to image saved by image save,praw why does this recursive function to check if a url is an image return none i wrote a recursive function to detect whether or not the url of any given post contained jpg or png but if it doesn t find an image on it s first try it returns none if i put a print statement in the function right below the submission it does print out but the string doesn t seem to exist when i try to return that value my goal is to write a function that will always return an image url also i am writing this for a discord bot so if i should be using async praw let me know thanks,0,56,117 i can t install the numba package via pip enter image description here i can t install the numba package via pip i want to install the numba package but an error appears every time,psql sqlalchemy paginate jsonb array i have a model which includes jsonb column result structure is following i have the following query this query returns all rows inside result and i need to include pagination here how can i do this,0,33,41 how to create a simple rest api web application with python we can make rest api application with spring boot by start spring io web site easily anyone know any good website through which i can get the skeleton rest api project with python my intention is to make rest api application with python,kubernetes create a persistent volume and use in my django app i wouldd to create a persistent volume on my kubernetes gcp cluster and use it in my django app as for example media folder on my kubernetes side i do first create a volumes claim then in my deployments yaml i create a volume and associate to the pod then in my django settings here my dockerfile when i apply volume claim on my cluster all was done volume claim was created but whe apply deployment yaml no volume was created for the pods also if i connect in bash to my pods no folder test files exist how can i create a volume on my deployments pods and use it in my django app so many thanks in advance,0,52,128 django pluralize person as people trying to output the correct plural value in django template when count is more than p review markers helpful count person reviews markers helpful count length pluralize found this helpful p still returns persons or persons instead of person and people any help to fix this in the template,pandas sort dataframe correctly with german umlauts upper lowercase and numbers i have this dataframe all strings i want to sort it so that german umlauts are correct also lowercase and numbers are correct here is my code to generate the dataframe and result the result is almost correct but the numbers are sorted in the wrong order should be before how can i fix the number sorting while maintaining all the other characteristics,0,52,75 can i let the field in the html to have a specific layout when this value is not the default values i made some fields useing django as models charfield and set the default values to default i also made the html tamplat to show the fields so can i let the field in the html to have a specific layout or text effect when this value is not the default values default modeks py html,sorting a dataframe in pandas i m starting with this dataframe i d like to sort it to find unique authors with unique books and i want to exclude co authors so the result would be the following dataframe i can t figure out how to do this any help would be appreciated,0,74,49 count number of items of an array exist in another array suppose we have an array a and a set of arrays in b what s the fast way to find how many items in a exist in each row of b for example if i have so i should get c,how can i add weight in adjacency list in python i want to add weight to the adjacency list my code is given below for the graph i want to add pair to the list but i don t know how to do it i am new to python i want to take input like a b where b is the destination and is the cost,0,55,67 is there an api to add remove delete notes for microsoft sticky notes i am using microsoft sticky notes and i want to create a script that can sync these sticky notes with my google keep notes although i haven t found any way to do this programmatically and i m not sure if this is even possible especially as it is a uwp app,does python provide a synchronized buffer i m very familiar with python queue queue this is definitely the thing you want when you want to have a reliable stream between consumer and producer threads however sometimes you have producers that are faster than consumers and are forced to drop data as for live video frame capture for example we may typically want to buffer just the last one or two frames does python provide an asynchronous buffer class similar to queue queue it s not exactly obvious how to correctly implement one using queue queue i could for example although i don t particularly like that produce is not a locked queue atomic operation a consume may start between full and get for example and it would be probably broken for a multi producer scenario is there s an out of the box solution,0,64,132 using python how to change dimensions and aspect ratio of svg file iam trying to change the dimensions of svg file in python using the following code however the aspect ratio is being kept according to input file how do i resize an svg in python according to new dimensions newwidth x newheight and their corresponding aspect ratio newwidth newheight,decide duplication in a set only if the first element of a tuple element of the set is duplicate i m creating a dictionary where the value is a set compose of multiple tuples a set create unique elements if both element of a tuple are found duplicated in another tuple but i want to be considered duplicate if only the first element in the tuple is duplicate so in the case above because the first element is duplicate should be,0,57,79 copernicus dem xarray select nearest lat lon with multi dimension coordinates this question is related but somehow i still need some help to get this to work xarray select nearest lat lon with multi dimension coordinates i have tried using cartopy but this fails the documentation mentions that the copernicus dem instances are available in geographic coordinates the horizontal reference datum is the world geodetic system wgs g epsg but i do not know how to use this information,is there an specific way to treat error in loop python i found a notebook but i stucked at this point in loop through track uris and pull artist uri using the api then use artist uri to pull genres associated with that artist store all these in a dictionary source,0,76,53 find the string from a list that contains multiple patterns i want to return the third element in str list because it contains both charlie and good i have tried but this seems overly verbose to me more elegant solution please based on the answer and comments below we have next s for s in str list if all m in s for m in matches it s obviously faster however marginally and neater,how do you rotate ursina entities around their local axes i cant get my code for rotating a d object around its local axes to work correctly im using the ursina game engine the d objects that i want to rotate extend the entity class which has a rotation property thats euler angles i learned via testing that ursina does euler rotations in the z x y ordercorrect me if im wrong i didnt find the euler order in ursinas documentation the code multiplies the objects current rotation matrix with the matrix of the new rotation around local not global axes to be applied it doesnt rotate properly i tried swapping the order of the matrix multiplication changing the euler orders and using scipy spatial transform rotation apply instead of matrix multiplication but none of these worked what did i do wrong in the rotate method,0,69,140 how can i sort for every word in a string for every string in a list for starters i did this text hello i want to make this code better x text split sorted characters sorted x sortedword join sorted characters print sortedword i want the code to do this but i couldn t figure out how to seperate words and every string in list example i like python i like reading books output should be i eikl hnopty i eikl adeginp bkoos,issues adding variable to getwindowswithtitle so i am having issues with getwindowswithtitle function from pygetwindow when i ask for input before the getwindowswithtitle call i get the following error if i comment out my input call the getwindowswithtitle works just fine the following is my code so far i am trying to get input to choose which window to select but even putting target in the getwindowswithtitle it gives me the same error does anyone know why i am getting this error after putting in my input,0,79,87 unable to run pytest command using bat file but same command is ok in pytest terminal i m using this command in pytest terminal and it is running fine pytest v s m sanity or regression or functional html reports report html testcases browser chrome capture tee sys but same command when i saved to bat file and run as administrator it giving error as unable to import wedriver manager attaching both snapshots run bat not ok pycharm terminal ok,how to use loops with playsound in python i am making a morse code program so i need to use loops with playsound module to play the short and long beeps again and again the files are playing properly without a loop but when i add a loop i run into an error,0,74,53 why settingwithcopywarning is raised using loc i have checked similar questions on so with the settingwithcopywarning error raised using loc but i still don t understand why i have the error in the following example it appears line i succeed to make it disappear with copy but i would like to understand why loc didn t work specifically here does making a conditional slice creates a view even if it s loc edit pandas version is,django not showing images in editor error i m try create post and add to this post images and i m use for this django summernote in django picture upload to folder on hard disk but not showing in editor console show error please give me advice how to fix it thank you settings py urls py models py screenshot from console,0,77,59 how to pcolormesh rgba array with d x and y i have a rgba array img with d x and y like this according to this question we can pass any array to plot and set the color using img however it just changed the edgecolors i want to show it like axs imshow img,gitlab job randomly failing with selenium showing white screen i m running simple selenium test on gitlab ci free tier sometimes i get failing job because elements where not located after taking screenshot it appears that page is displayed as white screen after running failed job couple of times it starts working it is very hard to reproduce because it is quite rare how can i get more info what kind of issue it is some memory problems with runners or other example selenium script edit how it looks like when running job couple times logs contain standard info when title will be not found i experienced this problem on different pages servers repositories possible issue is lack of memory on shared runners so maybe usage of below option can help but is not possible to test it due to randomness of this fail ci script image used for testing edit using wait is not a case here tested for sec with this random bug the page is not loaded at all title element is not available currently i m trying find some clues with logging,0,53,184 how to replace string in dataframe on specific column and row in this dataframe i want replace zw or zw to i mean delete it at one data row index is p column is countries i searched about it but i can t find any method to set column and row i found something like but this method remove all zw in countries column desired result is not desired result is,join hashtag list python give a single letter hi guys i have a problem i did a twitter scraper work for my thesis inorder to obtain some texts and hashtags to process so the problem is the seguent in the hashtag column i have all rows such as now in order to cluster this text data i wanto to join all rows into one in order to have something like this so because of these hashtags are in a pandas column called hashtag to do what i want i used this line of code but in this way i hadn t the rows as i expected as i wrote but i had what i have to do in order to obtain what i want thank you for the time spent for me i apologize for the stupid question have a good day,0,70,141 making a program than would ask the user for an integer then will asked if they wish to loop or quit,how to create an iam policydocument with multiple statements using cdk python i am trying to write a iam policydocument with multiple statements using python in cdk but i couldn t find any examples anywhere this is what i have in yaml which i am trying to write in cdk using python i wrote the following for based on the yaml but it is giving me errors any help for this is highly appreciated,0,21,73 why have been the selenium python api documentation taken down partially what happened to the selenium python api documentation is anybody aware why the selenium python api documentation has been taken down partially,how to stop the sound in pgzrun pygame zero when my game ends the sound plays right now for eternity and i only want it to play once when the game ends i ve looked it up everywhere but i really cannot find any good and helpful solution to this problem i use pygame zero here is my code for my game,0,33,61 take subset from dataframe based on multiple str patterns i have a pandas dataframe df from df i want to take a subset if either flsa w gk or flsa w fcm is contained in the df model for only one string i would do it as follows the approach below works but seems too lengthy is there a way to do this using fewer lines of code,unable to download file from url using python i am trying to download the file from the url i tried using the python requests library but the request just timed out i tried specifying the user agent from my browser as a header but it still just timed out including when i copied across every single header from my browser into my python script i tried setting allow redirects true this did not help i ve also tried wget and curl everything fails apart from actually opening the browser visiting the url and downloading the file i m wondering what the actual difference is between the requests in my browser and the python requests where i set the headers to match those in my browser is there any way i can download this file using python code snippet,0,63,135 how can i make a method available only from within the class good evening i need an advice googling i couldn t find a proper direction i need to make a method available only within the class i e other methods or functions if called from the program as a method of the object referring to the class i want attaching a screenshot to make it more clear any advice is appreciated thank you screenshot of the problem,create a custom signal filter in python scipy i am trying to implement the following filter using python and scipy i already know how to implement basic filter like this however the filter at hand is much more complex and i don t know how to attack the problem thanks,0,76,50 is there a way to list super primes between and n in numpy is there a way to list super primes primes in a prime position wikipedia article between and n using numpy,cloud function cannot import name storage from google cloud unknown location why am i getting this error this is my requirements txt and my main py it works completely fine in my local machine terminal when i execute my code but why is cloud function complaining about my user code,0,35,47 pycharm doesn t recognize python how do i configure it when i use the python version it is recognized as python in pycharm and this is a deprecated version my os is windows i d to like to know how to fit it i got no answer on the pycharm issues,cant get values from other class in python i try to use value from txtbox in window in other class by click button in window i tried more than ways but still not wroking how can i get values of txtbox in window when i click button and get run callstock and in callstock first i get value of textbox from window note code works fine when i set value example but i cant get that value from class window,0,53,82 how does a sieve of eratosthenes work in this code i need some help explaining the sieve of eratosthenes below i copied it from some other stackoverflow page but i do not understand it line by line can someone explain this i especially do not get the range i i part why are there three attributes in one set of parentheses also why is i squared thanks,tensorflow variable has no trainable parameters i m using a keras lambda layer to make some operations with a tensor of trainable weights or at least it should to do that i choosed a tf variable as parameter but despite trainable true the summary shows trainable parameters independently from trainable true weights remain non trainable an alternative option would be using a layer like in this case i have troubles in the custom func due to tf math multiply which does not accept at least according to my experiments the dense layer params in any way i tried get weights and variables every solution to obtain a trainable weight tensor is very welcome thank you in advance,0,65,109 i created a virtual environment in my editor but when i wanted to activate it by this code kivy venv scripts activate editor gave me error message the error message was cannot be loaded because the execution of scripts is disabled on this system please see get help about signing for more details can you help me,django list select related gives me this error store admin py store models py error i got systemcheckerror ps i know i can use collection in list display directly as it is already a field in my product model but i want to preload a related field table using list select related and use collection title in list display please help thank you errors class store admin productview admin e the value of list display refers to col lection title which is not a callable an attribute of productview or an attribute or method on store product,0,54,80 having problem with the usage of driver find element by selenium i am trying to make a bot that auto logins to a website in order to write the username i m trying to use when i m looking that spesific variable from website on inspect the varible is two word like matinput formcontrolname on any other website if that varible is one word like id i simply write id after by and it works what can i do in this situation,cannot import name registermattype from cv cv i got below error message when i run model main tf py on object detection api the weird thing is i run the same code before it worked well but now it gives me an error,0,79,39 python convert signed int to bytes this code works fine but when i change an int to i get the following error a bytes big an int to bytes big overflowerror can t convert negative int to unsigned how can i convert signed int without getting error,convert python string to latex formula i did try to use sympy for converting strings containing math equations to latex code and display these equations as an image for example i did try to use sympy on this does not work in sympy at least for me this will work in sympy at least for me maybe someone s got a hint how to change the following to sucessfully embed my equations inside a gui i got the function to generate der image from stackoverflow can t find source on stackoverflow right now but you can find it here thanks for helping to add source on github by tonyseek my problem is the way iam using sympy obviously i do use it the wrong way any recommendations are welcome,0,43,129 accesssing corsair com with python selenium is it possible to access with selenium in python without getting blocked by corsair when i try to load the page in selenium it keeps giving me this error message what i tried to bypass it is changing the user agent to a random one which didn t fix the issue this is my code,python pandas equivalent to r s group by mutate and ifelse probably a duplicate but i have spent too much time on this now googling without any luck assume i have a data frame i want to group by letters take the mean of numbers if all values in boolean have the same value in r i would write this would result in the following output how would you do it using python pandas,0,59,74 how can i send a sms in django i encountered a problem when trying to send sms using the smsc service in django project my celery task for sending email and sms email sends correctly but for sms i get that error function from smsc library what am i doing wrong thanks,identify lines of speech which contain words from a list using pandas i have the following dataframe and the following list which contains keywords i would like to generate an output which shows both the speaker and line no associated with them for each time their speech contains at least words from the keywords list i have tried iterating through each line in the dataframe to see if there was at least keywords present however my code only returns the last line below is the code i used the expected output for this particular case should be in a similar format whereby the first value is the line no which contains speech which has at least keywords and the letter is the person,0,52,126 output of a layer with weight argument in tensorflow is there a way in tensorflow to compute the output of a layer while specifying the weights something like y layer x weights w the final purpose is to compute the gradient of some function of the weights w mapsto layer x weights f w however automatic differentiation does not seem to work with layer set weights,why are the variables inside my env file resetting to the original file even after changing it from inside my python script i m trying to implement a checkpoint mechanism for my original script with the following structure my env file while this method is working inside a windows machine localhost it is not working on my ubuntu server that is if my code fails somewhere on the checkpoint i should be able to rerun it from that point only for example if code fails at checkpoint windows machine ubuntu machine also i am using try and except to catch failures from the code then exit system if there is any using i can use a config json to set these from time to time but i really wanted to know why this is happening,0,62,134 how to update button text on tkinter python button not defined error message i am trying to update the button text on a tkinter gui learning tkinter but am coming up against a small problem i am getting a button is not defined i am sure i am missing something stupid,start anaconda from specific env having trouble to start ananconda from particular env i use zsh shell on macos monterey,0,51,20 how can i sort a nested dict by multiple criteria for values and keys i have a nested dict in python that i want to sort in the first step i want it to be sorted by points if all the points are equal use wins if points and wins are equal it should be sorted by the team names like brazil morocco etc my dict is the output should look like this,calculation of floating weights based on weight and return dataframe i have two dataframes returns and weights and i try to combine them to a floating weights dataframe the idea behind this is that i want to dynamically adjust the weights in period t with the return in period t so the weights increase if there are positive returns and vice versa here i created a simple example the floating weights dataframe is based on the normal weights adjusted with the returns from the previous period floating weights k w start with normal weight floating weights k w floating weights k w floating weights k w the floating weights would look like this for reproducibility thank you very much for the help,0,73,141 pandas assing a full dataframe to a subdataframe i need to assign a full dataframe to a part of another bigger dataframe based on some conditions so i have two dataframes the first lets say and what i want to do is something like to get in df the values of df the result that i get is that the rows of df wih a became nan how can i fix this issue thanks for the answers,integrate js scripts on streamlit i am trying to integrate my medium profile on a streamlit app using the below code snippet generate through but looks like the tag is getting ignored any idea where i am going wrong,0,79,40 how to populate a dataframe column based on condition met in another column i was wondering how for the following dataframe can make a new column for example b and for each row define if its value is a x a between a between or a x i tried the following code but it didnt work,django unable to add wysiwyg i am trying to implement wysiwyg on my page with this link i am currently at point when they want me to add below but when i added above i got below error message i am attaching urls py do you know why i am getting pasted error message,0,56,56 receive a message from mqtt whilst simultaneously using a timer the project needs to have the light come on and stay on minutes after the last on signal given by a motion sensor my main problem is the logic in receiving the on message while in a loop to restart the timer kinda new to python so here s what i ve got so far,why is this float conversion made i have this dataframe an integer value from an integer column is converted to a float in the example but i do not see the reason for this conversion in both cases i assume i pick the value from the selected column from the first row what is going on,0,64,56 splitting value from one row to other rows in the same column in pandas i have a question regarding to pandas i have got a dataframe df now i want to split the from the first row into equal amounts where the taskid and userid is the same this is what i would like to receive i couldn t find anything here on stackoverflow thank you,open website in python with url parameters i m new in python an i try to open a webbrowser with an url and some url params my plattform is a current version of raspberrypi os with python example but now the webbrowser opens i tried and in the string but nothing worked for me now my question how can i open an url with url parameters it seems like the python webbrowser is parsing my on the wrong time thanks for your help edit just to make it clear i want to open a new chromium window with this example link the python script just calculates some url params for the website edit the problem was that the html file was on my local filesystem i forgot to add file in front of the path better example woud be wrong correct,0,71,147 python iteration to show specific data only how can i iterate in d list the output will be the rank and its corresponding name for mythic only,how to infer and convert dtypes in pandas dataframe here is my sample dataframe i would like to convert the dtypes to boolean in column a and b string in c and integer in d and e i am trying to use panda s method convert dtypes but it returns string for every one how can i automatically convert the types df convert types dtypes gives,0,27,61 sorting hash numbers in using matrices in python i m working on project to check for copies between two drives and i got stuck on sorting the output i have now is filename hash location in two list called drive and drive the output id e like to end up with two text files with a list of the files that aren t in the other drive i m not sure how to go about this maybe i should use dictionaries,subtract one column by itself based on a condition set by another column i have the following data frame where time stamp is already sorted in the ascending order i want to create a new column in the above data frame that shows the time difference between each row s time stamp value and the first time stamp value above that row where indicator is not nan immediately above row where indicator is not nan below is how the output should look like time diff is a timedelta value but i ll just show subtraction by indices to better illustrate for example df time stamp df time stamp we can use a for loop that keeps track of the last nan entry but i m looking for a solution that does not use a for loop,0,78,133 pyyaml how to set a default representer for non standard objects is it possible to specify a default pyyaml representer for non standard python objects how to instruct pyyaml to use a default representer for all non standard objects for instance i would like to invoke an object s str or repr method iff it cannot be represented safely,copying files between folders of jupyter notebook i want to copy files from one folder inside jupyter notebook to another folder for example there are some ipynb files text files excel sheets folders hi now i have created another folder named hello and want to copy all the contents of folder hi inside jupyter itself so what will be the desired path to copy,0,55,65 retrieve geographic information via an api with python i am a beginner in python i m trying to create a dictionary in a json file that i created before this dictionary must contain the geometrical type of the elements that i retrieve via an api i tried with the following code but i have the following error message the api looks like this the error i have what should i do,redis get stuck indefinitely i am trying to connect to remote redis server using python for that i am using version redis but when i print redis get it is stuck indefinitely below s the code snippet this is working now had to add ssl true for my remote connections,0,72,47 how to create pie chart using html and css and send to in email in django templates i want to create pie chart using highcharts js and attach to email but when i send email charts not render can anybody help me to render chart in email attachements,how to use proper container in python for the following code i would like to use a structure in order to not have to give values for each element min and max and also i would like to have a container if exists to can give one value and the other one to remain none for instance power to have only min element so for power to have a container with elements for min and max and same for temperature how is that possible in python please help thanks,0,47,92 issue with object programming and files i was trying to write a code and check it with pytest i thought i did everything ok but i got a problem after writing this i want to check it with method of class person when i tried to use method id the function ends and i got the output my code example of line of people txt,i have a text file i want search phrases like this format or with punctuation or like in jumbled word format i use python x any python library test txt personal information and demographic information on the service we may ask you to provide us with certain categories of information such as personal demographicinformation which is information that identifies you personally such as your first and last name e mail address mailing address and payment information including credit cardnumber personal information and demographic information such as information about your gender children occupation education level and grades you work with ifyou are a professional educator demographic information we may collect this information through various forms and in various places on the service including accountregistration forms contact us forms at checkout when ordering products or when you otherwise interact with the service to the extent we combine the non personallyidentifiable demographic information with the personal information we collect directly from you on the service we will treat the combined data as personal information under thisprivacy policy phrase personal information and demographic information info i want to search the above phrase in this text file in this text file those phrases may be same to same or in with punctuation or in lower or upper or title or white space between words or without space or jumbled word requirement it returns output either those below phrases or position of those phrases or its return true or false personal information and demographic information personal demographicinformation personal information demographic information demographic information personallyidentifiable demographic information personal information personal information,0,64,264 how to regex match list of patterns in python i have list of patterns and i need to return that pattern if that is present in the given string else return none i tried with the below code using re module but i am getting only null in matches when i tried to print matches completely new to corepython and regex kindly help,how do i hierarchically sort urls in python given an initial list of urls crawled from a site i am trying to turn the list into a tab organized tree hierarchy i ve tried using lists tuples and dictionaries so far i have figured out two flawed ways to output the content method will miss elements if they have the same name and position in the hierarchy method will not miss any elements but it will print redundant content i m not sure how to properly do this and my googling has only turned up references to urllib that don t seem to be what i need perhaps there is a much better approach but i have been unable to find it my code for getting the content into a usable list this gives a list to manipulate but i ve run out of ideas on how to output it without losing elements or outputting redundant elements thanks edit this is the final working code i put together based on the answer chosen below,0,62,171 i want download files with python using wget ftp but error occured please help to download i want down load ice nc files in ftp so library adress and file list loop for download but error messege occured like this valueerror unknown url type ftp ftp jan hycom glby t ice nc could i get some help,create sub list from list of dictionary and update values of dictionary i have a list of dictionaries and i am able to create a separate list of dictionaries based on sequence key however while creating the sublists above if there is a duplicate tag present with different options for example tag a in these cases i want to randomly select only dictionary and update that dictionary like below hope i am able to explain the problem any help is appreciated or if i need to rethink my approach of breaking down my original list,0,48,95 python returning that number input is incorrect but it is correct i ve made a python program that chooses between a random number or letter the user then tries to guess it but when the program chooses a number and the correctly guesses the exact number it returns with that the number the user inputted is incorrect this is my code is there any way to fix this thanks in advance,i installed brownie and after installation when i tried to see the version of it i ran into this error i am using macos if that matters importerror dlopen users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so symbol not found pygen send referenced from users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so expected in flat namespace in users local pipx venvs eth brownie lib python site packages cytoolz functoolz cpython darwin so i tried pip uninstall recordclass and re install it but couldn t fix the problem,0,70,57 how to equal an input with a list element why do i keep getting false even if the input was in the list,count the number of lists containing specific element in a nested list with mapreduce i have a list of lists containing strings and i want to count in how many of those lists each element appears so cow appears in lists dog appears in etc for such a small dataset i would normally do and thus however i want to do that for a large dataset using pyspark and mapreduce so that for each element in the list of lists i would have the above counter value etc i am trying things like with no effect,0,23,98 pyqtgraph stacked bar graph i have this set of data i want to draw a stacked bar chart in pyqtgraph similar to this one drawn in matplolib i have checked pyqtgraph bargraphitem documentation but i didn t find any information regarding stacking bar,how to iterate through methods of instances to get a representation string i m trying to make a pension tax calculator and have created a class client that will accept inputs from two separate users and calculate their taxes based on these inputs is there a cleaner way for me iterate through each client than to repeat this code if anybody wants the full code or if it s relevant,0,41,68 i want add my simples list in list of comprehension in python i have two lists of values and i would like to create a list which could be seen as a x matrix where the first column is my the values of my first list and the other column is the values of my second list here are my two lists,restart release rfcomm for bluetooth communication i am trying to connect raspberry pi to my galaxy note to use it for serial communication i have somewhat succeeded at that first i paired it and trusted through bluetoothctl then i run sudo rfcomm watch hci and opened with cat dev rfcomm i was able to connect to raspberry pi using bluetooth terminal only this app every other one failed and strings sent from galaxy would be shown in the cat window i have somehow messed up later and now running sudo rfcomm watch hci gives me can t bind rfcomm socket address already in use i can t release it with sudo rfcomm release hci or sudo rfcomm release as it then gives me can t release device no such device likewise cat dev rfcomm too now gives me no such file or directory i killed the process listed with sudo lsof grep dev rfcomm this had no effect on my ability to use rfcomm reloading with systemctl daemon reload and restarting with service bluetooth restart too has had no effect i can still scan for other bluetooth devices and i can connect to raspberry pi with bluetooth terminal but it seems rfcomm is gone i am aware that rebooting can solve this though i would like to do that programatically if possible without having to resort to power cycling thanks for your help,0,63,226 is pythonw exe an external application using python notepad launches but if i try that with pythonw exe idle doesn t launch but the exit code is also not sure why is it because pythonw is not an external application how can i launch idle from the interpreter i apologize not sure how to include code properly many thanks,logger name missing when enabling cors in my python app using flask i m trying to get cors working a workaround works however not on all api s so i would like to have the regular way of working working which is now having me stuck here already for a while i tried initializing cors like this which gives me the following error return logging getlogger s cors app logger name attributeerror flask object has no attribute logger name the complete error is when i remove the cors flask app everything is fine except for the cors issues i would like to fix this is my complete app py using google cloud platform could this be the key to my issue my app yaml is i will try to see what happens locally maybe it s solvable easier here thinking about when re typing the question here already updated my flask cors flask cors tried a lot of things nothing worked hence this question help is much appreciated thanks,0,59,154 why height parameter is not working in label widget pycharm showing me to remove the attribute height it is not an option,rapid selection of points from large numpy array minimal example my co worker and i are attempting to increase the efficiency of the above point selection there are many very large matrices generated and from these matrices there are many specific points that must be pulled out in the above code the first point that gets selected is list list list this continues on until the end of the much larger lists is reached is there a vectorized approach to this a way to avoid using for loops as this particular operation must be performed many times or pretty much any way that is more efficient than the above for loop,0,22,106 if add new blog in database than sent mail to all subscriber to notified current blog in django note add new blog only admin panell model py and it s my subscriber table add new blog in blog table than send mail to all registerd user in subscriber table,changing column label python plotly how to change column titles first column title should say year and nd column title year i tried using label but kept getting an error,0,48,30 save variable in pc python i want to save a variable user input fo mail in pc because i don t want it to ask to login again and again so please help me with how to store email variable in pc and also how to access it thank you,how to add a download path to gui application in python tkinter how would i add this download path to my gui application in tkinter that i am making using python to this,0,49,33 python selenium find element angular printscreen i tried to read this line but it doesn t work does anyone have an idea how to do this,turning a xml file to a data frame i have found a relevant data set about german politicians but i m new to the format it comes in xml with a belonging dtd file i m used to working with data frames and i ve tried different packages libraries in r and python to convert it into a df without any luck has anyone here worked with these formates before and can point me in the right direction thanks a million in advance the most promising solution i have found yet in r is it returns all of the variables divided into the correct sections but i can t turn it into a working data frame here is an extract from the data frame below this is the data from the dtd file data from the dtd file,0,27,133 change url formatting in jupyter python hey im trying to change parts of a string first is the last char second in the mid of the string nkw will be cat sport elec pgn there is loops because i want to run on the first cat n pages than go ahead to the next cat n pages thanks typeerror not all arguments converted during string formatting also tryied cat str count,what is the usual approach for things like this python multithreading i have the following code do task is basically a method which process some i o operations and i want to to execute it in parallel for each obj in self objs list i want self do final task to be executed only once all the threads finished their job my code works however it is very ugly and immature it seems is there a more elegant way of doing so,0,77,75 python requests urllib exceptions protocolerror connection aborted i am newbie to python i am trying to extract data from api s i tried extracting data in my local using postman and it extracts the data but when i use python requests i am getting connection aborted error can someone please help me in understanding this issue below are the code that i have tried code both using httpclient and requests method throws the below error,telegram bot commands visible for admin to use is there anyway that telegram bot can set commands that is available for administrator only because i wanted to implement a function that only admins of the telegram bot can use not for other users,0,73,43 tkinter not showing image i am trying to make it so my logo is at the top of the page my image ssm contains the logo but when i run the program it returns a empty tab with no text nor image on it and it also isn t the correct pixel size how do i make it so the image displays correctly,pydantic constr vs field args i wanted to know what is the difference between and both seem to perform the same validation even raise the exact same exception info when name is an empty string is it just a matter of code style is one of them preferred over the other also if i wanted to include a list of nonempty strings as an attribute which of these ways do you think would be better or edit fwiw i am using this for a fastapi app edit for my nd question i think the first alternative is better as it includes the length requirement in the schema and so it s in the documentation,0,62,113 change the element in a list of lists differently alternating every nth time i have a list of lists containing information about days in a month e g i would like to iterate through the list of lists setting the element id to a for the first five then b for the second five and continuing that alternation for as long as the list of lists might be i am struggling to get the syntax right using a for loop,how to get aws python lambda to return status codes that will be recognised by cloudwatch i m running an aws python lambda on a trigger and would like to monitor it using cloudwatch i m monitoring cloudwatch invocations and errors but the are always the same what do i need to do in python when the lambda returns so that cloud watch will recognise it as a success error the data that is passed to the lambda will sometimes be poorly formatted and will not be able to be processed i d like to return an error at that point that will be recognised by cloudwatch i ve tried the following but the errors and invocations count is always the same return statuscode body ok return statuscode body ok return statuscode body error return statuscode body error what am i missing not understanding updated code with follow but still doesn t work,0,79,148 is there any way to set self driver go to relative parent frameusing python selenium hello i want to set a command where tells to go to relative parent frame using python selenium self driver go to relative parent frame this one,snowflake connector for python doesn t work in lambda function update i have gotten past the unable to find snowflake connector issue but now it appears that when i build the lambda function some of the dependencies that the connector relies on cannot be resolved even though i can see them in my virtual environment running pythonpipbuilder resolvedependencies build failed error pythonpipbuilder resolvedependencies cffi wheel cryptography wheel sam build has failed command did not exit successfully exit code has failed command did not exit successfully exit code any ideas why it would not be able to resolve these two when it can resolve the other modules in my virtual environment original question i am working in pycharm and trying to connect to snowflake from lambda i have installed the snowflake connector in the project s virtual environment i have other packages that i can access from the same lambda without an issue when i try to use the this one i get this error indicating that it cannot find the package errormessage unable to import module app no module named snowflake connector snowflake is not a package errortype runtime importmoduleerror stacktrace i tried adding a python file to the root of the project and tried the same code and it was able to connect without a problem so that tells me the the snowflake connector is installed correctly and that lambda just cannot find that one package can anyone help me resolve this issue,0,44,243 how to solve the problem of importing when trying to import sentencesegmenter from spacy pipeline package spacy version i know this class is for an earlier version of spacy but would it have something similar for this version of spacy,create a repeating pop up window tkinter i need the popup function to open a window every seconds and close after the user has clicked a certain button however when testing this i wasnt able to click the button on the popup window,0,40,43 i just wrote some code for a simple game but my try except code keeps messing up i have a try except statement in a loop but my try except doesn t work even if i input a correct name of a tank,trying to make pandas python code shorter i m fairly new to python and pandas this code does exactly what i want it to do but i feel i should be able to do this in one line instead of three and without creating an extra dataframe dfmcomp i m trying to learn how to create better neater code i tried this to shorten it to two lines by replacing dfmcomp in the second line with the code that created dfmcomp i was hoping from there i could eliminate dfmcomp entirely and just print the sliced dfm but it didn t work i got this error indexingerror unalignable boolean series provided as indexer index of the boolean series and of the indexed object do not match and i am stuck where to go next can anyone help can this be done better,0,39,138 linked list while fast and fast next i am learning the following code for middle of linked list i noticed that if i use while fast next instead of while fast and fast next for the loop i got the same results may i ask why i should use both fast and fast next to stop the while loop from my understanding if fast next is none fast is always none is this correct thank you,select sets to create a complete list i want to create a complete list with given sets i have several sets in my solution like the goal is to select sets to create a list with all numbers from to if it is not possible create maximum coverage for example above is an example i need to write an algorithm to find the best sets because i will have at least different sets could you help to find a solution thanks,0,71,84 pandas collapse rows with same column id and concatenate multiple columns into without iterating over the dataframe is it possible using pandas methods to collapse from this to this and generate a new description column in the process that sort of summarizes the info into a single string note that this is a spin on this question,python error not enough values to unpack and main py not specified so i was doing some python exercise and been stuck on one which teaches parameters unpacking and variables so the code goes like this but the error i get running this directly on compiler is now if i run the code with terminal using command python main py first second third as the book says i get the error help would be appreciate,0,58,73 how to add a header to an existing csv file without replacing the first row what i want to do is actually as it is written in the title i want to enumerate the columns which initially doesn t have any column names but when i run the code it replaces the data in the first row for example example csv what i want what happens after running the code is there a way to prevent this from happening,if add new blog in database than sent mail to all subscriber to notified current blog in django note add new blog only admin panell model py and it s my subscriber table add new blog in blog table than send mail to all registerd user in subscriber table,0,77,48 how to change default language in qt designer how to change the default language in qt designer anyone has solutions,permanently sorting a table using sqlalchemy i have made a connection to the mysql database and trying to sort two columns of a table as above code is not showing any error but also respective columns does not get sorted in the table it is same as previous when i use the following code to see the data of the table can anyone please help me to sort the columns of a table without creating another table using sqlalchemy or any other library in python any help would be appreciated,0,20,91 scraping the attribute of the first child from multiple div selenium i m trying to scrap the class name of the first child span from multiple div here is the html code url of the page for the complete code i m achieving this task with this code for the first five div but do you know if there is an easier way to do it,valueerror must pass d input shape i want to save this as d array csv file with header as r g b but it is showing valueerror must pass d input shape four img concat shape is,0,65,38 grid fill empty space in scrollable area tkinter i m buildinging a gui with a list of labels in a scrollable area now i want that the labels fill the empty space via grid manager so i use the columnconfigure weight and rowconfigure weight method it works fine for the scrollbar but not for the labels inside the scrollable area example showing my issue,edit embed description with discord buttons using discord py i want to make a button discord interactions discord components for my help command for my discord bot the help command is basically a list commands with different categories it is also a embed message i wanted to make a button where it can switch categories means that it switches edits the discord embed message description i wanted to make a feature where the user can press the button to get back to the last category and for the next category of commands they are not all in one message the next category will appear and edit the embed message if someone presses the and buttons here is my code if you know how to edit the embed message when someone clicks on a button it will be much appreciated if you share it i will use this as future reference thanks,0,63,154 calculate average the letter length of a phrase with one function i did this programming to calculate the average letters of a phrase do you think this program is responsible for all texts and do you have a better offer thanks,turn python code into a generator function how can i turn this code into a generator function or can i do it in a other way avoiding reading all data into memory the problem right now is that my memory gets full i get killed after a long time when executing the code code output,0,41,55 valueerror must pass d input shape i want to save this as d array csv file with header as r g b but it is showing valueerror must pass d input shape four img concat shape is,combining elements from multiple lists in python say i have some lists i would like to combine elements from those lists above so i would have a new list looks like this how do i do this in python,0,38,39 how to filter edited messages in telegram ptb i need to detect whether a message was edited in a specific group chat could it be similar to what i have already written down here test forward handler messagehandler filters chat test sender filters edited message forward to group if there is a way to filter edited messages am i able to use it as a string to lower and split,numpy pandas nested condition in two columns introduction i have a pandas dataframe columns df opendate high low open close volume is eligible in which problem statement i want to add one more column end date which will be calculated based on below if is eligible is true then its end time will be that closestopendate which row has high value that of the is eligible true example let say row no has is eligible true high low open close then we have to find out next immediate row which has the high value my approach i tried the following solution vectorised approach but not working,0,63,106 turtle graphics setpos does nothing for some reason my code works until it gets to line bold text the cursor should move down px on the y axis but it stays there and draws the boxes over the second darkblue one does anybody know why that is help would be gladly appreciated i m still new to python,implementing introspection validation from okta using authlib in python flask app i am trying to implement introspection on client side suing okta as my authorization server but continuously getting error error missing authorization error description missing authorization in headers my implementation i have been trying to resolve this for a while but could not succeed,0,58,53 where to set environment variable in azure data studio python notebook i started using azure data studio notebook i am having some credentials in environment variables how can i use those environment variables in azure data studio,how to fix the pyinstaller xcb plugin issue when using opencv on linux i m writting a python application and want to distribute the executable using pyinstaller i m running pyinstaller w f inside a pipenv environment with opencv contrib python opencv python and numpy the resulting executable keeps giving me this error many posts suggest to change downgrade the libraries i tried this and many other things with no success tips advice would be greatly appreciated cheers,0,37,75 how t solve when scrapy returns garbled text i am using scrapy what i have done is like this there comes the garbled text like print response encoding shows euc jp however encode doesn t work in this case how can i solve,is there any way in python to create list using key value pairs how to create a list of key value pairs in python i have these two lists i have tried this code output i am getting expected output,0,41,40 splitting value from one row to other rows in the same column in pandas i have a question regarding to pandas i have got a dataframe df now i want to split the from the first row into equal amounts where the taskid and userid is the same this is what i would like to receive i couldn t find anything here on stackoverflow thank you,how to understand the trade off between looping and extra numpy dimensions when doing matrix work a common pattern i find myself in is the following alternatively we can do this without a loop by stacking the matrices in the two lists is the second method always faster assuming we can hold those stacks in memory is it merely a speed vs memory trade off how can i better understand this,0,71,69 attribute error in web scraping in python written some code to scrape a website but i m getting an error nontype object has no attribute text failed to find a solution for this so how can i can fix this error,attributeerror session object has no attribute session i am creating an endpoint that will effect a reversal using fastapi with python i have an endpoint that takes in an id via post request calls a reverse function on the transaction model but i get the error attributeerror session object has no attribute session on db session add transaction i am not sure where this is coming from transaction model reversal model endpoint this is my deps db,0,41,74 discord py sends argument weird so i am making a discord music bot and when the person searches something it plays the music and it uses the valuable arg for that so for example play christmas song but altough it does play the music correctly it sends this message now playing christmas song it s like it cuts the words and puts them both in like a sort of list this is my code,how to make an if statement with multiple indices of a list equal to an object in the list in python my current code works to a certain point i have another function called check x win status which does the same thing that the one below does except it checks for instead of anyone have any ideas as to how to make this more compact also i sometimes get an error in which the code prints win even if the game status,0,73,90 attributeerror datetime date object has no attribute timestamp my code is and my imports are but i keep getting attributeerror datetime date object has no attribute timestamp,showing gps points on altair world map i m building for learning purposes a python program that extracts gps data from jpg files in a directory and display the gps coordinates from the photo s on a world map i managed to extract the latitude and longitude values in a panda s dataframe and display it on a altair world map but my problem is that the points don t show up in the right gps position also when i pan the map the points move around the map and the map selve doesn t move how can i manage to get the points fixed on a world map and in the right gps position this is my code for the altair map this is a part of my dataframe thnx in advanced,0,25,122 i have to make this calendar program and it isn t running here is my code that isn t running it s a calendar program that counts days days left in year and leap years,passing a variable from a function to be acessible in other function python i m recently new in the python world and i m struggling with one problem i m doing an app that connects to a database in the raspberry pi which is always changing its ip and android phones can t solve its hostname that s why i need to specify the address i m currently using python and kivy i want that those variables mydb and mycursor inside the variavel function to be accessible inside the other functions is there any way for me to do this main py skye kv,0,32,99 html canvas javascript screenshot pass to python would it be possible to use html canvas to take a picture of the user s screen but also i wanna use this image with python function what i want to do is save the image of the html element with javascript and send it to slack with python,python mapping with syntax checkable keys i need to create a mapping of keys strings all suitable python identifiers to values in python all keys and values are constant and known at creation time and i want to make sure that every single key has an associated value dict the first idea that comes to mind for this would be using a dictionary which comes with the big problem that keys in my case would be strings that means i have to retype the key each time a value is accessed manually in a string literal so ides and type checkers can t spot typos suggest key names in autocomplete and i can t use their utility functions to rename or find usages of a key dict with constant variable keys the naive solution for this would be to create a constant for each key or an enum which i don t think is a good solution not only is at least one name lookup added to each access it also means that the key definition and the value assignment are separated which can lead to keys that don t have a value assigned to them enum this leads to the idea to skip the dict and use an enum to associate the keys directly with the values enums are conveniently supported by syntax checkers auto completion an the likes as they support both attribute reference via dot notation and subscriptions via however an enum has the big disadvantage that it requires all keys enum members to have unique values and keys violating this rule will automatically be converted to aliases which makes outputs very confusing i already thought about copying the enum code and removing the unwanted bits but this seems to be a lot of effort for such a basic problem question so basically what i m looking for is a pythonic neat and concise way to define a potentially immutable mapping from string keys to arbitrary values which supports the following the preferred way of using it would be to define it in a python source file but it would be a nice bonus if the solution supported easy means to write the data to a text file json format or ini or similar and to create a new instance from such a file how would you do that and why would you choose a specific solution,0,53,393 pandas number of unique distinct characters in a string how do we calculate the number of unique characters in a string in pandas dataframe i have data in column like this i want to add another column which mentions the length of unique characters in each string expected output so far i have tried however the above code gives me this result please help,raising typeerror when type is not correct i d like to call function foo a b c where arguments can be int or float those arguments user inputs using space as a separator for example in the same time user can input not only digits bit make some typo like k in this case i should raise typeerror and type the number of incorrect element in my code i have the next error i can t write k into int variable how can i raise the typeerror when user input k and how to be in situation if user inputs k h i that case i need to raise the typeerror with message the type of element is incorrect,0,63,124 jupyter notebook dataframe constructor not properly called arima model i am getting an error while doing a project using arima model code error python version statsmodel after upgrade also i upgraded statsmodel version but still i am getting the same error again and again,replace values of certain column and rows in a dataframe with the value of another column in the same dataframe with pandas i want to replace value in categori column from index to with keterangan column with the same index here is my dataset looks like i already try this but it doesnt work,0,48,57 create class and represent it without quotation marks i need to represent my datatype ps without the leading and finishing quotation marks so that becomes i tried overriding repr but cannot figure out how to properly do it my problem,rename the row and columns of a dataframe i have extracted a nc file using python and after processing the data the final output is an array with the of i convert the array to data frame but the rows and columns names index start from zero to and respectively however i want to rename these index using the following format columns first name and then until the name reach rows first name and then until the name reach to do this i have the code bellow however doin this give me the following error can any one help me with the probem,0,42,121 get execution for given date here s some code i have which fetches the executions from a state machine which started on a given date however it seems inefficient to list all executions and then filter them is there no way to filter the executions without pulling all of them from aws,how to pass variable to html emails sent from python i have this python script i want to pass a variable like first name age links from this python script to html template test html access and format them into html something like,0,51,41 i keep getting nameerror name root is not defined in tkinter when running a registration application i keep getting nameerror name root is not defined when running the code i have ran code similar to this before which seemed to work however that didn t involve many functions if any at all any help with this would be much appreciated,code gets stuck at loop number overflow encountered in exp i have a certain for loop in my code number of iterations somehow the code get stuck at iteration number i am pretty sure that this issue is linked to these two functions that i am using in the loop the code gives a warning at the beginning so i got rid of this warning by using scipy special expit x instead of np exp x but that doesn t seem to solve the loop problem any ideas,0,60,85 i want to check if there are any identical rows in a matrix i need to check if there are any identical rows in a matrix that contains integers values for example this must return true but in other example this must return false,scrapy xpath return empty i am trying to scrape the list of events of olympic using scrapy i am pretty sure my xpath is correct but it always return an empty list at the end any suggestion would be welcomed thanks expected output the link to the individual event link to tokyo rio edit as you can see in thee image div id olympic all games is there it helps limit the number of links we receive back as using data cy next link would return may different type of links but somehow scrapy doesn t recognize div id olympic all games,0,48,92 we are trying from instagram importing instagramy from python but it s not working i want to scrape the data from instagram different public and private accounts but when i run the following code,find path of a file which is not in the current directory and access the files in that folder one by one python i have questions here i just want to find the folder and then i want to load the csv files found in that folder to some other location note i am using macos,0,33,58 sympy very slow at solving equations using solve i am currently trying to solve an equation for t but unfortunately i am unable to get a solution due to the program running for too long is there a way to speed up the time taken to solve the equation code,how to accept urls without a protocol the following is a subclass of pydantic s basemodel when i send a request with a body like this the second url is invalid how to accept urls without a protocol,0,50,37 trying to put multiple images black and white python im trying to put multiple images in black and white but all the images are getting full black i cant figure out where is the error,subtract one column by itself based on a condition set by another column i have the following data frame where time stamp is already sorted in the ascending order i want to create a new column in the above data frame that shows the time difference between each row s time stamp value and the first time stamp value above that row where indicator is not nan immediately above row where indicator is not nan below is how the output should look like time diff is a timedelta value but i ll just show subtraction by indices to better illustrate for example df time stamp df time stamp we can use a for loop that keeps track of the last nan entry but i m looking for a solution that does not use a for loop,0,35,133 while true loop doesn t break after calling return i m trying to write a function that would take an integer divide it into digits sum them up and if the sum is loop through the process until i get a single digit sum could anyone tell me why my while true loop isn t breaking i m not really looking for an optimal solution i just want to know why this doesn t work,how can i random choice a question without the answer for a discord robot quiz game i just started learning how to code in python and i was wondering how can i randomly ask questions for a quiz without the answer that follows for example i d want the robot to ask what s the capital of france but without it saying paris questions what s the capital of france paris who painted the mona lisa da vinci ty,0,70,79 logging in main process when using concurrent futures processpoolexecutor any ideas on how can i get forked processes to log to main process my setup is like this,python how to add text on plot d mesh typeerror str object is not a mapping i am looking for adding node number on the plot as the figure attached unfortunately i started with the following code however it generates the following error typeerror str object is not a mapping given the following information coordinates of each node what nodes belong to each element and the value each node has,0,29,70 how to read yaml in multiple row using python we are reading the yaml file with below code in python but its giving me rows x columns but i want it in rows row for my table and another for my table giving sample data below the code my new yml having below data,ctrl not working when clicked to perform the code allocated to it so the code was working but i dont know what happened so if you click the left ctrl or the right ctrl the red yellow should fire a bullet but that s not happening so i used print to check if the code would append something to the red yellow bullet lists but it didnt so is the problem from my side or is it a problem in the code please help code,0,55,83 mypy error with union of callable and callable generator and typevar the above code produces the following error in mypy is this a limitation in mypy or am i doing something wrong,how to explode pandas dataframe with lists to label the ones in the same row with same id for example i have a pandas dataframe like this ignoring the name column i want a dataframe that looks like this labelling the hashes of the same group with their id here we traverse each row we encounter a and assign id to it and wherever we find the same hash value we assign id as then we move on to the next row and encounter e and b we then traverse all the rows and wherever we find these values we store their ids as now the issue will arise when we reach abc it will be assigned id as it was previously encountered in abc but i also want that in rows after the current one wherever i find ea assign the id to those as well i hope all this makes sense if not feel free to reach out to me via comments or message i will clear it out quickly,0,32,176 permissionerror errno permission denied geckodriver exe i am writing a bot for instagram using instapy i need a lot of accounts so i use threads but i get an error ode if i call the code for one account everything works,shape error while fine tuning mobilenet on a custom data set i was following deeplizard to fine tuning mobilenet what i tried to do is to grab the output from the th to the last layer of the model and store it in this variable x the output of the th to the last layer of the model has a shape of global average pooling d none then add an output dense layer with units however when fitting the model i got the following error could anyone please kindly offer me some guidance thanks a lot my code looks like the following,0,41,102 how do i find the index of an unknown value in python so basically i have a list like this and i don t know what val is so how do i get the index of val only knowing that it is not none,typeerror command object is not subscriptable this is part of my script that handels getting a custom prefix if needed i can send all of it that s my current script for getting the prefix and setting it depending which server it called from it worked great on my test bot but when i transferred it over it seemed not to anymore thats my error code i get it says typeerror command object is not subscriptable but i have no idea where command is its not included in my json file that s my json folder and it doesnt contain command in it so i m not sure why it being called,0,45,109 no module named pyfiglet fonts failed to execute script due to unhandled exception i have recently compiled a py file to an application and the py works fine but the application gives me this error no module named pyfiglet fonts failed to execute script due to unhandled exception then closes immediately the modules im using,how do i get the key press and write it to a variable i am writing a program translator wrote a programming interface i want to make it so that i get what the user enters write to a variable translate and output however i dont understand how to do it i have looked at many forums but have not found an answer i want the user to enter his text for translation in the left text entry window i receive this text write it to a variable translate and display the translated text in the right window i want to do this in order to automate the program so that the translation is automatic without buttons function languages,0,55,121 how to block a single integer input with pyinputplus method blockregexes i can t quite understand what the regular expression should be so that it blocks a single digit integer input this code blocks any kind of integer input this also allows inputs such as m even though in allowregexes i wanted to allow roman numerals to be accepted not mixes of roman and arabic numerals if anyone could help i d be very grateful,download attachments from outlook using win com module i would like to download multiple attachments from outlook i have this code at this moment but have this problem in this pic you see that attachment variable has problem code,0,73,38 develop a c module for applying selection sort i am trying to develop a c module for applying a selection sort algorithm to a list of data and returning the sorted list back to the python program as a python list format however i found that the result of the program below will be something like is it the problem of passing the array to the python or i should not use o or i,can i run unittest pytest with python optimization on i just added a few assert statements to the constructor of a class this has had the immediate effect of making about tests fail rather than fiddle with those tests i d just like pytest to run the application code not the test code obviously with python s optimization switched on o switch which means the asserts are all ignored but looking at the docs and searching i can t find a way to do this i m slightly wondering whether this might be bad practice as arguably the time to see whether asserts fail may be during testing on the other hand another thought is that you might have certain tests integration tests etc which should be run without optimisation so that the asserts take effect and other tests where you are being less scrupulous about the objects you are creating where it might be justifiable to ignore the asserts asserts obviously qualify as part of testing i d like to add more to some of my constructors and other methods typically to check parameters but without making hundreds of tests fail or have to become much more complicated,0,76,196 how to find inverse of mod when there is an unknown number i have a formula like x mod how can i find x in python trial and error is not allowed,django annotate post query set data with if current user has liked the post so i have this model model py then i also have this annotator for returning a bunch of data outside of the post table annotator py i d like to return a field called user liked which returns a boolean for each post in a query set that is true if the current logged in user has liked it or is the creator of a likepost to a post when the request comes in i get the current user making the request so i can get their uuid i d like to use that uuid to check if the user has liked a post in the query set how do i check if the current logged in user has liked a post object in a query set django i m assuming you can do something like user liked f likepost filter creator uuid current user uuid but that wouldn t be a boolean that d return user if i really wanted i could do user liked count likepost filter creator uuid current user uuid seems kind of inefficient though,0,41,170 extracting the actual output of generator in a list i am trying to get the actual output from the generator but i get the ouput as generator object please help me achieve the actual output from the generator output expected output,remove entries in a python set based on condition i used scipy spatial kdtree query pairs which returned a python set of tuples let s say this is the output next i want to erase all the tuples in the set which do not fulfill the condition what would be the most elegant fast pythonic way should i maybe convert to a numpy array,0,41,57 why doesn t my python pandas dataframe strip method work for trailing whitespace and how do i fix it i have this code to strip whitespace from the dataframe the dataframe before removing whitespace the dataframe after removing whitespace the whitespace after electronics is not stripped any ideas how i can fix this,xlsxwriter issue regarding exporting string as dates using python i have a list that includes dates in the following format this date i convert to string when i export this list to excel the excel sheet recognizes these string as date is there a way to make these dates recognizable by excel as string using python thank a lot,0,52,59 i don t know how to install pytorch i don t know how to install pytorch with pip on windows no commands i do will work i tried pip install torch pip install torch pip install pytorch pip install pytorch pip install torch torchvisual torchaudio pip install torch torchvisual torchaudio pip install torch cu torchvision cu torchaudio cu f and i used the website to try and install it but they all have this error,this page isn t working didnt send any data after pressing submit button i m currently taking a udacity s course full stack foundations one lesson in this course wants me to make a web server for a user to input something then the message will be displayed on the screen the user can submit constantly but it will only show the message that the user last submitted i am able to see the webpage with hello input box and submit button but after i enter something in the box and click the button it shows this page isn t working didnt send any data the console also didn t throw my any error it also seems like the output is correct i really couldn t figure out my mistake could anyone help me below is my full code inside the console the web page will only show up if the path ends with hello ps i m using python,0,71,156 typeerror send login mail got multiple values for argument email i am learning celery reddis and trying to send email through celery i have created a task in which i have encapsulated my send email logic i am calling the send login mail function and passing the keyword arguments using delay am i using delay wrong i have tried using apply async but still couldn t make it work p,remove group if contains record with status i would like to group records by id from df and delete group if any of records has status output i would like to get i tried dfnew df groupby id filter lambda x x status but i got the error typeerror filter function returned a series but expected a scalar bool,0,62,60 how to add two values from the same columns so i am looking to add values from a dataframe column and write the result in a second column column is given column will be my result what i want to do is column column column column column column,find the coordinates of the triangle containing the largest number of points so basically we have a list of x and y coordinate of points and we need to build a triangle that will contain the largest number of points from this list i can check if this point is in the triangle area or not,0,54,56 how to construct a nested dictionary while taking user input problem i want to construct a nested dictionar with user entering key and values in python below is an example of the dictionary here series name char name and wishlist is entered by the user also user can add multiple char name for particular series example,hi is there a way to write this code more briefly and avoid repeating if i am beginner c users lenovo pictures untitled practice py pycharm png,0,53,24 how to remove edit element in xml file using python i have below xml file i want to remove path and also want to edit source source so it looks like below to remove the path i used below code it runs fine but not able to remove path what changes i should do to remove the path and modify source please help thanks,retrieve data from manytomany field in the sequence of it was saved django i have a invoice system where employee or staff can create invoice and can add multiple product and quantity for the specific customer as i am using mysql i cant take json data or an array data so i was taking the quantity and price after discount and other modificaion as a string and then when showing or printing the invoice i used regex to find the quantity and price i added product ids in a manytomay field from where i am getting the product name and selling price while showing the data on printing page in when i use zip the products are showing as the id of the product so i want to retrive the data the way it is being saved or could you tell me any way to do it more easier way here is my models py here is my views py of printing page function i want it to be retrieved the product objects in the sequence of it was saved,0,63,180 pandas none series has i want to generate a pandas series with null values with int type i use this and it returns what can i do for it to return a series whose values are null,how to write commands in second cmd using the first cmd so i have a python file which i will run using vscode and then it should execute another python script in the background and should display output in new command prompt this was quite helpful but when i execute venv scripts activate bat to open the virtual environment i get stuck and cannot execute further commands i know since its virtual environment we cannot communicate to it directly but is there a way workaround to be able to execute commands even in the virtual environment,0,38,92 explode struct column which isn t array in pyspark i got a struct column from json with this schema since all of the inner strcuts have the same fields i want to convert the schema to something like this and add the id for example as a field for each element by doing it i ll be able to explode the column into rows any idea how can i do it or explode the column by any other way,convert bytes to signed integer with python i am trying to convert bytes to an signed integer on python i can simply do the following i thought in python i can just use the struct library but since it needs bytes i just added at the end so that the comes out here i must apparently add ff if i do this with a positive number it works with can someone explain me how the rule for this works and how i implement this correctly for python,0,78,93 how to communicate between two raspberry pi via bluetooth and send sensor data from one pi to another i m working for some school project i want to send temperature sensor data from one raspberry pi to another pi via bluetooth i searched a lot for tutorial but i didn t find any related tutorial please anyone help with this or any suggestions would be very helpful,selenium python getting specific text in data sort a in a html page there is this line and i can find it by using this xpath but i only interesting to put in a variable the funny keep in mind that the word funny is changing all the time so i need to find it and push it to variable but how do i extract this changing text thank you for helping,0,67,72 using python to populate pandas dataframe with sparse csv data i have the following text file that looks like the following using the following code i get output that looks like the following however i would like to see each of the data fields on the same line such as instead of one row per entry i d like to bulk them up to read as such,how to write commands in second cmd using the first cmd so i have a python file which i will run using vscode and then it should execute another python script in the background and should display output in new command prompt this was quite helpful but when i execute venv scripts activate bat to open the virtual environment i get stuck and cannot execute further commands i know since its virtual environment we cannot communicate to it directly but is there a way workaround to be able to execute commands even in the virtual environment,0,66,92 retrieve geographic information via an api with python i am a beginner in python i m trying to create a dictionary in a json file that i created before this dictionary must contain the geometrical type of the elements that i retrieve via an api i tried with the following code but i have the following error message the api looks like this the error i have what should i do,valueerror must pass d input shape i want to save this as d array csv file with header as r g b but it is showing valueerror must pass d input shape four img concat shape is,0,72,38 how to remove specific strings from a list in pyspark dataframe column i have the below python list lst name age country spark dataframe is below i have to compare the list with spark dataframe string column and remove the values from list from the column expected output is,why is this for loop solution to this problem sooooo much faster than my while loop solution i m completely stumped i m taking a python course through udemy i have a fair amount of java experience for android but it s been a while so maybe i m missing something obvious but i can t find it the assignment was to create a function that takes an int then returns true or false based on whether or not you fed it a prime number then use that function to find the first primes over my solution worked correctly but took a full ms to find the primes the highest of the five is so three seconds to loop times i ran and timed the instructors solution and his did it in ms the main difference between his and mine is that i m using a while loop and he s using a for loop with a set max range but that can t be it what am i missing here my code the instructor s solution,0,46,172 nameerror name yt is not defined i wrote this code to make a python video downloader from pytube import after i run it it asks me to enter the link i want it to download as i want it to do and after i enter the link it shows me this error how do i fix it,extracting pmid nct id and publication type from pubmed xml in python from xml file like this i try to extract pmid nct id and publication type four sample files are here one has nct id ideally i want to have a pd dataframe expected output but if somebody can tell at least how to extract for file i would greatly appreciate it too i will figure it out how to put it into a dataframe,0,59,74 how to solve requests exceptions connectionerror in get request python when i run get word function i will get this error requests exceptions connectionerror connection aborted remotedisconnected remote end closed connection without response please answer this problem,aws sagemaker pipelines throws a no finished training job found associated with this estimator after introducing a register step i am currently working on creating a sagemaker pipeline to train a tensorflow model i m new to this area and i have been following this guide created by aws as well as the standard pipeline workflow listed in the sagemaker developer guide i have a pipeline that runs without error when i only include the preprocessing training evaluation and condition steps when i add the register step to the condition step s if steps i get the following trace from this trace i see two potentially related issues the immediate issue is the attributeerror propertyfile object has no attribute to request dict i haven t been able to find any information on why we might be receiving it between forums and sagemaker documentation i also see a sneaky issue towards the top of the trace that has plagued me all day the line no finished training job found associated with this estimator please make sure this estimator is only used for building workflow config tells me that the register step is using our estimator when it should be waiting until after the training step has run i can t seem to find any reference to this error besides a somewhat similar stack exchange post i ve compared my code to the aws published examples many times and i m confident that i m not doing anything taboo would anyone be able to shine some light on what these errors are suggesting is there any more information or code that would be relevant thanks so much,0,32,263 invalidargumenterror incompatible shapes vs i am building a object detection model with bounding boxes and after i build it successfully i would like to merge it with the vgg classifier i have googled the error but i still cannot debug it i know that the is my batch size and is my number of labels is my model s output below is my model data generator my model the error message is,add the remaining quarterly columns that do not have any values i have monthly time series data as follows i needed to convert this monthly data into quarterly data as a sum of three months so i adapted the code from here to do just that the resulting df is as follows however i wanted to have all quarters listed in between not just the ones that have a value larger than so my desired output is as follows so in this output there is an additional column q because it is between the first and the last quarter periods even though it has no positive values does anybody know how to do that,0,75,115 abaqus viserror problem with xydatalistfromfield i have a python script in abaqus gui when i try to run this script i have error viserror no xy data was extracted using the provided options the python script fragment is i know that the problem is with xydatalistfromfield function but i don t know how can i solve it,how to summarize a dictionary per year with only reduce and map i imported a csv file using csv dictreader and converted the dictionaries into a list in this list of dictionaries i need to count the number of type and type actions sum of them for each year i would like to avoid using repeat loops and just use reduce and or map i need the following output,0,57,69 running a for loop in javascript through python selenium i use javascript to collate data from an html page via selenium however i cannot run the javascript portion from my computer via selenium py cause python only offers the driver execute script string of a script whereas i have a multi line for loop which won t execute with these commands the loop as you can test this won t work with the standard driver execute script let value,invalid table start location error while using gdoctableapp module to create table using google docs api in python i m trying to create a generic document using google docs api i m inserting images and dynamic tables whose borders are not visible tanaike s solution to create table by keeping borders invisible worked but here i m appending all the requests in a single request then inserting into the document but i m getting error after implementing the following code error googleapiclient errors httperror httperror when requesting atchupdate alt json returned invalid requests updatetablecellstyle the provided table start location is invalid details invalid requests up datetablecellstyle the provided table start location is invalid,0,70,103 how can i randomly assign powers to my heroes i m creating a hero game i ve created a dictionary containing magic powers my problem is how can i create a method that will randomly assign magic powers to of my heroes each hero get s powers without one magic power being assigned multiple times here s my code,remove the x axis spikes with empty labels in matplotlib i have a plot in which i have to divide my data points into several groups so i made customized sticks for this plot for instance i have to group data points into multiples of this is what i did and the x axis of the plot looks as however i wish to remove those spikes with empty labels as circled in red so the final x axis could look like any idea thanks,0,58,82 keras on apple m i am running following command on my apple m system code start code end it is giving me the following error which i am not able to figure out error start error end what should i do to resolve this,can t multiply sequence by non int of type float for datetime i want to write this code but i can t fully progress my admission date data are like dd mm yyyy admission date hastane yats i also used the pd astype str function for admission date but i think it wants this number how can i improve this thats my data set preview,0,44,59 pyqtgraph stacked bar graph i have this set of data i want to draw a stacked bar chart in pyqtgraph similar to this one drawn in matplolib i have checked pyqtgraph bargraphitem documentation but i didn t find any information regarding stacking bar,negative values of scientific notation in txt file i have a txt file with a mixed floating numbers as a string represented lists when i convert each element as a list of float numbers negative scientific values do not appear in the new list for example when i have the following values my output is as you see the output does not show the numbers starting from negative value how can i deal with this problem,0,41,76 i was told to reverse a number in python i did that but i can t remove comma after the last element here is my code the output shows now how will i remove the comma after,parallel coordinates in altair i want to do a parallel coordinates plot with multiple y axis i ve found how to do it in vega lite here but i haven t found the way to do it with altair there s only a very simple example where all the y axis are the same is there any way to do this plot in altair,0,38,60 merge array text per user how to merge correctly to get from this array what i need is to get something this what is the most efficient way to do it extra explanation inside the array we can see these element text then after a while we can see text,unknown problem with module using cv and mediapipe i have some trouble running the module on python this is my code it returns me the following traceback i m following a youtube online course for computer vision linked here at around the minute mark the module presented above is added i pretty much copied it and it doesn t work what s happening thanks and sorry for the long post,0,52,69 python pandas iterate through list and map i m trying to make a simple script that should get the id of an item and get some stats associated with it and add it to the dataframe it returns nan and i don t know why edit i was comparing the integer stored in one dataframe with the string in the other one it works beautifully now,how can i target my mozilla profile on mac os the same way i m targeting it in windows i have a working python script that ll run perfectly on windows it relies on python selenium and my current firefox profile here s the code i m relying on to grab my profile in windows i don t know how to make this work in mac os i guess the os path join function doesn t work the same is there any way to do this,0,64,79 how to read multiple cvs files to google colab at once i was doing something like this enter image description here is there a way that i can read them all at once,python openpyxl adding cell value to column p if match between column a list and tuple list background i have a list of values in column a which differ from worksheet to worksheet i wanted to identify a subset of values to be matched and if a match was made between lists then the script will add the value from the tuple list to column p and moves downwards per value see picture script output problem the script kind of works accept if the value in tuple is not found the column a list then it creates an empty cell in excel and moves down to the next cell see picture excel output questions script,0,33,118 how to calculate molecular weight of a molecule in python efficiently with less memory consumption here is my code to calculate molecular weight h o no co hcooh using predefined values of elements in a dictionary in the above else statement there is an extra step of subtracting the total from existing mass of element if a number is encountered after a letter how can i eliminate this extra check,render to html gives no output i am using a code to extract specific information from several excel files i render these outputs into html file with os system jupyter nbconvert to html no input no prompt check ipynb rename it and move it to another folder when i run the code cleaning the output before the rendered html is empty and displaying only the markdown code chunks if there is already an output and i run the code without cleaning it the new output is displayed in the notebook but in the rendered html i see only the old output how i can be able to render the notebook with the latest output,0,68,109 wxpython remove padding borders as seen in the picture below there are white spaces between the edges of the windows and the webviews as well as between the webviews the webviews are contained in a wx frame each any idea on how to remove these to reproduce this issue,how to return whole sql query data right now my code only returns lastrowid but i want to know how to return the whole object from my backend when i insert the new product to my backend python flask and mysql frontend is in reactjs post product route insert new product function right now insert new product return only lastrowid so i need to refresh my website to get the complete object the complete object looks like this but i get this object when i add a new product from the frontend,0,47,87 how to regex match list of patterns in python i have list of patterns and i need to return that pattern if that is present in the given string else return none i tried with the below code using re module but i am getting only null in matches when i tried to print matches completely new to corepython and regex kindly help,how to pass arguments from a message to a telebot my telegram bot receives messages in one line of the following form how can i send this string to three variables using telebot upd this works but i can t figure out how to get the data from telegram itself and transfer it to the text,0,62,61 edit confluence page via python script i need to access a confluence page via python script and change all use windows strings to use linux strings i can use want use this command inside of script,why does pandas groupby keep the key i would like to perform the following operations on a dataframe i got the result below my question is why the id column is kept i expect the id column disappear after this operation what i want is,0,34,44 pandas group by to json format i ve a pandas dataframe with columns region country etc i want to get below json format from the df post group by i m getting below df output of above group by how can i achieve the json format above thank you in advance,how to infer and convert dtypes in pandas dataframe here is my sample dataframe i would like to convert the dtypes to boolean in column a and b string in c and integer in d and e i am trying to use panda s method convert dtypes but it returns string for every one how can i automatically convert the types df convert types dtypes gives,0,50,61 problems when reading dataframe with pyspark in apache zeppelin very unclear exception on missing some methods in the objects first loading the python libraries in order to work with pyspark and use bokeh library then prepare the df and then call for the function in order to get bokeh plot then getting the below exception,selenium unable to locate element partial text link i am new to selenium and i try to click a link on a second page after the login page the login part works and the browser goes to the next page however on the next page it raises an exception this is my traceback this is my code login info obviously blurred the element that i am looking for is the part after go changes every week that why i use partial link text i hope someone could help me out with this one edit i found the fix by using xpath the problem was solved if someone could elaborate why partial link text does not work that would give me more insight in how selenium works,0,55,126 datetime index in plotting doesn t work why i want to plot one month of data one data per hour the dataset is over one year why is this code not working error message typeerror cannot do slice indexing on rangeindex with these indexers of type str thanks a lot,current date via psycopg posrtgresql is getting the day before rather the real current date i just noticed this behavior and didn t find much clue here s the quick testing code the output is but if i run the same sql in postgresql client directly i got the result of and the versions of each component as below did anyone encounter the same by the way i m running all these on m mac not sure if this matters supplement outcome as per mentioned in comment section timezone related trial modified python code by changing the sql it appears psycopg result is having hours gap but from cli the gap doesn t intercept,0,51,110 how can i create a script to switch between my arm conda and x conda i am on an apple silicon m macbook pro i would like to have a native arm python environment and an environment that runs on x architecture with rosetta i have installed two mini forge distributions both in the home directory miniforge for the native arm installation and miniforge x for the x installation,detect changes in virtualbox guest click on it using python if we have a virtualbox guest running android is it possible for python maybe via vboxapi or a similar library to the clicking at a particular screen coordinates can be done using console mouse putmouseeventabsolute but how can we detect changes to the virtualbox guest display,0,69,55 dynamically created classes with the same name i m trying to dynamically create subclasses in python with type and here s what i see in the output obviously this was not my intention two questions in that respect,any way to capture partial screenshot with kivy i am developing an app for android and i have this issue after i have taken a picture with the camera i need to crop it but the coordinates for the rectangle i have dragged over the capturing area start from the screen s coordinates aka touch coordinates do not match actual picture s if i try to crop the image with these using pil i get a partial result one possible solution would be to take a partial screenshot with these coordinates and get the cropped picture that way i tried to use pyscreenshot but then i found out that it does not work on android any ideas how to capture a partial screenshot on kivy thank you,0,36,128 changing values in numpy array according to index when i use the indices once to change the values it works however when i use the indices twice to change the values nothing has changed why i can t use the indices twice to change the values,how to detect a cycle in a dictionary i have the following dictionary with the first number being the node followed by a tuple consisting of a neighbor and then the edge weight some nodes have multiple neighbors and weights dictionary how would i use depth first search dfs to detect if there is a cycle or not the dictionary will be changed frequently for testing purposes so some may have cycles and some may not i am new to python and do not understand how to implement dfs to check for a cycle or not i have the following dfs code and then i call the function dfs visited dictionary but i get the error keyerror i also am unsure how to use this code to detect for a cycle or not,0,45,164 get last day of week of a given date given any day of the year such as today i would have the last day of the current week for example current day is monday so the last day of this week is saturday because of isoweek in my systems starts from sundays how get ldow df could be implemented,not able to scale the roi in opencv python i am trying to build a program that detects hand movements in a selected region of interest but the rectangular selection i perform does works or it gets unscaled the hand detection also starts working randomly at a few points any help would be appreciated,0,59,54 why does my class schema looks broken in fastapi and swagger i have fastapi application using python i have the following module and my endpoint looks like when i look at my schema in the docs page the schema looks broken what am i doing incorrectly,pyspark map and apply calculation using value from dictionaries i have two dictionaries one where userid is the key and their location is the value the first items look like this and another dictionary where placeid is the key and the location is the value the first items look like this now i got an rdd where userid placeid and a rating from the user on the place is given i would like to calculate the distance between the user and place and keep the rating using geodesic from geopy distance i could convert and join the values of the dictionaries and replace them with userid and placeid but i m looking for a solution that uses the pyspark language i came around mapvalues but that doesn t quite do the trick for me so eventually i would like to get the distance and the rating that was given,0,47,147 how can i integrate a line chart viewer in pygame i have an ai for a game in pygame and i want to create a chart to follow the evolution i need only the gen on x axis and points on the y axis i have tried this but i don t know how to make it fit on the surface in the game and not pop out as an individual window which will eventually stop the game any ideas,turtle graphics setpos does nothing for some reason my code works until it gets to line bold text the cursor should move down px on the y axis but it stays there and draws the boxes over the second darkblue one does anybody know why that is help would be gladly appreciated i m still new to python,0,76,58 mean by group exclude some rows i have a below table and want to calculate mean by state i would like to calculate mean only for the rows which has as customer i have below code how do i add customer criteria df output mean df fillna state missing groupby state score transform lambda x x mean,installing python macbook air m problem i am gettin following error while installing python on macbook air m i run the following command the following error is thrown my question is that how can i install python on macbook air m using brew,0,48,44 assigning to slices in python reversed list i m reading the fluent python book and a section talks about assigning to slices for example i tried testing this feature with some customised examples but the following gives me an error but this works why am i getting the error isn t what i m trying to do the same as the last cell thanks,data cleaning dictionary inside dictionary inside lists in csv i m a newbie learning data science i ve been trying to clean a data set but i ve had some hurdles on the way the first issue i had was to explode a dictionary inside a table into individual columns link below thanks to user parfait i could do it using literal eval then i had a problem trying to apply the same solution until i found literal eval has issues with null values i got rid of nulls and some bad uses of quotes now i got this it seems that a column which is a dictionary has not one but two values which are dictionaries themselves i ve tried to pop and del those values but it seems the data is not considered a dictionary so i couldn t afford it when running df creator map eval i get the message appended below look to the avatar and api columns these two columns are not necessary for what i want so i could drop them but i have not find a way to do it to be clear i just want to extract id and name columns as cre id and cre name add them to the main df with prefix and deleting the rest of the column thank you for your help edit added first ten rows of the dataset,0,61,220 how to call upon csv file on pandas python using words just to simplified the problem i make a list of fruits how i ranked them and their colour and i want to call them with their name and here is the csv file when i run the program when i put in the number in it and i dont want that i want when i put thanks in advance,query sum of two fields based on a value using pymongo basically i have an array of objects with nested arrays of objects i want to query the data based on the userid and sum of flashcardreversed value flashcardreversed count the user will provide the userid and a value count value that is desired here is my data for example the query should like is it possible to achieve this using pymongo,0,71,72 dataframe image does not export as image the library dataframe image is being used to convert a dataframe to png at spyder however it sends an error when the example code is executed the error is does someone know if this library only works for jupyter notebooks or if there could be another reason behind the error here is the code attempted to be run,pandas substract above row basically this is the challenge i have data set with time range and unique id what i need to do is to find if id is duplicated in date range where i want to return for id because the duplicate transaction is in range of days i can do this with excel and i added some more date ranges depending on day for exple wednesday range up to days thursday days friday days range but i have no idea how to accomplish this with pandas the reason why i want to do this with pandas is because each data set has up to m rows and it takes forever with excel to accomplish and on top of that i need to split by category and it s just a pain to do all that manual work is there any recommendations or ideas in how to accomplish that task,0,64,157 struggling to figure out where to insert perentheses hey guys i need to figure out where the parentheses fit into this code for the following expression and am a little confused to where the parentheses actually goes into i keep getting it wrong expression,how to split strings with double letters python i have been thinking about it for a while now and decided to ask for your help for instance i have a string abcdefggarfse or abcdeefgh my problem is that i would like to split these string at that point where the letters are doubled abcdefggarfse abcdefg and garfse abcdeefgh abcde and efgh thanks a lot,0,44,68 installing pip in raspberry pi sorry i am newbie when i try to install pip using following command i get following error please help me out,random numbers on matrix diagonal possible duplicate is it possible to amend this code so that matrix diagonal would consist of different random numbers for now they are the same,0,26,30 when to raise unicodetranslateerror the standard library documentation says but translation is never defined doing a grep through the cpython source i can t see any examples of this class being raised as an error from anything what is this exception used for and what s the difference between it and the decode exception which seems to be used much more frequently,remove paratheses with text inside from dataframe how do you remove text in paratheses paratheses included from a df column for example should be,0,60,24 how to resolve boolean series reindex warning i have a dataframe i am performing the following functions however when i do that i get the warning how do i resolve this lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat,how to make invisible telegram python mention i need to make sure that the mention of users is not visible it seems like this is done somehow through links but i don t know,0,67,34 pandas multi index loc i have a pandas dataframe for graph edges with a multi index as such however doing a simple loc fails with the message keyerror why does it fail the index clearly shows that the tuple is in it and in the docs i see loc being used similarly edit apparently df loc works go figure it was probably interpreting the first iterable as separate keys,modin attributeerror when importing from sparse matrix i am trying to use modin package to import a sparse matrix created with scipy specifically a scipy sparse csr matrix invoking the method i am getting the following attributeerror while using the original pandas api it works anyone with a similar problem thanks for the support,0,72,51 how can i print the first name name is the list of random names i ve tried joining it with join,if input list so basically i m trying to make it so that if user input is blue or blue it gives eye res the value of if not then give it the value of what i ve tried is,0,20,41 error when using tf data dataset from generator i am trying to make tensorflow dataset using tensorflow from generator i am quite sure that i have made a python generator that work perfectly fine but when i tried to pass it to from generator i always got an error this is the piece of code that i use to create the dataset but when i run it it always produce error,sqlite query in python using datetime and variables not working as expected i m trying to query a database using python pandas this will be a recurring request where i d like to look back into a window of time that changes over time so i d like to use some smarts in how i do this in my sqlite query if i say i get the result i expect but if i try to move those to variables the resulting table comes up empty i found out that the enddate variable does work but the startdate does not presumably i m doing something wrong with the escapes around the apostrophes since the result is coming up empty it s like it s looking at datetime now and not seeing the month bit comparing now vs now which would be empty any ideas how i can pass this through to the query correctly using python,0,65,148 is there a way to combine these loops is there a way to combine these two loops to make it more efficient thanks,can i make a numpy array immutable this post suggests a way to make a numpy array immutable using flags writeable false however when i test this the array is shuffled in place without even a warning question is there a way to make the array immutable background for context i m doing machine learning and i have feature arrays x which are floats and label arrays y which are ints i m new to scikit learn but from what i ve read it seems like the fit methods shuffle the arrays in place that said when i created two arrays fit a model to the data and inspected the arrays afterwards they were in the original order so i m just not familiar with how scikit learn shuffles and haven t been able to find an easy explanation to that online yet i m using many different models and doing some preprocessing in between and i m worried that at some point my two arrays may get shuffled so that the rows no longer correspond appropriately it would give me piece of mind if i could make the arrays immutable i m sure i could switch to tuples instead of numpy arrays but i suspect that would be more complicated to code and slower,0,24,206 influxdb unauthorized with localhost access when try to write the data into influxdb using influxdb client i am getting the below error i was able to login to the influxdb web browser using with the same credentials provided in the code but facing with the unauthorized message when using python code any help would be appreciated error raise influxdbclienterror err msg response status code influxdb exceptions influxdbclienterror code unauthorized message unauthorized code thanks,how do i stop the background music in the arcade library i need the music to play until the game is over at which point i d like it to stop but nothing i try seems to work below is the shortened version of the code i m working with if anything the sound should stop playing immediately because self game is set to false in the update right away but no matter what i try the music keeps playing,0,68,77 use fitsio to rename a fits file extension in python i am using the fitsio library trying to create a new fits file insert a table from a dataframe df and change a keyword however when i do that my first extension has no name i cannot figure out how to change the extension name right now i am doing the following,trying to pass a python function stored in an sql database to a menu in tkinter i am writing an application in python using tkinter as the gui framework i am saving lists menu commands in an sql table and iterating through all of the selected rows to build the menu so far this is working well but i cannot get the command to work when the menu item is clicked the sql table has columns id label command parent so and example row for the table would look like new placeholder rootfile when i click on the new command nothing happens if i replace row with placeholder it works as expected unfortunately this does not allow me to specify different commands for each menu item stored in the sql database,0,62,133 django view with slug and id i have this url and this view now i wanna show on that page category view html only the products that have particular slug and pk lets say kategorie cat cat is the category slug and the category pk is and i only wanna show the products that have this category and this pk btw yes product is connected with ecommerce via m m,python pandas pandas correlation one column vs all i m trying to get the correlation between a single column and the rest of the numerical columns of the dataframe but i m stuck i m trying with this but i get the error operands could not be broadcast together with shapes which i assume is because i m trying to find a correlation between a vector my imdb score column with the dataframe of several columns how can this be fixed,0,65,76 imagemagick installation in docker container with external fonts for moviepy how to install imagemagick in a docker container and also install external fonts for usage in moviepy,transforming sql query to django expression assuming i have the following django models and the according sql tables with some data i have simplified the models so that it is clearer useranswer partquestion solution i want to get all user answers where the answer is equal to the solution of the according question i ve came up with this sql query but can t really think of how to implement this into a djano query this will output the following i just can t get my head around this concept in django maybe using f expressions and some stuff thanks for any advice,0,27,97 python regex re findall method throwing list index out of range error i m learning web scraping using python regular expression and practicing the following script source but when i run it s throwing indexerror list index out of range,python xlwings set excel table style to none i have exported a dataframe to excel using xlwings and am trying to format it as a table i want to apply the none style but can t figure out how to specify the none this line works but instead of tablestylelight i want none i have tried none and none of them work,0,37,63 builtin function or method object has no attribute choice and more python calculator answers py input py main py multiplications py start py i get the error below i am doing it in diffrent files so it will look more clean i tried everything but i cant fix it the error is in the import i think because the input choise seems to be the problem any help appreciated ty,having troubles to write list in a new row every time during while loop with openpyxl i m encountering problems inserting the list values into a new row every time the code loops in a few words i need the code every it loops to write the values from lst into a separate row each time i have done an extensive research to try to understand how this works and found plenty of examples but unfortunately i couldn t make the code work following those examples this is the code i have tried to add ws insert rows idx amount just after the line ws append lst like this but it doesn t do anything because i suppose it needs something that tells the code to write the next values in that row i have also tried something like this but here as well i m not sure how to tell the code after it finds next avail row len list ws rows to write in that row thoughts edit at the moment if i enter at the prompt for instance it outputs if i continue inputting numbers for instance it outputs and so forth what i expect to be is in a few words every time the function gets called it writes in the same file but one row below i hope it is a clear explanation,0,61,217 list converts to blank dataframe my list xfrs returns a blank df when i convert it does anyone see any issues with the code i m able to append and print the list fine but when i append the df transfers is blank,python to r translation i have a couple of lines of code in python that i am trying to replicate in r but i m admittedly not skilled enough at this point to figure it out here s the code in python results of running the code above gives you this the goal of this code is to make a list of unique values in col b and then search for any of those unique values in col a and if it find them place them in the result column note that in row the result is green this is correct because even though col b shows a value of blue for row the actual value in col a is green i ve tried rewriting this section in r my thought was to write a function and try an lapply but either i m doing it wrong or that s not the right approach thank you in advance for any suggestions or help and i ll check back to see if there are any questions i can answer or information i can help clarify thank you again,0,41,179 why swagger ui doesn t show prameters and response i m using django and djangorestframwork and drf yasg i have this api in view py module and in url py module i have i need to have gameid in query params but it can not be seen there,how to send keys with python selenium after an element has loaded my code here i made an attempt of using the webdriverwait function to allow time for the text box to be loaded before sending the keys but it errored and returned this the selector id is correct being identifierid but since it isn t loaded properly the code could not find and input text how should i correct the function used for waiting the element to load in order for this to work,0,42,84 error by creating my own scorer with make scorer in sklearn the make scorer method of sklearn seems so simple in all the examples i see but when i try to use it on my cross validation it gives me all nan then i realize that something in make scorer is not working but i cannot figure out what i ll show you a small example if i run if i run,blank column appearing in csv output how can i remove it updated to add more lines of input file i have a csv file with header and subsequent data as follows shown only first few rows here this is how the file appears in bash shell i was asked to remove various types of columns and associated data which i have done successfully in the following code i was then asked to arrange the data such that the headers show control varxc repeats and and experiment varx repeats in columns next to each other which also has been done in the following code when i try to compile all this information the output shows up like this this is the final output i am not sure how i am getting that space on the left side can someone help me remove so that all the rows shift by one cell to the left,0,67,157 how to develop a delivery carrier in odoo i searched a lot about delivery providers in odoo i found some simple comments in the project source and some sampling modules in the app store does anyone know how to implement a new carrier this is the comment in odoo delivery addon i follow the steps but nothing happend,how to build a hmm model with strings as the observation sequence i have checked lots of examples and found out for python hmmlearn library the sequence to be put into model fit must be a list of numbers if i have a string list as the input i need to convert it into a number list first however if i have two states observation letters with two groups vowel and consonant shown as below my model result should give me emission matrix letters vowel and consonant states what should i put in the model fit how should i build the general hmm model any one have any idea,0,59,113 why i m getting this typeerror i am trying to create a getprefix command which changes the server prefix i m using an sql database to store prefixes i am getting the following error when i send any message in a server not only bot commands my code my database code the first time i ve tried this it worked perfectly with the same code i was able to update custom prefixes for servers in the database without any errors,how can i sort a list by the second item descending and first one ascending i have a list like this i wish to sort the number in descending order and if numbers were the same according to the name in ascending order i tried the following code and the reverse but i couldn t figure out to do it the answer that i m looking for is,0,77,66 retrieve dataset from a dictionary i have a function that splits a dataset in a non iid setting this function returns a dict of the labels for example if i apply this function to a dataset i obtain this now starting from this dictionary i want to obtain the original dataset split as stated by the dictionary for example dataset will have the samples and so on dataset will have and so on,runtimewarning couroutine command call was never awaited command i m having trouble with the error is here is the full code if needed thank you for your answer,0,76,27 append subresult list to result list i m trying to solve leetcode combinations sum problem and i ve did using recursion method pasting my approach here in my recursion function helper in base case when target i m appending my subres to finres i ve tried finres append subres but its not appending to finres it s actually appending and removing later later when i did subres copy its working fine so how can i add subres with just append,python why result txt not generating i am stuck at problem while writing detection script subproblem which can calculate total number of seconds an class object was in frame for example if a class object lets say dog was detected in video frame from that time i have to count till the dog leaves the frame of video for that i am using an detection script which is giving me every second prediction of the class from an float tensor c and getting reference from its labelmap gives me class name as names int c the names will be look like names dog cat bigcats insects and c in tensor gives class id as float so it is pretty simple i am getting detection of object every seconds now the task is calculate for how many seconds it was exactly there for that i am writing below code as you can see the code is made to mark each timestamp with their relative class and provide summary in result txt but as a result no file is generating find result txt it may be issue of the i have used functions but the code management made me to do so if you have an easy implementation to mimic this or any suggestion please comment below so i can know,0,72,208 how to avoid dry when inserting dataframe within a class i have a following code example above works but you can see that i repeat block of code twice how can i create engine in the method vlozit df using self connection from init please thanks,python calling a class method without initializing the class i want to call a function from a python class but it would be necessary to initialize it so is there a way to call class methods without initializing the class i have a js background i what i want is similar to this,0,44,53 parser xml with python don t generate all tree iterator if i have a xml file such as i m trying to get all elements but when i do i can see all items like these but i can t see these line do you know why thanks,pywinauto manipulate windows with variable titles i am trying to write an automation script that involves interacting with windows that have titles that change based on the user set search parameters in line and of the sample code they use app untitlednotepad but what if my script saves the file and then the window title is changed is there any other way to interact with application windows besides this handle in my code i have so even though i can connect to this login window i still can t interact with it unless i write app log login child window,0,46,95 django rest framework filtering does not response no data found when no data found i have a very simple drf listapiview which is using filters searchfilter as filter backend but the problem is it is returning an empty list if no data is found on the queryset my code serializers py views py result for a successful search expected result if nothing found currently returning an empty list now how do i do that thanks,python nameerror name raw input is not defined here is part of a script that causes the error below is the original code written by the script author,0,72,27 find all combinations with set characters i m new and i promise you i ve tried google for the past few hours but i must be using the wrong words and for that why i m here i m trying to find all combinations with some set fixed prefixed characters at in certain positions for example dt fg zr l m n q p characters to choose from,countvectorize to count the number of words in a huge file hi dear i have a problem i want to count and sum all words in my large dataset about gb for rows the code i wrote is then all suits well but i have a problem with segment part with the last command the kernel dieds and i can t do what i want that is to say to count all the occurrence of the words inside the dataset and sum them to see the first words most used by the people how can i improve my code let it doing what i want i think it is a problem for the ram but i have gb of ram i tried this code on a part of my dataframe i saved the first rows on another dataframe imported it and tried on rows my code and it works what i can do in order to perform what i want on all dataset thank you for the time spent for me and for the patience,0,63,180 two seaborn plots with different scales displayed on same plot but bars overlap i am trying to include seaborn countplots with different scales on the same plot but the bars display as different widths and overlap as shown below any idea how to get around this setting dodge false doesn t work as the bars appear on top of each other,regex to match a pattern multiple times i have this following string values using regex how to extract as below get rid of the last two digits the regex used d only matches one patern eg or i want to match and as well help needed,0,60,50 make a new dictionary that have no none items in nested dictionary i have a dictionary like this i want to make a new dictionary that only consist of the stocks that have value in the cdldoji i want to remove all the stocks that is none in the new dictionary how to do that,convert matlab system identification to python i have a piece of code in matlab that i want to convert to python the matlab code is using the system identification toolbox which is provided here to provide more explanation about the code i have data where i encapsulate it as iddata and split it to train and validation data these splits will be used in order to estimate the best order to identify a linear arx model once identified i want to detect nonlinearity in the system with these orders then i want to construct the arx model find the initial states and convert it to a steady state model finally i want to detect any abnormal behavior to identify if the system was unstable i started the conversion to python and found a package called sippy for linear arx mdeoling here is the code i wrote in python this code will read the data no need for iddata encapsulation and output the best arx model for a given range of orders this means it will perform as arxstruc z z struc nn selstruc v aic and sys arx z nn however when testing both on the same data to compare the output i found that the best orders given by matlab were while python returns when i investigated the reason i found that the loss value is different from matlab than python and since the output would be the order that achieves the minimum loss it is logical to have different orders so can anyone help me with that problem what is the loss function used in matlab and is there a package that simulates the system identification in matlab and provide the same results in python,0,55,286 how to kill terminal in vscode using a python code i understand that using import os os exit will pause the code but i would like to kill terminal completely as if i were clicking on the button shaped like a trash can is there any way to do this so i can put it inside my python code,how to escape and loop with python inside curly brackets for example i have a list items a b c and i want to escape and loop those in curly brackets for the requests body my wanted results is,0,58,38 how to remove edit element in xml file using python i have below xml file i want to remove path and also want to edit source source so it looks like below to remove the path i used below code it runs fine but not able to remove path what changes i should do to remove the path and modify source please help thanks,how to return multiple value from a pytest fixture with scope session i have created pytest fixture in conftest py for creating user and auto login now how to call the get post method using api client and how to access user in multiple test cases written in test views p,0,63,49 tkinter make a frame hide to the right with smooth fading animation i made a simple program where the main window has a frame hideout which will slowly move out of the screen but it doesn t work what is wrong here,python pandas compare columns with nan returns false i have dataframes one is called old and another is called new the dataframes have multiple columns but i am interested in column called addtext when you open the files in excel and compare the addtext columns they are completely identical when i do old new in python it returns false when i do new addtext equals old addtext it returns true why don t they both return true since both columns contain only the nan values in them example output,0,42,89 python requests response forbidden so i am trying to scrape this website i was able to scrape data from it without any problems but today it gives me response i tried using proxies passing more information to headers but unfortunately nothing seems to work i could not find any solution on the internet i tried different methods the code that worked before without any problems,how can i find sequences of rows based on two columns this is my dataframe i am trying to find the most common sequences of length and delivery type combined per over ie every six balls is there any way of finding how many times each sequence happens edit i d also like to label these patterns and create a column called ball sequence edit i have now combined delivery type and length in the length type column eg essy is extra short slow yorker i have also created a small table of expected outcome the sequence must occur in the same over and cannot be any random sequence of,0,68,106 how to handle subprocess run error exception how do i handle a subprocess run error in python for example i want to run cd userinput with subprocess run what if the user types in a directory name which does not exist how do i handle this type of error,sh api access token so i have a code here written in python to generate an access token from the api using the secret key and consumer key provided by stubhub when executing in command prompt i keep getting an error in line saying traceback most recent call last file c users desktop python py line in access token token respoonse access token keyerror access token any suggestions thanks,0,46,63 how to convert date time to timestampe in python i have a dataset that has a column of that date written in the following format how can i convert them to timestamp,pandas get the percent of a baseline value while baseline and drug are in the same column i have a dataframe of this kind and i need to loop over the value column and get the percent of bl for the washon and washoff values for each cell and cell into a new column aka any ideas are appreciated,0,32,59 jupyternotebook filenotfounderror winerror the system cannot find the path specified i ve created folder structures with code on my desktop and filled them with images using the cap cv videocapture with no problem to create folder structures and make directories i wrote this code and it works fine folderstructures on desktop but when i want to list images in a file i get this error error filenotfounderror winerror the system cannot find the path specified positive can you help me,python access a class attribute without initializing i have two files where each one contains a class i am trying to access the attribute d from class in class without initializing class the following currently returns an empty dict which makes sense,0,77,42 first and last methods used excluded items i used last to get last item of queryset after exclude some items as below but in output print item that not exists in output i test some other codes as below my holiday model and other model is i test that by first and problem was there too what is problem my code is wrong or bug from django orm using django and postgresql,wordcloud relative font size amongst multiple instances i m using wordcloud to render a plot with multiple wordclouds each one beeing a bar in a bar chart basically just adding some subplots like this is there a possibility to get the relative font sizes correct amongst all of the wordclouds a the moment those are only relative to each other inside the same wordcloud i tried dynamically setting min font size and max font size based on the frequencies but those just do not seem to affect the relations so if a word appears x more often than any other in the document i d like to have it times larger in font than all other words no matter in which wordcloud frequencies would just be dicts with the total words occurrences wordcloud x word word wordcloud x word word wordcloud x word word so how to create wordclouds from this an keep the proportions so that word in wordcloud is x larger than word in wordcloud,0,73,174 error c program files x microsoft visual studio buildtools vc tools msvc bin hostx x cl exe failed with exit i was trying to install mujoco and run a simple script which is however i encountered the following error c program files x microsoft visual studio buildtools vc tools msvc bin hostx x cl exe failed with exit code python version gym version i had downloaded the microsoft visual studio build tools and restarted the system but doesn t seem to help any help is appreciated,how to loop in python api with restriction on limit and can provide offset i am new to python api i need help in calling api data from python where we have limit of rows per page yes off course we can apply offset but i am looking for a loop to extract complete data below is the python script sry i am new and not having much experience in writing the script,0,68,74 drf serializers orderitem set all i was following serializer tutorial and came across some code that i did not understand its function what does the order item function do the snippet was from the serializer class below,calculating perimeter of contours opencv python i have this image here with lots of small printer dots in the color cyan magenta and yellow after separating the color channel cmyk i applied a threshold on the image here for the color channel cyan now i want to find a way to calculate the perimeter for each of these dots so in the end i want to have a mean and standard deviation for the perimeter i already found a way with the help from someone here on stackoverflow to compute the mean and std dev for the sizes of the dots with instead now for the area is there a way to get the perimeter,0,35,115 heroku discord py deployed but never came online i was working on my discord bot today and uploading it to heroku i did everything my tutorial said to do but when i flicked the deploy switch on the bot stayed offline has this problem happened to anyone else has anyone found a solution,shape error while fine tuning mobilenet on a custom data set i was following deeplizard to fine tuning mobilenet what i tried to do is to grab the output from the th to the last layer of the model and store it in this variable x the output of the th to the last layer of the model has a shape of global average pooling d none then add an output dense layer with units however when fitting the model i got the following error could anyone please kindly offer me some guidance thanks a lot my code looks like the following,0,53,102 typeerror dict is not callable i m working on a marry command according to my discord bot everything seemed fine the status command displays what i want but i m not able to update it once someone married it gives me this error line in update status users user mode change typeerror dict object is not callable this is my code,scrapy problems to have all informations i would like to use scrapy to have a database with the name of the dishes the ingredients and the preparation time so i can have the name of the dishes of the pages but i don t know how to proceed to tell the script to enter a dish and to take the ingredients and preparation time for each dish thank you very much have a good day my code the page that i have scraped name of dishes the informations that i want when you click on dishes image,0,58,98 can t extract simple information from an api i m trying to get information out of an api if i understand correctly once i use the json module i should get a dictionary where i should be able to extract the information from but no matter what key i use i get an error following error no matter what keyword i use,how to create a function that checks if values in columns of a pyspark dataframe matches values in the same columns of another dataframe how would you create a function that checks if values in two pyspark columns of a dataframe matches values in the same two columns of another pysark dataframe i want to make a new column that shows validation if those values in the two columns exists in the other dataframe the dataframes don t have identical columns except for the two columns to join on i m new to pyspark the code below shows a function that identifies validations when matching on one column the function above can show whether a value in one column of a pyspark df is existant in another df in the same column i want to modify this code to allow the function to match values in two columns in df to two columns in df and let the user know if the values in the two columns in df exist in the two columns in df for example,0,60,178 how can i improve api response speed if it uses cloudflare i need the fastest api response from exchange to find arbitrage opportunities as quickly as it possible now i am using websocket connection to the api but speed is still not enough good tried all server locations that are available in aws but this does not change situation much in my opinion the problem is about cloudflare does someone know about how to bypass its limitation,python mongodb how to add a nested dictionary to a key in an existing document i have been using python for a while and want to learn dbs now i am trying to learn mongodb goal to add a nested dictionary to a key in a pre existing document i am using pymongo for this like for ex i have this and i want to add another dictionary in titles key so that it looks like this i have seen you can use update one or update many to update a pre existing value but couldn t find for adding new data how can i achieve this,0,77,104 scrapy selenium extracts first link then throws error i m working on a scaper that collects property information the original code works perfectly using a list of all parcels it adjusts the url to go to the next page broken code there is a link to a pdf that is embedded in a javascript button the pdf contains more information that i want to scrape it will retrieve the first link but then throws errors error,how do i give score to csv rows my csv file row column data looks like this when i have patterns like row i want to return value when i have row like or random alphabets not like row i want to return value how do i do it using python it must be done by using csv file,0,75,65 how to draw multi line color in python i have problem i want to draw multi line color diagram in python i don t know how can i do that my data frame like this etc my script is and this plot is like that how i can solve this and draw multi line plot,how to group by pandas dataframe based on date and leave specific dates as nan here is example dataframe and i would like to group values monthly but only filling in values for the earliest date for the rest of the months i would like to fill values with nan with simply group by im getting and the desired output is,0,54,62 return a message and put in a new column after compare values in a dataset using pandas i need to see if the values in column deathrate is lower than and return balanced if isn t return urgent and put all this in a new column humanitarian help i tried this first,deleting a row on the basis of a particular column value and deleting the instances of that in another file i have a ruleset which i have generated from iris dataset which looks like below where the st columns are the attribute values say a a a a and the fifth column is the class value stands for don t care for an example means if a and a then we don t care about a and a the class will be now i have a dataset as well giving at the end of this question with which i am comparing this ruleset using the concept of confusion matrix to get the fitness of each rule to get the fitness i have written a code now the final output file looks like where the last column is nothing but the fitness of that particular rule now i want to sort this first according to the class then according to their fitness so that after sorting it looks something like then i want to pick the st rule which has the highest fitness from class and put it in a separate file say ruleset new and check for that rules existence in the below given dataset and all the instances from the dataset for that rule will be deleted and a new dataset say dataset new will be generated with the remaining rows of the dataset and the previous ruleset will have now one rule less again on this ruleset fitness will be calculated comparing with dataset new using the above code then in the next time the st rule which has the highest fitness from class will be selected and will be put in the ruleset new and the same thing will be repeated until all the instances of the dataset will be covered below is the dataset for an example here comparing between ruleset and dataset and finding the instances means from the ruleset has in the dataset please help me out i am new to python so unable to figure this out,0,52,343 how to use scipy optimize minimize for function with variables i m trying to optimise this function by finding the best values for sigma s sigma y and epsilon strain and stress should be dimensional numpy arrays i ve tried but i get valueerror can only convert an array of size to a python scalar i m a bit confused how to use minimise this,forbidden error code missing access discord py i m getting this error whenever i try to run my program i tried giving it all the permissions possible except admin but it still doesn t run it only runs when i give it admin permission the error occurs on on ready event here is my code here is the error edit all these permissions are given already,0,61,64 how to rename the same value in a column using pandas my dataframe is how can i display rows with the same data in the hospital column in this way via pandas,python printing longest length of string in a list my question is to write a function which returns the longest string and ignores any non strings and if there are no strings in the input list then it should return none my answer i m a beginner so i have no idea where to start apologies if this is quite simple,0,33,59 python docx how to set font spacing how to set font spacing in python docx or how to add element to w rpr w rpr w spacing w val w rpr,question about with radiobutton using tkinter in python basically my question is inside the cake class when i run the code and choose an option in the the second window it doesn t open a third window named receipt which i don t understand why when i choose the third option carrot cake and submit it should print self choice get the enter the if statement of the submit function but it doesn t it automatically goes to the else statementthis is the output i m getting any help would be appreciated,0,24,86 localizing rows from a dataframe i working with a dataframe which has columns but i m only going to use three of them in my task which are named price retail and profit and are like this my goal is to find the lines where the prices are lower than and sort by the biggest values of profit how can i make it,decode base array at specific index positions i handle a big number of xml files each of which stores a float array in the form of a base string for each of these files i would like to access the value of its array at a specific index without loading the whole array i wish to do this in python currently i decode the entire string and then access the value at given index but i am looking for a much faster method,0,63,83 except indentationerror unindent does not match outer indentation level when i compile this code i get file line indentationerror unindent does not match any outer indentation level what is the solution for this,solving system of linear equation using cramer s method in python i am trying to solve the following system of linear equations by using cramer s method implementing a function by scratch by using the above function on the system i get the following result i have solved the system using the numpy function np linalg solve and i get another result i cannot spot the formula error in the function i have witten what should i adjust in the fuction in order to make it working properly,0,35,84 proper c type for nested list of arbitrary and variable depth i m trying to port some code from python to c the python code has a function foo that can take nested lists of ints with variable list depth for example these are legitimate function calls to foo what should the method signature s be for a c method that can accept this kind of argument,different data is being added to a file than is being printed in the console i have been writing a program to get all the coordinates within a ten mile radius of any given point and when the distance data is printed its output is different from the data in the file not only this but it creates a blank line at the end of the file what should i do an example line from the file is m s n m s e an example of the printed info in the console is point,0,65,99 is there any way to set self driver go to relative parent frameusing python selenium hello i want to set a command where tells to go to relative parent frame using python selenium self driver go to relative parent frame this one,aws textract multipage pdf only extract st page for form and table extraction i am using aws textract for form and table extraction using following code for some pdf it extracts forms from all the pages but for some pdf is extracts only first page while using the textract user interface it extracts all the pages what could be the reason for this i am using following code which is available on aws edited it looks like its related to response size the size is almost fixed can anyone help me with this,0,44,95 how to split strings with double letters python i have been thinking about it for a while now and decided to ask for your help for instance i have a string abcdefggarfse or abcdeefgh my problem is that i would like to split these string at that point where the letters are doubled abcdefggarfse abcdefg and garfse abcdeefgh abcde and efgh thanks a lot,multiple plots from function matplotlib adjusted to suggestions i already have a function that performs some plot and i wish to use this to plot in a grid for n arrays let s assume the grid is n for simplicity and that n is even at the moment i came up with this unfortunately what i get if i do something like is correct but i need to close figures each time at the end otherwise i keep on adding figures to plt is there any way i can avoid calling each time plt close fig,0,68,96 how to replace a file which ws opened using sys stdout in python i am using sys stdout method to print the logs for test run now i am having a test case which will run every hour and my goal is to replace the log file with the latest one everytime it runs but using the following code the log is getting accululated in the same file every hour how to achieve this goal,when why use types from typing module for type hints what is exactly the right way for type hinting my ide and resulting code works fine for type hints using either of below options but some types can be imported from the typing module is there a preference for using the import from the typing module over builtins like list or dict examples and,0,73,63 is it possible to add this kind of default value to caesar cypher python here is a basic function call i would like to do as you can see below in the signature i would like to have the default value in s be the length of the string passed in for convenience is it possible to do this in python or some version of this,issues searching for uuid in text document python issues searching for uid in text document i m brand new to python coding in general i m working with an application that tracks objects and their states users can change these objects states whenever they need to i ve written a script that pulls a uid from the rest api then the uid is written to a text document and a date time timestamp is appended so i can see when that change was made the only trouble i m having is searching the text file programmatically to ensure a the uid s aren t being added twice and b the timestamp isn t being updated i need to maintain the time date of the original change this is what the data will look like i just can t figure out how to filter the data down on the open read using regex,0,66,145 how to make my message count command count messages for each server not all in once how do i make my message count command count messages for each server but not all at once because i want to have it like when i type messages on the server it count form only this when i use this on the other server it count from other server only here is code of my coommand,problem with custom language in pytelegrambotcaptcha i have tried many time to set a custom language for my captcha bot but when i put the text or any else function equal a string i got an error attributeerror nonetype object has no attribute text doc,0,73,45 python optmize the following if elif statments have a python code that return dataframes i am using if elif statements to comapre the df and return accordingly for eg this way for df i am having combinations wherever ther is data i am writing it to a file if not displaying appropriate msg to user figuring out a way to optimize it is there any way,converting modifying non standard string into datetime for python dataframe so i have a set of data for sales by month not in order but the string format for the data column comes out as month day year hour minute for example and it is a string object how am i able to convert this into datetime where i only take the month and day also how can i simply take only the month and convert it to an integer,0,70,77 unable to install beautifulsoup package for python using pip on ubuntu i was trying to install beautifulsoup in order to learn web scraping i was using pip to install bs package for python but i am unable to install it any help to resolve the below traceback error note i am using wsl ubuntu,retry failed readline of stdout with different encoding using python i am running a jmeter process using the following code but my script threw an error at the readline call because it detected a latin character xe which is not compatible with the utf encoding i d like to catch this exception and try printing out that stdout line with a different encoding or bytes only to help me identify the line that broke but because it s in the middle of a stdout utf process i can t think of how to do that,0,58,92 i want to loop this and everytime it loops i want so it prints untill infinite but it prints what am i doing wrong i want to loop this and everytime it loops i want so it prints untill infinite but it prints what am i doing wrong code,counting the frequency of words in a pandas column and counting another column i have a data frame with comments and their labels i would like to get an output like i was able to get the word count by using but i am not able to get the label counts any help will be appreciated,0,76,56 convert pst to us pacific for use with pytz i m trying to create http endpoints for example if the user made posts in sept november but none in december then jan onward it wouldn t return december but it takes the time zone in pst format because it does a sql query unfortunately pytz the library i m using for getting all posts from a month only accepts time zone in the format us pacific,how could i install matplotlib correctly on ubuntu i am trying to install matplotlib pip install matplotlib when i try to verify the version installed import matplotlib matplotlib version i get this import im q not authorized matplotlib error constitute c writeimage what is the problem thank you,0,70,42 mac m pip how to solve error building wheel for h py i am getting this error when trying to install h py on my mac error command usr bin clang failed with exit code error failed building wheel for h py python and hdf were installed with homebrew some more info,strtod returns wrong value when called from python ctypes and run from spyder or pyzo i need to call from a python script a c library which parses a string to a double and prints the result the parsing works or not depending on the ide i use my os is debian here is a minimal example the library file test c it is compiled in a terminal with the python script calls the library and passes the string parameter using ctypes file test py i run this script from a terminal with and i get it works as expected when i run this script with eric ide it works too however when i run this script with spyder or pyzo i get only the integer part is converted and a comma is used as the decimal separator instead of a dot i suspect an encoding issue i tried encode ascii in the python script but the problem remains have you got any ideas,0,48,161 can t use pygame init i installed pygame using pip install pygame i m unable to do any work and get failed request error message i read the pygame doumentation initialization and got the same message when i run this code in jupyter notebook the kernel shuts down dies,python how to read specific range of rows and columns from google sheet in python have got a data similar like below in google sheet need to read data range starting from a to c columns as fixed with countless rows flexible below in python help me out since i m new to this google sheet with python expected output in python as dataframe df is below,0,46,66 python get env from finished subprocess python so i have a subprocess like so now the subprocess itself is modifying the env and i wanna know how can i get this modified env from the process the example is using export however i run a script which may change or add other env variables so i d like to get the whole env,selenium common exceptions webdriverexception message in python selenium the following codes run with python selenium without an issue but after upgrading selenium package from to code above doesn t work anymore the complete exception messages nothing is specified after selenium common exceptions webdriverexception message i couldn t figure out what goes wrong chrome version and chromedriver version is as follows any help would be appreciated,0,62,61 converting python dataframe to a particular json structute hi i want to convert my dataframe to a specific json structure my dataframe look something like this and the json structure in which i want to convert my datafram is below i tried implementing this with below code with different orient variables but i didn t get what i wanted so if any can help in achiveing this thanks,python quit unexpectedly after pipenv install i am trying to install dependencies with pipenv install and receive modal letting me know that python quit unexpectedly i have uninstalled python and installed from not using homebrew python version os monterey pipfile terminal output after command could the problem be indicated by the failed locking or loading libcrypto in an unsafe way any one else run into something similar anything to try to resolve thanks all,0,69,78 how to generate list of sequence number in faster way using python anyone can improve processing time to generate list of sequence number here is my code and it needs second please advise thank you,page number of added bookmarks with pypdf i have added pdf files using pdffilemerger from pypdf and added a bookmark at the beginning of each pdf file using pdffilemerger addbookmark when i open the new file with pdffilereader and extract the pages where the bookmarks wer placed i get for the page number i use the following code for merging for reading the file i use why is the page number for the new bookmarks,0,38,76 pandas pivot table gives keyerror i m fairly new to python and completely new to pandas i have software usage data in a tab separated txt file like this the dataframe is imported correctly and groupby methods like this work all right however when i m trying to create a pivot table with this line i get where the key is the first ip value which should not be used as a key at all what am i doing wrong,matching pattern in python before it reaches a certain character i have a scenario where i have two strings to check for a match but the matching should be happening until a specific character in my case is found here is what i am doing with a positive look forward approach but it doesn t seem to work i have also tried this regex patterns but no luck and any help woud be great,0,77,76 save variable in pc python i want to save a variable user input fo mail in pc because i don t want it to ask to login again and again so please help me with how to store email variable in pc and also how to access it thank you,what is the correct way to filter data from db in monthly and yearly basis for analytics i am making an analytics section for my client where i need to display data in graphical form for this i am using chart js now i have a model to store visitors of the website now i want to filter the data in monthly and yearly basis to put it in chart js and display it graphically now what i am doing is this here i am able to get the count for my current month and year but making variables for each month and year is not the right to do it so please suggest me what is the correct procedure to filter the data so that i can make the analytics i have never before done this so i do no the correct approach please suggest me also the chart js code looks like this which also perhaps no the correct way to do make the analytics please suggest me what to do,0,49,173 how make a protect from editing excel file i create a excel file from a dataframe how can make it protect from editing this excell file i want be only for view from users,numpy sort much slower than matlab sort i am turning some codes from matlab to python i am sometimes quite surprised by the performance loss here is an example on sorting arrays which turns me nuts matlab elapsed time is seconds python can someone explain why there is a factor in performance for such a basic operation i see that sort is not multi threaded on python and this should be the main reason on my cores machine for now i tried following this link but this did not change the behavior in a terminal i also typed in python the following command returns which seems to indicate that i am really using mkl is there a way to have np sort work in parallel for arrays,0,34,131 how to use a value from first method in second method in the same class i want to use the d value from can add method for add method but get error moneybox object has no attribute d how to use d value for add method,python urllib request urlopen and readlines to utf consider this example this code prints out the type of the first entry of the result returned by readlines of the file object for the urlopen d url as and in fact all of the entries in the returned list are of the same type i am aware that i could do read decode utf as in the commented lines and then split that result on n however i d like to know is there otherwise any way to use urlopen with readlines and get a list of utf strings,0,45,95 is there a way to copy subfolder without copying recursively am trying to copy subdirectories from directory but i realize the first subfolder copied is copied recursively i would not like that i would like to copy the sub folder intactly when i run the code i have sub dir a sub dir b and dir b copied in new dir i however want dir a and dir b in new dir,apply function across pandas dataframe kruskal wallice i have a dataframe df and can t seem to apply this function across columns for each row i keep getting df desired output obviously i made the p values up,0,63,35 how to run a server in the cloud im creating a server in python that receives post requests process the information in the request using some scripts sometimes using a database and send back a answer in json format im searching for a way to run this server and code in the cloud in a way that i dont need my pc turned on for it to work because my connection is very unstable,python how to link a filename to a memory file the memory file will be an input of another program not python so a file name is needed,0,74,28 django successful login but still anonymous user being anonymous user even after successful login here is views py serializers py in frontend side react login component i am using sessions based authentication which is implemented by default in django i have sent a request of cookie as header to ensure the authentication process yet i am viewed as anonymous user by django everything in network tab is working fine though,how to plot the rotation of a curve along the x axis with matplotlib in python i would like to plot the line x y rotated around the x axis for a project i am working on i have used matplotlib to graph some d planes before but am unable to figure out how i would draw the revolution of a line around the x axis i m thinking i would have to use ax plot surface but am not quite sure how thanks,0,68,81 how to delete printed line of file my program read from kody txt file and print it on discord as replay to command i want to delete printed code from kody txt how to do this any ideas atm code didn t work because read coupon return empty value clear all txt file,beautifulsoup extract text from head and head i m trying to extract text from source code on a page in the tag and i d like to extract this d fgdrsql is a dynamic data and i need to scrap precisely this key every day my script start like this but i don t know how can i do that,0,49,58 how to register specific column field in models py file in admin this is my model i like to register just single field tag in admin py file separately from my original content model i ve used but i get this error attributeerror str object has no attribute meta can anyone help me here,pip error error exception traceback most recent call last try to run pip install requirements txt in code dir cmd returns i cannot install any pip package in my pc it returns that error i am using v ray and proxyfire i don t think these software make trouble with pip command because i use it without any error before formatting my pc i already installed python and added into env var python appreciate your support,0,50,75 error while running python code into c please how to solve it hey everyone i m trying to run script python into c as i m a beginner but i got this error microsoft scripting syntaxerrorexception unexpected token from my c code and my python code is but i don t know how to solve it the full issue and the error by details i don t know how to solve it please help,selenium and auto closing browser i have script on selenium and it works fine now i reworked it for selenium but now browser closing on its own when code ends i want to keep browser open,0,69,38 get element range in list and swap i want to swap element list by range in python my code is and my output is but what i want is swapped by list index range,how to have my discord bot python api leave a voice channel in an event i need help having my discord bot leave a voice channel through an event with the python api i ve created an event that makes my bot join a voice channel if there is only person present in said channel after seconds this part works i then need my bot to leave the channel if another person joins or the one person leaves i have not been able to figure out how to get it to leave any help would be much appreciated here is what my method looks like right now need help at the leave voice channel comment,0,34,116 add second elements of a list based on equality condition on python let s say i have a list like this i want to sum the elements that have the same st element and get something like is there an easy way to do that in python,does endless creation of objects to start new game hog ram in python i made my first game with python the structure of program is roughly this import pygame when i finished project i realised that by starting new game it does create new game object and starts game from scratch but it probably still keeps the old games variables sprites etc in memory even though anything isn t happening there anymore is my assumption correct and if so how should i structure my code instead edit from what i gathered from comments this would be better structure,0,48,97 copied xpath directly from chrome and not working trying to scrape odds from fanduel goal is to get the player s name in this case jayson tatum even when i copy the xpath directly from chrome it doesnt seem to work though it works when i hardcode and look for an element through xpath containing the text jayson tatum this is my code also tried this still get a nosuchelement trying both ways,is it possible that python takes very long to assign a name to a huge list gb i am working with a very long list of lists i m talking gb if you put it in a file a cleaned corpus in my script i assign it a name and then use it in another function that has to do with word vec spacy and semantic similarity calculate for each word in a list of words what is their semantic similarity i e how similar are the contexts in which these words appear i have many steps in my script and i ask it to print something after some of the steps all to an output file i am using bash to execute the script it s been hours and nothing is in my output file which i assume means that the list has not been assigned the name yet however when i run a py script with only the list in it also assigned to a name it takes very short also the model usually loads very quickly so that shouldn t be the problem either so am i doing something wrong here this is how i made the list that process worked i already have the list and the actual list is just a huge list of lists thanks for your help,0,73,221 i create two function for dispaly place and blog in my project web site but only one function displaying urlpatterns path views fun name fun,how to loop through each column in a row using pandas i got the dataframe like this how can i use pandas to loops all column in a rows and get the result like this thanks you for all your helping,0,25,41 typeerror str object does not support item assignment in dot product calculation i have the dataframe as follow the rscore and nscore values for each column should be drived from the dot similarty of two vectors as follow but i got,python quit unexpectedly after pipenv install i am trying to install dependencies with pipenv install and receive modal letting me know that python quit unexpectedly i have uninstalled python and installed from not using homebrew python version os monterey pipfile terminal output after command could the problem be indicated by the failed locking or loading libcrypto in an unsafe way any one else run into something similar anything to try to resolve thanks all,0,41,78 python how to read specific range of rows and columns from google sheet in python have got a data similar like below in google sheet need to read data range starting from a to c columns as fixed with countless rows flexible below in python help me out since i m new to this google sheet with python expected output in python as dataframe df is below,how to run a script on server using fastapi i m new to fastapi imported a script into the main py in my fastapi based api how to run the script when calling the url with value in the script like to make the script waiting for the value after url,0,66,50 is there a way to combine these loops is there a way to combine these two loops to make it more efficient thanks,scrapy shell view response not working proprly when i open the scrapy shell through the command scrapy shell this example comes from the scrapy tutorial i enter the command view response which opens my navigator firefox to be precise with a path looking like file tmp tmpnzkkilst html and the error file not found any idea on how to solve this issue,0,24,59 fill color between arrowheads in a quiver plot i m plotting a few arrows in a quiver plot and i wonder if there is a way to fill the shape traced between the arrowheads with color the quiver plots look like this i want to fill the circle ish shape traced by the arrow heads with color or at least connect the arrowheads with a line seems like it should be simple but i couldn t find how yet,pandas split and append i m new to working with pandas i don t know how to solve the following problem i have the following dataframe and i have to turn into the following,0,76,32 why do i have to add print function thrice in python i need to give print only once to get the output i am trying to find mean trimmed mean and median from a dataset with file format csv in python below is the code my question is i am unable to get all values at once using print function just once i need to write print function thrice is there anything to shorten my code,download extract msg files from folders a subfolders in outlook i would like be able to download extract msg files from folders a subfolders in outlook and possibly keep the structure can you please show a direction how it can be done thank you,0,76,42 remove urls from search result based on word list and from visited urls text file and write in files i am doing a google search using from googlesearch import search i get urls based on my keyword and i store that in a variable and then i have to filter the urls based on keywords and from a text file that has visited urls from the last google search thank you in adv,why i got mixed file path separators i am using windows with jupyter notebook under annaconda from the above i got and for path separators i am expecting the result like this how can i modify my codes to get above results,0,75,45 how to use jit on a numerical simulation i m trying to write a physical simulation using python which requires a lot of simple math computation i believed that numba s jit will help me run it faster the code is mainly calculations and i m not sure what s wrong i tried putting jit over each function i tried to specify jit nopython true and still its very slow,the given key does not identify an element in this collection value terraform i m trying to deploy a lambda function using terraform the code is written in python here is the terraform code which performs the operation during deployment i m also trying to invoke the lambda function using aws lambda invocation here is what i m doing but during deployent i m getting the below error the count index portion of the line snippet is underlined as the relevant subexpression can someone help me on this,0,64,83 call variable from other function sockets i am new to python and having issues calling a variable from one func to use in another first function gets localhost ip second function i would like to grab that ip and use it to port scan itself my open port function comes up with error attributeerror function object has no attribute ipv any help is greatly appreciated,python replace particular substring in string i need my program to replace a certain with a variable i ve tried this but it replaces the whole thing with the varibale so i need this to happen before after c but instead what i get is this c,0,66,48 timestamp binning mechanics when resampling i m not quite clear on how bin membership in dataframe resample is determined example actual output expected output reasoning i expected pandas to create the two bins and the timestamp to fall into the first bin while and the remaining timestamps should fall into the second bin edit i just realized that using hours instead of days yields the expected result why i m using pandas,what is an exception handler for i have a script which wants to load integers from a text file if the file does not exist i want the user to be able to browse for a different file or the same file in a different location i have ui implementation for that what i don t get is what the purpose of exception handling or catching exceptions is from what i have read it seems to be something you can use to log errors but if an input is needed catching the exception won t fix that i am wondering if a while loop in the except block is the approach to use or don t use the try except for loading a file,0,74,120 is there a way to re order duplicate index so that they appear cumulatively i have duplicated a dataframe using the below portfolio rtns loc portfolio rtns index repeat though i want to go from this to this how would i go about doing this sort index and sort values did not seem to offer much help for duplicates,pygame score update during the collision when using collide rect in my pygame i want the score to update only once when colliding not continuous increment to a very large number in a short time the score will update again after the one sprite completely leaves the collision area and re enters so the score will not update during the collision is there an efficient solution in pygame thanks,0,50,66 how to schedule code to run at a specific time every day need help to run code that automatically starts at pm every day on python visual studio code i don t want to print anything i just want to execute my commands like pg keyup enter for example only works with printing text,how to search for a value in two different type of field or index or heading of mongodb using python i am new to any kind of programming this is an issue i encountered when using mongodb below is the collection structure of the document i imported from two different csv files the first two entries are from a csv and the next two entries from another csv file now i am creating a user interface where users can search for a telephone number how to write the query to search the telephone number value in both the index telephone number and telephone number using find in the above case if not possible is there a way to change the index s to a desired format while importing csv to db or is there a way where i create two different collection and then import csv to each collections and then perform a collective search of both the collections or can we create a compound index and then search the compound index instead i am using pymongo for all the operations thankyou,0,51,181 how can i reorder a numpy array from high to low in another array without using in built functions i am having a bit of trouble here plus i am new to using numpy what i want to do is reorder the array t in v from high to low and changing the highest number to everytime in the array t without using unbuilt functions i would truly appreciate any help thank you,reduce padding top and bottom in plotly express chart i have the following chart but i wanted to remove big space between the top and bottom of the graph and the first datapoints the image is just a part of the chart it is much bigger because i m showing the data for all the countries here is the code maybe is the height that is too big but if i decrease it the labels and the datapoints overlap and make the chart terrible if i need to reduce height how can i add space between each tip of the y axis btw the whole code is here and the interface is on streamlit cloud if it help on solving the problem,0,74,123 changing values in numpy array according to index when i use the indices once to change the values it works however when i use the indices twice to change the values nothing has changed why i can t use the indices twice to change the values,z python ordering models and accessing their elements in z python imagine i get a model with the following shape c true c false c false c false how can i order the variables so that the assignment is alphabetically ordered c true c false c false c false how can i access any element of the model i mean if i do i get c and not the expected c true i put no more code in order to keep this post as simple as possible the c variables are just examples my final objective is a method that given c true c false c false c false returns an array a true false false false where a corresponds to the value of c a corresponds to the value of c etc edit for i tried sorted m key str lower but i get the following error descriptor lower requires a str object but received a funcdeclref this means i should convert each element to str which i do not want i prefer a native method of z that yields no modification in the type of the variables,0,45,199 how to extract specific keys for location to dataframe i have a small data frame which looks like that i would like to arrive at something like that i have tried but i get an error and cannot get through that any help would be much appreciated,dataframe has no object called str when using headers i have the following df i get this df from a postgres table using the following method then i tranform the data in a dataframe using this code i want to generate a column in the df named first name i m using this code to do this when i run this code i get the following error if i remove the header part df columns header i get another error when i get this data from sql server it generates correctly the first name column when i use postgres i got this errors why is this happening,0,47,104 how to save different plots in the same png file i have to save two different scatter plots in the same png file this is the code that i have been trying if i try this it is just saving the second plot and not both of them,python dynamic keys in nested dictionary i am using the django shell to try to create such a dictionary but this pieces of code dict section category x change the price element one in two like the result below how can you keep all the elements,0,48,45 how to avoid colors mixing up between two plot types in matplotlib i have the following result it s a plt scatter with plt bar on top of it for some reason the bar chart is being colored but i want it to be of a specific color which is not part of the colors used by the scatter plot how do i achieve that my current code,edit embed description with discord buttons using discord py i want to make a button discord interactions discord components for my help command for my discord bot the help command is basically a list commands with different categories it is also a embed message i wanted to make a button where it can switch categories means that it switches edits the discord embed message description i wanted to make a feature where the user can press the button to get back to the last category and for the next category of commands they are not all in one message the next category will appear and edit the embed message if someone presses the and buttons here is my code if you know how to edit the embed message when someone clicks on a button it will be much appreciated if you share it i will use this as future reference thanks,0,65,154 how to import random seed in cycle to obtain the same result in anytime i need to get the same results in any iteration i tried to use random seed in my script but it doesn t work how can i fix it my script in this script i got several random tables whole table from one subsample,is there a way to get exact location of query match in elastic search documents i have stored some html pages in elasticsearch now i want to match an input string with all the strings present in those html and get the exact location of the match so far i have written this query this returns the whole document where the match is found is there a way to get the exact location of the match,0,55,76 django rest framework filtering does not response no data found when no data found i have a very simple drf listapiview which is using filters searchfilter as filter backend but the problem is it is returning an empty list if no data is found on the queryset my code serializers py views py result for a successful search expected result if nothing found currently returning an empty list now how do i do that thanks,convert the date format from yy mm dd to yyyy mm dd i have a problem of the following nature after reading the data from the csv file to the pandas dataframe i have the date in the first column the format of this date is six characters yymmdd int unfortunately all attempts to convert to the yyyy mm dd format have failed from the input it gets the value none of the functions i tested support the yy mm dd format python asking for suggestions thanks in advance,0,72,87 how to install python on ubuntu since python is no longer supported in ubuntu and the usual deadsnakes method also doesnt work it gives following error,building a dynamic regex string in python x i m attempting to dynamically build a regex string for a match check it will use part of users input the problem i m facing is when i build the string which uses numerical digits d for example it ends up with an additional backslash to escape the initial one so the re match never works i initially thought this was a simple problem to solve but after lots of googling and failed attempts at arr what if i must be missing something any pointers or insight would be appreciated,0,30,95 isuue running rpi ws x neopixels using python on rasberry pi i have installed the files for ws neopixels on raspberry pi b using and ran the python strandtest py i am facing an import error eventhough rpi ws x has been installed successfully while running the same code in the code editor the module is imported properly and facing an other issue,how to add multiple sensors on this python script i m trying to control gpio state using bluetooth using bluetooth terminal involving both gpio output on off device and gpio input binary sensor the script for the gpio input sensor part is the following by that the gpio output part worked but only one of the sensors worked i know python is known to only run sensor but i needed the first one written above the gpio one what should i change add in the script so it can run both sensors gpio and gpio or any other way so that the bluetooth terminal can access multiple python programs if i have to make separate script for the gpio one,0,59,115 discord py disabling command in channel i m trying to disable the command in one channel but the command is still working,how to determine did or did not on something what s the straightforward way to distinguish between this two seems to me sentiment analysis of nlp could do it for me so i m using textblob sentiment analysis but both sentences polarity is,0,20,42 python s enumerate equivalent in c i am learning c and have been taking a lot of online courses i am looking for a simpler neater way to enumerate a list within a list in python we can do something like this in just one line does it have to involve lambda and linq in c if so what would be the solution i tried it with dictionary in c but my gut tells me this is not a perfect solution,inserting json data from python into sql server i make a call to an api via a python script to retrieve data i store this data into a json file using please find below the contents of the json file i have tried extracting the values onto a table in sql server but to no avail it is not recognising this as valid json and getting the error message json text is not properly formatted unexpected character q is found at position all i would like is to extract only the values in the data array into a table as seen below enter image description here any help would be greatly appreciated thank you,0,79,116 how to one hot encode df column with list separated by pipe i have a df column containing lists separated by pipes and including extraneous information i m having trouble one hot encoding the list for example i want to encode as i ve tried but it seems to one not encode by individual characters,best practice calculating compound inflation could anyone help me with calculating compound inflation rates please i did not find a solution online so i used a good old for loop to calculate one cell at a time code attached there must be a better way to accomplish this data,0,47,50 org apache hadoop fs unsupportedfilesystemexception no filesystem for scheme oci when i am trying to access file stored in oci object storage using pyspark as shown below i am hitting above error,how do i manage an index with more than documents in elasticsearch for fast searching i have created an index in my elasticsearch server localhost that takes log files of an application this data is of more than gb json data and it took me almost hours to send it from logstash to elasticsearch according to request i can see that my index has more than million documents when i search for a particular field and its value it takes a lot of time for es to search and get results from my index i know that my output will have more than documents that s why i use the scan function instead of search in python my sole reason to choose es was that it takes very little time to give outputs but in my case it takes several minutes and in most of the testing i get a timeout error from es how can i improve my search result time is this how search engines for netflix also retrieve data,0,28,174 elif statement unreached in python script in the following code the if statement is reached and runs fine the elif statement however seems to have no effect when the script is run when the conditions for the elif statement are met nothing happens and when i press return button twice the script just keeps going skipping the elif statement altogether my code,invalid datatype for loaders pytorch lightning datamodule i m trying a text summarization exercise and i have train and test datasets with two columns text and summary labels i m using t pytorch and lightning wrapper and i have a pytorch dataset class which i can confirm is working correctly and returns the following as a dictionary of text and the ids labels and masks as tensors then i have a lightning data module class that converts the dataframes into pytorch datasets and fits them to data loaders returning train val and test data loaders everything is working until i try to execute the model and i get the following warning and error userwarning you defined a validation step but have no val dataloader skipping validation loop i have clearly defined and returned this in the data module invalid datatype for loaders textsummarydatamodule i have confirmed that i am returning a dictionary of the tokens attention mask and labels for both text and summary,0,62,162 beautiful soup web scraper indexerror list index out of range i am making a web scraper that scrapes yahoo finance and tells me what the current stock price is i keep getting an error like this after running the program this is the code i am a beginner into python so any help would be appreciated,how can i flat a list of dicts i have a dict which contain a list product which will contain only one dict i want to flat the product list of dict to obtain this how can i do this product list will always contains only one item,0,57,49 ccc j s escape room solution python i am trying to solve the j s escape room problem from the ccc i can t figure out why the recursion does not stop at a return statement here is the link to the problems,if i have autocommit true for pyodbc connection can i assume i don t have to do cursor commits after an update or insert i have the example code below do i still need a cursor commit after the last line i am running against a sql server db host if that matters,0,41,52 delete old file when uploaded new in django rest framework i wanted to delete old image from folder when uploaded new image and i tried but couldn t get result serializers py services py what i did so far i don t know what s wrong with it,django pluralize person as people trying to output the correct plural value in django template when count is more than p review markers helpful count person reviews markers helpful count length pluralize found this helpful p still returns persons or persons instead of person and people any help to fix this in the template,0,42,52 google colab change variable name everywhere in code cell when i highlight a variable within a cell in colab all the instances of that variable shines up is it possible to change all these instances of the variables at the same time and if such how,how could i install matplotlib correctly on ubuntu i am trying to install matplotlib pip install matplotlib when i try to verify the version installed import matplotlib matplotlib version i get this import im q not authorized matplotlib error constitute c writeimage what is the problem thank you,0,46,42 why doesn t the int function convert a float to integer while in input function why doesn t the int function convert a float to integer while in input function result,how could i install matplotlib correctly on ubuntu i am trying to install matplotlib pip install matplotlib when i try to verify the version installed import matplotlib matplotlib version i get this import im q not authorized matplotlib error constitute c writeimage what is the problem thank you,0,29,42 error using selenium python unable to find class in html source code i m learning how to use selenium i was doing some testing but got this error selenium common exceptions nosuchelementexception message unable to locate element layout layout base my code the source code i m trying to find using find element what am i doing wrong,can i put input in mindstorms while programming in python when i was programming in mindstorms robot inventor and decided to put an input in my code i bumped into this nameerrorthis is the error is it even possible to put an input in mindstorms,0,51,46 when using rembg in python to remove image background how can i turn on the alpha matting here is shown how to do it using curl here is my code also from the same website blockquote,detect if there are or more of the same symbol so i need to know if in a string which contains only s and s has of one of those in a row my first thought was to iterate through the string like so but it randomly gives out a wrong answer my next idea was to use regex like this but it still sometimes makes mistakes anyone has any ideas on why that would happen regex was taken from here,0,36,84 how to remove an element from an unevenly shaped array i want to get rid of the s in labels and get the correspondingly matching index elements from pred for eg the output should be i tried to use np where labels but it only works for arrays with lists of same lengths but as you can see the arrays in labels have different lengths and that is a problem,my discord bot doesn t seem to be executing a function on member join i m new to coding discord bots so this might be some easy fix mistake i made but when a member joins my server the bot doesn t seem to react be it to add a role or just send a random message in the console i d also add i m using replit to host my bot,0,68,67 from base encoded public key in der format to cose key in python i have a base encoded public key in der format in python how can i convert it into a cose key here is my failed attempt,python pandas dataframe merge join tabels on different keys i have tables of following form my aim now is to merge all tabels together i would go the following way step merge df and df the result is ok and gives me the table in next step i want to merge it with df so i did make a step between and merge df and df my problem now the output is the column isin here is lost and the step produces an error is there an elegant way to merge this tabels together with key column isin and why is the key column lost in the second merge process,0,37,112 resampling raises valueerror values falls before first bin i don t understand when and why this error is raised from my understanding resample should create as many bins as needed in order to bin all the timestamps of the index so the message values falls before first bin does not make much sense to me example actual output expected output i m using pandas,pysimplegui one line progress meter does not return false when pressing x on windows in the docs of pysimplegui it is stated that the function returns true if either the cancel button is pressed or the x button in the windows titlebar however it is only working for the cancel button in version mwe am i missing something,0,62,56 add second elements of a list based on equality condition on python let s say i have a list like this i want to sum the elements that have the same st element and get something like is there an easy way to do that in python,why is memoization of collision free sub chains of collatz chains slower than without memoization i ve written a program to benchmark two ways of finding the longest collatz chain for integers less than some bound the first way is with backtrack memoization which keeps track of the current chain from start till hash table collision in a stack and then pops all the values into the hash table with incrementing chain length values the second way is with simpler memoization that only memoizes the starting value of the chain to my surprise and confusion the algorithm that memoizes the entirety of the sub chain up until the first collision is consistently slower than the algorithm which only memoizes the starting value i m wondering if this is due to one of the following factors is python really slow with stacks enough that it offsets performance gains is my code algorithm bad is it simply the case that statistically as integers grow large the time spent revisiting the non memoized elements of previously calculated collatz chains sub chains is asymptotically minimal to the point that any overhead due to popping elements off a stack simply isn t worth the gains in short i m wondering if this unexpected result is due to the language the code or math i e the statistics of collatz,0,48,212 insert frequency of elements in list without using temporary list input a a b b b b c c d a output a a b b b b c c d a what can be the best way to get the output as above without using temporary list in python i am trying using while loop but the frequency of last element is missed out as the loop gets terminated,how can i plot d list onto existing plot without knowing x locations i am plotting a graph with datetime and power which can be seen in the big blue line on the attached image after plotting the image i am trying to insert the d list only unusual in the same plot actually df power includes the values of the d list only unusual but without including y axis alongside with only unusual i can t plot the graph how can i plot the only unusual list in the same plot so that it will be visible on the main blue line with a different color my code my data,0,75,105 pandas find the previous instance index number of a matching value i am trying to get the index number of a value in pandas for example in below table i want to bring index numbers to column found anyone have idea how i can iterate from bottom to top and find the matching value and get its index number,converting multidimensional list into a single string in python the result i get can anyone help me to solve this,0,59,21 tkinter set option command for entry after declared it i need to declare the option command for an entry after declare it here s my code here s the full error i got is there another way to pass the command option after declared it because i need to pass the entry in the function parameter set in the command,read spark data with column that clashes with partition name i have the following file paths that we read with partitions on s when i read these with pyspark all the files have the same schema and get loaded in the table as rows a file could be something like this the issue is that sometimes the files have the date field that clashes with my partition code like date so i want to know if it is possible to load the files without the partition columns rename the json date column and then add the partition columns final table would be edit more information i have or partitions sometimes and date is one of them not the last and i need to read multiple date partitions at once too the schema that i pass to spark contains also the partition columns which makes it more complicated i don t control the input data so i need to read as is i can rename the file columns but not the partition columns would it be possible to add an alias to file columns as we would do when joining dataframes spark,0,58,194 selectively sum elements of list in python editediteditediteditediteditedit,connecting a proxy to a python script using the telethon module i need to get the proxy from the proxy txt file and add to the code i doing this but the proxy server does not connect to the script what did i do wrong and why is the proxy server not connecting,0,8,52 not a valid xpath expression trying to use div aria label contains i m trying to locate div aria label containing following but i get the below error error code element i m trying to locate after following there is afifrah which changes as i use different links so i want to only locate the div aria label containing the text following what am i doing wrong,does it matter in which order you use prefetch related and filter in django the title says it all let s take a look at this code for example when using prefetch related first does django fetch all the manytoone manytomany relations without taking into consideration filter and after everything is fetched the filter is applied imo that doesn t matter since there s still one query executed at the end thanks in advance,0,63,68 and or statement only prints out output but i need all of them python when i run it it only prints out the information that is associated to ct i want to see the information for ca co and ct,how to detect tcp port scan using python i am a newbie to network programming in python i would like to know if there is any way that we can code in python to detect this kind of scan i would like to build a open source project by using the method that you might suggest thanks in advance,0,40,60 why do we need to give y in sklearn s kfold split sklearn model selection kfold s split function takes x and y y is optional as parameters why do we ever need to give y all the split function does is to generate the row indices for kfold cv so the number of rows should to be enough actually x is also not needed is it a kind of compatibility issue thanks,function that returns in a list the positions where the motif was found in a sequence i have these two strings i am trying to create a function that returns in a list the positions where the reason for the string s was found in the sequence of the string t that is in this case the positions would be but also if the reason is not found the list will return am i going the right way can someone please guide me,0,67,86 python regex groupdict with repetitions of groups wondering if there is a function such as match groupdict that catches repetition similar to match captures function when i run this code i get what i would like is something like that is there a function to do so or should i just do it by hand myself,delete a specific values from a list i have an intermediate list in the following format i need to delete all the occurrences of code please assist,0,54,27 question regarding negative indices in tuples and lists in python in this program why is the output and not this is the case with lists also i noticed print t doesn t give the output as but instead gives what is going on here why can t we go backwards please help me i ve just started python i have no background in programming,how can i find out if a list contains letters without using any libraries in a list of lists i want to get rid of the one that has letters my attempt is however this is not working,0,64,38 csv file data replacement i have many csv files which looks like i need an short function with that i can overwrite the cell in the data section from data to something like test data i need to replace a big amount of cells in csv files with that method maybe i can read the line line in the file and save it as new one so i knew it s definitely done,pandas apply function and assign indexed value of function return i have a pandas dataframe with some addresses that i am trying to geocode the geocoding function returns a list of lat long i d like to assign the lat and long to columns in pandas dataframe separately here s the code how do i access the values of the list and assign to pandas dataframe lat and long columns i d prefer to not modify the function as it is used in multiple places,0,71,82 python selenium how do i download an mp file located under inspect network on chrome when i hit inspect network i see the mp file i want here is a screenshot when i double click the mp file it opens a separate page where the video starts playing how exactly do i download this video using selenium the html for the second page screenshot of second page,label elements within a group in numpy i know how to label elements of one input array like the followings now there are two input arrays including group and value arrays a label resets on the first element of a new group it is if the corresponding value is otherwise it starts from how could i do it without spliting arrays or iteration,0,69,66 assign a value from dictionary to the list and convert the list to a dictionary i have a dictionary and a list i want the output as a dictionary with the values of k a assigned to first list k ato the second and so on in the list a like below i tried a lot but couldn t figure out a possible solution to this can anyone please help,python typeerror zipfile object is not callable when i type the code it shows this error as output how can i fix it any ideas what does it mean the zipfile object is not callable i even declared my zip function like this beforehand i declared extracting zip operation like this above i m writing this code in google colab i added the tensorflow part to my code here,0,67,68 evaluating expressions in pulp i have developed a lp problem and this works however when i print out total transfers it just gives me an expression like buy aarons m buy adams c buy adrian buy ait nouri r buy ajer k whereas i thought it should be a number how can this be printed out as a number i really want to put this into my objective function as a panalty value but unable to do this,split decimal to multiple binary column in data frame data frame has a column decimal i need to convert decimal to specific binary columns example decimal binary step with the code i got the below binary table binary step pick value and create new column requirement below is there any other efficient method,0,72,59 how create a subtask in jira automatically in case of build failure in bamboo i have an automation test project in bamboo for each build failure i need to create a subtask in jira how i can achieve this goal through automation is it possible to write a shell script for this case,multiple input and multiple output tensorflow model i am trying to build a tensorflow model which takes images as an input and gives output embedding for each input image the images are saved in a list called triplet the part of code is given below when i try to run the code i get the following error can any one please suggest where the problem is also the code provided is simplified for stack overflow so it may have syntax issue thanks in advance,0,53,86 how to one hot encode df column with list separated by pipe i have a df column containing lists separated by pipes and including extraneous information i m having trouble one hot encoding the list for example i want to encode as i ve tried but it seems to one not encode by individual characters,how to add two values from the same columns so i am looking to add values from a dataframe column and write the result in a second column column is given column will be my result what i want to do is column column column column column column,0,47,54 json data parsing using python to get the specific headers value i have a following json file format in which the data will be having dynamic update i have to parse the json file using python with the following scenario if the status pass then the results of value should be maths q q kindly me with this scenario using python,docker compose for neo j and python connection error i use docker compose to bundle a flask python app which interacts with a neo j database the two docker images work fine separately but i cannot connect the two with docker compose and when i launch the sudo docker compose up build command i have the following error when the python process start running it seems i cannot initiate the connection to the neo j database from the python process i use the following commands neo j being the name of the docker service of the neo j database here is my docker compose yml file,0,60,98 why does an ann validation accuracy oscillate the following training curve is generated using the same tensorflow keras script written in python can anyone tell me the probable cause of the oscillation of the green line so that i can troubleshoot my script source code plotting script,ok idk if its because im new to python or if i litterally broke something for my discord bot and need to redownload discord py so this worked yesterday and now its popping up alot of errors since ive tried to update do a version of discord py that will work for slash command and continue being developed here s the code its a rather easy bit of code to have the bot do some basic commands in discord so i was extremally confused when it started shooting errors out in the dozens if anyone knows what is happening here and how to fix it can you please explain to me what i did wrong and what the next course of action should be i ve tried moving code in and out of the document and editing my main py but as far as i can tell i haven t done anything wrong on it and here is what happens when i try to run the code as a new guy to python this is very intimidating if you need any of the other documents that show up in the error section i will be more then happy to post them for review,0,48,196 pysimplegui one line progress meter does not return false when pressing x on windows in the docs of pysimplegui it is stated that the function returns true if either the cancel button is pressed or the x button in the windows titlebar however it is only working for the cancel button in version mwe am i missing something,attribute error list object has no attribute checkclick in the swap function i am checking under some index a button class instance which i checked using print statements but for some reason it still gives me an error saying that it has no such attribute check click any tips on formatting are also welcome i am just a beginner i am using three different arrays to hold various instances values and coordinates for each corresponding array position i am trying to make a sort of match game thanks for any help,0,56,92 create a python pandas multiindex object from separate index objects without going into detail why i d like to do this is it possible to create a pandas multiindex from separate index objects i m specifically interested in somehow preserving the specific index types in the new multiindex instance solutions including conversions to and from a dataframe series etc are fine as long as the original separate index object types rangeindex int index datetimeindex survive,stop tkinter gui with a button i am creating a gui with tkinter and i need help i have two buttons one for starting my code and another one for exit the gui and stop the code running here is part of my code the problem is that when i press exit button the gui does not respond anymore and the code still continues in the background how can i stop the execution of the program with my exit button i tried also to delete the exit button and to stop the code simply closing the gui but the problem is the same after a while not respondind appears how can i solve it,0,74,114 how to filter rows based on cell contents in a row based expression i read some data from a file the first column is assigned object type because of the xxx in the very first data row so this will fail because of that one xxx in the first row of data where a number should be how do i rewrite the above line to filter out the bad row without actually changing the contents of the dataframe,not able to access a customfield in jira rest api i need to get the timestamp of the duration an issue was made the transition into waiting for input state i tried to get this using custom fields using this url jira base url rest api field i found out there is a custom field for it which is as follows but when i try to access this customfield i get an error like attributeerror propertyholder object has no attribute customfield the code which i am trying is need help to access this customfield i am using jira rest api and using python,0,77,95 how can i find whether each element in a list can be added based on the given values or not so i have a function findsum s g and i want to find whether elements in s list can be the sum of any numbers in g list or not so for instance if the output should return what i have tried what changes should i make to my code to make it work,how to set the font color of the data labels of the doughnut chart using python pptx i am trying to format the doughnut chart using the below code it s doing everything except changing the color of data labels is there a way to achieve that any help will highly appreciable,0,71,50 influxdb time range query i am trying to form a sql query for the below condition in where clause but it is giving an error influxdb query which i am trying and it is giving an error is as below but above query is giving badrequest error could you please help me to correct this query,error connecting installing mysqlclient to my django project please help when i try to run pipenv install mysqlclient it gives me an error indicating that visual c or greater is needed and now i have gotten but still not working i also tried usimg unofficial windows binaries for python extension packages and this showed that mysqlclient installed successfully but when i tried to run mysqlclient it gave an error saying do you have mysqlclient installed please help,0,56,78 exception sdl unable to load image when running kivy apk on android i created this very simple app just as a demo then to run it on android i converted it into an apk with buildozer the conversion was successful but when i tried running my app it crashed i tried to debug it with adb logcat and got this error i have no clue why this is happening can someone help me,how to see a particular metric in spark structured streaming with python i m very new to spark and python i m trying to see any metric in spark structured streaming for example processedrowspersecond but i don t know how to do it i ve read in structured streaming programming guide that with print query lastprogress you can directly get the current status and metrics of an active query but if i write it i only obtain none once the last part of my code is the following any idea on how to do it will be highly appreciated,0,74,93 typeerror cannot perform reduce with flexible type in flask i need some one to help me on this flask project i m doing a classification program that classifies alzheimer s and i need to solve this problem in line and line error,how to launch monitor and kill a process in python i need to be able to launch a long running process in python while the process is running i need to pipe the output to my python app to display it in the ui the ui needs to also be able to kill the process i ve done a lot of research but i haven t found a way to do all three of those things subprocess popen lets me start a process and kill it if i need to but it doesn t allow me to view its output until the process has finished and the process i am monitoring never finishes on its own os popen lets me start a process and monitor its output as it is running but i don t know of a way to kill it i m usually in the middle of a readline call when using os popen is there a way to know if there is any data in the buffer before calling read or readline for example thanks in advance,0,43,171 unable to install requirements txt i am getting below mentioned error when i am trying to install dependencies psycopg psycopg h fatal error libpq fe h no such file or directory include libpq fe h depends libpq ubuntu but pgdg is to be installed,is adding an api interface to an alembic model a bad idea i m using a distributed selenoid cloud infrastructure to distribute my automated tests in order to keep track of the selenoid instances i have a selenoid table in mysql which tracks which selenoid instances are enabled and disabled i have this table modeled using the python alembic library i m now in the situation where i need to make some custom api calls to the selenoid instances i was thinking about adding the api interface directly to the model this way i can query for my selenoid instances and then immediately make api calls with the results example of what i m thinking is this a good design practice or a bad idea,0,41,122 parser error when trying to read csv file with pandas on jupyter hey community im new to coding and as a job task they asked me to read a csv file i used the commands and after that second command i get the parser error i would be very thankful for any help i am really hoping on landing this job,custom range in numpy histogram trying to output histogram data using numpy i get the following output using above code the edges are automatically calculated is there any option to force the edges to be created like the example output like below maybe using range option like,0,61,47 do python files need to be converted into an exe to run on users computers will a python file run on a random user s computer just fine or do i need to convert it into an exe first and then send the exe file to the user thank you,kivy how to use clock schedule properly in this instance so i am working on some code to randomly send keypress s through virtual keys after a random timeframe seconds is just for testing purposes i m trying to add clock schedule once but with how i have things right now it is firing off every second because it s stuck in a while loop i ve been wracking my brain around on this one trying to figure out how to implement this properly but i can t seem to come up with something so i am reaching out to you guys to see if you can provide any input on possible solutions to this what i want in the log run is for the user to input a time they would like this to run for and for it to create a countdown timer for the user to see but before that i need to change how this current timer system i have set up is functioning and i figured clock schedule would probably be the best bet as now while the time sleep is running the program won t close,0,49,182 django type error missing required positional argument file id hello i m trying to create a platform that will solve problems and then let the user download a file with the result i m having trouble with the downloading part this is the error i m getting models py urls py views py download html,python replace d in txt have source file txt download from accounting program with a in line when it s not needed it makes line break and have d and a in the place when it s needed i need to open it in excel i have another opportunity to download it in csv when i download almost the same data in xml i encounter the same problem when getting data with python but i ve solved it by but i can t replace a separately when i write i get all a and d a replaced by space when i write i get everywhere d a in both places please help i tried to replace separately u u d u a any but it doesn t work this combination isn t found tried solution but it doesn t work couldn t attach picture in comment,0,50,136 how do i handle cookie accept button within nested iframes in selenium with python i ve tried almost everything and searched on so but can t get passed the cookie accept on gmx com hoping someone can help out so far i ve tried and what am i doing wrong any help is greatly appreciated,sqlite query in python using datetime and variables not working as expected i m trying to query a database using python pandas this will be a recurring request where i d like to look back into a window of time that changes over time so i d like to use some smarts in how i do this in my sqlite query if i say i get the result i expect but if i try to move those to variables the resulting table comes up empty i found out that the enddate variable does work but the startdate does not presumably i m doing something wrong with the escapes around the apostrophes since the result is coming up empty it s like it s looking at datetime now and not seeing the month bit comparing now vs now which would be empty any ideas how i can pass this through to the query correctly using python,0,51,148 applying args and indicating string values in merging columns function i am using the following function but want to apply args instead of column column to make the amount of columns variable also i want to give in the arguments that the args should be string values does anybody know how to implement this,how to organize list of string file names into a readable form im making a script to anaylze file size changes over time and at the end i have a file that looks like this but thats pretty hard to read and figure out what files change and what directories changed the most how can i organize this dict so it looks more like this,0,54,65 binance websocket for futures i can t make the websocket for coin m on binance returns any data i managed to get it to work with the spot endpoint but in the futures it is a null response i m trying differents parameters in the susbcribe method but neither of them returns anything also i can t find any list with all the possible symbol pairs that could be used any ideas,check if values in a column exist elsewhere in a dataframe row suppose i have a dataframe as below i want to check if elements in column d exist elsewhere in its corresponding row so the outcome i want is towards that end i used but this is somehow giving me false false false false,0,68,55 unable to create logfile minute wise in python while using multiprocessing unable to create logfile minute wise in python while using multiprocessing,open and save entire workbook and not just a sheet pandas on python and pandas so i m trying to use pandas to write to a workbook while saving the entire workbook as a whole and not sheet by sheet for example test xlsx has sheets named sheet sheet and sheet currently i m getting an error of attributeerror dict object has no attribute to excel i m trying to open the workbook write some data to a sheet and save the workbook as a whole,0,22,83 easy how do i separate elements grabbed by class name using selenium webdriver i m opening two links from links txt and outputting to names txt i m trying to get rid of the word featuring and add between the elements current output desired output my code html here s a screenshot of the html just in case,why plot python different with matlab and even excel im trying to read data from scv file and plot them reading process easily worked but by plotting is full missed up i have tried that with matlab and even excel both are plotting correct but in python i have problems it seems like that plot photo with python plot photo with matlab i would be thankful for your help,0,55,69 django orm query to update reverse many to many field models look like book can have many authors and author can have written many books now this information is required to be updated in the db how can this be done in an efficient way using orm currently the db may have book id linked with author id author id so the update should be able to add author id and delete author id as well,how to use choices in a model from a table previously populated with a fixture i have the following model i populate the model via python manage py loaddata db json json fixture after the model is populated i would like to use those regions and countries as options for another model field i did some research and it is clear to me how to use choices from a constants py file but i have not found a good explanation on how to use it with previous populated models,0,70,86 superimposing plot over errorbars in matplotlib i am trying to superimpose a plot over my error bars i have searched online and this seems to be the method to do this i am expecting the plot to look the way it does however with thin black lines running between the thick colour lines,typeerror strings must be encoded before hashing on this code i have this error wordlist hash hashlib sha word hexdigest typeerror strings must be encoded before hashing can someone help me,0,53,29 hangman python project i have been trying to code a hangman game but couldn t do it because there seems to be an error with my if requests because he dosn t detect a valid letter in the word although there is please tell me if i can give you any more information looking forward to hearing from yall and i am really interested in the skills i can learn d,formatting a number that has been retrived from an excel file using openpyxl i am trying to retrieve a balance of an account that is stored in an excel worksheet and display that to a tkinter gui i get the number to display but i need it formatted with the and decimal points any help would be much appreciated code when running said program i get screenshot of results the balances are correct but how do i get them to alway display as currency with the and decimal points,0,69,93 why does colaboratory google take much longer than pycharm are there any factors in the python code that could justify the delay in generating the results i plotted a gif of orbits in pycharm and the result took about seconds on google collaboration it took minutes can i do anything to improve this,how can i display dates on the x axis in matplotlib i have daily data from jan st april th i have the dates in datetime format but when i plot a line plot with time on the x axis and the variable on the y axis matplotlib prints out way too much on the x axis how do i fix this issue with plotting dates i have done this so far how do i plot the dates so you can see the xticks,0,55,87 resampling raises valueerror values falls before first bin i don t understand when and why this error is raised from my understanding resample should create as many bins as needed in order to bin all the timestamps of the index so the message values falls before first bin does not make much sense to me example actual output expected output i m using pandas,remove rows from dataframes not present in dataframes in dictionary i have a hundreds pandas dataframes such as these i also have one dictionary like this except with a number of keys and values to reflect the number of dataframes what i need is a way to go through the dictionary and for each dataframe and corresponding key i e df and d and df and d remove the rows not present in the dictionary value dataframe so for df i need to go to the key d and remove the rows that are not in the dataframe for this key that is remove r and r from df so the result i want would be any help is greatly appreciated ps if it is easier to keep the rows instead of removing them that would also be helpful,0,62,137 how to solve this error install cryptography for dirsearch tool i don t know why this error i want to solve this error so that i can run the dirsearch tool properly note pip install cryptography not helpful click to see screenshot,time sleep alternatives for trials are there any alternatives for time sleep on python where i can run a function while timeouts because i have these codes what it does is that it runs the pyautogui after seconds what i want is to run the pyautogui at the start and have trials for seconds if the image is not located within seconds then it will return error,0,41,68 xml to python dictionary i have an xml file where the contents are in tree shape like below what are the various ways i can convert this to a simple dictionary in python,folium chloropleth map only showing grey help to troubleshoot i having trouble getting some air pollution data to show different colors in a chloropleth map using folium please let me know where my code may be throwing an error i think it is the key on parameter but need help this is how my map turns out enter image description here what i would like is for the mean concentration of the air pollution data to show up on the map but the map is still greyed out here are the files i used geojson file used download zip in upper right of this website data file exported data from here here is my code import geopandas as gpd import folium,0,33,125 regular expresssion i have a dataframe and i want to extract a specific part of it into a new column i believe this should be easy to do so using regular expression the dataframe i have is like this the desired output is to get all the gr ids in another columns such as i think the best way to do this is sort of df b df a str extract regular expression any help on how to do this,phython my script can run but nothing happens so i ve been working on my school project and making progress and it looks like everthing works at this stage but for some reason when i run the script nothing happens i could try removing some lines of code and try to figure out the issue but i really dont know what to remove since i need everything on the code right now if someone could help i really would appreciate please ignore the comments troughout the code im portuguese haha,0,77,89 creating and filling empty dates with zeroes i have a dataframe df i want to fill the missing dates for each product id with restocking events to start i have created a date range dataframe using dfdate pd dataframe date pd date range simple date min simple date max where simple is some master dataframe and min and max dates are and,env file always returning none using os environ get and os environ i m trying to access the env file but it always returns none here is my file structure in my env file i ve written i ve tried doing and both of these methods return none so what am i doing wrong here any reply will be appreciated here is also the error message just in case it s useful,0,50,65 not able to define logic in else for pattern printing got stuck expected pattern printing below is my code i have printed the first part but got stuck with else part printing required some input how to build logic for else part expected output,converting an xlsx file to a dictionary in python pandas i am trying to import a dataframe from an xlsx file to python and then convert this dataframe to a dictionary this is how my excel file looks like where a and b are names of columns and and are names of rows i want to convert the data frame to a dictionary in python using pandas my code is pretty simple what i want to get is but what i get is what might be the issue,0,45,90 calculating standard error does not give expected result i want calculate standard error of vector and i don t understand why it doesn t work let s consider vector calculating standard error of mean is just to calculate standard deviation and divide it by square root of length of vector however when i calculate this by function i obtain completely something different could you please explain to me why i don t unsterstand why this difference occurs,how can i fetch the html elements within a bounding box using playwright i have a full page screenshot taken with playwright and a object detection model which returns some bounding box coordinates over it i would like to fetch the corresponding html element s text that is contained within the bounding box so far i am using playwright s python api like this but it seems that the coordinates further down in the page are not found is it possible that the lower elements are not in the viewport and i need to scroll down to find them and in general is there an easier way to retrieve the element handles of interest within a bounding box from a screenshot,0,73,119 problems scraping a dynamic website with beautiful soup i would like to scrape crime news articles from the website but the soup object does not return the required div tag could anyone give me reasons for that,finding selenium by class attribute when classname isn t unique using selenium how i can select element by class attribute i have i need to click in mis comprobantes i can t use class name because it isn t unique,0,37,37 loop in pandas dataframe i have this problem looping through this dataframe its printing the same column for each value thanks,converting a text file to json using python i have a text file which contains which code in python could be used for converting the text file to a json file looks like this,0,21,34 is there a way to copy subfolder without copying recursively am trying to copy subdirectories from directory but i realize the first subfolder copied is copied recursively i would not like that i would like to copy the sub folder intactly when i run the code i have sub dir a sub dir b and dir b copied in new dir i however want dir a and dir b in new dir,wrong output on python string to datetime so i want to read csv and make a plot for the data i use plotly candlestick to output stock data however some problems i met here very strange the output for dataframe that reading from excel is like this here i am using strptime to convert the data to datetime but the output is wrong you can see that was converted to why how can i get the correct result and i will need to use it on plotly candlestick function data sample if you need,0,63,98 adding the last position of an array to the same array in matlab one can do how can i replicate this in python,apscheduler id not found can date scheduled jobs have ids i don t know what i am doing wrong but whenever i run this code i get the error apscheduler jobstores base joblookuperror no job by the id of item last run was found,0,23,38 how to get a google sheet id which doesnt exist yet i have a google worksheet with which i m doing pivot tables i would like to add pivot tables in new sheets that dont exist yet one pivot table by sheet on the same spreadsheet currently i m creating new sheets and recovering their ids by hand i wish it was automatic here my pivot table do you have any ideas,is it possible to change the sent file in discord python i need to change embed with local file photo from my machine to send embed you need to send the file along with it but it cannot be changed when i try to do this my code i get the following error typeerror object of type file is not json serializable there is no such error when using a link from the internet directly without file from link i think i need to upload my photos to the internet with a photo api or something else but it is very slow is there a solution to this problem,0,72,109 extract a specific url field from json output using jq i have json output as follows i want to extract the value for the example io creatorid field currently the following code returns all of the values under annotations however when i tried the below script appending example io creatorid it fails error can anyone tell me how to achieve this using jq fyi i am running this as a python script,so i want to use ffmpeg with heroku but i keep getting the error that i dont have ffmpeg installed so i made a bot for fun on and its okay when i run it like on replit or my local pc but on heroku it wont work i did add the heroku s ffmpeg to buildpacks but it still give me the same error also the codes are available at github,0,68,73 removing white space from url python i have a url that has white space in the beginning i have to remove it before passing it to urllib request urlretrieve but i am not able to remove it what i have tried till now any idea how to remove it my final code running above code will throw error as urlerror urlopen error unknown url type https root cause of the error additional white space in the beginning of the url,row selection by input values in pandas i m getting input from user and trying to select the specific row in a data frame but i cant my code my data frame has the date yyyy mm dd and battery serial but no time hr mm sec column,0,79,43 how to extract longitude and langitude from keys i have the following setup for my data frame now i am trying to arrive at having place id lat and lng in columns my code is but unfortunately nothing is happening i have still my core column including the entire geometry,writing commands and flags separate with argparse i was writing down a code in python which makes use of argparse module to make it easier to use it i can add arguments in the form of flags like but like in gobuster when you use help flag h you can see you can also pass commands like dir fuzz etc they also have separate help flags for each of them like how to achieve this i can make flags without arguments by in short i m trying to find out how to define commands separately so that they also show up under commands in help section and not under optional arguments i m also trying to find out how to create a separate help section for each command,0,49,124 merge all txt files in dataframe pandas i have a series of txt files in a folder and i wanted to move these files to a data frame but i only managed to do this by saving a csv file how do i work with the data frame directly without having to save to a csv file follow my code below,restarting a custom generator function for training new epochs in keras i ve written a custom generator to take my specific order of files and yield batches in a specific way the generator is working fine and returning the batches as needed the problem is when training i need more epochs to fully train the model but after being depleted in the first epoch the generator is finished and doesn t return anything more in the next epoch using model fit dataset generator clean path noisy path denoised path noise data batch size verbose epochs batch size makes tensorflow return an exception as expected warning tensorflow your input ran out of data interrupting training make sure that your dataset or generator can generate at least steps per epoch epochs batches in this case batches you may need to use the repeat function when building your dataset what is the best way to go around this my generator also has a seed input to synchronize training and validation sets very much likely the generators in keras if i wanted each epoch to have different seeds would i need to write a custom fit function too the generator at the moment,0,61,187 optimize function python dataframe i have this python code of the supertrend implementation i am using pandas dataframe the code works fine but the supertrend function runs slower and slower as the dataframe increases in length i was wondering if there is anything i could change in the code to optimize it and make it go faster even with a large dataframe length vector version,combining two values from two different columns and print unique values and count of unique values i have a data frame where i have two columns and each column has values each and i want to combine all values from the two columns and print all unique values and count number of unique values example column fruits has values these values apple orange banana grapes mango column fruits has values these values apricot avocado blackberries grapes mango now i want to combine values from both the columns and print all unique values and also want count of unique when both are combined expected result apple orange banana grapes mango apricot avocado blackberries unique value count please can anybody help me with the code,0,65,135 how to simplify slightly different if statements to one in python i would like to simplify this code and not repeat the if not statement and the print only one condition is being added in the first case curaccession data and the print is exactly the same is there any way to achieve this with a flag or something excuse my naive question i m not familiar with python,how to aggregate values in pandas i have a pandas dataframe that you can see in this screenshot it has a time resolution of minute i would like to aggregate the first columns and calculate the rolling average and for the th column availability of the ev i would just like to take the value every minutes for this i have the following code when i run this code i get the following error typeerror only valid with datetimeindex timedeltaindex or periodindex but got an instance of rangeindex do you know why this issue occurs and how to solve it,0,69,103 how can i find the last non empty column number of an excel file using openpyxl how can i find the last non empty column number of an excel file using openpyxl so if the last column with data is column n how do i get that letter and then convert it to a number,get last day of week of a given date given any day of the year such as today i would have the last day of the current week for example current day is monday so the last day of this week is saturday because of isoweek in my systems starts from sundays how get ldow df could be implemented,0,53,59 np zeros missing required argument shape pos i m working on a notebook from the deeplearning ai course and i ve ran into an error the problem was that i had initialize the parameters of the neural network with zeros i ve filled in the correct shape at correct position in the argument but it does not seem to be working and i m getting the following error enter image description here,pandas compare dataframe with csv file and update the csv file i have below ddataframe now i have another csv file reporst csv now i want to compare the df to this csv and then update the csv to the below now it is updated and look same as it is in the df how can i update the csv according to the df value but not tough the other rows in the csv which are there already i have the code getting error keyerror none of hostname are in the columns,0,68,91 how to put cookies in python requests i have a cookies like that how to put it in this link i tried it bu didnt worked,how to get matlab error message when running a matlab script from python i am running a matlab script through python for some reasons i am running it using os system matlab batch my script in python assume there is an error in the matlab script this error will be printed on the terminal window as matlab work space but i want to catch the error message in python level and use it for other purposes e g email it out or save it to a txt file i d appreciate it if you can help me with this note for a reason i can t use matlab engine package in python so i am using system command,0,27,113 what is the main problem in this situation,how to hide axis tick labels in plotly my code is this the resulting image is this radar chart i can t hide the tick labels no matter what sorry for the dreadful formatting thanks in advance,0,8,36 python web app with flask updating image tag on view with button tag i m developing a web app with python and flask i want to display an image using an html image tag and a button tag to open the browser and choose an image and display it inside the tag by updating it using jinja how could i do that main py index html,what is the best way to work with whitelisted ip s on a mysql db when using docker i have a server which contains a python file that connects to two external mysql db s one of those db s can be easily reached while the other server requires that ip s be whitelisted in order to have access to that db that server s ip is already whitelisted and works as intended when ran the problem arises however when i attempt to run the docker ized variation of the application the first db runs just as it does before but the second db no longer works when inside the container i can ping the second db and it works but whenever i try to access it via the code hosted on the server it doesn t return data within any of the functions that utilize it i noticed that the container has a separate ip and may be causing issues since that docker container s ip would not have been whitelisted and may be where the problem begins i am fairly new to docker so any documentation links that would assist me would be extremely helpful,0,66,189 set a maximum to the instantiation operator of a class python i want my code to return a error if the user enters a to high instantiation operator like this but i don t just want to print out an error i want the console to give an error out,replace all occurrences in a string by another string i have this string i m trying to replace all p n x by x n for example would return,0,50,25 problems with putting the apply method the error i am getting is the following int object is not iterable i think i am applying the apply function correctly but still getting an error,how can i concatenate pytorch tensors or lists in a distributed multi node setup i am trying to implement something like this for nodes each node with gpus i tried to get a sum of these but what i want is a concatenated version like this or is also ok with me is it possible to achieve this from torch distributed,0,33,62 pygame score update during the collision when using collide rect in my pygame i want the score to update only once when colliding not continuous increment to a very large number in a short time the score will update again after the one sprite completely leaves the collision area and re enters so the score will not update during the collision is there an efficient solution in pygame thanks,how to add pandas data to an existing csv file in google cloud storage i m saving files to a csv on my google cloud storage using pandas the problem is that my file gets overwritten when i rewrite data i have however specified the writing mode to a to add afterwards without rewriting the file thanks a lot for your help,0,66,62 getting error message while runing code in pycharm i m trying to run a code that will draw a love image using pycharm but i get an error that i seem unable to fix please i need help with this what am i doing wrong i get this error while runing the code below in pycharm i don t know what am doing wrong,why is my psycopg query failing with psycopg errors internalerror assert i m running psycopg on python querying a redshift table i m querying a table with a select passed to the cursor execute method and i m getting back the following i can query other tables in different schema and the same schema but not this table the table has varchar and timestamp column types i m using the infinity special date time input in one of the columns,0,62,74 cannot use make function in cygwin it just says no module found called numpy i already installed numpy and i have anaconda but for some reason it doesnt get recognized by cygwin error cygwin log,why is that find customer by name function only search the first customer example of customers that i want to find from my list my code from customers module to handle the customers system the code in main,0,36,35 how to convert dask object columns into decimal columns i have this function in pandas i would do however dask doesn t support this so what is another way to convert a column into the decimal type,how to run gunicorn inside python not as a command line i have a flask application i run it in production with this command instead i want to run it inside a my file py i need a function to run and it should accept the app object and port binding and number of workers how can i do that i need something like this psudo code the most important part to me is the app app part the main point is that i want to use the app object as an instance of flask i want to directly give app object to gunicorn not throough addressing it in a string what i have tried i have opened gunicorn library main py file to see how it works but could not figure it out,0,36,130 pymongo find primary master node name in mongodb replica set i m working on an api which requires the primary node s name from an mongodb replia set is there a way to get the name and ip of primary master node in a replicaset using the pymongo api or generally any way i could get that info from a python program,how to update a text value in a button i m new to python and kivy and i have trouble to display updated value from a variable for now is only displaying the starting value which it is there is a code in which i m decreasing the value of myapka moneyy by when i click and i want to get this variable myapka moneyy to be displayed and updated each click i click,0,59,72 python import module with arguments i have a module that defines some functions and i want this module to import different package based on arguments for example i now have a file called my module py when i import my module from another file i expect to somehow add an argument cuda such than when it s true then my module imports cupy and then prints out cupy otherwise import numpy and prints numpy for example this is my main py,creating multible ids for multible buttons in one input tag i m working on a tictactoe game using django djangotemplates python and a bit javascript i ve come across a problem tho i only have one button which is for looped times its id is its index now i m not certain how to add the index which i defined in the for loop in the javascript onclick function here the html template here the models py and here the views py i also got a database but there is really not much in there except the player ids,0,75,93 how to draw semi infinite line ray in matplotlib we can draw infinite lines from a given point with given slope in matplotlib with plt axline is there a clean way to draw a semi infinite line or ray from a given point in a given direction preferably without having to calculate the axis limits for axhline and axvline we can use one of xmin xmax ymin ymax arguments to get a ray but axline doesn t accept these related questions,get all the values of particular key using periodictask of celerybeatmongo models i am using periodictask of celerybeatmongo models to schedule my tasks i have a requirement where i need to fetch all the values of particular key something like this get all the values of a particular key but using celerybeatmongo,0,78,51 how to use pandas to rename rows when they are the same in column a my dataframe is i want to use pandas to rename hospital when a row with the same value in the hospital column has a different value in the generalrepresentation column and when a row with the same value in the hospital column has the same value in the generalrepresentation column no renaming is done for hospital the effect i want is shown below,can celery wait until enough resource ram is available i have a program that does heavy computations on big images and obviously it can only process so many requests that the system s ram allow i use celery redis for queuing these long tasks and wonder if there is any way to instruct celery to check for ram availability first before starting a new task but keep them queued nonetheless some type of lock that will open after ram is freed by a finished task i would be happy with any suggestion or direction to look in,0,79,95 django how to remove url parameters what would be the best way to remove parameters from url in django for instance when facebook adds fbclid i am trying to do a redirect directly in urlpatterns but the parameters keep getting passed through for some reason i assumed this would be some simple command like allow parameters false or something for example go from to,column with list values if list has more than element decode both values and include in a list in the same row in new column i have two columns cat and cat that have gibberish for values in them this is because i will be referencing a python library to derive info from those gibberish values if a list has more than element in a row whether in cat or cat i want to go ahead and fill the row of a new column results or results with its values separated by a comma examples shown below how can i get from cat and cat to results and results,0,62,111 how to generate list of sequence number in faster way using python anyone can improve processing time to generate list of sequence number here is my code and it needs second please advise thank you,python pass variable to paramiko so i m taking all ips from the range to and individually connecting to ssh with each ip when i run print host it gives me the ip but when i use the variable host in ssh connect i get the error getaddrinfo argument must be string or none and if i put the variable host into quotes i get the error can only concatenate str not ipv address to str,0,38,75 how can i efficiently decode vectors to numpy operations i am trying to generate an encoding that maps vectors to operations between numpy arrays and do so efficiently for example if i have two operations np add np foo and i encode np add as and np foo as what is the fastest way to go from a vector np array to np add essentially a more efficient way to do,python running error on macbook pro m max running on tensorflow i am trying to run this code from github binary bot on my new macbook pro max m chip metal device set to and i am getting the following error any suggestions,0,68,42 how to convert bson to json on python im catching program packets and i got this bson gwaaaajjraadaaaau qaelqasex lo qgaeg jaaeaaaaa also i found a site to convert it to json but its on java script how to make similar using python site code,conditional count of rows in a dataframe based on two columns in another dataframe i would like to add a column to df that includes a count of rows in df that have matching herd and ddat values the output i am looking for is,0,42,45 integrate facial recognition model trained in python in advance java projects i want to develop a web based voting system in java the system has facial recognition and otp verification i have a a facial recognition code in python and the model is accurate how can i implement facial recognition in my web based voting system,typeerror descriptor date for datetime datetime objects doesn t apply to a datetime date object so i am trying to convert a yyyy mm dd string into a english format as weekday ddth month year however i am having issue converting the string into a date format which i believe is yyyy mm dd here is my code i am getting a typeerror descriptor date for datetime datetime objects doesn t apply to a datetime date object error which i frankly can t wrap my head around any help would be appreciated cheers edit here is a working example using the calendar library although completely different it works,0,56,99 getting a maximum value from a list in pandas columns i have the following dataframe df i would like to apply max of all in the list values and would like to get the following result i have tried this but couldn t succeed can any one help on this,given a rod of length n you need to cut it into r pieces such that each piece s length is positive how many ways are there to do so description given two positive integers n and r how many different ways are there to cut a rod of length n into r pieces such that the length of each piece is a positive integer output this answer modulo example with n and r there are ways to cut a rod of length into pieces constraints testcases my approach i know that the answer is n choose r mod i have tried all different ways to calculate it but always out of test cases went time limit exceeded here is my code can anyone tell me what other approach i can use to make it in o time complexity,0,47,164 sort d list with last character s frequancy in python i want to sort a d list t a b b with each list s last character s frequancy in reverse since b is times and a is time so sorted list should be t sorted b b a i wrote the code but it is not working fine what is the right way to do it without using counter python,expand information in one dataframe and link with data from other lets say i have dataframe as such and another one my goal is to expand df id to connect it with respective value from df variable to do comparisons of within values of variables from df for each index from df data at hand has large volume what s the most efficient way to expand information from df and ascribe value from df variable,0,79,71 use multiple cooldowns discord py i ve been trying to use multiple cooldowns for invalid commands and command cooldowns but i get redefinition of usage for both of the on command error events this is what i have currently,ajax post data does not show up in python i make this http post request using jquery when i receive the request in python when i try to print request data the string is empty when i attach the debugger i see that data are under form request form how can i make them accessible from request data thanks in advance,0,35,59 pretrained model error collections ordereddict object has no attribute eval i m using the pretrained resnet model and i have to use in this project this model with pretrained weights which gives,vectorizing a custom parsing function gives a valueerror i ve written a custom number parsing function basically i want to convert app size information as it is given in the google play store m m k to a standard float number to apply this function to a column of data in my data frame i want to vectorize it using numpy vectorize however when i m testing it i m getting an error this is the function as you can see if it receives any input that can not be parsed as a number it returns the original input when i test this manually it works fine parse numbers m returns and parse numbers not a number returns not a number now i try to vectorize the function and i test it like this i get the following error when i test it using only the parseable numbers vparse numbers m k not a number it does return a list of the correct numbers to me what am i missing here am i not using the numpy vectorize function correctly,0,31,170 brownie not working cython undefined symbol pygen send i set up my development environment on fedora and when i run any brownie command such as brownie console or even brownie version i get the following error setup python cython gcc gcc c fc x ganache cli v i have spent a whole day trying to fix this error please help me out,how do i get the key press and write it to a variable i am writing a program translator wrote a programming interface i want to make it so that i get what the user enters write to a variable translate and output however i dont understand how to do it i have looked at many forums but have not found an answer i want the user to enter his text for translation in the left text entry window i receive this text write it to a variable translate and display the translated text in the right window i want to do this in order to automate the program so that the translation is automatic without buttons function languages,0,58,121 game stops reacting after th click when balls generated this game will generate a ball in a random location on the grid after each click but it stops reacting on further clicks after reaching balls see screenshot above since the program does not react on clicks anymore i interrupted it in console with ctrl c after interrupting execution the console shows following how can i fix this,read a tar gz compressed file form a file stream uncompress it and put it in another file stream without writing to disk i have a big gb directory with multiple files that is stored in s in the format tar gz and manipulated by a lambda function the file system of the lambda function is read only so i would like the operations to be done in memory i cannot include it in the image of the lambda function itself as github won t accept such large files having lambda to read it from s seems to be reasonable but i can t get how to uncompress it sorry i m a beginner here is what i wrote here is the error message,0,70,119 django display a list of post s categories with a number of post hi i am trying to make a template in django that displays a post categories table and has a number of posts with it i can t seem to make it right using annotate when making queries on my model like this views py im receiving list of posts instead and has a posts count key with value of models py where did i miss thanks,how can i get the permutations for every number within range to lst so i wrote this code that attempts to return all the permutations of a number in range lst however the output that i got seems to be incorrect because when i put in i get but i m supposed to get and when my input is permutation my output is but i m supposed to get this what changes should i make so that my code returns the correct output,0,75,273 how to add track number metadata for an mp file using mutagen every other tag seems to work e g title cover art artist but i encounter an error for the track number tag trkn every time in the mutagen documentation it states what s the fix to this,setup py is not install dependencies i am trying to create a command line utility that can be installed via pip install git and i am testing locally with python setup py install when i test this locally it installs fine and i can invoke it from the command line but i get a modulenotfounderror no module named dependency error the github url appears to be correct based off of the documentation here specifically git running pip install git actually works as well so i feel confident that the url isn t the issue project structure any pointers here would be appreciated,0,47,100 string variable won t change in function i m making a game in python and i decided to make most of it within a function if you look at my code it should change the value of the variable but it won t,python iterate list of column names and access to column i have a dataframe called df want to iterate the columns to encode list and get the value of df column but i m getting the following error as expected any idea about how cancould i do it,0,40,45 python import helpers how do i import helpers in script py python version directory structure script py command error,pandas column into key value respectively i have a pandas dataframe similar to this my end goal is to have column to be the keys in a dictionary and then column to the values e g dict index s p marketcap any help is greatly appreciated i am quite new to pandas python and have been referencing this doc with no progress here is the code i have at the moment which is scraping the data,0,25,77 route to directory in flask i need to expose some icons from a folder in flask like so i need to make the assets routeable so i can access the png files from urls like this here is what i have in my app py so far i am not sure how to add the assets directory to the app py so the png files are accessible,kivy numeric keyboard on text of the text field i am trying to add numeric keyboard in ui which will be display as clicked on the text on filed but some how numeric keyboard not show in the ui i use numeric json file to open the numeric keyboard as per the kivy documentation json file and link is here is my code below,0,68,64 connect to mysql database over ssh in python script i am in a situation where i need to access a mysql database running on another computer computer b unfortunately the computers aren t on the same local network the only way i found that i can access the sql database on computer b from my laptop computer a is via ssh my question is can i access the sql database over ssh from python,how do i stop the background music in the arcade library i need the music to play until the game is over at which point i d like it to stop but nothing i try seems to work below is the shortened version of the code i m working with if anything the sound should stop playing immediately because self game is set to false in the update right away but no matter what i try the music keeps playing,0,73,77 how to save python result as excel xlsx this code below read txt files and print the results but i need save the results as xlsx i searched the internet but i didn t get any solution can someone help me the data format in txt files is like this them are registration data from images uploaded to an e commerce,identify lines of speech which contain words from a list using pandas i have the following dataframe and the following list which contains keywords i would like to generate an output which shows both the speaker and line no associated with them for each time their speech contains at least words from the keywords list i have tried iterating through each line in the dataframe to see if there was at least keywords present however my code only returns the last line below is the code i used the expected output for this particular case should be in a similar format whereby the first value is the line no which contains speech which has at least keywords and the letter is the person,0,59,126 dimension reduction using varimax rotation and method used is principal to find component score coefficient matrix here all my code which gives me rotated component matrix but i m looking for component score coefficient matrix dimension reduction using varimax rotation and method used is principal to find component score coefficient matrix,django jquery get selected value display undefined hi i m having issue with passing data to jquery in my select i have added onchange method and it calls getproductdata and pass this select element in getproductdata i get the element and display the selected value i tried using few methods but the output of alert is object object or undefined i m not using select id on change because it in a dynamic row and each id for tr select and input are the same for a better understanding please view this image forms py html jquery,0,52,91 ray tune fail to start to run i just run a python script as is shown on however when runing the script it seems that no change happened for a long time when interrupting it with ctrl c it shows below i have no idea what have happened and what to do the script the feedback,i can t create super user postgresql and django i am doing a project with django in which i try to change the database from sqlite to postqresql when i try to create the super user i get this error settings py models py the project works normally when i turn on the django server the problem is when i try to create the superuser from the terminal i am not sure if the problem comes from the connection between the postgresql database with the project or if it is some problem of migration of the models created and loaded in django s default database sqlite it would be excellent some help thank you very much,0,56,113 how to remove backslash from decoded json string i have records that have a list of maps dict in which i have encoded data in it when we decode the data we get a json string with extra backslashes now i need to remove the backslashes from the json string json output rawdata after decoded data my python program but this is able to remove double backslashes and newline n but it leaves single backslashes output,python not enough arguments error when insert into mysql i m trying to insert multiple csv files into an existing mysql database here s my code the problem is when i execute the code i get this error mysqldb exceptions programmingerror not enough arguments for format string i ve counted right and i have the same number of s and columns so i don t know why this error is popping out thanks in advance for the help i m starting to go crazy i can t found anything lol,0,76,84 function view throws an exception of unboundlocalerror at group share when a user tries share a post what could possibly be the course of this exception unboundlocalerror at group share when i try sharing post of another user in a group the exception trace seems to be on the the first line of the forloop new new post video add img here is my view for users to share post here is my model post,groupby and pivot pyspark dataframe on many columns i am new to spark and want to pivot a pyspark dataframe on multiple columns there is a single row for each distinct date rank combination the rows should be flattened such that there is one row per unique date the real data has feature columns and the ranks go from to for each date the desired output i have a solution that appears to work for my trivial example but the memory usage is so extreme that i can t use even th of my data without getting memory errors,0,71,101 how to update many to many relationships using sqlalchemy and fastapi models py data inside table user roles how can i write an api to update the user roles table when request object to the api is user id roles how can i achieve this using sqlalchemy in fastapi,printing lists of dictionary keys within a molecular interval for an assignment i need to implement a previous function into a new function that given a fasta file and a min and max molecular weight returns a list of sequence ids for sequences that have a molecular weight within the given interval this is my previous function this function prints a dictionary with as keys the ids and molecular weights are the values this is the new function it works but it s not the right output it gives all the ids instead of only the onces that are within the given molecular interval the fasta file that i use,0,44,109 having problem with the usage of driver find element by selenium i am trying to make a bot that auto logins to a website in order to write the username i m trying to use when i m looking that spesific variable from website on inspect the varible is two word like matinput formcontrolname on any other website if that varible is one word like id i simply write id after by and it works what can i do in this situation,how can i fix a traceback most recent call last error in a pulp constraint i am trying add constraints to this linear optimization problem using a for loop the constraints are x a x b x c x d x a x b x c x d etc the traceback error occurs on the first run of the loop and i am struggling to figure out why any help would be greatly appreciated,0,79,76 how to convert infix to prefix if the operator present in front of expression if an equation is how could i convert it into prefix it s operator is in front of the equation,can t find module cpickle in poetry and jupyter i am trying to cache some variables in jupyter notebook cells that are big and take long to compute i use ubuntu and python i added ipycache in my pyproject toml file and it was successfully installed with poetry then i added load ext ipycache in a cell and when i execute it i get i thought that pickle is used by default in python and whenever cpickle is imported then it automatically uses pickle instead however this import import inspect os sys textwrap cpickle is not on my end so i cannot do something like import pickle as cpickle to fix this error it also seems ipycache is not maintained anymore is it possible to resolve this issue from my side or should i try a different caching method,0,37,139 problem with assigning d array as a one slice of d array i try to load series of dicom files into d array i do this on bad way because i got an error something like this not fluent in python valueerror could not broadcast input array from shape into shape i don t understand why because i specify the shape as,keras output layer for multiclass classification problem with value range to i have an input layer of neurons two hidden layers of neurons each with relu activation function now i am having difficulty constructing my output layer you can compare the input value with the pixel value of mnist dataset each input numeric value has an output from the range of to each value from this range to represents an output class i have contracted an output layer of with the activation function sigmoid my code is in my training data set the input and output are int data type but i get an error like this invalid argument received a label value of which is outside the valid range of label values can anyone please help me with this is the problem in my loss function how can i tell the output layer that i have outputs class from a range of to,0,64,200 how to create an animated line plot with ploty express i m trying to create an animated line plot to illustrate the price increase of different asset classes over time year but it doesn t work and i don t know why what i ve done so far output,inputs at the same time can t be read i am just starting with python when doing a tutorial i did exactly what the guy said and in the beginning it worked but then it didn t anymore it is as if the first line becomes the input of the second input if i run each input line seperately it works though i m working on vsc,0,46,65 separate a list in parentheses keeping them inside a list i have a list like this and i want this i am interested in knowing if there is a library that performs this procedure directly otherwise how to do it with some function,calling one python script inside another with command line arguments i have two independent python scripts that work independently by supplying relevant arguments now i need to call python py in python py and pass the relevant parameters that are accepted by python py is this the right approach note both scripts should keep working independently as they are now,0,43,56 retrieve dataset from a dictionary i have a function that splits a dataset in a non iid setting this function returns a dict of the labels for example if i apply this function to a dataset i obtain this now starting from this dictionary i want to obtain the original dataset split as stated by the dictionary for example dataset will have the samples and so on dataset will have and so on,validation password and updating the dictionary python i have to create a validation function to check if my password meets all the requirements the password must be at least characters the password must contain at least one lowercase character the password must contain at least one uppercase character the password must contain at least one number the username password cannot be the same then i have to write my signup function and check if my username is in my user accounts dictionary if it is not i have to updates the username and the corresponding password in the user accounts dictionary updates the log in dictionary setting the value to false returns true when i run the code i get this my dictionary is empty i think my dictionary update command is wrong because the validation function is working these two functions are link to another one in which i open a file txt thank you for your help,0,76,161 i want to get sendtime as an input in smtplib i am coding a program that sends scheduled emails but i require the time in code like this i would like to get this send time as an input from user like,database data is not updating on my apache website unless i restart apache service edit i have django installed and am using apache to host the website using wsgi i have checkboxes on my website and when i click a checkbox and then click submit it saves the change to the sqlite database and refreshes my website if i log out of my website and then back in the checkbox is no longer clicked but the related database item is showing true in the django admin site if i restart apache using sudo service apache restart and refresh the website it then has the proper boxes checked i am brand new to django apache so i apologize if this is a stupid mistake but restarting apache every time i make a change seems wrong edit i have changed my code to use a modelform i think i did it properly as recommended by the first commenter but i am having the same problem my views py my main site html my models py my forms py,0,42,171 snap get real command not working how to fix this code is supposed to print a db in bytearrays and then print an array with the floats values of the plc output however when i run the code i get the following error message,error pg config executable not found when install psycopg in centos i am install psycopg in the centos using this command but shows error like this i have already install postgresql devel using command dnf install postgresql devel y and install successs why still could not install the psycopg,0,43,48 venv with renamed python exectuable i m trying to create a virtual environment using a custom python build e g mayapy exe m venv myvenv but i keep getting the following error error winerror the system cannot find the file specified this is a known issue and has something to do with the fact that i m working with a renamed executable do you guys have any work around for this issue,find nearest value in dataframe let s say i have a dataframe like below each cell has x and y coordinates in tuple i have an input called i and that s also x and y coordinate in a tuple my goal is to find the nearest point for input i sample input sample output i have tried the below snippet this gives me what i expected but is there any efficient solution for the problem,0,71,78 can t download file on put file in pywebio i m having a problem running the pywebio program in combination with flask when i try to use put file or download session from pywebio it produces an error like this and the file cannot be downloaded error status and here s an example of the code i m using,dataframe slice after every nth column in python my dataframe has rows and columns and i need to slice the dataframe such that all slices chunks are of a size each so i want a since after every nd column finally i want to append all these slices one below another so i get a final dataframe of size any help will be appreciated,0,53,74 rear diagonal sum in the matrix i want a matrix amount that can be in any size for example x or x etc but reverse my problem with for loops along with if not working well would appreciate help for example the result is the function gets an initialized matrix with values and size,sqlalchemy orm define custom function in model for selects how can i define custom filter function for model so i won t duplicate it across my app i mean if i have some model like this and i often use such select get row data for specific table and row i don t want to use activerecord mixin where i can get session inside model so i want to make some function which will get params and return object for session execute i didn t find anything useful in documentation,0,61,87 leetcode smallest string with swaps time limit exceeded problem using python the problem is to use unionfind to solve the problem below is the correct solution i kept getting the time limit exceeded error if my find in unionfind class is either or there are total test cases for this problem using the two find methods above will only get passed so what s the difference between the correct find and the two above thanks,filenotfounderror in subprocess check output i want to connect and use the functions of adb in a python environment in the terminal adb is connected well as shown below to use this in the python environment subprocess check output was used i wrote python code as below i got an error as below in my opinion subprocess check output does not seem to be able to import the path environment variable how should i solve it,0,77,70 getting errors while making a serial connection using netmiko i ve tried dev ttys ttys com but no luck getting following errors while connecting via serial using netmiko,how to get nearest match in csv file python if want to get the nearest match in my big csv file in python my shortened csv file is i have made a programm but it isn t finished and i don t know how i can complete it do i have to use an another program algorithm look from left to right on the row and find the row with the most sequential matches to the search data,0,27,76 how to automate elements without a class id in python selenium i m trying to automate the pressing of the following button in selenium but i m used to referring to elements using their id this button has no id,raising typeerror when type is not correct i d like to call function foo a b c where arguments can be int or float those arguments user inputs using space as a separator for example in the same time user can input not only digits bit make some typo like k in this case i should raise typeerror and type the number of incorrect element in my code i have the next error i can t write k into int variable how can i raise the typeerror when user input k and how to be in situation if user inputs k h i that case i need to raise the typeerror with message the type of element is incorrect,0,38,124 google function how to handle multiple resource path in python i am trying to create a small rest server using google functions would someone please let me know how to handle multiple resource path currently i am doing following way as google function is using flask underneath for python is there any way i can handle it using app route decorator,web scraping pagination using beautiful soup python it gives me this error kinldy explain how can i solve it,0,61,19 extracting the actual output of generator in a list i am trying to get the actual output from the generator but i get the ouput as generator object please help me achieve the actual output from the generator output expected output,python read a line from a file then remove it with threading i have this program that uses python threading to read different lines in a file if it reads a duplicate line then reads another one and once it has read it removes the line from the file the problem is that whenever it reads the file it doesn t update the file or i m not quite sure what s happening it can sometimes read the same line as before therefore breaking it i m not sure if my code is the most effective way to do this,0,41,96 read in multiple google sheet workbooks with a for loop in google colaboratory i have multiple google workbooks all named in a structured way e g math student assessment sheet grade math student assessment sheet grade i made a dic for all the workbook names and variables i would like to declare them as i tried to read them in but i get this error i am confused what is wrong with my code,how can i setup visdom on a remote server i d like to use visdom for visualization of results in a deep learning algorithm which is trained in a remote cluster server i found a link that tried to describe a correct way to setup everything in a slurm script i use my ip and to connect to the remote cluster server i have the following lines of code i got this error how can i run my plotting script on a remote server how should the command line of python code be in my slurm script how can i store the plot and move it later to my laptop using scp command,0,75,113 how do skimage morphology remove small holes and skimage morphology remove small objects differ both of these methods are included in the scikit image library for python i m trying to extract certain objects from images and ran into these two methods in a senior dev s code written for the same purpose i have read the documentation for both skimage morphology remove small holes and skimage morphology remove small objects but i can t understand what difference these two methods pose when they are run on a ndarray containing an image,openai gpt search api not working locally i am using the python client for gpt search model on my own jsonlines files when i run the code on google colab notebook for test purposes it works fine and returns the search responses but when i run the code on my local machine mac m as a web application running on localhost using flask for web service functionalities it gives the following error this error occurs even if i implement the exact same example as given in openai documentation the link to the search example is given here it runs perfectly fine on local machine and on colab notebook if i use the completion api that is used by the gpt playground code link here the code that i have is as follows any idea why this strange behaviour is occurring and how can i solve it thanks,0,72,148 find common character in list of strings i want to find common chars in given list of strings without using collections library can someone help on this input output,how to create yolo model from train and test images i have a dataset of images that have two folders test and training i need to do object detection using opencv and yolo thus i need to create my own yolo model for the street objects for the training folder training example training image training image for the test folder test i have the classes txt file which includes id name and classification warning indication and mandatory example here the numbers are the numbers or ids in the training folder names and classification my purpose is to create a yolo model from these training images i have checked some papers and articles but in their case they label the full image using labelimg but in my case training images are so small and they don t need any labeling thus i m confused about how to do this could you please give me some ideas,0,29,153 replace values of certain column and rows in a dataframe with the value of another column in the same dataframe with pandas i want to replace value in categori column from index to with keterangan column with the same index here is my dataset looks like i already try this but it doesnt work,making an animation with matplotlib i am trying to create an animation in python with matplotlib but i don t know what is wrong with my following code it is producing a blank image,0,57,33 how make a protect from editing excel file i create a excel file from a dataframe how can make it protect from editing this excell file i want be only for view from users,how to check if a file is a csv xml or json without relying on the file extension i have a program that accepts a combination of multiple input files and also can take directories to scan for those input files normally i only accept files with valid file extensions for csv xml and json but as i ve learned over the years you can t really trust the user to give the correct files for example if a user has a file with an xml extension but the actual contents are json i would want to warn the user and treat the file as a json file another situation is the on unix based operating systems file extensions aren t used for identifying file types like windows does which can open up more situations of incorrect file type compared to the file contents right now my program collects the list of files filter them into only the ones with acceptable file extensions and then i create a concurrent futures threadpoolexecutor to be able to check all the files simultaneously the actual check looks like so there are two major issues with this i have the following idea to remedy this the problem with this is that since my program tries to run this check on multiple files simultaneously the memory usage can get dangerously high with so many files opened at the same time the other minor issue is the i o cost of opening and closing so many files at once just to check for the file type is there some more efficient alternative for what i m trying to do,0,34,266 only accept numbers with one decimal place the user should only be allowed to enter a number between and with one decimal place furthermore if is passed it should try again the input what i tried i don t want to use round number also i am not allowed to import any modules except math,cleaning data deleting rows with any text in certain columns i m trying to do some date cleaning on some huge datasets and i m new to python i ve used google to search for my problem so please bear over me with my terminology the data is imported from a csv into a pandas core frame dataframe some of my columns should only contain numbers and others only text i would really like to get rid of the rows within column req sampletime and cprnum which is not digits long and contain text so it would look like thanks for the help thanks to danish bansal i used your code as it fits my problem the most my final code looks like this i get the error message as typed above in the code but it still seems to work and the output is as excepted with the correct number of fewer rows than the original file,0,57,152 object is not callable but i do not know how to divide the module into each other i have this trouble module object is not callable i want to split the values i get in modules how to do it better combine them into one module or can i do as i wanted in the code,transferring files from a subdirectory i have a subdirectory update and i need to move all files and folders from it to the current directory removing all files and folders from the current directory the problem is that there are a lot of subfolders in the subdirectory and i can t figure out how to move them all,0,58,57 python how to reduce to one liner how do i write the following in minimum lines using python,how to assemble nested list elements output it is working but when i change nested list like this i get an error what is the best solution to fix this problem,0,18,39 typeerror unsupported operand type s for list and float in python bar chart i am trying to plot grouped bar chart i have this data i want to plot graph like this with labels printing at degree angle getting this error my code is this,how to use python to map bytes to c struct i have a nested c struct size is very large and bytes how to map the bytes to c struct and access the member,0,46,34 why is sqlalchemy not setting default value correctly for some reason in this example the optional is active attribute is not getting set to default value i was expecting the default value of is active being optional input to be true but i get none if not explicitly passed,how can i send messages to my private telegram channel with telethon i want to send a message to a private telegram channel using python with telethon what i tried but this code gives me this error,0,47,37 error in multipart form data request using pydantic basemodel in fastapi this is my pydantic model this is the endpoint i m trying to send a request via multipart form but i m getting the error this is the payload of my request what am i doing wrong,how can i get geopy to read addresses from a data frame i m testing this code i keep getting this result however if i pass in an address like this below it seems to work fine result i must be missing something simple here but i m not sure what it is,0,44,51 how do you add more than one command how do you add more than one command function to python py this is my code,logits and labels must be broadcastable logits size labels size i am trying to build a model that predicts the facial expression the model i used link i adjusted the data so that it has three folders train test validation each folder contains three subfolders named disappointed interested neutral this is how i ran the code this is the model itself when i run model fit it gives me the following error i have tried a lot of different ways and codes but i keep having the same error,0,23,86 azure ml studio container has crashed did your init method fail i am trying to deploy an ml model through the azure ml studio using the notebook itself the commands we are using can be found here we have registered the model as below but while running this command we are getting the error that container has crashed did your init method fail the logs are the init method is,hangman python project i have been trying to code a hangman game but couldn t do it because there seems to be an error with my if requests because he dosn t detect a valid letter in the word although there is please tell me if i can give you any more information looking forward to hearing from yall and i am really interested in the skills i can learn d,0,71,69 how to group data returned from sql and convert in json i have the following data coming from sql result and i have to make a json structure like i know there are multiple ways to do it like involving dicts and list or itertools but unable to figure out a cleaner way to do it because data is variable and it d keep coming from the db,adding labels to some datapoints in seaborn regression plot given condition here is a table i ve created a regression scatter plot scatterplot with best fit line i would like to add labels to datapoints in the plot where values are in either columns not sure how to do this,0,67,51 neural network input of layer sequential is incompatible with the layer expected shape none found shape none i am working with some data to make a trainable model suing neural network this is the code i am working on it gives me this error valueerror input of layer sequential is incompatible with the layer expected shape none found shape none please any one can help we solving this problem,add filters dropdown to line plot based on a pandas dataframe i have dataframe and want to visualize in line plots that represents in a whole vehicle segmentation status in active registered and productive the status is count from transaction by month small dataframe image example in the x axis i want to put the month and in the y axis is active registered and productive and i try by implementing this code output plotly i also want to filter by company in dropdown and value get from dataframe column company so when i select a determined company that represents their value status active registered productive how can i make dropdown into plotly or any other way,0,71,116 how to download a video using python i just want to watch many anime but im so lazy ok if you can help me i have got a code and one small problem the site block my last request and give me this i think the problem in ip where the request comes from when site sees new ip he blocked the video download link how to fix it sorry for my english,ssrs download from python giving corrupt file when i run my script it creates a corrupt not openable pdf file here is my code which seems to work for a lot of other people this is a no parameter test report and it s called untitled the status code is and i ve confirmed the login info is correct by changing one character in the password to make it incorrect which returns a bad status code if i go to the url in my browser it shows the report but if i do the full url it gives me an error any suggestions,0,73,102 how to request existing files from a form in django i m trying to add a feature for users to update thier profile but i want to be able to get thier existing informations so they don t have to fill all the form again i have tried request post on the form but it doesn t work it does not update the form with the existing user informations views py,can returned attributes be forced into lowercase changes on our ldap server have changed the case of the attributes returned from search for example mailroutingaddress is now mailroutingaddress the searches themselves are case insensitive but the python code processing the returned ldap object is attempting to reference attributes in all lower case and failing is there a simple way to specify that the ldap module should lowercase all returned attributes or is there a straightforward way to change them to lowercase as soon as the results are returned we re trying to avoid extensive rewrites to handle this change in our ldap software this code returns an error key not found when the last line was change to this it worked i was hoping there was something i could do when the ldap object was first bound or i could iterate over all of the attributes passed back by the search function,0,66,151 matrix powers in tensorflow given an integer k and a symmetric matrix a as tf variable how to compute the k th power of a most efficiently in tensorflow,merge two dataframes based on rows i know there are a lot of resources on merging two pandas df but i am trying to merge one df based on the ids of the second one but i need to make new columns out of the rows of the second df its a bit confusing but i have an example here that might clarify what i am trying to do what i have what i want any help would be appreciated,0,27,80 jsondecodeerror expecting value line column char when scaping sec edgar my codes are as follows i could run the exactly same codes last year but when i ran it yesterday the warning popped up jsondecodeerror expecting value line column char why how should i solve the problem thanks a lot,find a column value that has transacted in all distinct column values i have to find all values in column that have transacted in all distinct values in column for ex from the above table we can identify the fruitseller a sells all the fruits,0,56,45 why do we need to move if statement i don t understand why moving under end text works but it doesn t work in the position shown below the full code,add column from column using python and spacy i have a bigquery data warehouse containing all the data from a mongodb database those data are sync once a day i would like to add a column to one of my table that column is a cleaned lemmatized version of another column the type is string i can t do that with dbt because i need to use the python library spacy how could i run such a transformation on my table without having to get all the data locally and sending m update on bigquery is there some gcp tools to run python function against bigquery like dataflow or something like that and in a more general way how do you tranform data when tools like dbt are not enough thanks for your help,0,28,138 when using rembg in python to remove image background how can i turn on the alpha matting here is shown how to do it using curl here is my code also from the same website blockquote,calculating the average vector for each unique element in a list i have a list of the form that has a size of around it contains many duplicate entries there are actually only unique words in this list and so i would like to reduce this list down to a size of the number of unique words by taking the average vector of every occurance of that word for example my new list will have the form and will be of length how would i do this,0,36,91 syntax error in random number generator in python x heres my code im getting a syntax error on the question raw input not sure why im using a mobile python app that i think runs on x because of the raw input main works fine im not sure what the questions problem is im still learning python so if anyone could explain thatd be great,or as a shortcut for if is not none else very often i will have assignments like this is somewhat verbose i think this can be shortened to at least if i know that var a will not take on a value like or are there any downsides to using this shorter notation,0,64,55 how to run a server in the cloud im creating a server in python that receives post requests process the information in the request using some scripts sometimes using a database and send back a answer in json format im searching for a way to run this server and code in the cloud in a way that i dont need my pc turned on for it to work because my connection is very unstable,typeerror employee object is not callable i have a class and below is code for post request i am getting error in last return where i was trying to get employee emp id value,0,74,32 doubly linked list insert after a certain node ends in loop python trying to learn data structures in python implementing doubly linked list when i am trying to insert a new element after an element it is ending up in a continuous loop please try to explain where i am going wrong and why is it ending it continuous loop i am posting my entire code here but the issue is at insertat please help,find a connected subgraph with n nodes and e edges in python i have a very large undirected graph dataset in the form of txt which i converted to networkx graph i need to extract a connected subgraph containing n nodes and e edges if possible but not necessary how do i go about it this is the code i wrote for finding largest connected subgraph the subgraph i want is somewhere in the middle of min and max subgraphs any help help will be appreciated edit it can be any n nodes no specific nodes required,0,74,99 how to handle large labels text got cropped in python barchart i have this data and i plotted bar chart but the labels for my bar chart i rotated them to degree as labels are large but even after rotating at degree the text got cropped you can see in figure below how to figure this out,how can i scrape json value from key i am trying to scrape odds from betting site i am pretty new to python and i need some help some kind of odd id is stored in key b so basically for every match in this json file if match contains key b with value i want to scrape value of key g and store it in my list gg in key g value is odd that i want to scrape but if match doesn t contains key b with value for that match i want to append only one time to list gg with this command i can scrape odds but i don t how to append to gg if match doesn t have b oddid,0,61,126 run string through hashlib lets say i have a string like i would like to run this string through every hashing type python can offer from some package lets say hashlib so ideally solution for this problem would be something like is this even possible in python,how to handle the lights in pyvista when using a transform matrix for the camera i m using camera transform matrices in pyvista to do an animation but my object is shadowed i apply the same transformation matrices to the lights as you can see below here is the animation i get when i don t do anything to the lights,0,47,59 grpc about a client to server stream rpc but with an error of exception iterating requests i made a demo about a client to server stream rpc but when i run client it appears an error as below and codes of server codes of client protos i make it as easy as possible but i still can t figure out what is the problem could anyone help,python remove quotes and brackets when printing a list of lists into a file my list looks like this how would i store it in a text file so it looks like this,0,62,34 i just wrote some code for a simple game but my try except code keeps messing up i have a try except statement in a loop but my try except doesn t work even if i input a correct name of a tank,implementing an unbounded min priority queue using a singly linked list in python i am doing a class project and i have to implement an unbounded singly linked list using python i need to implement a given insert that has to consider the following cases insert into an empty queue insert at the front of the queue insert after some existing node this is the class given in python and i need to implement the insert function given at the bottom i am new to this so any help would be greatly appreciated,0,39,93 python django struggling to create a dynamic list i want to create a section on my site where for each subject links to corresponding past papers can be found but i am struggling to get any output looking for ideas my views py my models py my html content,python pandas replace string of zeros in series i have a pandas dataframe with a date variable with dates formatted like this however some dates with for the timestamp are formatted like this i have written a simple function to strip the last digits leaving only the date and time with no decimals but before stripping i need to standardize the dates with for time to have the same number of characters as all other dates so far i tried this code but no change occurred no error message was given i also tried it with regex false and tried using str replace instead p s here s my function to strip digits does anyone now how i can replace the timestamps or know of another way to strip all dates to end up like,0,47,142 problem with eliminating rows that contain nan in selected rows in ascii data file i have an ascii data file containing nans in each row my goal is to keep the rows where column name lat is not nan here s the partial listing of my data file here s my code any help thanks,root after in tkinter stops after first iteration consider the following code instead of calling the function do something every milliseconds it stops after the first iteration is my understanding of root after wrong or am i making a mistake any help will be appreciated,0,53,43 how to get every value of a key of a json file with multiple dicts how to get every value of a key of a json file with multiple dicts i want to extract every value of username key data json this is what my code so far but it gave me this error keyerror username main py,reading a text document with special formatting in to a numpy array i have a text file with the following format x value y value z value id i would like to read this into an array and i have been partly able to do with positions np genfromtxt file skip header n header lines usecols however i run into a problem when the x value is negative this results in the following x value y value z value id the problem being that numpy now reads x value as one column and does not separate the the string from the float i hope i was able to convey my problem clearly does someone know how to solve this problem,0,56,110 scientific notation for scatter plot i have a dataframe with customers and their scores i would like to plot a scatter plot which shows the frequency in a scientific notation currently i have plotted the data above as follows how can i transform axis in a scientific notation for example,how to import python files from within a notebook when the files are in another directory i have a folder structure that looks like and in my notebooks i want to run but of course that results in the error so far i found i could do this by first running but that is breaking some functionality in vs code what is the right way to do this update i m finding that running this in my notebooks and then importing my code as is working much better but still happy to learn of any better approaches,0,51,96 how to update many to many relationships using sqlalchemy and fastapi models py data inside table user roles how can i write an api to update the user roles table when request object to the api is user id roles how can i achieve this using sqlalchemy in fastapi,how do i ssh from one linux server to another using python i am trying to ssh from an ec tools linux server to an on prem linux server i am attempting to utilize the built in os module to ssh into another server but my code is not currently accepting the password input the idea is that you run the python script and you type the name of the server you want ssh into and the script will pull the server credentials for aws secrets manager and use the credential to open up an ssh session on another server note i do not want to remotely run commands on another server i simply want to run a python script to grab creds and ssh from one linux server to another the issue that i have is when i execute the python script on the ec instance i am being prompted to enter a password this is an issue because the password should have been applied with the server pw variable that the script executed i stored the password input as a variable and printed and verified that it has the correct password does anyone have an idea as to why the password command to verify credentials for ssh is failing in this instance,0,44,212 iterating through a list python sql i m trying to search a database by iterating through a list of search values i m almost there as this works for integers but not strings the code below won t work but if i replace the list values with numbers it does,how to iterate through a string and change a character in it in python i want to capitalize a char in a string specifically using a for loop can someone show how this is done using the code below or something simpler but still using for loop iterations,0,47,48 a type guard function that st argument s attribute type is determined by the nd string key argument e g key dict then typeguard dict i tried to parse a json data into a python pydantic class object the problem is that the data is like i m thinking to make a type guard function check type and use it like below it will allow my ide to have better maintainability is it doable,python turtle why does this program not work so i was making a snake game i have the following code what it does is that just a turtle window with a black background pops up and stays blank if i press s the background colour changes to white and that s all i have no idea why this doesn t work any help is greatly appreciated pls i need to give this a birthday present tomorrow if someone could give an immediate response i would be extremely grateful thanks in advance,0,69,90 selenium python framework import issue when i run my selenium python tests via right click run in pycharm all is good however when i try to run with command line pytest i get error here is my folder structure driver py file looks like this testname py looks like this and when i run pytest v s tests testfolder testname py i get following errors in my console thank you for your help,plotting a heatmap based on a scatterplot in seaborn is there any way that i can plot a heatmap in seaborn based on a scatter plot for instance i have the following scatter plot and want to plot the corresponding heatmap in such a way that darker spots in the heatmap shows more crowded areas in the scatter plot,0,68,59 i want store a specific number when achieving the condition in to a list python i want to store and in a list when achieving the conditional wholesale i want to store value ms explain more about what i want i am new to programming sorry if there are errors in the code,compatibility of datetime with cudf and pandas for filter datetime in python i want to test cudf but stuck with a first simple task of filtering by datetime code works perfect with pandas but not with cudf testdata csv looks like with cudf throws keyerror datetime,0,55,45 how to solve the duplicate integer issue in an array for the isvalidsubsequence array sequence question prompt for isvalidsubsequence how to solve this repeating s issue using my code,how make a protect from editing excel file i create a excel file from a dataframe how can make it protect from editing this excell file i want be only for view from users,0,28,34 how to disable all tensorflow warnings i have a for loop with several different deep learning models in it that generates this warning i have tried many different things in the for loop to stop it from popping up with no success is there simply a way to disable all warnings,how do i write a neo j query that only returns a node that doesn t have a very specific relationship with another kind of node lets use a family tree for simplicity s sake a person parent of b human parent of c human parent of d human for the sake of arguing node a is of a different type than nodes b c and d it doesn t matter why i want to find a query to return only node a s if none of the human nodes connected to them have the property social security number e g d ssn null or trim d ssn if one of a s relatives has that property i don t want it returned i ve tried experimenting with lots of where clauses with parenthesis but neo j didn t like it i also tried some pattern matching but apparently i was getting a cartesian product and couldn t figure out why any thoughts,0,51,142 how to find the closest date from a mysql query to a specific date i have a table in mysql which stores dates i also have a datetime variable called x i want to get the closest date from the table to the x variable i ve been trying to do something like but it doesn t seem to work any possible solution,how to compare multiple columns and produce values in single new column using apply function in pandas using the apply function in pandas i want to compare multiple columns in a datafarme to see if there values are higher or lower than a numerical value than based on the result of the condition if higher or lower i will output a string value in a new column i am able to do this when comparing column to the numerical value but not with multiple columns how would i do this with multiple columns below is example i m using the example works well for column but i cannot get it done for multiple columns in addition to column c which im comparing to the numerical value i want to also compare columns b and columns d to the numerical value note i do not want to use lambda function method code is below,0,61,156 python regex re findall method throwing list index out of range error i m learning web scraping using python regular expression and practicing the following script source but when i run it s throwing indexerror list index out of range,how to loop trough objects in html i want to loop through my categories in my html i am making a filter that will show all of the categories but i cant get my for to work i need some help heres my code ask if theres any more info that you need to solve this html views models,0,37,61 osmnx error module osmnx elevation has no attribute add node elevations raster i am trying to get elevations from a raster file and add to the road network i am getting module osmnx elevation has no attribute add node elevations raster error following this notebook my osmnx version is and all other functions have been working i don t want to use the add node elevations function because requires a google api key and i am looking for a free option,how to connect to azure data lake storage using presto on python so i need to use presto to connect to adls now i have read hive can connect to adls and presto can be used to connect to hive but i could not find a single article on how to connect to adls using hive using python thanks in advance,0,72,61 pandas find the previous instance index number of a matching value i am trying to get the index number of a value in pandas for example in below table i want to bring index numbers to column found anyone have idea how i can iterate from bottom to top and find the matching value and get its index number,detecting kick discord py i tried to add a functionality to my discord bot that would detect when some moderator kicks someone and retrieve the kicked user s id i am thinking of an event like on message or on member join but couldn t find an answer to my question thanks for the help,0,59,49 python requests not recognizing params i am requesting to mindbodyapi to get token with the following code using requests library gives a response as follows but if i request the following way it works anybody could tell me what i am doing wrong on the above code,how to remove a specific value from two lists if they exceed a given euclidean distance i have these two lists of data x y now i want to remove the specific cartesian point x y which has more than a specific euclidean distance example how to do that this is what i did but didn t work out,0,47,58 changing color of squares in pygame i want to make simple program in which you can press squares on screen and they will change color but i can t find in documentation how to do it with pygame draw rect i don t even have an idea what is the name of the thing i want to do so if this is very easy i am sorry,is there a way to find the number with the highest probability of being the next one in a user input list so the user inputs a list of n numbers in one string not more than and the program finds and outputs the number with the highest probability of occuring next i m somewhat of a beginner and am stuck on counting the prbability python won t let me convert both he list element and the method i m using to ints,0,62,81 how the following conditional statement works can someone explain me how this code works i really appreciated,leetcode getting stuck in while loop i m doing question leetcode substring with concatenation of all words i m getting right answer in pycharm but memory time is exceeding while submission of the code i think its getting stuck in while loop it s accepting when i run these variables or or but when i submit it s getting time limit exceeded with series of just aaaaaa time limit exceeded image the code,0,18,69 can t download file on put file in pywebio i m having a problem running the pywebio program in combination with flask when i try to use put file or download session from pywebio it produces an error like this and the file cannot be downloaded error status and here s an example of the code i m using,python numpy array of numpy arrays as object i have some np arrays i want to concatenate them as objects in an np array i want to obtain coordsall this is my code coordsall is now but i want two objects in my output array like many thanks,0,53,48 using discord py to send a message everyday at a specified time i m trying to make a discord bot that will send a message at a channel at a given time i found previous codes but they don t seem to work for me since they give indention errors i m not an experienced programmer and any answer would be very helpful,django form fields to html i m crating fields in a for loop and storing them in a list in a django form when trying to place the fields in the html file it appears to be printing the object something like this django forms fields integerfield object at my html looks like this this is how i create the list how can i convert that string to an actual input,0,59,68 how to get the first and last date of the month with year and month in python in the below code from the month and year need st and last date of the month for ex month and year first date last date i tried with calendar but it simply returns,except statement with a while statement i got this situation what i want is to continue the except while i len datelist not just the first time an error occurred there is an easy way to do it thank you so much,0,59,40 cannot delete or update a parent row a foreign key constraint fails sql error i m trying to delete the product row using the delete button on y frontend frontend is in reactjs but it throws this error message on the python sql server ysql connector errors integrityerror cannot delete or update a parent row a foreign key constraint fails grocery store order details constraint fk product id foreign key product id references products product id on update restrict delete route code product dao py file code postman request,python heapq replace is slower than pop and push so i want to half the largest element of a list k times i implemented it with heapq after multiplying everything with to have a min heap at first i was using max to get the first item and heapreplace because according to the documentation they were faster heapq heapreplace heap item this one step operation is more efficient than a heappop followed by heappush and can be more appropriate when using a fixed size heap heapq nsmallest n iterable key none also when n it is more efficient to use the built in min and max functions however when i run it with a large initial list and k it takes very long over s and when i run the version with heappop and heappush it runs very fast is heapreplace really slower than heappop and heappush or am i doing something else wrong,0,77,149 how to get text from handwriting image in python the image the image is handwritten line of text this is extracting the text some what but not the expect same in the image and the code is the output buttered off before there twinkling like new yar sytemy hung cuter of tempting uwitationx they beaged hi to contre the extera,operations on a graph using pyvis with python i have defined a graph by using from pyvis network import network and defining a network as net network i added to the net edges and nodes using the functions net add nodes nodes and net add edge x y there is any chance to deal with this graph not only using a visualization so for e g to find all paths between two specific nodes because searching in the documentation there is only the possibility to plot the graph i saw other options e g class to deal with graphs example but is very annoying to define the graph with a dict of a dict,0,60,106 lowest value subtract second lowest value within a group panda python groupby i have a df which i m able to get laptime difference between the lowest laptime substract and the remaining laptime within the groupby with original df i need to fill the value with the lowest second lowest value within the group however i can t find a solution result trying to get kindly advise thank you,problem with executing command in python script so im trying to execute a code from a friend for a discord bot it s a markov bot that s started with the command b sendsim when i try to execute the command it gives me this error it works on windows but not on my raspberry pi i tried to fix it but i do not know what s wrong what s the problem i just want to know what s broken,0,68,75 pyusb usb core usberror errno input output error in windows i have a python code using pyusb to talk to a device that looks like this and i am getting in the device ctrl transfer call that exact code is working on linux with this same device but failing on windows what can be the problem,interpreting multiindex datetime i have the following code what can i do to interpret the multiindex dates as the x axis in more readable year and month format such as in a format like strftime y m a similar question was asked here renaming months from number to name in pandas but i am unable to see how i can use this to rename the x axis any help would be appreciated,0,53,71 usage of qtableview and qstyleditemdelegate classes pyqt i found a pyqt code from here including two classes customtableview qtwidgets qtableview and customdelegate qtwidgets qstyleditemdelegate how can i use them for a qtableview in a qmainwindow with my data code data and qmainwindow,remove group if contains record with status i would like to group records by id from df and delete group if any of records has status output i would like to get i tried dfnew df groupby id filter lambda x x status but i got the error typeerror filter function returned a series but expected a scalar bool,0,39,60 difference of results between while loop and for loop when working with list i was trying to answer an exercise in a beginner s guide to python book i tried using the while loop first and got the right output but i experimented by using the for loop and got an unexpected output why the difference in results output incorrect correct output,recursion puzzle with key in the box i currently try to understand recursion on made up example imagine you have a briefcase which can be opened by the key the key is in the big box which can contain other smaller boxes which key might be in in my example boxes are lists the recursion appears when we find the smaller box we search it for the key the problem is that my function can find the key if it is actually in the box and can t go back if there is nothing like key unfortunately i could not understand how to go back if there is no key in the smaller box can you help me solve this puzzle by the way have a nice day here is the code big box consists in the way when the key can be found and returned,0,61,146 need values to unpack in for loop got in django after updating my project from django to django i am facing this issue need values to unpack in for loop got let us consider my views py as how could i solve my issue,how to add fields with default values to the user model in django i need to add fields to the user model with default values that will not be displayed in the registration form but i am new to django how can i implement it and what am i doing wrong models py forms py views py settings py,0,51,55 no module named pip which using virtualenv based python when running the system installed python i can find pip however if i create a virtualenv with this python and activate it then i can no longer find pip i am completely baffled by this what is it about reading through a symlink that could make pip disappear,average list of arrays within a list for each number how to average this list consists of array and list i mean to get average on each number i tried below c a b but results in error unsupported operand types please help me in acheiving this like the expected output below expected output average sample format on each number not the right answer of above average,0,55,70 adding the last position of an array to the same array in matlab one can do how can i replicate this in python,in python remove all stop words bad characters from my pandas dataframe in python i would like to remove all stop words including bad characters in one go from my pandas dataframe this is what i have tried however my dataset still contains some characters that are in my stop csv for example and are still in my dataset where it successfully removed of and ft why i have also done the same with regex a za z however i prefer the stop worklist solution and would like to get this working concrete example print of stopword list example dataset after cleaning before cleaning after this contains but dec was removed,0,23,111 python asynchronous fqdn resolution i have a list of k ips and i need to get their fqdn doing this synchronously takes ages so i tried coding it asynchronously but i don t see any difference in execution times synchronous method execution time seconds for ip addresses asynchronous method execution time seconds for ips obviously i am doing something wrong but i can t figure out what,dictionary leaf generator here it is my tree a nested dictionary i managed to write a function that prints all the leaves which produces the desired output at this point i thought it would have been nice to decouple the action printing in this case from the access to the leaves so i modified the function above slightly turned it into a generator and moved the printing part in a for loop which unfortunately doesn t work first of all why doesn t it work and then of course how to properly write a leaf generator,0,69,95 return previous row value based on id column to find differences between current row and previous row i am new to python i am having a problem trying to look up previous row values based on id and timestamp in a python dataframe can anyone please advise how i should derive the solution below is a simple example for example id timestamp sapstock laststockdate laststockvalue,how can i make a tkinter button for loop with different commands that execute functions with different parameters i am trying to write a restaurant app that displays all available menu options and adds the item price to the total after the menu item button is clicked for example if i click cheeseburger is added to the total and the label on the bottom is automatically updated here is my code here is what my program looks like here is the csv that my program reads,0,75,89 integer divisions hey guys i wanna make this problem but i made a mistake guess i want to find the integer divisors for the number n entered there is a two condition first n must be between and second if n number is equal to zero i want to print zero as output,python hexidecimal byte interconversion oddity i must be missing something yet the following doesn t convert back anyone know the error here,0,56,21 indexerror index is out of bounds for axis with size when running inference on coral dev board i m trying to run a quantized and edge tpu compiled tensorflow object detection model on a coral dev board my code when running it via mdt shell it throws the following error the dev board runs mendel linux and has python and pycoral installed what can i do to be able to successfully run the inference,trying to read and print netcdf variables in python i have imported a netcdf file into python and am now trying to access specific variables in the file of over variables this is the code i m using in order to just print and read each variables this returns me with the error any idea on how to overcome this error this is the only way i can find that is used to print each variable,0,76,76 how to load string to a pandas df with columns names i have the following string that i read from file i want to create a df that looks like i tried but this doesn t work as expected it gives me df of columns it should be only columns with rows,python kivy gameover label text i m making a game in kivy and i have a label with a text that says game over i want this text to appear whenever the game is over and disappear whenever i click on start game how can i do that i tried a lot but can t seem to find any solution any help is appreciated thank you so much below is my code main py homescreen kv gamescreen kv main kv,0,54,74 why does np linalg solve give me an error when trying to solve a x system of equations i m creating an nxn matrix with the largest value being n n np linalg solve works when n but for n it gives an error here s my code i also noticed that doing np linalg cond on the matrix had the same problem it worked for values up to but gave a division by error when n was or greater,invalidargumenterror input to reshape is a tensor with values but the requested shape has op reshape i encountered some problems when using tensorflow this is my code the console reports an error my dataset s shape which type is list in reshape layer the data of input rashape to data batch size self lstm step num self input length self vector length i dont know where the error is and why the shape cannot be converted i am more than thankful for any hints how to clean up my code thanks in advance,0,78,79 replace string in paragraph while keeping style docx library i am replacing the strings in tables and paragraphs of word document however the styles change how can i keep original style format there was a similar post however it did not help me maybe i did something wrong,learnable leakyrelu activation function with pytorch i m trying to write a class for invertible trainable leakyrelu in which the model modifies the negative slope in each iteration however i set requires grad true the negative slope wouldn t update are there any other points that i must modify,0,48,44 why isn t selenium successfully clicking my download link i am trying to use selenium to download an excel file from a website i am not sure why the code isn t allowing me to download it i get an exit code so everything ran successfully but i am not seeing the file in my downloads,from timestamp obtain datetime object python i m trying to convert this timestamp time into date i ve tried several functions pandas timestamp but unsuccessfully it seems that the function datetime fromtimestamp is not able to recognize because of the final zeros zeros if i delete manually these zeros i m able to convert the timestamp correctly this below is the code if i go to epochconverter and i copy and paste ts i will get the correct answer immediatly how can i solve this simple task,0,55,83 pair wise distance of points with pair specified by incidence sparse matrix in my code i have an array of point position and a sparse incidence matrix for every non zero ij element of the matrix i want to calculate the distance between the i point and j point currently i m extracting the indices with the nonzero however this method sort the output indices and this sorting is taking most of the execution time of my entire application,convert pandas column with object type to date iso format i have dataframe as below i tried to use this solution how do i convert dates into iso datetime format in a pandas dataframe to convert my timestamp column to iso format but it is not working my df test timestamp still appear as object column instead of datetime please help,0,73,61 django view with slug and id i have this url and this view now i wanna show on that page category view html only the products that have particular slug and pk lets say kategorie cat cat is the category slug and the category pk is and i only wanna show the products that have this category and this pk btw yes product is connected with ecommerce via m m,django urls exceptions noreversematch reverse for activate with keyword arguments i cannot register a new user due to below error urls py views py account activation email html a new user is registered to a db but as you can see there an error error image do you guys know what is wrong any help is appreciated,0,65,49 automatic counter as a subclass of integer is it possible to create a class of integer where an instance of a certain class say automaticcounter will increase itself by some number say each time it is called this is what i have tried so far,converting string formatted iso date to epoch in python i have a string formatted date t how can i get the epoch value of this,0,46,25 dimension reduction using varimax rotation and method used is principal to find component score coefficient matrix here all my code which gives me rotated component matrix but i m looking for component score coefficient matrix dimension reduction using varimax rotation and method used is principal to find component score coefficient matrix,flask admin column formatters not called i m using flask admin and would like to add an extra field to my inline model view purpose is to display an image from the filesystem issue is that my column formatter is never called and the image never gets loaded any suggestions would be much appreciated,0,52,50 django double join with multiple models i ve spent quite some time on it and still haven t been able to figure out how to join these tables with django i have a movie database with following models in my postgresql i can pair moviename with genretitle using following query i then get something like this how can i achieve the same output with django views,change objects dynamically in python i have a number of objects with a similar name format e g max a max b max c etc given the value of a certain object id i d like to change the value of the object named max id let s say increment by assuming the object already stores an int e g if id a then i d like to execute max a but if id q then i d like max q i know i can use eval max id to get the value of max id but how can i change the value,0,64,95 explanation for this no flux boundary code needed im completely incompetent in programming can anyone help me understand what this code does exactly according to the notes it should impose a no flux boundary condition but im completely baffled at what the terms indicate can anyone explain this to me,convert minimum spanning tree to list of indices using scipy if i have the following input and output graphs created using scipy sparse csgraph minimum spanning tree how do i produce a simple list of indices so,0,49,33 curl commands in python notebook fail with internal error i am running the below code in google colab and get the server encountered an internal error or misconfiguration and was unable to complete your request if i am running the command without passing in the variable data like below it runs perfectly fine only when i m looping through the file and passing variables it seems to be failing this works,how to use conda update n base conda properly i have two very simple questions regarding updating conda i e when updating one of my environments with conda update all i get a warning my setup comprises a base environment and two actual work environments say env and env the latter two environments are kept up to date with conda update all issued within each of those environments the base environment was only generated in the installation process of anaconda question should one run conda update n base conda on the command line of the os linux prior to activating any environment or should one activate a particular environment or is the environment out of which this command is issued irrelevant question after running conda update n base conda from out of whatever environment as determined by the answer to question would a subsequent conda update all issued within one of my two work environments env install or update any additional stuff only as a consequence of the previous conda update n base conda ps i find many questions on stackoverflow regarding conda update conda but they don t seem to cover this one,0,71,195 not null constraint failed orders order user id i am new to django and i am building an ecommerce website when i try to make a new order in my website i got this error not null constraint failed orders order user id each user can have multiple orders and i want to show the orders in the users profile but i am having problem with placing orders models py forms py views py template,how to count value change during a for loop in python i have a dataframe that consists of one column that consists of and they are structured in this way my goal is to count only the first in each repeating s in a loop so in this example of it should be able to only count a total of how can i use a for loop and use an if condition and count this,0,64,81 how to update all cell values of pandas data frame without looping through i have a pandas data frame read from csv file as follows i need to joint the full path to the file name in the first column what s the best way to do it without looping through each item,how to fix this issue typeerror object has no attribute value in connectivity i can t able to insert values in ssms geting error,0,53,24 i have a df with countries and states when i select a particular country i need to get the output as below i need output as in hyd vjy bang output country city india hyd india bang india vjw i tried using to dict to json but i m not getting the desired output thanks,how do i analyze this code for time and space complexity ideas for removing those,0,51,15 trouble finding least common multiple of numbers i am currently trying to solve euler problem which wants to find the lcm of numbers the code above is brute force but for some reason it doesn t work can someone point me in the right direction,why is opencv gpu cuda template matching so much slower than cpu i have compiled the newest available opencv version for use with the newest cuda with fast math enabled running on a windows machine with a geforce rtx super graphics card arch i m using python runtime results images used source image needle image python code using cpu python code using gpu even if i wouldn t take the time it takes to upload the files to the gpu into consideration the matching time alone takes more than x of the whole process on the cpu my cuda is installed correctly i have run other tests where the gpu outperformed the cpu by a lot but the results for template matching are really disappointing so far why is the gpu performing so badly,0,47,138 trouble with pandas converting file in the output i just downloaded pandas through vs code python and i m getting this error on my screen i ve tried moving around the numbers in the csv file the code is finding the file of course i m currently using through windows i m using this code to print out the csv file this is the csv file this is error that i m getting,dataframe how to draw a d graph using index and columns as x and y and data as z my dataframe line index and column index store x and y values while the data values are z values i e f x y let s take an example then f is i would like to make a d plot of function f i don t really mind if it looks like a d histogram or a surface plot both answers would be appreciated,0,70,82 from dummy to a list pandas i have a dataframe with many dummy variables instead of having a lot of different dummy columns i want only one column and each row needs to contain a string with only the dummy variable equal to output,detailview in django keyword slug i recently started learning django i want to display one news item but when i open on the link i get an error message views py urls py models py what am i doing wrong,0,45,37 how can i detect if a word is present on a chrome page using selenium python this is my code on the website there is the word inventory how can i detect if the word inventory is present on the page if it is present then print x and if it is not refresh the page until it will be,how to show a hidden window in pyqt i have two codes when i switch to a new window vprs py the first one is hiding untitled py in the window vprs py i have a back button how do i make the first window appear when i click on this button untitled py here is the code untitled py vprs py i tried to solve the problem myself but nothing worked if you need any more lines of code i will add it thank you in advance,0,60,84 python firebase realtime database set method promise i am new to this trying to get response on successfully adding data to firebase real time database from python successfully added but unable to get promise response unable to find documentation also can someone help below is my code for set the data,keyerror after re running the same code a keyerror is returned when i try to run the below code my dataframe has the following columns i know that there are many questions on the keyerror name but what was weird is that without changing anything this error appeared while running the code but previously i could run the code with no errors nothing has changed any help on this would be great traceback,0,50,72 multiply a list by the elements of other list i have this list of list with a series of values i want to multiply each list in values but the corresponding element of list i am trying with this but it does not work the expected value would be,sql alchemy having problems creating relationships without foreignkeys im trying to create relations but without foreign key constraints in db quite similar to this post sqlalchemy create relations but without foreign key constraint in db however im trying to do it with classical mapping and i cant figure out what im doing wrong with it after so many attempts i even with additional tinkering i only get this error sqlalchemy exc invalidrequesterror when initializing mapper mapped class inspectionrecord inspection records expression inspecteditem inspection id failed to locate a name name inspecteditem is not defined any help would be really really really appreciated,0,49,96 missingpluginerror the atoti jupyterlab plugin is missing install it and try again i am pretty new to working with atoti while running the code session visualize exploration i am encountered with the error i have installed atoti by using pip install atoti jupyterlab but still continue to be encountered by this error,audio not playing on the front failed to load resource net err unknown url scheme i am having a problem with audio playback at the front this problem is only present when deploying to prod when launched locally audio is played when i launch it on production when i play audio via the a tag i get the following message failed to load resource net err unknown url scheme can you please tell me which way to look where to look for a solution i ve already googled everything and zero information i would be extremely grateful thank you backend on flask frontend working version local frontend non working version on prod another computer,0,49,104 if statement skipping over options whenever i run this code no matter the input it just skips to do you think you will make playoffs,counting the frequency of words in a pandas column and counting another column i have a data frame with comments and their labels i would like to get an output like i was able to get the word count by using but i am not able to get the label counts any help will be appreciated,0,25,56 how can i programmatically get an element from the drop down menu on this web page i retrieved this html with a web scraper i want to extract the element for the second option a class c menuitem link href lists members import id import contacts a how can i do this i have this code so far but it doesn t work,colab unable to access webpage using flask ngrok i m trying to run flask application on colab but i keep seeing the following when i go to the tunneled page code,0,53,29 python selenium find element angular printscreen i tried to read this line but it doesn t work does anyone have an idea how to do this,generate output file python as it can be seen in the code i created two output files one for output after splitting and second output as actual out after removing duplicate lines how can i make only one output file sorry if i sound too stupid i m a beginner,0,27,49 how to stop all processes if one of them changes a global stop variable to true how could i make all the other processes stop if just one changes stop to true i would think since stop is a global variable once one process changes stop all the others would stop,how do i extract tags with marker from html using beautiful soup i am trying to find li elements that have marker such as seen below using beautifulsoup i tried using cssutils but was unsuccessful maybe i am using it wrong pseudo code thank you in advance for your help,0,52,50 why is sqlalchemy not setting default value correctly for some reason in this example the optional is active attribute is not getting set to default value i was expecting the default value of is active being optional input to be true but i get none if not explicitly passed,function to filter dataframe with multiple if and conditions look at a dataframe and a variable and return a set of clients which are in both the infolist and dataframe and any client in infolist with membership fee larger than offer price any client in infolist who feedback is or higher example dataframe infolist expected outcome code tried so far not sure why this isn t working after tons of research,0,47,71 soql query using like and string list i analysing data from salesforce using python and am searching for records with usernames containing jack jones or jill in them the current non ideal solution that i have is i have an example here and have managed to get the following example to work however i am unable to pass a list of strings such as is there a way to pass the list into the soql query itself thanks t,temporarily assigning roles using discord py so i am trying to write the moderation function of my discord bot and i want to implement tempmute there is nothing in the documentation that i can find that lists any ways to temporarily assign roles or assign those permissions to mute a specific person,0,78,51 templatedoesnotexist at fund me issue i have went through the answers to similar question on this site but nothing seems to work as i receive the same error message each time help would be greatly appreciated error message on the bottom directory tree directory tree urls py in fund proj urls py in fund me views py settings py relevant code error message and traceback error msg and traceback,display list items and count occurrences from list hi this is my first time posting here so apologies for format etc so i am doing a python programming course at college just now and it s assessment time the assessment is to take an already made logfile txt that has iip addresses in it on separate lines and we have to make a program that analyses and displays the ip addresses and also the count of how many times it appears and then separately the same list but display the most common ip occurrence so far i have managed to open the file and split it so it takes the ip addresses and add them to a list and a function that displays the most common ip however when i try display the full list of addresses and how many times each one appeared i just cannot get it to work i have tried using collections counter but i keep getting a non hashable error i m not sure where to go from here as no other way of doing a list is working and taking the ip addresses and manually putting them in a list inside python is not allowed here is my code so far result my list any help is appreciated thanks,0,62,210 what s python json serializable i have two ways to represent python object by json dumps first second then i tried p json dumps person the second way would say it s not json serializable so basically for python json dumps only work for built in object like dict object,venv with renamed python exectuable i m trying to create a virtual environment using a custom python build e g mayapy exe m venv myvenv but i keep getting the following error error winerror the system cannot find the file specified this is a known issue and has something to do with the fact that i m working with a renamed executable do you guys have any work around for this issue,0,44,71 don t understand why map returns iterator makes code to fail i have some code that does in python it works fine but in python i debugged and delete table id range function is never called i know that map returns now an iterator so i changed the map to become a list with and only adding this the delete table id range function runs i don t understand why is this happening can somebody explains,extracting coefficients from ransac regression i have this code snippet taken from here what i m failing to do is to extract the parameters from the predicted data i e for the cubic function i would like to know the a b c and d from the ax bx cx d equation how can this be done in the pipeline especially for the ransac estimator,0,70,66 how restart dicord bot after client close discord py i make disocord bot with api in flask now it just needs to send message to channel but if i start bot with flask all flask code stops i tried to use client close and i had exception runtimeerror event loop is closed i tried to use client clean in different places but i still had this exception now my code looks so,check whether url exists or not without downloading the content using python i have to check whether url exists or not using python i am trying to use requests get url but it is taking alot of time as the file starts downloading as soon as get is hit i don t want the file to be downloaded for checking the url validity can this be achieved using python,0,69,67 inserting list to tables column postgre i am trying to normalize some data that i retrieve from an api but it doesn t seem to work any pointers ok after some corrections it returns how do i overcome this my approach might be wrong altogether because the table i am retrieving the data has about m rows but how could i make this one work,month name offset in x axis with matplotlib i am plotting some time series from nc files using pandas xarray and matplotlib i have two datasets two plot this i use te following code please note that due to memory allocation issues i had while looping through the variables i wrote a very basic code with no loops sorry for that i obtain the following plot i want my plot to start with jan and end with dec but i cannot figure out where is the problem i have tried to set x axis limit between to specific dates but this creates a conflict as one of the time series is for years and the other two are for year only any help would be very appreciated update i figured out how to move the months specifying the follwing so i obtained this but i still ned to delete that last jan and i cannot figure out how to do it,0,65,163 does separating classes in different modules have performance consequences is it better to have all your classes in one module assuming they are related somehow in terms of performance because python needs to search the module and maybe importing packages to every module takes time i e animals py or do stuff with animals py,javascript version of while true loop i wrote this bit of code i ve tried the below but it doesnt seem to be working i m having bit of a struggle trying to create a javascript version of it since it seems js while loops constantly rerun but python seems to wait for input before rerunning i am using the readline module to receive input from the console is there something im getting wrong im fairly new to programming any solutions,0,49,79 how can i remove none in myresult how can i delete none in the middle of output code a result i want to get from output output,parsing xml in python by using xml etree elementtree i get an xml file using the request module then i want to use the xml etree elementtree module to get the output of the element core usg but i m already confused how to do it im stuck i tried writing this simple code to get the sysname element but i get an empty output python code xml file,0,27,63 pybind py class def property readonly static incompatible function arguments for str i m trying to bind c class static non arguments method to python class static constant field use pybind here s my sample code config cpp the config module compiles successfully but when i use it in python console here s the exception it raise how should i fix this or is there a way to bind c function to python module constant attributes variables,column stored as list how can i split as columns in pandas python assume tags column as stores as below how can i split into multiple columns or set into one list desired as to be combined as list and filter out duplication,0,70,43 attributeerror module keras utils has no attribute plot model but installed keras and tensorflow i am trying to make a plot graph of deep learning model in keras but it keeps giving me an error which is not very informative here is my code this is my error message,zipfile check for correct password i have this code to unzip a zip file that is encrypted with a password it works but i want that if i give the function a correct password it extracts it and returns for example true or with a wrong password it returns false how can i improve my code,0,46,56 how can i concatenate pytorch tensors or lists in a distributed multi node setup i am trying to implement something like this for nodes each node with gpus i tried to get a sum of these but what i want is a concatenated version like this or is also ok with me is it possible to achieve this from torch distributed,how can i get rmse from training data i have a problem i found this question someone wrote the rmse for your training and your test sets should be very similar if you have built a good model and another wrote rmse of test rmse of train over fitting of the data rmse of test rmse of train under fitting of the data i think rmse of test data it is but how could i get the rmse or another metric of my training data perhaps it is but with that i got so how could i get the rmse from my training,0,62,109 py operand type s for or pow list and int help simple neural network with only numpy the code returns an error code output values types more i need a correct finction to classificate output in values up to or down to,tabular response in microsoft azure bot framework python i have created a bot using azure bot sdk and want to show response in tabular format currently i am retrieving data from db in a dataframe object then using dataframe to html to convert it to str object and then sending a response to bot framework emulator using on ui the response is presented as enter image description here i want to show a proper tabular structure what s the correct way of doing it,0,44,82 group together consecutive numbers in a list i have an ordered python list of forms how can i group together consecutive numbers in a list a group like this i tried using groupby from here but was not able to tailor it to my need thanks,random events in python what is the best way to implement a random event in python for example the variable a is set to with a probability of and otherwise to i ve done this until now as following is there another way for such cases,0,46,48 how to fix this error unable to convert string actl as to float error in python i am looking for support and advice on how to fix this error couldn t convert string actl as to float in python please give me a solution with example as i am new to python programming error after running the code will be added here soon thank you in advance,get occurences of at least n consecutive rows meeting a specific condition i have a dataframe df with a binary column target and i want to compute the occurrences of at least n consecutive rows such that df target i found a lot of answers about computing the occurrences of exactly n consecutive rows meeting a given condition on some dataframe columns but they don t solve my problem i could use the fact that the target is finite to build the following algorithm to solve my problem but i would prefer a solution using the power of numpy or pandas more pythonic can someone help me many thanks,0,64,110 pytesseract manga text detector i want to detect text from manga i tried with pytesseract but it does not detect all the texts do you know any solution to increase the quality of detection of pytesseract on these types of images exemple not detect text sens is not detected currently i m just doing a detection without a specific setting,python in pycharm there are three files i want to compress to a zip file how do i do this here are the three file names content inside should not matter in this example here is my current code my goal is to create a zip file compressing the three files listed above when the script is executed here is my desired output one new created zip file,0,61,68 is there any documentation for implementing forgot password feature in django i would like to implement a forgot password function and at that point an email would be sent so that she would be able to change her own password i have not found documentation on this someone could show me a way thanks for listening,separately save the model weight in pytorch i am using pytorch to train a deep learning model i wonder if it is possible for me to separately save the model weight for example i have the bert model as the base model and an additional linear layer on the top after i train this model can i save the weight for the bert model and this linear layer separately,0,56,69 error while fetching data from cassandra using pyspark i am very new to apache spark and i just have to fetch a table from cassandra database below i have appended the data to debug the situation please help and thanks in advance cassandra node spark node cassandra table to be fetched dev device keyspace table name access pyspark with connection to cassandra code to access cassandra table and error can anyone point out what s wrong here,automatically create multiple python datasets based on column names i have a huge data set with columns like eas eas and so on to eas and nor to nor i want to automatically create multiple separate data sets that consist of all columns that end with the same number grouped by column name number and column number pasted as values in the new column bin my data frame i don t know how to create bin column and paste the column name values but i could separate data sets manually like this this would take a lot of effort for me plus i would have to change the script every time i get new data this is how i imagine end result thanks in advance,0,74,124 javascript await and python await are they same concept from a user point of view when we think of for loop we could say for loop in javascript or python are the same thing conceptually can we say await in both languages are conceptually same i smell this can be a bad question but albeit interesting question for me,applying qpe on a large matrix on amazon braket i m running a qpe algorithm on the amazon braket but it can only apply on a or matrix when i want to expand it into a or more it will come an error as i know there is no theoretical limitation on the size of matrix qpe can solve here is the main part of the code and when it comes to a matrix the error report is like so i m wondering if it s the packages problem or the program problem or any other had met the similar problem as i thanks in advance,0,59,105 valueerror unexpectedly found an instance of type class keras layers core lambda layer lambda expected a symbolic tensor instance i am trying to train a cifar dataset using transfer learning and a research paper used a resize technique but the functions change names i am getting this error how can i fix this valueerror unexpectedly found an instance of type class keras layers core lambda layer lambda expected a symbolic tensor instance,function conflict between get and getattribute i m writing some code in python and have just recently discovered about descriptors i have created a class which looks like this my intent is to have a decorator which adds an event to the decorated property so that when the property is changed the event is set this is an example of how i would use it problem is that when i try to get event it considers class iteration test property to be an int object thus it throws an error i wonder if there is any way to bypass the get when using getattribute so that i can access the event variable or if i need to change my approach completely,0,62,118 how can i name a table with a string or var i want to program a discord bot which creates a table with some simple input therefore i need to know how i can name the table in sqlite like my variable splitdata my code,how do i wrtite django fbv to class based view i have two user types a and b i need to write the below fbv into class based logoutview auth view how do i write the below fbv to cbv views py,0,45,39 struggling to figure out where to insert perentheses hey guys i need to figure out where the parentheses fit into this code for the following expression and am a little confused to where the parentheses actually goes into i keep getting it wrong expression,getting an error of team jaja needs to have a value for field id before this many to many relationship can be used i m trying to add team to the database but i get this error took a look at similar questions but none of them solved my issue i am new with django my code looks like forms py models py views py when i try to do it without forms like for example with only title field it is successfully adds it what am i doing wrong in here,0,44,86 how to write a text parser logic which identifies keywords from a dictionary how to make a simple text parser that finds keywords and categorizes them accordingly example i have two dictionaries now i want to pick out if the keywords from a are present in b and the result should be something like this i m a beginner and the logic to get this is very confusing,is it possible to center a map using geopandas i am plotting pairs of points over a geopandas map everything works but the problem is that the default world map plot centers in the atlantic ocean but i would like it to center in the pacific ocean i ve looked through the documentation and i can t find a way to do it picture of how the map plots by default picture of how i would like the map to plot the plot can be reproduced using the following code i have tried using plt xlim this flips the map but doesn t shift the center i have tried plt xlim but as expected this does not work because matplotlib does not know that longitudes can be also set from to is there an alternative approach,0,67,133 how do i move to a mouse coordinate from a string i have the desired mouse coordinates which i would like to move to written in a string but when i try to move it i simply get here is my code,pandas computation on rolling calendar month i have a pandas dataframe with date as the index and a column spendings i intend to get the rolling max of the spendings column for the trailing calendar month not days or weeks i tried to capture a snippet with custom data for addressing the problem below borrowed from pandas monthly rolling operation now to create a column max to hold rolling last calendar month s max val i use this raises an exception like however if i manually access a random month window like below it works without exception i could have followed the method using list comprehension here but i would like to use panda s vectorized method i have many dataframes and each is very large using list comprehension is very slow here q how to get the vectorized method of performing rolling calendar month s max the expected o p ie primarily the max column holding the max value of spendings for last calendar month will be something like this,0,42,176 simple https python server to detect weather its connected through ca cert or not first i create a ca cert key pair with now i run a server with python code now this server can be connected for both secure ca cert case and ingore ca cert server connections when using ssl case that is curl cacert public cert pem cert type pem and curl k will work how to detect if the request is ingnore ca cert or not from server side,how to compare two lists of same length but different data types and their corresponding values i have two lists i want to compare the two of these lists and for each instance of direction x continually add the corresponding values in depth together so i should get a value of since and it corresponds to each x string in list direction the lists depth and direction are greatly abbreviated for example purposes i want to iterate over both lists and in reality they contain a couple thousand values each i have already created a zip and tried working with it like this i actually had this for loop under a defined function but unfortunately this for loop doesn t return the proper value i get a value and no errors but it s always a value of and not sure where i m going wrong here,0,76,154 how can i send a message without a command i want to send a message without command if a condition is true i wrote this code but it doesn t send any message,python coin flip streaks returning double as much probability i m a beginner new both to coding and to python and i m using the book automate the boring stuff with python to learn one of the practice projects of the first chapters is the following write a program to find out how often a streak of six heads or a streak of six tails comes up in a randomly generated list of heads and tails your program breaks up the experiment into two parts the first part generates a list of randomly selected heads and tails values and the second part checks if there is a streak in it put all of this code in a loop that repeats the experiment times so we can find out what percentage of the coin flips contains a streak of six heads or tails in a row my programm returns exactly double as much percentage as it should expected returned i ve tried to fix my code by comparing it with the other replies i ve found but since i ve used a different approach i still don t understand why this happens as everything looks right i hope this wasn t a dumb question thank you for your help,0,32,205 how to fix this error unable to convert string actl as to float error in python i am looking for support and advice on how to fix this error couldn t convert string actl as to float in python please give me a solution with example as i am new to python programming error after running the code will be added here soon thank you in advance,how can i show the order of list s elements in python in c c when we say it prints the order used in the iretation but in python i have this example i want to print the oder of the elements joseph is glenn is etc i know i can use a count count to print it but i see print order knows already the order of elements so is there a way similar to c to print the order of elements directly,0,64,86 replacing a character in a string but it duplicate this is a line of code i create that will replace a with a character from a string output but when applying the same rules for the duplicate character o in word output i know what the error is but i m stuck at creating a solution for this type of problem this is some more output in the same situation output,creating cartesian product of sub dictionary key val pairs i have this dictionary i want a dictionary with the cartesian product of the key val pairs inside i need to create the below dictionary out of it,0,71,36 unit test optimization program pyomo i am implementing several optimization programs with pyomo so far i have written some integration tests with unittest on optimal objective value and optimal variable values i would like to write unit tests for each objective and constraints to make sure they are correctly implemented what s the correct way to do it,store password in cloud environment i started to use cloud and use python code like this this is suboptimal is there a way to store credentials in a cloud environment without pushing committing them to git,0,58,35 how to write function that gives the histogram of data in python i was assigned to write python function that gives the histogram of data each histogram element h k corresponds to the frequency of k in the data using if and for loop statements the data list a anyone can help,how to use csv as instance attritubes in python how do i import csv file and use it as instance attributes for my class here is the code ive written driverandteam csv looks like this i keep getting list of out range error in line of my code but im not understanding why how can i fix my code so it works,0,77,62 how to group by the mean of specific columns in python in the dataframe below i want to do the following find the average of each unique series per aic trx for each grwth time grwth time grwth time grwth time export all the outputs as one xlsx file refer to the figure below the desired outputs look like the figure below note the numbers in this output are not the actual average values they were randomly generated my attempt thanks in advance,colab unable to access webpage using flask ngrok i m trying to run flask application on colab but i keep seeing the following when i go to the tunneled page code,0,77,29 i m trying to understand the shap values of a predictive model below please help me understand what s the o p of value explainer means o p o p array although with the summary plot i understood what is the contribution of each feature to the model please explain me what s this numbers in both the output means and array,sum of number in a binary tree i have a list that can contain either two natural numbers or two more lists each of these lists also contains either two integers or two further lists and so on e i i need to use recursion to calculate the sum of all the numbers in the tree and write the following code the code doesn t work because it returns sum always to so my question is how can i make it work but still using recursion have i not recognize the base case correctly,0,63,99 django redirects to non existing url two days ago i created a django project and it worked all right but now when i am working on another django project still when i run server it s redirecting me to the older project i am using different virtual environment for both of them even after deleting the old one the issue is not resolved thanks in advance,checking index for series object in python i have code like this i want to change alphabet index x for a series object i created which contains the alphabet as well but with ascii characters for each letter as indexes can you give me a hint how to do it i tried doing this in this way but this does not work,0,65,60 how to drop columns with mode occurences over in python my code doesn t successfully drop the columns i need to drop columns with mode occurences over,why do you run other lines of codes of a python file say test py when you are just importing a piece of test py from somewhere else say main py i have two python files one is main py which i execute the other is test py from which i import a class in main py here is the sample code for main py and here is the sample code for test py finally here s the output when you execute main py from the order of outputs above you can see that once you import a piece of a file the whole file gets executed immediately i am wondering why what s the logic behind that i am coming from java language where all files included a single class with the same name i am just confused that why python behaves this way any explanation would be appricated,0,28,138 how can i integrate a line chart viewer in pygame i have an ai for a game in pygame and i want to create a chart to follow the evolution i need only the gen on x axis and points on the y axis i have tried this but i don t know how to make it fit on the surface in the game and not pop out as an individual window which will eventually stop the game any ideas,either of the two pydantic attributes should be optional i want validate a payload schema i am using pydantic to do that the class created by inheriting pydantic s basemodel is named as payloadvalidator and it has two attributes addcustompages which is list of dictionaries deletecustompages which is a list of strings i want to declare either of the attributes of class payloadvalidator as optional i have tried looking for the solution for this but couldn t find anything,0,76,79 getting index of element close to end of list i have a sorted list containing objects and i would like to get the first index of the last value which is retrieved by using the get val method of the list i wrote this function but i was wondering if there is any way to optimize this even more edit the list doesn t contain numbers it contains objects,how to pass arguments from a message to a telebot my telegram bot receives messages in one line of the following form how can i send this string to three variables using telebot upd this works but i can t figure out how to get the data from telegram itself and transfer it to the text,0,67,61 error importing randomforestclassifier form sklearn when i try to run the imports chunk of code from a notebook i get this error message can somebody help me i am using the latest versions of python and scykit learn,docplex error docplex mp utils docplexlimitsexceeded promotional version problem size limits vars consts exceeded i want to use docplex module in python and i have installed cplex version and installed python when i tried to run the code i got the error docplex mp utils docplexlimitsexceeded promotional version problem size limits vars consts exceeded cplex code how do i solve this problem thanks,0,37,64 how to stack d array on an existing d array python i m trying to stack array a below a such that i get array b with the following shape this was my attempt but np stack requires the same shape,numpy d indexing of a d array with known min max indices i have a d numpy array of false booleans and a d numpy array containing the min max indices of values in the first array to change to true an example and i want the following result how is this possible in python with numpy edit i would like this to be performed in one step i e no looping,0,39,70 split text string from a certain percentage i need to split a text from a certain score for example the first dot after of text example if i wanted to divide the text from the first dot after i would get how could i get this result,how to add track number metadata for an mp file using mutagen every other tag seems to work e g title cover art artist but i encounter an error for the track number tag trkn every time in the mutagen documentation it states what s the fix to this,0,49,47 pyinstaller pymongo no worked hello after pyinstaller my programm no worked,how to open images from a path in a txt file if i had a text file that just had lines of full directories to images on my machine eg f desktop images def jpg f desktop images abc jpg c users me downloads orange jpg c users me downloads apple jpg how could i get python to open them by reading the lines in the txt file using the pil module let s say i m just starting with some like above code works if the txt file only had line but how would i do it to read through and open multiple lines thanks,0,12,87 i created a virtual environment in my editor but when i wanted to activate it by this code kivy venv scripts activate editor gave me error message the error message was cannot be loaded because the execution of scripts is disabled on this system please see get help about signing for more details can you help me,how to say if elements in the same column are the same then calculate the average of corresponding values in pandas how can i calculate the average of average delay mins of each country my idea is to calculate the values corresponding to similar origin destination country s names and store them in another list where there are no duplicate country names,0,54,57 how to make a unsorted version of this code,is there someone have success in scraping from amazon using beautifulsoup i want to make a web scraper of amazon but it looks like that everydata is none type i found in google and there are many peoples who make a web scraper of amazon please give me some advice to solve this nonetype issue here is my code thank you,0,9,61 are bare threads reusable i ve been playing around with threads the other day in python so generally a minimal code with threads looks like this this example shows a thread which is created run and joined to the main thread but after it is complete t can t be started anymore what is the point of such behavior and can we reuse threads instead of creating them every time we need to run something,selenium sqlite no such column publicly routable error my program has been working fine until recently and i have not changed anything in the code the last time i had a problem with selenium like this it was because my chrome updated its version but this time my chrome version has not changed my code does not use anything like sqlite either chrome version version official build bit code i use to launch selenium error message,0,73,76 shap dependence plot doesn t work with an error which is related deep inside the function i have this code and my data is when i run this code i am getting this error the error is deep inside of this function and i am not sure how my data can change it how can i fix this issue,pywinauto how to resize active window i m trying to automate some windows tasks and i got a dataframe of all windows opens and then i added some more coluns in order to make some validations before proceed with the automation after i activate a window from set focus function i m not beeing able to resize any window at all simply nothing happens i already tried using win gui solution i also tried using pygetwindow functions to resizeto or size but nothing happens as well if i run the following command app move window x none y none width height repaint true attributeerror uiawrapper object has no attribute move window my code how can i resize the active window after set focus edit following vasily ryabov tips i downloaded windows sdk in order to install the feature that has inspect exe also following the documenation from pywinauto from getting start topic and from the documentation available at accessibility tools inspect i was able to find my application with inspect and the resize options is available as evidence below so i tried the following commands o the error o the error o the error attributeerror uiawrapper object has no attribute wrapper object,0,57,189 when i am fetching the data of students by city in tkinter it s only show last value as i mention i want to print data of student who s belong from city but in label it only shows one data and terminal shows all the data i am using for loop to print data here is text file expected outcome if selected surat then,how to keep python application alive and listening to activemq i m new to python so maybe this is a trivial question but i haven t been able to find the answer i m looking for yet i m working on running different python applications on data using a message broker activemq and stomp i m able to build and run a single application that sends a message to a channel it s subscribed to and triggers a listener method now i m trying to send a message from one python application sender to a queue and subscribe to it from a different python application receiver however after setting up the connection subscriber in the receiver how do i keep it alive and listening for a message from the sender for an indefinite amount of time other threads i ve found mention using sleep statements which does technically prevent the application from exiting but it also blocks the application so it doesn t do anything either,0,63,156 convert number to cardinal in python i want replace any number in string to cardinal num then print it i have one challenge the user may not draw any spaces between the number and the next character input output,retrieve dataset from a dictionary i have a function that splits a dataset in a non iid setting this function returns a dict of the labels for example if i apply this function to a dataset i obtain this now starting from this dictionary i want to obtain the original dataset split as stated by the dictionary for example dataset will have the samples and so on dataset will have and so on,0,39,76 how to convert infix to prefix if the operator present in front of expression if an equation is how could i convert it into prefix it s operator is in front of the equation,when i am trying to use cryptography pbkdf hash in python but when i enter a wrong password it throws error this is the kdf setup this is my hash algorithm this is the error i am getting when input a wrong password and then try to re enter it libraries used sqlite hashlib tkinter customtkinter functools uuid pyperclip base cryptography,0,37,60 python dataframe if a particular row is bad then drop previous n rows i have a data frame i check if a row is good or bad if a row is bad i want to drop this and the previous two rows n in my actual problem n i have a working solution is there a better way checking if my solution is the pythonic way of doing it my code expected answer my solution,how to display data of relative foreign key in django html page i saw may answer but i don t know why in my page its not working can anyone help me to find the mistake model views py after importing all school html i wanna display multiple image of school i have inlined in admin how we can get all the images that foreign key to schoolmodel,0,75,64 python xlwings set excel table style to none i have exported a dataframe to excel using xlwings and am trying to format it as a table i want to apply the none style but can t figure out how to specify the none this line works but instead of tablestylelight i want none i have tried none and none of them work,put row value in quotes based on values in other row i have a dataframe like this dots represent spaces first row contains values with spaces the spaces must be retained second row contains numeric values that tell how long the values in the first line are i want the values in the first row to be enclosed in quotes based on the values in the second row value space the final result should look like this,0,63,78 i want store a specific number when achieving the condition in to a list python i want to store and in a list when achieving the conditional wholesale i want to store value ms explain more about what i want i am new to programming sorry if there are errors in the code,scrapy returns a different table than is indicated by developer tool im trying to do some webscraping with scrapy for a project at uni essentially i need the data contained in the table on the following url the problem is that when i run view response in the scrapy shell the resulting page looks like a mess and the corresponding table is entirely different the table does contain similar data but not from the area code or category foreclosures that i filtered in a prior step to obtain the url when i navigate the developer tool in chrome i get selectors which are valid in scrapy only the data are those of the table that occurs in the view response webpage and not the table i get in my browser i hope someone can help me with a solution or at least point me to the problem as i m rather new to webscraping for reference this is my script which is just an adaption of the scrapy tutorial,0,55,167 finding the length of a portion of a csv file in python i m trying to get the average of part of a column in a csv file but i haven t been able to find the length i noticed that when i run len it s counting the amount of characters and not the length from len should be note this is for a class and will not be using pandas,how to skip the debug logs with in the console using selenium and python i m using selenium with python and i m getting these in the output which i want to skip so please tell me how can i skip these warnings,0,71,41 how do i print the number of items with for loops in a list and dictionary how do i print the number of items with for loops in a list and dictionary here s my code,how to re arrange the boxplot text in specific order i am trying to put in text into my boxplot however after i arranged my x axis in a specific order superior deluxe family the data labels are no longer following that order how should i change my code to reflect that specific order data my code output,0,35,56 getting a empty dataframe using pandas i m using pandas to create a dataframe in python but i get only the columns when i try this this is my code,how to change value of variable passed as an argument in python i m trying to code a little game about planets in pygame i was trying to implement a way to stop the movement of the planets by stoping them from updating their position if a global variable paused was set to true this is what the code for the main looks like the part of the code that handles the events is in another file and imported as events just to organize it a little bit and the part of the function keydown that is supposed to change the variable paused looks like this note that this function does more than this it checks for k backspace and k escape and does different things at the same time so returning a value is something i m trying to avoid and doesn t work anyways tried it also the part of the code that prevents the planets from moving when paused true looks like this simplified before i moved the event checks to another file everything worked fine the issue now is that the variable paused doesn t change though the rest of the code related to the key events works just fine i did some testing and discovered this the code above will not change the value of myvar which doesn t make a lot of sense to me so is there a way i can invert the variable paused without having to explicitly write the code inside the function keydown inside the gameloop let me know if i made any spelling or grammar mistakes since english is my second language and also let me know if my code sucks which is pretty likely,0,29,280 i keep getting unicodedecodeerror utf codec can t decode byte x in position invalid start byte i m trying to read monthly csv file but for some reason i keep getting this error this is my code below what do i do,pydantic initialize numpy ndarray how can i initialize a ndarray when using pydantic this code throws a valueerror the truth value of an array with more than one element is ambiguous use a any or a all,0,41,35 discord member scraper this script scrapes all members ids in a server and then saves the ids in ids json i want to make it save the ids after scraping a specific number of member ids so for example i want it to scrape only user ids and then it saves it or make it only scrape online users ids what should i do,how can i use index method to see if one word matches user input in hangman i am designing a hangman game for the final project of our club and there is a problem on determining whether the letter the user inputs matches the one in the original word for example if the user inputs e in the second blank of t n orflow which is the word tensorflow i need to see if the user inputs e however for a more exciting game experience i used random to randomly put blanks in the word and there may be multiple blanks present at different positions of the word each time then when i try to write an if block to decide whether the user has input the wrong letter the codes start to go wrong at first i used if letter in select to see if the letter is in the word selected however some words have multiple same letters and the program made a wrong decision then i used the index method to find the index of blank in the word for example the index of the first blank in t n orflow is and i use the index to find the letter in select which is the correct one however since there are multiple blanks the letter user inputs filled both blanks so is there any other way to solve the problem which means the if block will determine whether the user input is correct once at a time for example if the user inputs e in t n orflow the program will see if the user inputs e then decide whether the user inputs s this is the main block which goes wrong in this code select is the correct word and res is the index of the blank in which the program will see whether ans corresponds to select,0,64,308 error trying to use keyboard and mouse control methods at the same time with pynput i m having problems because controller names match for both mouse and keyboard so try doing this but it is giving me this argument error that if i used them importing directly to each one it would not happen,pytest mocking property and setter i m having a real hard time understanding how to mock a class that has a property and setter fixtures that access a private attribute after running the test this is what i get i ve also tried using propertymock in various ways but nothing seems to work how do i get this to work how do i mock the myentity class so that everything works the way it should,0,53,74 how do i move both files and folders to the specified directory there is a code that moves files from one directory to another but it doesn t move folders how to make it move both files and folders to the specified directory,how do i make a while loop that repeats itself if a variable isn t equal to a certain number in python i want to make a while loop that repeats itself if let s say var isn t equal to example code the code above might be inefficient but i d really like to know how you do this,0,42,57 the same phrase is repeating while using different command i m developing a telegram bot i do this on my code and the question is why my bot repeat the same first phrase when i put the second command ps the code is working now i deleted bot pulling under the if and i put the hello and start commands in differents lines,visual studio code doesn t move to next line usign asyncio and pyppeteer my goal is to open an browser using pyppeteer and creating a new tab but visual studio stops executing the code after the browser await launch headless false line but executing the same code in for example thonny does work any help here is the code its just an example form the internet,0,62,64 get value dictionary python i have this data and i need access to the value low high etc but i don t find a way to do it im trying this data open but says keyerror i can acces to data meta data time series min inclusive i can access to the values low high using the date but the problem is that the date changes so hope you guys can help me thanks,convert multiple nested json to pandas dataframe here s the response i get from my stock data api provider i need the results to be a simple pandas dataframe with the following columns date company open high low close volume,0,73,39 jupyternotebook filenotfounderror winerror the system cannot find the path specified i ve created folder structures with code on my desktop and filled them with images using the cap cv videocapture with no problem to create folder structures and make directories i wrote this code and it works fine folderstructures on desktop but when i want to list images in a file i get this error error filenotfounderror winerror the system cannot find the path specified positive can you help me,split text data into row data records using python pandas as i am new to python as i am trying to split the text data and convert into as excel columns and row records suppose i have records as i need to split into as is one column is second column is third column and is fourth column th column is th column is th column is the below example records are in text txt i want to convert into excel file based on the above mentioned characters can anyone help me would be appreciated example text format output format example,0,77,106 how to remove double quotes from csv file when i open the generated csv file there are some unwanted double quotes in the column track uri that i cannot remove please can you tell me how to remove them the code of the program is here here is a screenshot from the output file,how to convert a dictionary to pandas df i have tried this following code to get live data from an api i have tried to convert tick data to pandas dataframe but getting the following output how can i make proper dataframe,0,53,41 running a file via import from a function i am currently attempting to run another py file via the following script however it will not run the other file the file called talk currently simply contains the following i have done this before but since then i have completely forgotten,trouble understanding a specific lambda function syntax i am having trouble understanding this bit of code specifically its syntax i understand the lambda functions but what is s doing here,0,50,30 django newbie templatedoesnotexist my project directory is called test and the app in question is called posts django tried loading these templates in this order using engine django views py urls py i have mentioned the app in settings py so that probably shouldn t be an issue what am i doing wrong filetree,program ends up using the same values regardless of different api calls i want to fetch game reviews with steam api single api call returns game reviews i loop times in order to obtain reviews i also count the words in these reviews and write the occurrence of each word frequency out to a file the problem is that frequencies in my file are multiples of thus the same reviews are being fetched over and over again for all iterations meaning the same reviews were counted times it is either with the way i am calling the api or something with my function calls which maybe store the first api response inside them throughout the runtime and keep using it even though new api responses are fetched also url s i construct seem to be correct and gives me the correct json when i paste them to my browser data i want in the api response json is inside reviews array each element have a review key which the value of them contain the actual user review,0,52,185 error while saving optuna study to google drive from colab i can save a random file to my drive colab as works fine but when i use the official documentation approach of optuna using the code throws an error as,keyboard interrupt crashes my code in python i am a new programmer and even though i just used ctrl c while writing my code to copy paste some code but after that my code stops running due to keyboard interrupt my code is compiled and has no errors please help i tried it another time without ctrl c in a different file but it shows the same error and i am getting the following result nothing seems to happen after that when i debugged the code i found this error,0,40,90 numpy use sets as rows and columns of matrix i have arrays has countries has dates the other has a data structure like so country date otherfield i need to make a matrix with countries as rows dates as columns and otherfield as the corresponding value for each row and column and i was wondering if there is a cool way to use numpy to do this expected output should be something like this,how to get class of object being created in init parameters so i am trying to create a class with an initialization method that needs to get the type of the object being created in order to properly set the default values of the init arguments to give a concrete example with code say i have the following class this is the functionality i am looking for but my ide is saying self is not defined which i can understand as self has yet to be instantiated so my question is how would i go about implementing this properly i do not want to hardcode the class type in where i currently have type self because subclasses of this class may have their own values for some class variable and some other class variable and i want those subclasses to use the class variable corresponding to their type my solution needs to work in python python but i would really prefer to find a solution that works in all versions of python and later if possible,0,78,174 plotly parallel category linked brushing cross filter with dash in python i want to create a parallel category in plotly that have linked brushing as the documentation from plotly however inside it only show how to do it without plotly dash how to combine go pract and dash can someone help me with this,filtering a column specify case sensitivity to reduce ambiguity i want to improve my code to specify that my function can include any case for example apple apple apple should be accepted and so on do i have to specify every single variation like below or is there a cleaner alternative,0,52,52 mfi indicator from talib python library doesn t return any value im using binance websocket stream to get kline data im trying to get data or values from mfi money flow index to automate some trades i tried other indicators such as rsi and it worked,pandas get the row which has column value and update comments column with another value i have the below dataframe so i need to update then comments when the verstatus not equal developed or nan else anything so expected result would be i tried but it not works properly,0,44,48 count level size per level in multi index and add new column what is a pythonic way of counting level size per level in multi index and creating a new column named counts i can achieve this in the following way but would like to gain an understanding of any simpler approaches code this is the desired output,how to import data from a py file to another one dear stackoverflow community i have two py files example py and example py plan to run example py first example py second and want to import a list from the first to the second one indeed i tried import example and wrote then example list in example py which is used to get the list list from the example py but it actually makes the example py file run in example py so my question is how can i import the list variable directly to the second py file without starting the first py file again,0,62,95 jupyter notebook dataframe constructor not properly called arima model i am getting an error while doing a project using arima model code error python version statsmodel after upgrade also i upgraded statsmodel version but still i am getting the same error again and again,matplotlib plotting custom colormap with the plot i have been following a tutorial on plotting f data over a circuit color coded with the fastf library i wanted to add some extra s to the script to utilize the official team colors it works but the end result shows the colormap with the circuit covering the n bins in the picture above i used the same colormap as in the tutorial winter so there is most certainly something wrong in my code however the original tutorial gets a cleaner end result with only the circuit showing like this the tutorial in question uses a default colormap from matplotlib winter to get the team colors working i had to create a custom colormap from the colors that are fetched from api let s get into the code i have tried so much and searched everywhere without success the custom colormap is build with this sequence of code i got from the matplotlib docs i register the colormap to easily call it later in the script with get cmap the eventual plotting of the circuit is done in this piece of code this is where i think things go wrong but i m unsure of what is going wrong i guess it has to do with how i use the colormap but everything i changed broke the whole script as i don t have a lot of experience with matplotlib it s getting very complicated as i don t want this question to be overly long the whole code can be read here,0,48,257 getting a wrong result calculating the rsi with tulipy im getting the candles closed price from coinapi the rsi i get is always different as the one i see on tradingview does anyone know why it is different i also tried ta lib but it s more difficult to use thank you,how to split a string in a pandas dataframe and return multiple dataframes i have a pandas dataframe containing strings i would like to end up with three dataframes so that the first one contain the characters before the first underscore the second one before the second underscore and the third contain the last part for the first like i ve tried to split it into lists and but this ends up affecting only the first row anyone who have a solution,0,51,81 column bind in numpy array and matrix i have two arrays and a matrix i want to column bind them in order to have one matrix but when i do this python reports me how can i solve this error,how to return all leaves in a recursive tree i m trying to create a function that will return all the leaves in my recursive tree i saw many other posts about it but i couldn t modify it to my own code i am trying to make like a decision tree this is my code from some reason it returns only the root and not the leaves for example diagnoser return all leaves self is supposed to return,0,43,73 how to get video data from webrtc server in python i have a problem i want to receive data from a webrtc server c and process it on python but i can t see any example for it anyone can help me,python text based game display items get items i have got the movement down but can not get it to display the item of the room when you move into a room i also can not get it to pick up an item that is in a room i do not want direct code if it is possible i want to learn how to do it i am using a dictionary for the rooms and items and i have tried doing rooms currentroom item and rooms currentroom item both give me a key error i also need to know how to change the dictionary from go south to just south but you still have to use go south to move anywhere i could not figure it out either this is for my school project due on sunday and i have worked on it for weeks and researched for an answer and can not find one anywhere i have tried many things but none have worked the try and except method is the only one i could get to work for the movement and once you get to the mammoth fields i want to be able to fight the boss and check if you have all the items and if not than you die and game over but if you have all the items you fight the boss and win here is my code so far,0,41,231 line chart of two numpy arrays matplotlib i m trying to plot a line chart using above arrays all the arrays are of same shape but still for some reason the line chart is coming out to be messy i m still a noob could anyone please tell me the mistake output,getting this problem from firefox or chrome blocked loading mixed active content using fastapi with jinja traefik letsencrypt ok first i think i know about this issue where my css file is using something http instead of https in the href but that is generated by something like this in my index html note that i am using traefik for reverse proxy and having letsencrypt to handle https cert i am following this guide while i change the codes inside for fastapi for my own but the rest such as traefik and docker etc is same as for my main py so currently after the rendering i found out that my css file is loading from http instead of https is there any way to fix this to make it https instead of http also for my file structure is something like this my traefik configuration traefik toml and my compose my docker file and i have a prestart script,0,51,158 running telegram bot on heroku so currently i m trying to create a bot that messages every minutes using python telegram bot jobqueue the app is deployed on heroku and it seems to be working just fine but sometimes it doesn t message me after periods of inactivity ex not using start with the bot how do i solve this issue when i check the log it seems to be running fine thanks,background isolation from complementing images i m trying to isolate a background from multiple images that have something different between each other that is overlapping the background the images i have are individually listed here but there is a preview of all of them combined here i wanted to do it in a sequence of images as of i m reading some video feed and by getting the last frames i m processing them to isolate the background like this from this code i m always incrementing my buffer with bitwise operations but the results i get is not what i m looking for bitwise and the way of concurrent adding to a buffer its the best approach for me in terms of video filtering and performance but if i treat it like a list i can look for the median value like so it results me which is still not perfect because i m looking for the median value if i would look for the mode value the performance would decrease significantly is there an approach for obtaining the result that works as a buffer like the first alternative but outputs me the best result with good performance edit as suggested by christoph rackwitz i used opencv background subtractor it works as one of the requested features which is a buffer but the result is not the most pleasant code,0,72,227 how to reply to a message sent by the bot itself i want the bot to reply to its help message by saying this message is now inactive here s the code error message object has no attribute called reply,add the remaining quarterly columns that do not have any values i have monthly time series data as follows i needed to convert this monthly data into quarterly data as a sum of three months so i adapted the code from here to do just that the resulting df is as follows however i wanted to have all quarters listed in between not just the ones that have a value larger than so my desired output is as follows so in this output there is an additional column q because it is between the first and the last quarter periods even though it has no positive values does anybody know how to do that,0,39,115 formatting a dictionary with pandas python how would i be able to rearrange the values of dictionary a so that it turns into the format of a all the columns values will be turned into keys with their corresponding values how would i be able to get the expected output below code expected output,error in python code trying to open and access a file here is info from the txt file i am trying to access movies drama possession the big chill crimson tide here is my code i get an error message indexerror list index out of range please explain why or how i can fix this thank you,0,54,60 pywhatkit python open browser but sometimes not send the message it just opens the browser and creates the message but after the established wait time it closes the tab and does not send the message increasing wait time value works but it fails on some occasions any suggestions,openai gpt search api not working locally i am using the python client for gpt search model on my own jsonlines files when i run the code on google colab notebook for test purposes it works fine and returns the search responses but when i run the code on my local machine mac m as a web application running on localhost using flask for web service functionalities it gives the following error this error occurs even if i implement the exact same example as given in openai documentation the link to the search example is given here it runs perfectly fine on local machine and on colab notebook if i use the completion api that is used by the gpt playground code link here the code that i have is as follows any idea why this strange behaviour is occurring and how can i solve it thanks,0,48,148 find the best match in list of string i have i managed to get only the name using split to be and i did the same thing to end up with i wanna get the best match which is dexter new blood if you can add way for getting index as well,how to use conditions referring to several colums in order to fill a third column in python i would like to fill my verif column with values depending on several conditions referring to several columns all in the same df if reception is empty and premier is entrant radio then verif becomes utilisateur if reception is empty and premier is different from entrant radio then verif becomes n de renvoi else when reception is not empty write mevo in verif however the result in verif is mevo everywhere can anyone help please,0,52,95 how to convert mxnet ndarray ndarray ndarray to a scalar i got a weird object that shows like this this is what it outputs i want to convert it to a scalar but no matter how i try it stays as array still outputs,sap ase extension python module stmt query timeout i am trying to move from a windows based pyodbc using the sap adaptive server enterprise driver to red hat linux based sybpydb solution current pyodbc solution i am trying to replicate this under linux using the sybclient package passing smtmquery timeout causes the connection to fail but without this the call to the stored proc will timeout i can t see anything in the documentation about this thanks in advance,0,41,75 how can i collect the vowels and consonants of a script without collecting empty spaces i was looking to see how i would be able to collect the consonants without counting any blank spaces in between words main,a regex for looking after pattern many occurs but only till a substring there is a regex i use to collect all the names in a long text file multi line the file contains several sections and i need to collect names only up to a specific substring for example computers it is possible to do this with python e g cut the file content after the substring but for some reason i must use regex only how example for the text file output jon mon gon,0,38,85 python subprocess throws syntax error redirection unexpected i am trying to run a python script which passes a location of a file as an input of a shell command which is then executed using subprocess but executing this throws me the error,getting multiple outputs from my dictionary when i need only one im having a little problem with only printing the corresponding abbreviation that is stored in a dictionary this is my output i only need the entered abbreviation key value not all the abbreviation not found outputs i hope this makes sense,0,42,52 rolling sum based on all previous dates not previous rows sorted by date given the following dataframe i need to get the rolling sum of all previous dates as follows using gets me which isn t quite correct how would i get the sum of all previous dates rather than all previous rows,pandas dataframe aggregation i have the following dataframe i didnt include an index here but obvisouly there is also an index now i would like to aggregate those two columns since i do not care if the id is in the column id or in id i would like to get the following result that means that i want to sum the count column over all the rows in my dataframe where two ids are the same doesnt care if they are in id column or id column i thought about grouping the dataframe but that did not work properly i am happy for any help,0,52,106 how to fix can t find main module in error i am calling my python file from windows service the code is working fine by itself and the service works fine too but when i call the python code from the windows service i get this error my python code is this and he is my windows service in c and the error i get is this how to fix that,python to log in windows automatically with task scheduler i created a python script to automate a task i would like to run it every day on a hourly basis and for this i created a task in windows task scheduler is there a way to write a script to log in windows automatically when my account is logged out because my script fails if the windows user is not logged in thank you,0,71,74 module does not have the attribute subprocess detached process this ought to be a very simple question from the documentation there s a constant used in the subprocess package run function subprocess detached process here s a more detailed programn that proves the python version number yet i get with this program i agree that it looked like a version problem but it seems that i ve conclusively demonstrated that it s something else,elegant way to swap doubles with strings in pandas dataframe i currently have a data frame with a column titled job code job code can contain one of six hundred different int values each int corresponds to a string value that i currently have listed in a notepad like this i was wondering is there an elegant way to replace the numbers in the job code column with the corresponding strings from my notepad file i am currently using the below method but i am sure there has to be a more optimal solution than typing all codes in jobstrings by hand,0,66,103 discord py timed mute command not working i do not receive any errors the code works fine till i get to the time manipulation part of the command so mute test d testreason the code works fine till i get to the d part then just stops working and i have no idea why please help,using class variable for type hinting in init in python i have a list of allowed types in my class and in the constructor i would like to pass an argument that has to be in that list of allowed types so conceptually this is what i would like i m not sure how to tackle this how would you set something like this up maybe there s a better set up for this but i m not sure how thanks,0,55,77 how to fill matplotlib polygon regardless of point order i am trying to make the area shown below all green so far i use this but not the whole four sided figure is coloured it would be possible to fix the rotation of x and y in this specific example but in other times it would not work is there a way to fill everything between the area between given points regardless of any order of the points,error comparing dask date month with an integer the dask map partitions function in the code below has a dask date field where its month is compared to an integer this comparison fails with the following error valueerror the truth value of a series is ambiguous use a empty a bool a item a any or a all what is this error and how to fix it,0,76,61 why are accuracy of fit generator accuracy of evaluate generator and custom accuracy different in keras i wrote the following code if i try to calculate the accuracy with evaluate generator or with custom code i get different accuracy from the one i got with fit generator more specifically or accuracy variables are different values why is this happening,scipy minimize not finding solution i m trying to solve a set of equations using scipy minimize however i m not getting satisfatory results so maybe i m gettting something wrong i want to solve the following system of equations using wolfram alpha i get the answers which indeed solve the system of equations giving a residual error of now using scipy minimize i do first it says success false and second it finds solutions that are not optimal why having initial values that are close to the optimal solution it fails to find those solutions is it something wrong with the definition of the optimizer tried running it giving initial values of and it just gives awful results note i don t want to use fsolve to find the solutions but minimize the reason is that my real problem involves having more equations than unknowns so at the end i want a solution that minimizes the errors of all this equations however since it was not giving good results i wanted to first test on an easy problem for which an exact solution exists but even in this case it doesn t work once i make it work for this problem i ll expand it adding more equations,0,55,201 fast way to access elements of a matrix or pandas dataframe from a list of coordinates i would like to select non consecutive elements from a matrix or pandas dataframe where the row and column of each element is given in a list of coordinates output this code works but i asume there are more efficient ways avoiding for loops to solve this any suggestion,web scraping extract n number of time the same thing i have this code to scraping all sections of different website that has section web with the word transparencia however i do not know why when code print all url with the word filter it s repeat n number of time and i only need one of them input output for example in this output the url with world transparencia repeat and increase for every web section but more to more when there aren t more web section the code continue print a few more line with all url,0,65,95 replacing all but one type of character in a string python the desired output of this code would have been l ll but it was l ll an l ll an lilli n lillia sorry about this i m not the best at code but i d appreciate a solution thanks,django image compression not working for aws s bucket i trying to compressing image before upload on aws s bucket but i am getting this error this backend doesn t support absolute paths after add this image compressing code problem image resizing not working after integrating aws s bucket problem getting this error page after image upload notimplementederror at blog edit hello this backend doesn t support absolute paths here error details of my terminal here is my models py for upload images though i am getting this error but image is uploading on aws s bucket why i am getting this error and how to overcome it how to use image compressing in django for aws s bucket,0,43,116 selenium useragent i want to open google using the following code is working but i don t understand following line why mozilla and mac os x is there a shorter version with just the standard code,try except with files handle where to close suppose i want to introduce a try except block while handling a txt file which of the two following way of capturing the possible exception is correct in other words should the h close be called even if the exception occurs or not secondly suppose that you have the following code if an error occurs in code line here should i use h close in the except block is there a difference with the previous coding lines,0,35,81 parsing xml in python by using xml etree elementtree i get an xml file using the request module then i want to use the xml etree elementtree module to get the output of the element core usg but i m already confused how to do it im stuck i tried writing this simple code to get the sysname element but i get an empty output python code xml file,how can i name a table with a string or var i want to program a discord bot which creates a table with some simple input therefore i need to know how i can name the table in sqlite like my variable splitdata my code,0,63,45 pointing numba to the tbb is there a way to point numba to the latest version of the tbb installed on my virtual environment please by default numba finds an outdated version of the tbb and resorts to omp here is the numba warning although the installed version of tbb is,django data import from json file url into database i m trying to import data from a json file url into my django database on a weekly basis to keep my database up to date that data is coming from an importer which was written in go and which provides me with that json file via a link i still don t have a way to automate this or to make sure how to check if an item got updated or not and then only update those items but that is not my main issue right now my main issue is that i m receiving the following error every time i try to import the data with the manage py command this is my code the json looks like this,0,51,127 methods endswith removesuffix not removing suffixes i am trying to remove suffixes but for some reason it is not working code is outcome is where it should be any help i feel like i am missing something obvious,multi threading and events exercise in python write a program using two threads such that one writes even numbers in increasing order and the other odd numbers in incresing order with respect to a certain threashold for instance given i would like to have as output i think an event object should be used in order to alternate between the print of a thread with the other but i do not know how to implement it in order to make it work since i think i have not fully grasped the tools to work with threads yet i leave here my faulty code for the task,0,37,106 error the pycuda distribution was not found and is required by the application what is causing this error,lookup table in xarray so i want to merge datasets is a single band raster dataset that came from rioxarray open rasterio the other a lookup table with an index dim mukey the coords along mukey correspond to mukey index values in the lookup table the desired result is a dataset with identical x and y coords to the raster dataset with variables n and k whose values are populated by merging on the mukey if you are familiar with arcgis this is the analogous operation xr merge and assign don t quite seem to perform this operation and cheating by converting into pandas or numpy hits memory issues on my gb machine does xarray provide any support for this simple use case thanks,0,18,122 attributeerror when using pytest monkeypatch to change fixture object attribute in my pytest file test foo py i am trying to change the value of foo path to mock path using monkeypatch however when i try the following i get an error error test foo py test foo attributeerror foo has no attribute path what should be the correct way to make this change so that foo object in test foo will use mock path and pass that test test foo py,trouble printing out list elements from dictionary i am a student trying to learn the basics of programming in python for the sake of practice i am working on a function that reads data from a file put the two columns in question in two lists and then assigns the two lists as a key value pair in a dictionary i think i manage that task fairly ok although it is probably better and cleaner ways of doing this however my problem is that i for some reason don t manage to print out the contents for the two lists the way i want the data file i am reading from is my code looks like i want the output in the terminal to be like this the error message i m getting is is there anyone who can help me fix this,0,71,140 access django database on postgresql from independent python script i have a website built with django and postgresql each user user in django auth system on the website have many account models and other models an app running on windows python based need to access read write data from the database each app is associated with a specific user my questions,how to repeat numpy array at specific index changing every loop i want to repeat first four indices time then the next indices but want this dynamic as index number might be changed expected output should be y i am trying to repeat array at specific index as shown in the following code,0,60,55 how do i know whether any exe file is installed by python i want to check the any exe file is already installed or not tried the above code but gives none as zoom is installed in my machine,find and use top features in xgboost regression pipeline i want to get the top features with xgbregressor with ft weights xgb reg sort values by weight ascending false head i get the top features but how could i use this in my pipeline i have this class featureselector only top how could i only use the top features and later printed out for example print grid feature selection top top features imports xgb pipeline,0,39,62 non greedy regex pattern for email python i m new to regular expression and stuck at this situation where my current regex pattern is returning two results and one of them starting with the phone no string doesn t have a space between phone no and email i tried using the to make expression non greedy but its not returning anything,create a custom signal filter in python scipy i am trying to implement the following filter using python and scipy i already know how to implement basic filter like this however the filter at hand is much more complex and i don t know how to attack the problem thanks,0,61,50 don t understand why map returns iterator makes code to fail i have some code that does in python it works fine but in python i debugged and delete table id range function is never called i know that map returns now an iterator so i changed the map to become a list with and only adding this the delete table id range function runs i don t understand why is this happening can somebody explains,django form fields to html i m crating fields in a for loop and storing them in a list in a django form when trying to place the fields in the html file it appears to be printing the object something like this django forms fields integerfield object at my html looks like this this is how i create the list how can i convert that string to an actual input,0,70,68 histogram with opaque bars if i make a histogram using plotly express then the colors cover each other however if i use ff create distplot then the colors are more transparent this shows transparent colors which is much nicer is there a way to get the colors to appear like that in px histogram,read array of array with pyspark i have an array of arrays of numbers of the following structure spaces and line returns are preserved the size of the data is gb is it possible to read it as a dataframe of columns integer and double so far i have tried to read it as json creates only one corrupted record and as text it reads each line individually and i am not sure if the order of lines is guaranteed any ideas,0,50,84 combine dataframes when the dataframes have different size i have df one is i want the result as follows the column of the new df is the same as the column of the df depending on the value of the df,pandas how to set values from another column based on conditions column wise i have a dataframe that has this shape the first two columns have the values i want to populate with the rest of the columns the rest of the colums col i col z should be populated with values from col a and col b depending on the value of each one for example the first row of col i has a b so it should be populated with the value of col b at the same row i tried different functions for this apply applymap but none of them are suitable for this use case the remaining table in this example should look like this,0,45,118 django change last login from datetimefield to integerfield i have a litte probleme i have a legacy database that have a users table and in the table of users the last login field is an integerfield when i have extend an absractbaseuser and put the last login in integerfield it give a me an error when trying to connect to django dashboard it say that the last login field expected a number but got date time value any help please,how do i rearrange an equation to be in terms of a specified variable with sympy i can write for example to generate an equation of a line that passes through those points but the output is given as presumably being equivalent to x y how can i instead set the output to be i thought it might have to do with some formatting settings in the equation method so i checked the documention but it didn t say anything about it edit it appears that if i input i will get the albeit ugly output this does give a rearranged solution but the issue is that this is only in the form of x f y i m not sure how i would get it to instead be in terms of y f x edit i think this might actually be a bug with solve or eq if i instead manually type or i will get the somewhat ugly but correct output of now if i were to instead type or i get the output of this is rather strange though because and both output so i m really not sure what is going on here,0,77,197 can i get the screenshot data as a file like object or the image in bytes without saving any file i want to send a screenshot over a discord webhook i am using the dhooks module for this to send a file i need a file like object so i want to get a file like object without having the need to store the screenshot as a file any idea how to do this,is there a way to correctly show tag borders in tkinter i am working on a text markup tool using tkinter it is mostly built around using various tag methods on the text widget the thing that is driving me crazy however is my inability to get correct borders around tagged text if there are overlapping tags consider the following piece of text tagged with two different tags shown with square brackets my example when i use tag configure outer borderwidth relief solid i want to get a border around my example however i get two borders around my and around example if the background color is set for example if there is no background color involved it works as i want but i really need the ability to change background colors minimal working example question is there a way possibly hacky to get single borders around such outer tags what i want what i get,0,71,154 python re match exact string with pattern string block emp string block reg re match d d d string returns block emp the above regex works correctly reg re match d d d string returns block here the excepted output for string is null but the regex returns block this regex will not match the full pattern and returns only what matches in the string how to match the string excatly with this pattern thanks,combining elements from multiple lists in python say i have some lists i would like to combine elements from those lists above so i would have a new list looks like this how do i do this in python,0,63,39 many to one matching algorithm with a maximum of matches to one i need an algorithm that matches many x to one y is there a procedure for this thank you very much for your help best if python related answers but no must,retry failed readline of stdout with different encoding using python i am running a jmeter process using the following code but my script threw an error at the readline call because it detected a latin character xe which is not compatible with the utf encoding i d like to catch this exception and try printing out that stdout line with a different encoding or bytes only to help me identify the line that broke but because it s in the middle of a stdout utf process i can t think of how to do that,0,44,92 how to click in selenium and downloadfile i want to click pdf download button but i can t how can i do that,how do i extract a specific data from a field in python to print it i m using the discord py api to build a bot to show me by different commands the results of some votes for example i have a question of do you like fruit and the options yes and no i want to show by screen when you use the votes command that the option yes has votes and the option no has the problem is that the variable that contains the number of votes is not an individual variable nor it gives it to me in json format but in field format any this returns postman when i make the request res ordereddict option yes number votes ordereddict option no number votes from this i only want the command to use the votes part but i don t know how to extract it from the string i extracted the other data from the other fields like this since they are jsonfield but i don t know how to do it with the other form could you please help me edit i tried using this code i ve seen in some questions here but it doesn t work either thank you in advance,0,22,208 importerror cannot import name henormal from keras initializers if i try to run the line i get the error message i m in a conda environment where i installed keras gpu with and from i get how can i solve this,append dataframe i am trying to get stock price from tiingo and append dataframes however the result shows a bit different how can i make it look like this,0,38,29 how to catch a string based on a subsection of it i have multiple strings in a list each list is a link in a string format i have some strings whose style is the following mailto newsletter dcda dcda com some of these strings change in the part they have different addresses i want to find a regular expression that can capture the whole text based on the mailto part,tuples to dictionary with two occurances my question is how to turn two tuples in a dictionary and have it so that if there are two strings that are the same in the first tuple it returns the first element from the second tuple e g however this outputs however i would like it to be apologies if this is too simple a question to be stuck on i know i have to add more to my code which is why its returning the wrong output i want i ve had a look at other resources however it doesnt answer my specific question i ve thought about putting an if statement and do x count k however i didnt know where to go from there,0,68,120 python pandas nlargest not working properly with keep all when i try to use the function below even if keep all the output is however the sorted array is what i want is how can i solve the problem edit for the people who interest to solve it here is the example code which show the problem,how to solve invalid character in identifier error so i am making a discord bot i saw this code on a stackoverflow question i got the error here i retyped code the starting part where is the error but still no success please help i used another interpreter it showed the same error but at a different place i e last claim stamp,0,59,60 python scrapy item add xpath error invalid syntax hello stack overflow friends i m having some trouble with scrapy it s returning syntax error at the item add xpath command here s the script the error returned,how do i count the number of duplicate groups of data after using groupby in pandas with python here is what i did now i have an object where i have id associated with a column dataframe here is my code so i printed out in a for loop and it gives id with a column dataframe for each loop i want to figure out which of these resulting grouped dataframes are duplicates how many duplicates exist and the id s of the duplicates the entire dataframe associated with a given id has to be identical to another dataframe with a different id so i would like to return a which tells me id and are identical there are three of them and we call this group a,0,30,139 how to combine turtle with tkinter so i ve got tkinter code that when ran opens up a new window with a square root calculator when i try to get turtle in the same window as the square root calculator windows pop up,equation solver to solve for x but short and simple equations so i need help to create a program that can solve for x in a simple equation such as x or x if anyone can help that would be amazing,0,43,41 how can i improve api response speed if it uses cloudflare i need the fastest api response from exchange to find arbitrage opportunities as quickly as it possible now i am using websocket connection to the api but speed is still not enough good tried all server locations that are available in aws but this does not change situation much in my opinion the problem is about cloudflare does someone know about how to bypass its limitation,how do i goto the next step there will be new reactions to add and a new question to ask after has been used how do i print a new question and wait for the new reactions i ve tried many ways and it just doesnt work,0,77,47 remove consecutive duplicates while keeping the max value i am trying to remove consecutive duplicates from column x while keeping the entry with the max value based on column y unfortunately with no success the data frame is as follow what i want to achieve is most of the solutions i found just remove the duplicates tout court without accounting for any repeating pattern please note that the duplicates might have the same value,how do you use headless chrome with selenium this question is asked because i want to know what is the optimal way to do this in as there have been changes and i see that people are doing it differently i want to be able to automate my twitter follow bot in the background using headless i am also new to python and still learning so i d appreciate code lines code,0,74,72 imagemagick installation in docker container with external fonts for moviepy how to install imagemagick in a docker container and also install external fonts for usage in moviepy,replace values from non identical columns in other dataframe i have two dataframes and i need to replace values in df from df i get the error can only compare identically labeled series objects how can i make this work,0,27,38 python read data from api and save into dataframe i am trying to read a list of stock ticker and get price from tiingo but it reads only the last item mo and save into dataframe data how can i get the price for a full list thanks,how to match regex included in one another i am coding in python and my problem is the following i am trying to match regex for products that are described in a specific way let s say product is abc alphanumeric characters or symbols e g abc xyz abc def and product is ab alpha numeric characters or symbols e g ab xy z ab def i need to retrieve the full name but also the root the root is case sensitive if not i could have used ignorecase true my first attempt to match those was for full name for root the root would match would match all examples of product but also the examples of product since ab is included in abc outputing ab in all cases the solution i have found is the following for the full text for the root which enabled me to match both products distinctively the use of is to match a non capturing group without it it would output only ab as a group the use of c is to indicate a negative lookahead which ensures that c is not after any ab matching group for my personal use i specified all the characters that would make the product selection intertwine i e ab and abc de and def etc the use of a za z s s is to match match a number or a symbol in my case and stop at an escape character that is a comma full stop or white space this being said i am sure that there are better ways of doing it,0,49,262 why doesn t the int function convert a float to integer while in input function why doesn t the int function convert a float to integer while in input function result,how to use csv as instance attritubes in python how do i import csv file and use it as instance attributes for my class here is the code ive written driverandteam csv looks like this i keep getting list of out range error in line of my code but im not understanding why how can i fix my code so it works,0,29,62 entire data from date range not being plotted in matplotlib i have the following code this code produces the following plot for some reason it is not plotting right since the data here is till the month of december but for some reason it is just showing the plot till end of august,problem is selenium python beginner in coding i received this error when trying to run my code let me know what i can do if needed i ll post the full code here,0,53,32 sort columns names only not rows in python hi i have df input which needs to be sorted for only column names not by rows restructuring the dataframe my required output column names should be sorted after n columns here after columns my input dataframe is as follows required output dataframe thanks in advance,trouble understanding a specific lambda function syntax i am having trouble understanding this bit of code specifically its syntax i understand the lambda functions but what is s doing here,0,52,30 how to transform a tuple into a dictionary i need help with a list of tuples i have the next list i need to transform a tuple into a dictionary and get the next result,subclassing xgboostregressor for scikit learn estimators receives typeerror super takes no keyword arguments i tried to subclass xgbregressor to create a custom scikit learn compatible estimator with gridsearchcv embedded i kept receiving the typeerror message saying super takes no keyword arguments in the context below the first code is a procedural version of the second code the second code is what i intended to do but failed i want to create a new class for xgboost regressors with gridsearchcv as a cross validator running the following commands xgbr xgbr xgbr fit x y you should see the error message,0,35,94 map elements of a list as value of another dictionary i want to map elements of a list as a value of a dictionary in a list a list of dictionaries a list i want to map elements of the source list as a value of key source for each dictionary in sample list wanted output,how to clip a polyhedron using a plane in python i want to split a parent convex polyhedron d using a plane d into child closed convex polyhedrons how to do this in python an illustrative example is shown in image below,0,54,43 replacing all but one type of character in a string python the desired output of this code would have been l ll but it was l ll an l ll an lilli n lillia sorry about this i m not the best at code but i d appreciate a solution thanks,use import module to access module from site packages i want to import all modules from a particular directory of a package which i installed using pip that is it lies in site packages what i tried let s say the package name is package and it has a directory called directory it has many files like a py b py etc i need to import all of them i listed all files in directory using in built file which isn t the problem when i tried to import the modules using importlib import module i got modulenotfounderror even though i m percent sure they exist i used relative import code snippet modules is the list of all files in directory modulenotfounderror no module named c users package directory finally what am i doing wrong and what is the right approach to refer site packages,0,43,131 how to use wildcard in numpy array operations for instance define a numpy array with numpy str format and doing the replace operation supported by numpy char the returned result would be a b c d e f g h but i i i d i i i h is expected,beautifulsoup strainer to strain items from a specific container only is it possible to make a beautifulsoup strainer that strains all order cards from container only without order cards from other containers below the sample html what i have so far is the code below which strains all order cards from all containers the goal is that page soup contains all order card items that are in container only the following loop then uses that page soup to iterate through each item in order card to get the details from each item card rephrased above the goal is to get the details from each item card that are in container only there is no need for parsing any other containers than container following that is a loop that gets the details from all the item cards in all containers in fact that is not wanted as the output includes items from containers other than container only running python on anaconda win,0,37,152 how to loop through each column in a row using pandas i got the dataframe like this how can i use pandas to loops all column in a rows and get the result like this thanks you for all your helping,clone the repository to use python with azure functions trying to figure out the issue with my cmd as it is getting stucked as i tried to run below commands to get the virtual env enabled this is working but when i try to clone the repo my cmd is getting stucked below are those commands also those repo is also a sample one here my task is to use pytorch any help would be appreciated thanks,0,41,77 what is the difference between rdkit s molecule fingerprints fingerprints fingerprintmols and chem rdkfingerprint can anyone tell me when i should use fingerprintmols fingerprintmol instead of chem rdkfingerprintwhen making molecule fingerprints these are the two options is fingerprintmols fingerprintmol more efficient,convert all dates column to datetime of multiple dataframes in a dictionary i have multiple dataframes stored in a dictionary and i try to change the type of the dates column from object to datetime for all dataframes in the dictionary at the same time this would be an example with two dataframes df df i try to figure out a way to convert the column dates to datetime format within the dictionary for all dataframes at the same time so far i was only able to convert them individually before putting them together into a dictionary with df dates pd to datetime df dates thanks a lot,0,35,105 subprocess contradiction between two programs i know this may seem weird but i m trying to understand why the following happens i m editing a python program at work and when i run the following python function i get in the output that type c is bytes and sys stdout write c runs regularly and prints one byte at a time but when i run this function from a standalone program i get the following error how is that possible,is there a better way to select rows from a pandas dataframe based on multiple conditions i m trying to select rows from a pandas dataframe based on multiple conditions the code looks like this is there any better way in terms of code readability to do the same thing,0,74,49 how to count the number of values for each index in python pandas dataframe i have the next dataframe i need to create the new column len x in dataframe and insert into it the amount of values in each cell i need the next result i will be grateful for help,company data formatting i have the following dataset following is the expected outcome what i am trying to do here is for company aggregating the company data with respect to their eid and clean name and taking minimum of start date and maximum of end date if i do simple aggregation for ghi company minimum of start date will come as and maximum of end date will come as which is incorrect basically i want to separate ghi company as they are two different data i understand i may have to use nested for loops for eid clean name and start date and end date to compare the data between each row but i can t seem to get it to work as i am unable to understand the usage and logic to implement it in the loop here is what i started with which is not much to go on but stil this is just a sample to check how the nested for loop works which it didn t because i got an error in line if j j i am new to python and still trying to figure out how things work also note the dataset is already sorted with respect to eid start date end date and clean name so basically i have to merge consecutive duplicate rows with min of start date and max of end date and the last company with min of start date and end date as null since it indicates that the employee is currently working in this company any leads would be appreciated thanks,0,50,247 python how can i print an alphabet from a list given a number given a number from to i m trying to return an alphabet in the corresponding position from a list example i have tried the following as expected that returns a type error because there are no integer values in my list what can i do to return an element from my list in which its position is equal to the users number input,selenium python getting specific text in data sort a in a html page there is this line and i can find it by using this xpath but i only interesting to put in a variable the funny keep in mind that the word funny is changing all the time so i need to find it and push it to variable but how do i extract this changing text thank you for helping,0,77,72 how to run a server in the cloud im creating a server in python that receives post requests process the information in the request using some scripts sometimes using a database and send back a answer in json format im searching for a way to run this server and code in the cloud in a way that i dont need my pc turned on for it to work because my connection is very unstable,python requests ajax form authentication issue i have seemed to be an obvious problem login to a website programmatically and then get data when authenticated i ve been reading stackoverflow for a few days and can t find a working solution here is the login form which is also accessible using a separate url and after logging in via browser it redirects to the home page here is the python code i ve tried same logic in powershell but none of the above is working i m still getting results for non authenticated user,0,74,89 pagination in django not pagination the posts by posts per page after writing the view for my pagination in django the button works fine meaning that they load new pagesz but the problem is that all the posts still remains in all the new pages and that is not what s expected views py elementlist html,visual studio code python h no such file or directory windows gcc i m a total beginner in c and getting crazy trying to embed python in c using vs code ide and gcc compiler i am stock and now i m keep facing this silly error that says python h no such file or directory gcc i have followed steps explaned in using gcc with mingw in vs code in order to configure c in vs code but i failed to install mingw the bin folder was empty so i add already installed codeblocks mingw to my path and it seems to work i have python installed and tried other solutions and already put python h and python library path in project include path c users mpc appdata local programs python python include and c users mpc appdata local programs python python libs here is the code that i want to compile and this is my c cpp properties json c configuration file and this is tasks json file,0,54,149 how to setting the speech rate in azure text to speech hello i am trying to configure the speech rate using python with the text to speech services i need the parameter statement,how to check os variables and use them with same name as python variable from a list hopefully i can explain right what i am trying to do i want to check if variables giving from a list exists in os if so use the same os variable name and value in python this is how am i doing it right now but i think it is a lot of code and if want more os variables i would be bigger so what could be a good starting to do this smarter and more efficient os linux variables must be somthing like this to start with result so what is printed here above should literally be the variable just to show what i mean,0,33,124 i am trying to call aws lex intent b from intent b in lambda function using python i used below code to but it did not work for me after using below code i was not able to traverse to different intent,regex having optional groups with non capturing groups i have an regex with multiple optional and non capturing groups all of these groups can occur but don t have to the regex should use non capturing groups to return the whole string when i set the last group also as optional the regex will have several grouped results when i set the first group as not optional the regex matches why is that the input will be something like input text xyz t vx n expected output t vx n thanks in advance,0,42,89 python optmize the following if elif statments have a python code that return dataframes i am using if elif statements to comapre the df and return accordingly for eg this way for df i am having combinations wherever ther is data i am writing it to a file if not displaying appropriate msg to user figuring out a way to optimize it is there any way,i just wanted to open a window doing nothing just a simple display but it immediately closes through python code and the screen opens and immediately closes like just in an instant but it transitions to the first pygame window,0,70,40 how to use tkinter canvas to create multiple text one time for example the main window get stuck when run this part how can i avoid it when loading the text,how to delete rows based on change in variable in pandas dataframe i ve got a dataset with an insanely high sampling rate and would like to remove excess data where the columnar value changes less than a predefined value down through the dataset however some intermediary points need to be kept in order to not loose all data e g now i want to delete all the rows where the change in v from one row to another is less than dv and the change in t is below dt but still keep datapoints such that there is data at roughly every interval dv or dt lets say for dv and dt the wanted output would be meaning row and was deleted since it was within the changevalue but row remains since it has a changevalue above dt and dv in both directions the easy solution is iterating over the rows in the dataframe but a faster and more proper solution is wanted edit the question was edited to reflect the point that intermediary points must be kept in order to not delete too much,0,31,192 inserting list to tables column postgre i am trying to normalize some data that i retrieve from an api but it doesn t seem to work any pointers ok after some corrections it returns how do i overcome this my approach might be wrong altogether because the table i am retrieving the data has about m rows but how could i make this one work,extracting value with beautifulsoup get text problem i am trying to extract a single value from the code below my code is i expect but somehow i get strange output what i am doing wrong here,0,65,37 how can i make a pygame mouse clicking event i want to add to the variable i when i click the image in pygame how can i do it,problems when reading dataframe with pyspark in apache zeppelin very unclear exception on missing some methods in the objects first loading the python libraries in order to work with pyspark and use bokeh library then prepare the df and then call for the function in order to get bokeh plot then getting the below exception,0,30,55 pandas typeerror unsupported operand type s for float and str i have a function generateid but i have a problem with this line data df id cont data df apply lambda row row product name row hour shift strftime y m d h m s axis because of this data conversion problem i have this error typeerror unsupported operand type s for float and str here is my code,how to extract this dictionary using beautiful soup i want to get to variable last element of dictionary pasted below it s in another dictionary offers and i have no clue how to extract it,0,56,34 list count in python dears please need help in count method if and if using count and searching on or or false list count or list count or list count false return only not while there are another elements consider as false as below bool function if we used bool or bool or bool to know its boolean value will return false also i tried to check will return false not true,percentage of occurrences in a column using groupby in python pandas enter image description here suppose i have multiple entries in a column search term i want to calculate the percentage of occurrence of the brand i know how to get the count of each brand but can someone suggest a way to get these in percentage,0,75,57 cannot resize array using np resize i am trying to resize an array to x my code is as below when i go to reshape later on in my code i get the following you can see from the error that the array hasnt changed size and is still i believe im missing something simple but i cant seem to find it thanks,is there any way to rotate dcc dropdown at an angle as shown drop down button is in the image is rotated is there any way to do it i looked into but didn t find anything,0,63,36 resize an uploaded requested image by flask i made an image request system on flask by web browser but i would like to resize this image and save them i tried several things and i could to do this using this code but it s not a smart way to do this because i need to save the image and open the image resize then and save the image again some suggestion,how to return key value pairs in nested dict whose value is a list that contains said dict as you can see the question itself is convoluted but so is this problem i m trying to get the key value pairs for name name symbol symbol and price price in this api output i ve tried several things but can t seem to get it straight any help is appreciated here is the dict here s one of my failed attempts,0,71,75 pydantic custom data type for phone number value error missing mysql schema for user my pydantic model is i want to create a custom datatype for phone number so i can use it at multiple places i am trying like below via postman i am sending i see error in postman any inputs on what i am doing wrong above,keep only letters and spaces from log file with python i have a log file that looks like this i read as a multiline string and i want to keep only letters and spaces and look like this i can do it with but i don t want to have to add all possible characters i was thinking something with isalpha and isspace or some regex,0,58,65 split up duration while upsampling dataframe how do i split up a duration while upsampleing a dataframe as in the example below and can i replace the for loop with e g the group by function i want to use pandas to transform data like this into this and i get this far,how can i fix this problem in tensorflow fit in python can you tell me what the problem is with this code the last line of the code means there is a problem but i can not understand where the problem comes from the errors we have,0,51,46 fastapi pydantic optional field currently i m learning python and fastapi and i can t figure out what typing optional is for both work i don t understand what s the difference,python discord bot use of async not allowed outside of async function i am making a discord bot in python and some of the commands have the bot typing a bunch of nonsense but i have to have the whole async with asyncio sleep everytime i would like to put in a seperate method that i can call something like this but this doesn t work as i cannot use the keyword async and await outside of async method is there a clean workaround for this,0,27,85 python subprocess loop runs twice so i created a python script to batch convert pdf files using ghostscript ideally it should work but i am not sure why it isn t working for now it is going through the input pdf files twice and when it runs the second time it overwrites the output files here s the script here s the ouput i am missing what did i do wrong,create a pyspark function that determines if two or more selected columns in a dataframe have null values i want to create a pyspark function that determines if values in two or more columns of a pyspark dataframe are null a new column should be made to show true or false if values in both columns have been populated the function should stop processing if it encounters null values in both columns the output should look like this the above would stop processing once it hurts a null or empty value in the table thanks in advance the code below shows if a value in one column of a dataframe is null i want a new function that does this with or more columns,0,68,125 when i run the sportsipy nba teams teams function i am getting notified that the requested page returned a valid response but no data could be found the code that i am running straight from sportsipy documentation returns the following the requested page returned a valid response but no data could be found has the season begun and is the data available on does anyone have any tips on moving forward with getting this information from the api,how to calculate time elapsed since an event occurred in a specific column pandas dataframes i am analyzing readings from my continuous glucose monitor as a diabetic i have a spreadsheet where i ve logged the date time the type of entry and my blood glucose level each row represents a new entry and entries can be of various types for example what i am trying to do is to create a new column that tracks the amount of time in hours elapsed between sensor swaps so that i eventually can determine if there is a relationship between sensor age and bgl control variability here is an example table beforehand and here is what i would like it to look like afterwards there are a few other stackoverflow pages that i ve found with similar questions but i am having trouble adapting them to my specific issue so far i have only been able to get to this line which i understand will output a series of null values except for where the type is new sensor in which case it will output the date for that event i can t figure out how to expand on this to get what i really want though any help or advice would be greatly appreciated thank you so much,0,76,212 trying to extract a string value between dots from a string column im trying to extract a default string value from a string column but without sucess this is the column with some string values what im trying to reach this is my unsucess code and the result could you guys help me i have a kinda difficult with regex and it just blow my mind when i have to deal with it,modulenotfounderror no module named createcredentialsxml i have a question about my new python project it is the first time that i use different folders for my project i have the following structure i work in pycharm environment after pressing play i get the error message my main function looks like this init py createcredentialsxml py i tried using path or sys path to fix the problem but it does not work can you please tell me how to fix the problem,0,73,78 why does python numpy behave like this with arrays why do the two methods results in the same result dw dwhy when does not,create a new variable based on other variables i have a dataframe in python called df where i have dichotomous variables called ordering ordering ordering ordering with true false values i need to create a variable called clean which is based on the other variables meaning when ordering true then clean ordering when ordering true then clean ordering then clean would be a combination of all the true values from ordering ordering ordering ordering here is an example of how i would like the variable clean to be i have tried the below code but it does not work df clean df ordering df ordering df ordering df ordering would anyone please be able to help me how to do this in python,0,26,126 myhdl signals inside functions not showing up in vcd should i be able to see these in the generated vcd file i can see all the signals i created at the top level but not the ones local to the function here is the code i used to generate the vcd,convert inner tbody html content to json i m trying to get web data from a website and i only need to grab inner html data from a tbody class and convert it into json for better control as well as to save the data into a file later on i ve only managed to read each element by using find element by xpath from selenium is there any way to read the whole innter html tbody content then parse it to json requests wont work since it s inside an iframe the website and the tbody is the scroll table with title tinh hinh dich ca nuoc i only want the table minus the title and the header of the table if possible the code for reading an element,0,51,124 a type guard function that st argument s attribute type is determined by the nd string key argument e g key dict then typeguard dict i tried to parse a json data into a python pydantic class object the problem is that the data is like i m thinking to make a type guard function check type and use it like below it will allow my ide to have better maintainability is it doable,how to speed up this python loop any suggestions please threading or something like that outputs here downloadtime downloadtime downloadtime,0,69,24 python how to generate two new columns in a pandas df based on the order of the values i have the following table as input and i need to generate something like this pos when sorted by x and pos when sorted by y are based on the location in the sorted dataframe by each of these columns,how to write a python string to a c struct s char member in python i have a c struct passed from c to python and i want to change the content of a char member in python little c compile to so file create the struct and call the struct member function callfunc in little py little py littleoperation py if i deirectly assign python string to c struct char member little memberstr paralist para the address will be changed i tried ctypes memset the address remains the same but the char member not changed at all why is ctypes memset not working,0,50,99 page not found the current path register register didnt match any of these on running server browser show i am trying to save the the data into database on submitting the form the browser show page not found error and and some wrong address while i am rendering the homepage on submitting the form views py file urls py file,how do i modify the values of an iterator in python as a side project i m making a basic html parser the html comes in as a string and i make an iterator for it i need to remove groups of whitespace at certain points e g if the character is whitespace i d like to consume it remove it and advance one by one until i hit a non whitespace character where the function would stop iterator setup for example becomes,0,59,79 no start line crypto pem pem lib c expecting certificate request full code below full output below i tried to open the certificate file called certificate pem with openssl req text in certificate pem commands but it shooted the error that i wrote at output this error didnt happen when i built certificate with x certificatesigningrequestbuilder but i get an error when i try to build a self signed certificate with x certificatebuilder thanks for all help,python printing bytes strangely so i have this very simple code when i print a it shows only the first byte and the last byte for some reason does not show properly it prints b xb and it should print b xb x or at least that s what i would like to print now when i look at the file that i stored it saves the bytes exactly how it should with no issue there does anybody know what s going on here also with some integers it prints properly but with this one for example does not,0,66,94 convert a groupby object with no aggregation function into a dataframe while keeping the grouping say i have the following dataframe df is there a way to get the grouped data as a dataframe e g edit using set index does not seem to work since it does not group the second columns specified e g country as noted it is not grouped for each country as required,huggingface document summarization for long documents i would expect summarization tasks to generally assume long documents however following documentation here any of the simple summarization invocations i make say my documents are too long what model or configuration choice makes this most automatic i ve read other questions suggesting manually chunking the data or truncation but the choice of boundaries and chunk length seem like they would make a difference in summaries what s the best practice for an arbitrary long document unbounded would be great but let s say tokens at a minimum,0,65,92 error with installing and importing gtts in python i m facing this issue whenever i am installing and importing gtts issue in installing issue in importing i did pip install gtts and imported from gtts import gtts thank you ps python version,pandas how to split a string column into several columns by the index of specific characters i want to extract the user id from a string column called filename and create a new id column based on the index of specific character in the original string two examples for the string in filename with id of or digits filename id session neg emotions rating csv id filename id session neu emotions rating csv id i tried this but i couldn t find the end index of the id for the slice per row it or depends on the length of the id as or digits finding the index of s after each row in the data frame will solve my problem the simple option didn t work for me i also tried some split option but i don t have a specific character such as comma to split by thanks a lot sorry if it s a duplication of a previous question,0,43,164 how do i add a border to a sprite when the mouse hovers over it and delete it after the mouse stops i have a sprite and i want it to be so that when the mouse hovers over it it places a small border around the sprite and when it leaves delete that border how would i go about doing this sprite class i can add more code if required thank you,stemming words in a list python nltk i feel like i m doing something really stupid here i am trying to stem words i have in a list but it is not giving me the intended outcome my code is and the ouput i get is as opposed to i feel like i m doing something very silly with my list but could anyone enlighten me what i m doing wrong,0,73,68 flatten and convert a dictionary to a list this is my dictionary i want to remove those and keys that you see there and have it become a list format like so i want it that way so that i can get a clean json output like this any help would be greatly appreciated thanks in advance,in discord py is it possible to wait for a variable to change from a different part of the code than the variable changes i tried using time sleep but instead of waiting for the variable it paused the whole code not allowing the variable to change this is my code i can t figure out what to replace time sleep with,0,59,58 in graphene how do you provide both a list and a specific element from one right now i have some code that lets me get all items and their properties however i want to also be able to get a specific item right now if i run the query i get a how would i provide a way to get a specific element ideally without providing a whole separate endpoint,can this conditional be shortened is it possible to just use get function from dictionary for this is this the best we can do to shorten this piece of code n dict is a dict type uppercase d and nes is just a list of str i m just curious if there is a better more pythonic way to retrieve a value like c has with trygetvalue,0,70,66 pytorch lightning tensorboard logger automatically adds epoch scalar as in how do you prevent the tensorboard logger in pytorch lightning from logging the current epoch pytorch lightning lightning trainer with a lightningdatamodule and lightningmodule automatically logs a scalar with name epoch showing the number of epochs even if never told to do so how do i remove control that behavior,sqlalchemy group by day in timestamp column i have an orm model defined in sqlalchemy as below i m planning to get the sum of all views in each day and tried to group the results based on their end to i have used the following query in sqlalchemy but this query throws this error i am using the timestamp in my model and i don t plan to change it because of some reason the only thing i can do is modify the query the sqlalchemy is connected to aws redshift,0,60,89 performance using loc vs simply using inside square brackets i know pandas provide various ways to index data i wanted to know is there a difference between the following two methods from the perspective of performance i e which one is faster or both the same,convert pandas column with object type to date iso format i have dataframe as below i tried to use this solution how do i convert dates into iso datetime format in a pandas dataframe to convert my timestamp column to iso format but it is not working my df test timestamp still appear as object column instead of datetime please help,0,45,61 how plot multiple dictionaries of dataframes by columns python pandas i would like to plot multiple dictionaries of dataframes in the same figure with subplot i can draw a dictionary of several dataframes on the same figure but i can t add another one the figure must be,pandas search for char in row and write finding into new column i d like to search for a list of special characters in my dataframe rows if one of the characters has been found i d like to write into a new column if not the column should contain a will print this now my approach which doesn t work because i can only use str contains only works for str columns as it seems how am i able to find my characters in the whole row target dataframe would be,0,49,90 how can i store results from a loop in a dataframe i have the following loop creating kpi values for each of my subsets is there a way to store this in a nice table something like this with the sku value and sku scaled in the columns edit code used to create kpi function,how to find the intersection time of a parameterized curve with a shape i have a curve parameterized by time that intersects a shape in this case just a rectangle following this elegant suggestion i used shapely to determine where the objects intersect however from there on i struggle to find a good solution for when that happens currently i am approximating the time awkwardly by finding the point of the curve that is closest in space to the intersection and then using its time stamp but i believe there should be a better solution e g by solving the polynomial equation maybe using the root method of a numpy polynomial i m just not sure how to do this because i guess you would need to somehow introduce tolerances as it is likely that the curve will never assume exactly the same intersection coordinates as determined by shapely here is my code and just for the visuals here is what the problem looks like in a plot,0,56,166 drop certain columns from a dataframe while converting to list i have a sample dataframe at present for the input dataframe i m using to drop unwanted column i e id in dataframe and proceeding ahead which is correct but there are two dataframes is there anyway we can optimise it while converting the dataframe to a list can we have only age and name in the list and ignore id like lst max stan please assist on this thank you,how to replace text in a file using python i would like to read one large file containing lines of switch commands and then start a new text file containing the same list of text commands but only replacing a few characters or lines of text with the desired new text i would also like to have conditionals meaning if one specified line of text is present then i would like a desired text to be replaced in it s place in the new file i am using visual studio code,0,78,90 how to convert a date to text format in excel file using python excel store date column called today and data type is date when i import the excel to another excel using python how to change the date type to text type below is my code and try to convert but not work could anyone give me advice thanks,how can i move a list of files from a dictionary to a directory first time asking a question here so feel free to let me know if i m not doing anything correctly i m essentially trying to append the txt files from the dictionaries values to a specific directory with os and path i ve tried this but i get a type error typeerror join argument must be str bytes or os pathlike object not list here is my code below i look forward to your responses,0,60,86 sci hub response error on python request i created request to sci hub se by requests on python server response error actually bot request successful after deployment but in hours more request got error i use this link could you help me how to solve it this is my code,retrieve dataset from a dictionary i have a function that splits a dataset in a non iid setting this function returns a dict of the labels for example if i apply this function to a dataset i obtain this now starting from this dictionary i want to obtain the original dataset split as stated by the dictionary for example dataset will have the samples and so on dataset will have and so on,0,52,76 pytest create sparksession i need to test my spark project using pytest and i dont understand how to create a spark session i did some research and came up with however when running the test i get attributeerror function object has no attribute format what am i doing wrong,how can i customise error messages shown by pyinputplus how can i customise error messages shown by pyinputplus in python i have tried many method but unable to do it i want to print error message as please enter a valid digit phone number is there any way to so it i try to use allowregexes and blockregexes but unable to understand it,0,49,64 i am trying to make an url shortener and i am facing this problem this is the python code this is the error module pyshorteners has no attribute tinyurl,so i want to use ffmpeg with heroku but i keep getting the error that i dont have ffmpeg installed so i made a bot for fun on and its okay when i run it like on replit or my local pc but on heroku it wont work i did add the heroku s ffmpeg to buildpacks but it still give me the same error also the codes are available at github,0,29,73 how to change default language in qt designer how to change the default language in qt designer anyone has solutions,python optimize weights in portfolio i have the following dataframe with weights and then i normalize each row using i want to optimize the normalized weights of each row such that no weight is less than or greater than if the weight is greater than it will be clipped to and the additional weight will be distributed to the other entries in a pro rata fashion meaning the second largest weight will receive more weight so it gets close to and if there is any remaining weight it will be distributed to the third and so on can this be done using the optimize function thank you update i would also like to set a minimum bound for the weights in my original question the minimum weight bound was automatically considered as zero however i would like to set a constraint such that the minimum weight is at at least equal to for example,0,20,159 how to compare csv and write result to new csv using pandas i want to compare the sku of source and destination file and if destination sku matches with source i want to copy the meta title meta description and description of that row source csv destination csv merged csv my code is working now but if the number of lines changes increase then it throw error,get session value from django form i have forms one is the main one and the other one opens in a modal window i need my second form to get the company session value aign emp id however i don t know how to send this value when i call my form from the context first form py second form py request session aign emp id is the value that i would like to obtain the point is to get to obtain the value of the session from my second form view py context mayoresprintform mayoresprintform is where i need to send my session value template html i would really appreciate if you help me with any suggestions,0,63,108 csv table row as label for previous several rows i have a question about tensorflow i have csv data like image attached and i want to map it green row is label for previous rows is it possible to do it inside map function dataset map and how,huggingface document summarization for long documents i would expect summarization tasks to generally assume long documents however following documentation here any of the simple summarization invocations i make say my documents are too long what model or configuration choice makes this most automatic i ve read other questions suggesting manually chunking the data or truncation but the choice of boundaries and chunk length seem like they would make a difference in summaries what s the best practice for an arbitrary long document unbounded would be great but let s say tokens at a minimum,0,51,92 pandas looking to create a multiple nested dictionary here is what i am looking to generate here is the df and i have the following array so far i have the following code this results in the following dictionary now i feel like i ve gone down the wrong path as i m not sure how to get roll it up to the id level any help would be much appreciated,duplicate analysis using conditions i am trying to do some analysis of the duplicates prior to drop all of them and keep the first or the last result i want to check the quality of the duplicates in order to keep one or remove both value i want to put some conditions if pic of the duplicates have a difference lower than in the pic column i want to keep one and the the value as a mean if it is higher than that drop both rows i am getting the following error i would need to iterate to do this analysis in the whole df thanks for the help,0,69,111 display specific column through pandas i have portalmammals species csv which cotains following columns i want to find out how many taxa are rodent and display those records by using pandas i am trying this but this code giving me only value counts that are true and false how can i display only those records that are true example,merging dataframes with partial string matches i am trying to merge two dataframes of different sizes based on partial match of the column name and sub name and full match of values in column a the codes edit i want to do an outer merge of these two dataframes if there is no match keep the rows if there is a partial match between sub name and name and also if the values in column a match merge them together if there is a partial match between name and sub name but the column a values don t match keep both rows i am trying to obtain or this it doesn t matter if i keep the full name or just the sub name where the rows match if i needed full match i would use merge df df how outer but since i am working with substrings i don t know how to approach this maybe str contains could be useful note the sub name can be made of more than just three letters this is just an example,0,60,172 how to say if elements in the same column are the same then calculate the average of corresponding values in pandas how can i calculate the average of average delay mins of each country my idea is to calculate the values corresponding to similar origin destination country s names and store them in another list where there are no duplicate country names,how to count how many times the value appears in the matrix how to count how many times the value appears in the matrix on python function that gets a matrix and a number and checks how many times the number is inside the matrix and returns the value example matrix and number print,0,57,58 range function doesn t work in jupyter notebook i use jupyter notebook in vscode i execute the simple code in jupyter notebook ipynb the code execution result is but the code is executed well in python file py of course the code execution result is it s an error that i don t understand i want to avoid not being able to use jupiter notebook because of this problem i ask for your help,append from a string list until a semi colon in python how do i append from multiple string lists i don t know what are but i ll need to separate into new different lists using the semi colon as a separator in python for example if i m given the following string list i need to get the following results and append with the same logic and order when given a new string p s since there are no patterns in the list i ll be given i can t just use for the task which is what i ve tried,0,69,94 attributeerror fitsfigure object has no attribute set tick labels font i am a beginner in programming i am trying to produce two plots using aplpy and subplot and simple code the code is as following it gives me the error attributeerror fitsfigure object has no attribute set tick labels font could you please help me thanks in advance,uploading large txt files into google colab first question i am new here thing is i am trying to upload this huge file into google colab en txt text plain bytes done however its not uploading can anyone explain me or solution i want to extract the data and split it into shards,0,52,53 django manytoone reference multiple tables right now i have the following model that i d like to be used in different models i want to store the day of the week and time in different models from the docs i d have to create a foreignkey field in the above model to accommodate the manytoone reference example this doesn t sound right to me should i create different daytime model instead thanks in advance,how to add a download path to gui application in python tkinter how would i add this download path to my gui application in tkinter that i am making using python to this,0,71,33 how to collect all book categories with the help of scrapy i am new to scrapy and python and am having trouble understanding the flow from this site i am looking for how to gather all the categories of different types of books using scrapy then determine how many books are listed in each category and export the result to json format which software can i use vsc or spyder,detecting whether build ext is building a python extension with debug information i have a python package that has a cython extension in my setup py file how can i tell whether build ext or bdist wheel were supplied with the debug flag i want to link against different libraries based on the debug flag,0,71,51 how can i send a message without a command i want to send a message without command if a condition is true i wrote this code but it doesn t send any message,compatibility of datetime with cudf and pandas for filter datetime in python i want to test cudf but stuck with a first simple task of filtering by datetime code works perfect with pandas but not with cudf testdata csv looks like with cudf throws keyerror datetime,0,32,45 round all index to min in pandas datetimeindex i know about round ceil floor functions this rounds to the nearest minute interval what i want is that each is rounded to minutes in the case of round will be rounded to and to i would want both rounded to the datetime index,attributeerror nonetype object has no attribute group in googletrans i want to convert unknown language strings to english for which i m using googletrans python package that works along with an api to perform the desired task so i did following this gave what is causing the error is there any other way around to achieve the task,0,60,57 how do i import cookies from any browser preferably ie to selenium chrome driver i want to add my cookies from ie from a particular website to selenium browser by way of import imports i currently have if they are any help to you thanks in advance,how can i enable pdf page breaks from html maybe using a marker in the source html file i am using pdfkit to create a pdf from a html file like so i create the html file myself before doing this conversion what i m now trying to do is find a way to impleet a page break the html file doesn t use page breaks because well it s basic html but pdf s are page type structures so how can i pickup something in the html as a marker and then use that to implement a page break in the pdf of course pdfkit from file source target pdf is a simple single line there s no parsing of the content so i don t see how i could tell it what to look for any ideas edit with some advice from nathanial below i ve added to my css but i don t see pdfkit from file source target pdf picking it up opening the html file in the browser and printing to pdf works perfectly so this is more of a pdfkit issue found a similar question here how to insert a page break in html so wkhtmltopdf parses it i think the pdfkit wrapper for wkhtmltopdf is limited on the commnd line this works perfectly but how do i replicate that in python it s not my first choice to doa os execute,0,47,225 nameerror name sqlalchemy is not defined i ve installed sqlalchemy by adding it through project settings but am getting this error which i can t seem to figure out traceback most recent call last file users backup pycharmprojects pythonproject app py line in db sqlalchemy app nameerror name sqlalchemy is not defined app py,how to add return none if element not found in beautifulsoup i want to append respond timestamp to the list the returned value for respond timestamp may be empty then i use try except and append none but none doesn t add to the list because count of the list is important what should i do,0,45,51 exception sdl unable to load image when running kivy apk on android i created this very simple app just as a demo then to run it on android i converted it into an apk with buildozer the conversion was successful but when i tried running my app it crashed i tried to debug it with adb logcat and got this error i have no clue why this is happening can someone help me,how to use a class to store variables that are updated in different functions and then call these updated variables in different functions i am solving a problem which involves traversing a n x m matrix in a zigzag fashion where n and m can be same number or different numbers i e we will have a square or rectangular matrix to solve this problem i have a main method which will traverse the matrix and within this main method i create and call on movediagonallyupwards and movediagonallydownwards methods to move in the zigzag way the problem i am having is that when i pass row and col as arguments from the main method into these two other methods and inside these methods i update row and col e g or these changes do not reflect in the main method when i return to the main method and i do understand why this is the case so my challenge is how can i pass back the updated row and col to the main method i thought of using a global class to achieve the above my idea is to create a separate class to hold these variables like the below but i am having problems with calling and using these global row and col in my main method any ideas how to adjust the row and col in main method to achieve the above thanks,0,74,236 reading multiple txt files from multiple folders i have folders each containing txt files i need to read all of them in order to compare the word counts of each folder i know how to read multiple files in one folder but it is slow is there a more efficient way instead of reading the folder one by one like below,compare the values of two columns of different length in two different dataframes and perform a math operation if matches a condition i have two different dataframes of different length but have two columns in common i need to perform a math operation let say multiply the float value in value column of st dataframe with value in number column in nd dataframe if the condition matches with same id and class eg in st dataframe if id is and class is a then the value must be multiplied with the value in nd dataframe whose id is and class is a likewise for each id and class of two dataframes matches the value in value column should be multiplied with value in number column i tried by df assign function df assign value df value df number loc df id df id df class df class got the error valueerror can only compare identically labeled series objects what went wrong or any other solution for this thanks in advance,0,63,165 finding the length of a portion of a csv file in python i m trying to get the average of part of a column in a csv file but i haven t been able to find the length i noticed that when i run len it s counting the amount of characters and not the length from len should be note this is for a class and will not be using pandas,pyrogram get all members in a channel with more than members i have a channel with more than members and i m trying to get all of them i know that iter chat members has the limit of members so i m calling get chat members multiple times by increasing the offset like this however i continue to get only the first members when members offset is greater or equal to i get zero members from get chat members is there a way to get all members from a channel with more than members using multiple calls thanks,0,71,96 python django struggling to create a dynamic list i want to create a section on my site where for each subject links to corresponding past papers can be found but i am struggling to get any output looking for ideas my views py my models py my html content,how to get value of variable from inside of class in python so im writing some simple code in python pygame just to learn i encountered problem when i want to check collisions of ball whether it is the same as y possition of my pallete the main problem is that the value of variable of my pallete is updating by the user and it sits inside class pallete in function move how can i get it out and put it outside class into function holding ball,0,47,87 find a column value that has transacted in all distinct column values i have to find all values in column that have transacted in all distinct values in column for ex from the above table we can identify the fruitseller a sells all the fruits,how do i create this function correctly i have defined a function string adder that receives two arguments and returns a concatenated version of both arguments however when i run the code i get this error message function string adder at x cf bb any advice on what i m doing wrong,0,45,47 how to access items from ndarray with dtype object how can i access data inside a numpy array with dtype object the following raises an indexerror,why is this variable changing i m writing a chess interface for fun with my friend the eventuality being we both make bots and fight them out i ve met a roadblock when i re evaluate the moves that are legal to look for checks as they should be illegal moves the actual code for the interface is a couple thousand lines long but i ve simplified the code to show the problem i ll post the simplified code in which i can replicate the problem and then the key parts which i think cause the problem the simplified code and the key parts are and the issue is that the variable self black pawns inf changes in the function where it occurs once excluding print statements in which black pawns is set to it it makes no sense to me that this variable changes the isolated area of code where the variable changes is in the first key part as i have shown above i print the variable before and after and it changes even though the lines of code that supposedly change it do not even include this variable i assume i am missing something in python that it creates a link between variables that are set to each other and somehow by changing one it also changes the other below i will show the output when the program is run for the first iteration of for notation val in a a b b c c d d e e f f g g h h in which the change occurs as you can see the first list in each list changes becomes and true becomes false this is expected for the variable black pawns but also happens for the variable self black pawns inf i ve tried to explain the problem as best i can any help would be appreciated thanks,0,24,304 iterating list to create df i have a variable class list that comes from a post request api in graphql that looks like this how can i iterate thru this list and create a dataframe that looks like this i need to create the df like this because i will merge with another df also i m curious what s the need of this list organization like a list of lists list of dict thanks in advance,telebot how to take a massage in input here i don t know how to take a message in input here,0,75,20 conan package manager and cmakepresets json is it possible i ve just started using conan package manager do you know is it possible to somehow call cmake with presets from conanfile py the current implementation is the following i ve managed to call cmakepresets json by the following code but it seems hacky i don t like it thank you in advance,how to store multiple results from a function in a for loop as unique variables in python i have a function that returns different values based on different inputs i want it to go through a list spitting out results for each input but then i don t know how to store each of those results as a unique variable here s an example of the list the function returns a different integer depending on the input i m going through the list with a for loop like so the function in the loop runs for each item in the list and returns a unique integer for each but how do i store each of the returned values as their own variable i ve tried this but it overwrites the variable each time and only leaves me with the last one in the loop is there some way to dynamically change that variable in each run through the loop,0,57,155 this python code for quadratic equation isn t working i m trying to get the userinput for a b c using a function and it doesn t seems to work,how do i update tkinter label i m trying to update the tkinter label on click of the button doesn t work when i click the button here s the code what am i doing wrong thanks for help,0,25,37 python how to include r in print output how can i format my string such that r is included in the output rather than being interpreted as a carriage return i am building a long string with formatting entities in it like n and t hence i want to preserve the printing output that i get with the below,datetime as a parameter of stored procedure i have this code snippet with a stored procedure read records from to the stored procedure takes to parameters from datetime and to datetime i d like to assign it values taken from fromtoform how can i do this i tried according to this answer but it ended with error,0,59,51 pandas merge overwriting lists in column how do i prevent mutation in the list upon merge as later i want to concatenate the images on both columns many thanks,cnn training out of ram cause by big dataset i have a big image dataset of around images my system is out of ram when i train the model i don t want to downsample the dataset is there any way i can fix this issue i know there is a way like i can send images part by part to the model but i don t know how to do that or is there any better way to do this,0,29,81 how to identify a qgraphicsitem i want to know if there s a way of getting a qgraphicsitem s id nothing complicated lets say i have a qgraphicsscene and i created a lot of rectangles of the same size and color in it even if not with ids than how can i identify them update here s some of my code thanks in advance,pandas running total depending on other columns i have a df i need to have a running count by id depending on the two date columns like so the big difficulty i am having is making sure to count rows where the end date in the previous row is less than the start date of the next row i am counting completed transactions that are before a start date i haven t tried any code yet because i m not even sure how to tackle the problem,0,61,86 scraping the shoe sizes with bs i am trying to scrape the shoes sizes of this shoe how can i scrape the value,pytorch lightning tensorboard logger automatically adds epoch scalar as in how do you prevent the tensorboard logger in pytorch lightning from logging the current epoch pytorch lightning lightning trainer with a lightningdatamodule and lightningmodule automatically logs a scalar with name epoch showing the number of epochs even if never told to do so how do i remove control that behavior,0,23,60 how to setting the speech rate in azure text to speech hello i am trying to configure the speech rate using python with the text to speech services i need the parameter statement,pvporcupine error porcupine pvporcupine create keywords jarvis alexa typeerror create missing required positional argument access key this code for a hotword for jarvis has an error here s the error i get how can i resolve this error,0,33,33 find nd minimum along second axis in a d numpy array i have a numpy array like this i want second minimum from every array present in the d array like this,how can i pass the press of a character to a function python tkinter the function must accept three variables i dont know how to pass the button click,0,32,29 changing an double array field to a single array in hive or pyspark i have a field interest product id which looks something like below the schema is as below as the field interest product id is of array type and also the element is array string the field shows how can i convert it to a array string expected outcome please suggest the best way thanks,how to export discord server bans into a txt file discord py im trying to make a savebans command to export all the banned users into a txt file what ive tried is im sorry if this is a stupid question i am new to discord py and python i switched from c coding so thanks for any help,0,65,57 is it possible to add this kind of default value to caesar cypher python here is a basic function call i would like to do as you can see below in the signature i would like to have the default value in s be the length of the string passed in for convenience is it possible to do this in python or some version of this,opening app through python causes error sql error i am trying to automate logging into a desktop application via python so far no matter how i rewrite startup code it results in the sql error it works without issue when i click the shortcut and even when i launch the exe in command prompt i have tried i have even tried launching a bat that then launches amtech exe that still results in error when i click the login button what else can i try,0,66,86 how can i remove a json element from a list without removing the whole list this is my json file dates here is my code after i saved the date variable in my list i want to remove it from the json file e g i only want to remove from the json file how can i do this,why is python importing scipy even though i haven t asked it to i have a file constants py from which i want to import a constant seed when i run i get i would understand this if my file was called scipy optimize highs constants py but constants py is in my local dir also why is python looking several layers deep in scipy how is it getting from constants import seed and from scipuy optimize highs constants import seed mixed up i am running code on the rapids paperspace gradient image my sys path,0,63,85 how can i save some information that i got in views to one of fields in models django this is my views py i want save type in device field in model and this is my models py this is my forms py,why is the result value of a generator function using the yield keyword different i am curious as to why the result values of the two conditions are different with the generator function using the yield below,0,42,37 improvements in the v pokemon battle game i m trying to create a mini pokemon battle game with some pokemons their movesets and their stats it was going smooth until a weird error occured in creating the pokemon s typechart line no to here s the code can anyone please help also i ll be glad to have some suggestions and improvements in this code,filtering rows that have unique value in a column using pandas i have a df i am trying to keep only rows that have unique value in column value so that the result df looks like this i dropped id because it has more than unique value in column value respectively i read this answer but this simply removes duplicates whereas i want to check if a given column in this case column value has more than unique value i tried but this returns nan for every row since i am trying to fit n returns on n m rows after grouping i can write a function and apply it to every row but i was wondering if there is a smart quick filter that achieves my goal,0,70,139 pandas multi index loc i have a pandas dataframe for graph edges with a multi index as such however doing a simple loc fails with the message keyerror why does it fail the index clearly shows that the tuple is in it and in the docs i see loc being used similarly edit apparently df loc works go figure it was probably interpreting the first iterable as separate keys,reading filter query set in django framework i m very new to django i m trying to return the sum of total revenue attained by selling cars with respect to a particular site in django i have tried the annotate method to fetch the results i have written a query set using annotate this returns me a filter object users filters cars showroom filter object at x abba a and i m unable to read it i tried using qs count but it returns me the entire query set list can some one help me with a way to read this particular query set value,0,72,98 django ignoring updates to urls py the urls py file in my dango project is being ignored for example i tried commenting out the admin urls from the project and i could still use the admin i tried adding a name space and django says it doesn t exist mysite urls py wallet urls py please help,aws textract multipage pdf only extract st page for form and table extraction i am using aws textract for form and table extraction using following code for some pdf it extracts forms from all the pages but for some pdf is extracts only first page while using the textract user interface it extracts all the pages what could be the reason for this i am using following code which is available on aws edited it looks like its related to response size the size is almost fixed can anyone help me with this,0,50,95 runtime error when using pytorch convolutional model i m trying to develop a covid classification model the images dataset i used is of shape torch size when trying to run my model i m getting this runtime error message as shown in the image any help to understand and fix the issue please this is the code,formatting text to the tkinter progressbar i got to know about adding the text to the progress bar as per this question displaying percentage in ttk progressbar it helps me but i need a few more adjustments to do to the answer i need the text the percentage to appear on the left side of the progressbar for this i added side left to the layout format for horizontal tprogressbar label as under however this moves the text to extreme left it overlaps the progressbar border and is not clearly readable,0,56,88 creating a new column in pyspark by selecting specific values which are not null in pyspark i aim to create a new column in which i select a column value out of columns which is not null from i have attempted with the following code but that does not quite work does anybody have a better solution,copy csv file from local machine to remtoe server with serial column i need to copy the file into a table from local to remote the problem is the table has a serial id column the not in the file when i m trying to copy the table is missing a column and i m getting an error because the data types are not matching this is the table this is the code i also tried this command this is how a line in the file look like this is the errer,0,59,90 replace all occurrences in a string by another string i have this string i m trying to replace all p n x by x n for example would return,replace occurences of a numpy array in another numpy array with a value i have a d numpy array i also have a second d array i want to replace all occurences of the elements of the second array with so eventually my second array should look like is there a way in python numpy i can do this without using a loop i already checked at np where but the condition there is only for example where element value and not multiple thanks a lot,0,25,88 search substring in list of dictionaries of namedtuples keyed with an event type i have created a list of dictionaries of named tuples keyed with an event type what would be the most pythonic method to return print results that only contain approved or reviewed and approved,save the created by updated by and deleted by information i am trying to save the information in each of my tables about the creation the update or the delete of a record currently i have the following and i m having the following error how can i make sure this error does not happen is it a good practice to do such a thing,0,46,64 type error with operations with dates datetime package i have this code i get this error typeerror unsupported operand type s for or pow float and datetime timedelta i m interested in the number of the days not with the hours,group list of dicts by two params and count grouped values i have list of dicts with id numbers i need to group it by main id and second id and count values in each group what is the best python way to reach this i m tried with pandas but don t get dict with groups and counts list looks like i need result like,0,39,62 no start line crypto pem pem lib c expecting certificate request full code below full output below i tried to open the certificate file called certificate pem with openssl req text in certificate pem commands but it shooted the error that i wrote at output this error didnt happen when i built certificate with x certificatesigningrequestbuilder but i get an error when i try to build a self signed certificate with x certificatebuilder thanks for all help,what does the f value do i was solving roman to integer problem and i came across it this is the code the second line doesn t make much sense to me can anyone please help,0,66,34 how to display image writing an html code in jupyter notebook enter image description herewhere am i going wrong i want to view output the stack overflow image from ipython core display import html display display html img src stackoverflow jpg alt stackoverflow com width height result is a broken image icon,i want to add a new customer to the customers library dict and to save it in the dict so when i want to add another it ll add and not replace them this is the code i used in the librarycustomers py module this is the code i used in the main py adding a new customer based on the input every time i run this code it doesn t add the new customer to the customers dict in the main py,0,46,78 wed scraping with beautifulsoup not returning values hi i m very new to scraping been trying to do a project have been following the instruction managed to pass the error by using user agent etc which eventually gave me code but the code from the start is not returning a value for the productlist i cant figure out why as i cant see any error in the code any help would be much appreciated,widgets are not clickeable qt designer i ve been trying to make gui but my biggest problem right now is that any of the buttons are clickable even if i code an action for them and as you can see in this picture i can t select numbers in the spin boxes either,0,78,51 deleting all labels from grid square in tkinter without knowing labels in first place so i would like something along the lines of what this code looks like it should do but grid isn t defined,how to plot the rotation of a curve along the x axis with matplotlib in python i would like to plot the line x y rotated around the x axis for a project i am working on i have used matplotlib to graph some d planes before but am unable to figure out how i would draw the revolution of a line around the x axis i m thinking i would have to use ax plot surface but am not quite sure how thanks,0,35,81 plotting a barchart which should be sorted by their rank using particular column for all categories from other column someone please help to make related code in python using seaborn matplotlib libraries example table like below,error the pycuda distribution was not found and is required by the application what is causing this error,0,35,18 edit dict in string i want to edit string data i want to replace with every id in and want output to be i tried with format but it is not working,how to make function as a list and store it in variable this is my code so how i can store the above function in the list so that i can store a list in one variable output may be something like this i want output above format can anyone help me please to solve this problem thank you,0,33,59 invalid literal for int with base in my views after it worked a while i m keep getting this error invalid literal for int with base from the views in my django project after it worked for a while here is my views py looks like and here all the message models py please help me i m beginner in django,efficient bulk loading options for elasticsearch in python i am trying to ingest a large amount of data into elasticsearch using python for this purpose i am using the bulk api helper and i have developed a function that looks something like this this is the part where the actual ingestion takes place now each of my documents contain quite a large amount of data i have a couple of fields which are big strings and i have noticed that this ingestion process is quite slow i am ingesting the data in chunks and it takes a little more than a minute to index documents is there a more efficient way to do this i am trying to make the process faster,0,59,123 discord py how to make the bot leave voice channel after the mp file is finished discord py how to make the bot leave voice channel after the mp file is finished,trying to do telemetrics on openstack using ceilometer in python as a project i need to do some telemetrics with ceilometer on openstack i was given an old piece of code as a reference how the newer version should look like using what little knowledge of python and openstack i have and spending hours on openstack documentation i wrote the following code for some reason when i try to run this code my virtual machine running it says that projects is an unknown attribute what is a newer way of showing all projects in openstack is there anything else wrong with the code,0,32,103 problem getting stocks prices from yahoo finance i m doing some web scraping from yahoo finance nvidia stocks and i m wondering why when i run my code i get always the same value but in my browser when i refresh the page i get differents values as it should be how can i fix it,i either don t understand multiprocessing in python or flask sqlalchemy some time ago i wrote a flask application in python which spawns a new thread that does some processing then updates the application db sqlite on a regular basis the function i use to update the db is quite simple this worked quite well my thread has spawned several other threads each of these calling the update db function above which updated the db correctly now i changed my code because i wanted to make use of a process instead of a thread which would then again spawn those other threads so i did nothing more than simply inherit my class from python multiprocessing process instead of threading thread this child process now does all the work and still correctly very well but what i don t understand is why my db updates still work as before even though i have not changed the logic shown above the global variables flask app and database are set in my main application process before the new process is being started then in this new process i still call the global function update db as above and that still works first how can another process access these two global variables they are not passed from the main process to the child process the latter simply accesses them without any change in code since they are global objects in the python script moreover how can the child process access and update the db if both flask app and database objects have been created in the main process and again never been passed to the child process,0,54,267 how to handle duplicated or blank columns and add number in duplicated ones in python dataframe dataframe has columns with repeated dates and empty columns i tried objective to add any string value like a jan repeated column and blank columns renamed as a b so on output required in tabular form for further processing and storage,figuring out if all data in a pandas dataframe row is the same except for a particular column i was able with the help of so to get this working the above code essentially takes a column and checks if all the cell values of the dataframe in that column except the one specified by the input string are and if so it makes that one set to as well how do i do this for a row instead,0,57,80 find numpy array with don t cares in a numpy array i would like to find a numpy array with don t cares like where is the don t care and find it in arrays like and return the row index s and for the above sample the a array are normally around rows shape note the b array can have don t cares any where or none examples,creating requirements txt in gitlab probably a silly question but i am trying to set up a project in gitlab that is going to be used for deployment of an ml model for which i will use fastapi i m very new to this and will try to provide as much info as possible i created the project in gitlab which right now only contains a readme md file the actual python code is stored in a folder on my computer myproject which contains two folders each of which containing some data py scripts and a notebook to set up requirements txt i tried to create a virtual environment in windows now when i open the myproject folder it contains those two folders with code and the virtual enviroment which also contains lib scripts pyvenv cfg the latter contains i also cloned the gitlab repo but on my computer it is saved somewhere else in c users me i know that i need to do but i don t understand how to actually add this requirements file all of the packages and libraries that i needed for my ml model were installed a long time ago with anaconda before i created this virtual environment have i done anything wrong,0,69,201 pandas split column by some specific words and keep this delimiter i want to split the column by some specific words and keep the delimiter in the same time i tried to split the column with str split but the result isn t i want example data test csv my code my result desired result how can i do this,in keras how to control the number of mini batches drawn during one epoch i read keras s official manual and a few examples such as this one i understand that we can specify the size of a mini batch using the batch size parameter and specify the number of epochs using the epochs parameter but how can we decide how many mini batches are there within one epoch in scikit learn there are a few options to indirectly control this such as max iter tol etc but i failed to find something similar in keras,0,56,89 md analysis using python i am trying to run this python traj orientation group py g fniii ps nchain t nw gro x fniii ps nchain t nw xtc o fniii ps nchain run phrsn orientation protein res start protein res stop group for md analysis and i got this following below usage traj orientation group py h g grofile x xtcfile o outfile protein res start protein res start protein res stop protein res stop group group group traj orientation group py error unrecognized arguments group can you help on this,how to make couple for elements from two list different size in python i need to make couple for elements from two lists two lists are different size ex result thanks for support,0,68,33 extracting value with beautifulsoup get text problem i am trying to extract a single value from the code below my code is i expect but somehow i get strange output what i am doing wrong here,handing error index is out of bounds for axis with size within a function gives what i am trying to do is searching within the df with certain criteria to find the country but i got this error returned from the function if values are not in the df if non existing name or grade passed to the function this will throw i tried to return none if the con is not true but i did not work how can i avoid this error if non existing values passed to the getcon function,0,37,96 block replace coded numpy d array i have a numpy array that is built with coded sections the sections come in x blocks i have a large dictionary of what those x blocks should be replaced with how do i replace those x codes with values in the dictionary,having trouble encoding dataset array dataset i ve been trying to deploy the ensemble method from sklearn to a small dataset i have linked above for some reason i keep receiving this error this is the code any help and or suggestions on getting encoder to work so i can use the ensemble method,0,49,53 how to handle subprocess run error exception how do i handle a subprocess run error in python for example i want to run cd userinput with subprocess run what if the user types in a directory name which does not exist how do i handle this type of error,combine values from two columns in a dataframe and get the count of each i have a dataframe with two columns and each column has values i want to combine all values from the two columns print them and count how many times each value appeared for example column fruits has values these values apple orange banana grapes mango column fruits has values these values apricot avocado blackberries grapes mango now i want to combine values from both the columns and print all values and also want count how many times each appeared expected result print count against each value like this,0,46,111 python filter items in two lists matching given pattern having the lists in my python code use case as a user i want to loop through items in listiterationdata and find matching items in both listone and listtwo that ends with listiterationdata i items in listiterationdata would function as matching patterns in listone and listtwo something like the following would be my expected results many thanks for your help,plotly dash output a specific number of checkboxes from slider input i m trying to output a specific number of checkboxes in plotly dash based on input from a slider the aim is that a user will select a certain variable from a dropdown box and a value from a slider which will then return a specific number of checkboxes based on the slider showing the variable s values at the moment the code works fine for one checkbox but i can t seem to find a way to loop through list of components in a div and when i output more than one checkbox i receive a callback error stating the expected length was and received a greater value instead my current code is thank you in advance solution,0,70,129 python django struggling to create a dynamic list i want to create a section on my site where for each subject links to corresponding past papers can be found but i am struggling to get any output looking for ideas my views py my models py my html content,sqlite icu for windows i know questions like this have been asked a lot and trust me in the past several weeks i have read everything i could find but i cannot find a way to use the sqlite icu extension for python on windows it works flawlessly on linux like a lot of the things i tried i obviously tried installing tru pip and that failed i tried different python and pip versions and that failed so i looked up into the error and the setup py of the pip package and found out it fails bc i don t have pkg config on my machine that is all fine but i don t know shit about libraries on windows on linux it is easy you just apt install what you need and when you need to compile something it just works i tried manually compiling the extension on windows and i got a dll file actually one using cygwin and one with msys but when i try to load them in python i get an error sqlite operationalerror the specified procedure could not be found btw compiling it using gcc on linux and then loading the so on my linux machine works flawlessly i think like with a lot of python extensions coded in c i should compile it using msvc but i cannot find a way to make that work if anybody knows how to do it pls help me or if you have compiled it before pls share the dll file with me at this point i am so desperate i would literally load any dll file you give me as long as it works thank you to anybody who read thru and even more to anybody chimes in,0,47,287 how to calculate molecular weight of a molecule in python efficiently with less memory consumption here is my code to calculate molecular weight h o no co hcooh using predefined values of elements in a dictionary in the above else statement there is an extra step of subtracting the total from existing mass of element if a number is encountered after a letter how can i eliminate this extra check,get youtube video link in python i need to make sure that i enter a word in the console and a link to the video should be displayed for me for example if i mean the word linkin park in the console it should give me a link to the first video for this request in my example the first link is numb official music video linkin park how can i do this,0,68,74 no text file created in vs code i have tried creating a text file on vs code using w mode but was not able to create one when i tried doing it on pycharm it worked here s my code,send post request with javascript i have this working api in python how can i re build the same thing in javascript if it s not possible how can i send this post request from the font end,0,39,35 why does python generator result like this here s the code the result is that res false and res false apparently the result for res is incorrect when i comment out the for loop print res true and res false which is correct i m confused can someone explain why,not sure why i m stuck in a python stuck recursion loop the add and mul definitions here are nonsensical because of their dependence on returning self causing infinite loops if they create a new distribution using the lambdas then it works fine as in my own answer below i m just playing around with classes and overriding trying to build a small statistics tool however when i run this code i get stuck in a recursion loop inside the mul call which is being run in the n pdf call and i cannot figure out why i think it has something to do with python lazily executing the mul instead of doing what i kind of wanted let s say in the language of cs which was to create a new pointer to the old function call for pdf that is owned by the new pointer to pdf and then to set the old pointer the main pdf pointer to the new function i think this is quite poorly worded so edits extremely welcome if you understand what i m asking p s i know that it is no longer a pdf after being multiplied by this is not an issue,0,44,197 get on optionmenu tkinter python how can i get the get to get the value at the moment of the click on the button the value printed always stays the one i ve set by default,import csv adding a header with pandas i m importing a csv without a header and i m trying to tweak my script so that a header is included during load in addition to including the header can i define the field types the layout of the file i m importing header and types any ideas for implementation,0,37,55 why does playwright not change url once button is clicked on uber eats essantially i want to enter an address into uber eats and go on to the next page however i have noticed that the url isn t actually changing once the button is clicked i have tried doing the same thing by specifically targeting the find food button on the landing page for some reason this doesn t actually change the page help would be appreciated thank you,splitting the total time in seconds and fill the rows of a column value in second frame i have an dataframe look like start time and stop time are in seconds followed by milliseconds and my expected output to be like i dont know how to approach this forward filling may fill nan values but i need the total time seconds to be divided and saved as second frame in accordance with respective labels i dont have any code snippet to go forward all i did is saving it in a dataframe as df pd dataframe data columns labels start time stop time thank you and i really appreciate the help,0,78,107 python def function with error exceptions does not work correctly i defined a function and it s not working correctly it should raise a typeerror exception when type is not int or float and a valueerror exception if value if i use eg n as ppb python tells me and when i use a negative value for ppb it works i m not sure if this is correct too i hope you understand my issues,effectively save instance attribute with nested multiprocessing pools processes i have two custom python classes the first one has a method to make some calculations using pool and create a new instance attribute and the second one is used to aggregate two objects of the first class and has a method with which i want to send said calculations also in parallel in the two first class objects and correctly save their new instance attributes dummy code the problem is that as i have found out during my extensive research about the problem multiprocessing process creates copies of the namespace in which the processes work and the values aren t returned to the main namespace setting the process daemon to true produces an error because daemonic processes aren t allowed to have children which is the same thing that happens if i exchange the processes by an additional pool using multiprocess instead of multiprocessing or concurrent futures doesn t seem to work either additionally i don t understand how multiprocessing queue works and i m not sure if it could be applied here i have read somewhere that it could be used i would like to do what i am trying to do without having to pass a shared memory object to the processes to write the new attribute into it and then apply it to the states in the main namespace i hope someone can point me towards the solution even if i have not provided a working code reproducible example,0,74,238 formatting a dictionary with pandas python how would i be able to rearrange the values of dictionary a so that it turns into the format of a all the columns values will be turned into keys with their corresponding values how would i be able to get the expected output below code expected output,how do i get the previous second folder or the folder with a certian name i want to get a certain folder the name of this is certainname or it is two folder previous what i got what i want,0,54,40 opencv pytorch prediction error with onnx model my codes are here i made a model for the prediction of cell and converted it to onnx then load with opencv to predicted with opencv but went somethings wrong,how to select different option regardless of randomized variable the question might be a little misleading as there are no exact words to express my query shortly what i want to do is make a random variable and according to it pick one name from let s say options then pick another name from the same pool of options however without being the same as the first name for example if i have students john mary doug brandon and ava and i want to choose between two of them but not pick the same student twice here is how i proceeded to choose the first variable using random randint function note value names are just an example now for the second value i have had some ideas however i don t know how to complete it any help is appreciated have a great day p s as far as i know there are no other similar questions or at least i couldn t find any if there are please redirect me there,0,37,169 start and end indices of the matched strings after comparison i am trying to create two lists containing the start and end indices of a string in this case two strings are of equal lengths for example here matched lengths are gg cg cg i want the following kind of outputs now my chunk of codes looks like the following one but i want the indices to locate the matched sequences,how do you iterate through files in a list i have a list of file pathnames and i want to iterate through this list opening each file and extracting certain data points from it however when i run the code it doesn t open the file it just takes the nth character from the file pathname and adds it to the target list instead of the value from the file that i want what have i missed to make it so that it doesn t actually open the files,0,71,87 how to filter streams values i am using pytube to download videos but running the code i get a stream object similar to this how can i filter only p resolution or a specific fps,is there a way to plot multiple lines using hvplot line from an xarray array i have multiple ytraces data in an xarray array data trace selection can be done by the above creates a line plot with a widget slider that allows scrolling through the lines with single line displayed at a time i would like to be able to plot all lines without creating the slider widget hvplot documentation is sparse as to how to do that,0,35,77 how to fix this issue typeerror object has no attribute value in connectivity i can t able to insert values in ssms geting error,flatten json dataframe in python i have made an api request and i am receiving the json in the nested format below along with what i expected i dont often have to flatten json data when i do i just use json normalize i have tried to use json normalize but it hasnt had any effect this time any help would be much appreciated just to clarify once i have made the request the json data is going into a dataframe the fields should become columns the end result is table that has the columns id field field etc,0,24,99 how do i specify a file type filter in plyer so that the user is only allowed to select files with certain extenions i am looking for something like filters extension i tried this but it does not work i can still select files with extensions other than jpeg and jpg,python for loop isnt recognising int inside a list i am trying to change the contents of a list changing every for a and for a however i struggle to find why my code does not change the digits as intended or even recognizes them the shortened contents of log txt are as follows,0,52,57 python create file from list add empty line to the end i have to create the cvs file from the list here is the code i can understand n breaks the line but when i open the file i see last line is empty this is how content looks like is there any way i can remove last empty line found the way to fix this but wanted to check if this is the right way,how to click on a specific onclick valueusing selenium and python what can i do to replace find element css selector in selenium python to click on a specific onclick value the browser is google chrome,0,76,33 two different graph ticks parameters on y axes from one table considering below table my question how can i modify the right side y axis ticks parameters to price red so that it represents the numbers of price column as well as the title,how do i generate multiple random lists for a portion of a larger list in python i keep getting duplicate lists started working with python today and decided to test my learnings on a small project i want to have a roster of lets say people from this roster i want there to be x number of teams of y depending on how many people want to play i know how to write this if we assume all names in the roster are going to be used but where i m lost is how to generate unique teams for a composition of something like teams of whenever i try to solve this i will get of the same teams of here is an example of the code i m attempting right now if my input variables were and i would get something returning like how can i change this to get random results closer to this,0,44,161 need to split a column but only removing the character good morning below the first rows of my df and my code when i try to split by the to remove the strong tag from the link split only removes the character split returns a keyerror any ideas how to get this to work first desired link,how can i queue a wav file in pygame mixer and then play that file in a loop i cannot use time sleep or any loops because of gui blocking i m currently having trouble with pygame s mixer i am trying to queue a file ex wav to play in pygame for an app that i m trying to make i want to loop ex wav after the previous audio files ex wav have played but i cannot use a while or for loop because i am using guizero which cannot have loops because it blocks the gui maybe a code example is a bit easier to understand what i m trying to get across this does not achieve this i ve tried i want to make it so that ex wav is not played and looped until after ex wav is done like i said i cannot use while or for loops due to gui blocking and i also cannot use time sleep or any other wait commands for the same reason if there isn t an easily made solution for this i understand,0,60,173 mac m pip how to solve error building wheel for h py i am getting this error when trying to install h py on my mac error command usr bin clang failed with exit code error failed building wheel for h py python and hdf were installed with homebrew some more info,aligning html divs of text next to each other in plotly dash i am trying to place div elements side by side without luck i have been following and guides on using width and display inline block but without luck if you look at attached pictures it looks like the block that is supposed to go to the right actually does until i update the page by choosing a song in the list to show the lyrics on the left then it pushes the recommendations to the bottom any ideas my code looks like this edited code would look like this since the bottom style is connected to the parent div above recommendations as far as i can tell,0,48,121 recursive sequentially powerset function in python what i expect for but my function give this result i can not fix it and in some situation i want to stop calculation and continue with others let say if and get come together dont continue anymore for and what i expect iterative function is also good for me,selenium not finding xpath button element on twitter this is the path i am using to find the button on twitters website but selenium always returns this error am i doing something wrong or is their another way to select the button element for selenium to click on does twitter have a way of making their html unfindable to selenium p s it is also not as simple as selecting the class or span i have tried those and the same issue arises i have gotten this to work so i am confused if i do the same thing with the nextbut it still doesn t work with the correct xpath here is full code for problem doesn t seem to want to work to find said element but when i do python i main py and do it interactively it finds the element,0,65,140 substract pandas dataframes with different indices i have two pandas dataframes which i would like to substract the base dataframe minuend has more indices and columns than the other dataframe subtrahend they are defined as following the expected result is what is the best way to achive this since minuend subtrahend or minuend sub subtrahend df does not work out of the box,split up duration while upsampling dataframe how do i split up a duration while upsampleing a dataframe as in the example below and can i replace the for loop with e g the group by function i want to use pandas to transform data like this into this and i get this far,0,61,51 want to check certain values are present in the excel sheet with python i have an excel sheet and i want to check if particular value is there the code is but the output is displaying failed everytime i want to check if adm yourstore com is there or not can anyone help,cannot install libpulse dev in ubuntu i like to use pocketsphinx speech recognition engine for that libpulse dev is one of the dependencies however i cannot install libpulse dev in my system i used the following command to install the package sudo apt get install libpulse dev and i get the following output what should i do thank you in advance,0,50,56 dimension error when using model predict in keras my train set has columns including a target column that i m trying to predict while my test set dataframe test has columns when i run the code i receive this error my model looks like this,how to unescape non ascii string in python i want to unescape string like n and get as the result n i tried often recommended unicode escape but it doesn t work as it it doesn t handle anything but latin is there a good way other than to manually scan for sequences like n,0,44,51 one column lost after using simpleimputer i used simpleimputer on some dataframe the no of columns in the imputed dataframe is less than the original dataframe cat cols is a list of categorical columns of dataframe x valid and has elements i e original dataframe has rows columns imputed dataframe has rows columns,dataframe to sql db if table exists the below snippet will write dataframe to sql db what it does is it writes the data from dataframe to sql if a table already exists if suppose a table is not created in a db then it creates the table with tablename which is specified and then it is writing to db but i need to write records only when the table already exists in a database how to do that please help me,0,57,83 how do we find specified numbers in a random generated list in python i have created a random list here how do i get numbers that smaller thn desired decimal number like and add them to another list,how to release memory from tf graphs when using tfrecorddataset sorry if there are any mistakes in this question i come from a pytorch background but i need to use tfrecorddataset in order to read from tfrecord s currently this looks like the following however i need to create multiple tfrecordreader s per pytorch worker to do batch balancing this results in me having tfrecorddataset buckets to balance with per worker per gpu so i end up with tfrecorddataset in memory i have enough cpu memory to do this but the issue is that the memory is not being released from the tfrecorddataset as the memory is increasing consistently over the course of training i believe the issue is that the computation graph keeps being grown every time a new tfrecord is read a new tfrecorddataset is created for it but is never released how can i make sure that the memory used by the tfrecorddataset is released after i finish iterating through a single tfrecord i tried however i get an error that i would really appreciate any advice on how to make sure the memory does not keep growing i am using tensorflow for reference,0,42,205 resize ipython display audio bar is there a way to resize the audio display bar in jupyter notebooks for example if i wanted the bar to be twice the width of its default this would help scrubbing given a longer audio duration we want to extend the size of the grey display to be the length of the red line drawn is this possible with ipython display audio or is there an alternative library that can do this thank you for your help,choosing how many x axis labels display on an altair chart in python i have an altair chart where i am using mark rectangle i want to choose how many x axis labels are displayed to have the marks form squares in the visualization or perhaps i want to choose the range of the x axis labels right now there are far too many labels being displayed below i have an example of what i am trying to achieve and what my current output chart is i apologize if the issue is due to something else i am currently figuring out altair my code currently what i am trying to achieve my current output,0,79,113 how to solve requests exceptions connectionerror in get request python when i run get word function i will get this error requests exceptions connectionerror connection aborted remotedisconnected remote end closed connection without response please answer this problem,is there a way to unmerge google sheets cells with gspread or some other python library gspread has this method for merging cells but i don t find anything for unmerging i see there s a way to do this in javascript though but my project is in python so i would really like to stick to it,0,32,56 object of type inputmediadocument is not json serializable i tried to send file over telegram bot query edit message text inputmediadocument typeerror object of type inputmediadocument is not json serializable,value is not updated in the if statement i know this is a silly question but i would like to know why dictx is not being updated the functions returns dictx value ignoring the if block thanks,0,26,37 inputs at the same time can t be read i am just starting with python when doing a tutorial i did exactly what the guy said and in the beginning it worked but then it didn t anymore it is as if the first line becomes the input of the second input if i run each input line seperately it works though i m working on vsc,add hours to workday in python i need the following script to compute the working hours from am to pm so that if i add hours it will be added from am the next day example if it is now pm and i add hours and the working day ends at pm the output would be hours and hs so far the script computes hours regardless of the labor restriction,0,65,89 pandas pivot table gives keyerror i m fairly new to python and completely new to pandas i have software usage data in a tab separated txt file like this the dataframe is imported correctly and groupby methods like this work all right however when i m trying to create a pivot table with this line i get where the key is the first ip value which should not be used as a key at all what am i doing wrong,trying to make a blackjack game kind of summarize the problem i am trying to make a simple blackjack program that picks two numbers for the dealer and two numbers for the player also i want to make a loop that checks if the player is hitting or staying based on what they input hit or stay if they hit i want it to add a card to the player deck and give them the option to hit or stay again if they stay i want the dealer to check a set of rules and those rules are does the dealer have less than and does it have less than the player a if it does have less than and less than the player it will draw a new number and add it to the dealer hand b it will then run through the loop of checking if it has the following conditions does the dealer have and does it have more than the player a if it has any number and it has more than the player then it will print a win message does the dealer have over a if it has over then it will print a house busted message does the dealer have more than the player a if the dealer has more than the player but less than because of the previous check then it will print a house wins message so that is what i am trying to accomplish with the stay command and so far i haven t found any issues with it my hit command however will not register even if i don t type stay i m trying to debug it by having it print a message and end the loop when i type hit but it still runs through the stay commands regardless i think it could be an issue with my input converting to a string don t be too harsh on me lol i only taught myself how to code last week and started with python here is my code where i am having issues,0,77,359 loop of list into a tabbed new list i am a high school student by observing the inputted sequence i want to create a program that creates general formulas on quadratic to a polynomial with nth power equations this posted code will function as a means of validation for inputted sequences if you have a better code please help me thank you the same concept was shown below here is my code,how to find percentage after group by in pandas i want this to be in a form where i get kept broken and f p p for each amount bucket example desired output current output how do i achieve this unstack did not work,0,72,44 get request that uses more than one parameter if i build a simple fastapi instance with a get operation like this if i run the api and immediately after that i use i get correctly now i would like to do something like this how does requests get have to be written to get the desired result,errors on if an elif statements i am a beginner at python i am getting syntax errors on elif and if statements if dc dc elif b b,0,56,27 convert pt to pth i ve been trying to compile my custom trained yolov model using sagemaker neo the compilation gives an error the weights are a pt file is there a way to convert the pt file to pth,how to change values of a column boolean by other values i would like to change the boolean values of my success column in my members dataframe specifically i would like to change the true values to success and the false values to fail would you know how to do this code,0,40,53 name get ade k pairs is not defined so i m trying to make function for preprocessing dataaset in semantic segmentation but it tells me that my function is not define whereas is actually define on there my code is like this when i run that it always showing nameerror name get ade k pairs is not defined whats wrong with my definition because sometime it can get run and sometime it can t,how to create a list of named lists in python i need to create a list of named lists so that i can iterate over them this works but i m wondering if there isn t a better way the reason for doing it this way is that i have a function do some list operation l and i want to do something like rather than i ve been searching for how to build list of named lists to no avail,0,66,74 how to extract data under a tag from website using bs i need to extract version which is and date which is jul however using my code it only gives me version what am i missing to get the date text too,most efficient way to compute differences and intersection of two sets in python let s say we have two sets s and s i require three different sets based on these two sets these could be easily computed as follows is there a way to compute these sets more efficiently i imagine the different set operations have multiple internal processing steps in common so there might be redundancy,0,44,67 python datetime converter i m trying to write a python function to standardize incoming timestamps to yyyy mm ddthh mm tz offset example issue question how are others handling this type of issue in python,how do i get python dataclass initvar fields to work with typing get type hints while also using annotations when messing with python dataclasses i ran into this odd error that s pretty easy to reproduce running this gets you the following without from future import annotations it seems to work fine but in the actual code i m making use of that import in a couple different type hints is there no way to make it so that the annotations import doesn t break this,0,30,80 i am getting error while installing web module in my django project i am getting this error when i am trying to install web in my django project cant understand whats wrong if anybody knows please help i am installing it in my virtual environment meta c users saran onedrive desktop interview crypto core,simulating non linear actuator in drake i am trying to simulate a simple bar link robot with a contracting actuator with a non linear force strain curve force decreases roughly exponentially as the strain of the actuator increases i have created the sdf of the robot with a prismatic joint in place of the actuator the issue i have is that i need to actuate this joint with a force that changes based on the current position of the prismatic actuator how could i model this in drake as far as i could find the jointactuator only allows for a constant force to be applied i am trying to simulate this using pydrake,0,47,110 how do you add more than one command how do you add more than one command function to python py this is my code,heroku django virtual environment source code modification i managed to deploy my django app with mongodb as database on heroku but i need to modify some source code in django package in the virtual environment how can i access to virtual environment created by heroku from requirements txt or maybe how can i upload directly the virtual environment to heroku and make sure that my git django app is working on it thank you,0,23,74 minimizing a simple linear combination i know this is this is not a practical thing to do this question i just so i can understand what is going on but i am wondering why scipy cant minimize the following linear combination it returns the initial weights and only does iteration,pandas sort dataframe correctly with german umlauts upper lowercase and numbers i have this dataframe all strings i want to sort it so that german umlauts are correct also lowercase and numbers are correct here is my code to generate the dataframe and result the result is almost correct but the numbers are sorted in the wrong order should be before how can i fix the number sorting while maintaining all the other characteristics,0,51,75 dimension error when using model predict in keras my train set has columns including a target column that i m trying to predict while my test set dataframe test has columns when i run the code i receive this error my model looks like this,python how to transpose the count of values in one pandas data frame to multiple columns in a second data frame i have data frames df and df i want to add columns to df named group a group b and group c where each counts the number of repetitions of each group in df according to the id column so the result of df should be likes this,0,44,68 python flask duplicate flash messages i m having a problem with get flashed messages returning two flash messages i have an html form that updates the row values of a table when submitted here is the flash message i have set for it here is get flashed messages in my template file when i run my flask application this is the output i get after i press update on the form how can i stop from getting two identical flash messages,time difference with binance server i m trying to build a very simple automated tool in python to allow me to post orders on binance it s really to get the hang of python while having a goal in mind a finish line i m using this great library and of one the basic things i want to do is find out if there is a time difference between my computer time and binance server s i m using to this end the get server time method both times are returned in epoch which is ok but there is a small time difference it s not a problem for me to pass orders or to keep on with my journey but i d like to understand the reason behind it i m curious to be thorough and understanding all of the ins and outs of this here is my code and it returns a small time difference as seen here i ve tried syncing my computer clock through various ways the most famous you see on google fiddling with the time service of windows is there any reasons behind this you all could think of thanks a lot in advance,0,77,193 i would like to print all alphabet letters in the string below however i do not get an output when i run the code what am i doing wrong i would like to print all alphabet letters in the string below however i do not get an output when i run the code not even an error what am i doing wrong no output,django get raise self model doesnotexist course matching query does not exist i am building a lms from a tutorial using django backend with vue js for the frontend i keep getting the following traceback when i try to post a comment to a lesson on the site i believe django is throwing this error due to the foreignkey being used on the course model in views py because of this error it is also not dynamically updating the course titles on my course lessons i have researched that django throws these exceptions with foreign keys when django is unable to generate unique names any guidance with how i can implement a try and except block for this would be really helpful here is the models py,0,65,124 str object has no attribute to string in pandas i have a dataframe i m selecting a row and using to string index false on it i m doing this repeatedly over a large dataframe and times out of it s fine every once in a while though i get attributeerror str object has no attribute to string there s nothing unusual about the data in the instances where this happens what could be causing this,arima fitted values and plot values are different i want to store the estimated values predicted by arima model i am unable to view the values model predict and model fittedvalues is giving me the wrong values model plot predict predict is giving correct view on plot while my fitted values are showing in order of thousands model fittedvalues,0,69,54 get text from span class with beautifulsoup and requests so i tried to get a specific text from a website but it only gives me the error floor soup find span class text white fs px text truncate attribute value text attributeerror nonetype object has no attribute text i specifically want to get the floor price text my code,why do i get indexerror tuple index out of range i ve been trying to create a tictactoe agent and when i ran the training loop i got an error pointing towards the in the function that checks whether someone won check game status if you need the whole environment let me know here is the way the board was created which means the means empty spot for o and for x here is after action state function tocode function basically converts x to and o to this is the function that the error pointed at this is the play one step function that takes experience and puts it in a replay buffer using greedy epsilon policy and this is the epsilon greedy policy this is the training loop this is the error trace does anyone know what causes this issue i already tried to rewrite the function only and give it a few cases and it worked absolutely fine with no index problem if you need more of the code let me know thanks in advance,0,53,176 sort columns names only not rows in python hi i have df input which needs to be sorted for only column names not by rows restructuring the dataframe my required output column names should be sorted after n columns here after columns my input dataframe is as follows required output dataframe thanks in advance,how to declare symmetric self referential many to many relationship in sqlalchemy for storing directed graph when i do this i get this error from sqlalchemy sawarning relationship graphnode to me will copy column graph nodes id to column graph edges from node id which conflicts with relationship s graphnode from me copies graph nodes id to graph edges from node id if this is not the intention consider if these relationships should be linked with back populates or if viewonly true should be applied to one or more if they are read only for the less common case that foreign key constraints are partially overlapping the orm foreign annotation can be used to isolate the columns that should be written towards to silence this warning add the parameter overlaps from me to the graphnode to me relationship background on this error at it sounds like sqlalchemy is noticing that putting something in one node s from me list will result in a change to some other node s to me list this is the desired behavior i want to be able to traverse the links backwards as well as forwards is there any way to do this properly without sqlalchemy complaining at me,0,52,173 subsetting data with a column condition i have a dataframe which contains date visitor id and pages columns in the page visited column there are different row wise entries for each dates please refer the below table to understand the data desired output the output should be a subset of actual data where the condition is that if for same visitor id the page contains string step before string netbanking in same date then return the visitor id,i need to speed up python code with numpy this code is the gaussian noise symbol in the photo there was a speed issue fhd photo is processed in about seconds this is impermissible for my tasks i need to reach a speed of at least milliseconds already optimized the slowest part of the code generating an array of random numbers this operation takes about s i reduced the matrix a hundred times and then multiplied it a hundred times the code above takes ms of which the most time is spent multiplying one matrix into a large one ms how could you make this operation faster and now to the main problem all this code still takes a very long time ms the most time consuming operations adding matrices takes ms opening ms and saving ms photo is it possible to speed up these operations in any way in python thanks full code,0,75,154 calling a python script function from c form i m trying to call a specific python file s function from a c form but i think that i keep having problems with ironpython due to the usage of custom libraries microsoft scripting syntaxerrorexception unexpected token shows up when creating scope can the ironpython problem be solved or are there any alternative ways to do it here s an example of what i am trying to do pythonscript customlib c form,extract and rename zip file from specific folder using python i am using python to unzip a file i have a zip file in folder wowo if i select folder using path and use only file name the code doesn t work but when full path filename given it works i don t want go give full path and file name together i want to define path saperately,0,75,65 telegram bot commands visible for admin to use is there anyway that telegram bot can set commands that is available for administrator only because i wanted to implement a function that only admins of the telegram bot can use not for other users,how do i query sql server database with a user s input i get a error with the user input when i use an within the name for example if the userinputopening london it works and gives a list of all the openings that have something like london in them but if the userinputopening king s it throws an error cursor execute select from openings where name like format userinputopening pyodbc programmingerror microsoft odbc sql server driver sql server incorrect syntax near s sqlexecdirectw microsoft odbc sql server driver sql server unclosed quotation mark after the character string what do i need to put in the cursor execute so that it takes whatever the userinputopening entered i want to treat it like a search engine and have it display all the results of the users search i also want to make it so that user doesn t have to be perfect with their title hence why i ve added the like in my sql statement thanks,0,43,161 exe file doesn t output the result text file i create a python script that outputs the result in a text file and it works but when i convert it to exe file it doesn t create the the textfile i used pyinstaller and auto py to exe to covent python script to exe file,how i m gonna create the url pattern for each topic i want to create a url patterns for each topic how i m gonna do that this is my code models py urls py forms py from django import forms from models import task views py base html to do index html extends my app base html add task html extends my app base html so i want to create a to do app i created a form but know i want to create url patterns for each topic how i m gonna do that,0,49,83 redirecting output of launchfile called from python i have a simple piece of code which runs a specified launchfile execution of the launchfile stuff generates lots of logging output on stdout err so the actual script s output is getting lost is it possible to somehow redirect or disable printing it on the screen,how can i combine the dataframes returned by a function efficiently in python i have a function which returns many values on every run but i am interested in dataframe being returned i am currently using a list to store dataframes and then at the end i use pd concat to convert all the dfs in to a single df it s working fine but when i try to push this code for review i face linting errors too many local variables there s no way i can deal with other varibales so is there a way more efficient to store these dataframes and then later convert it to a single frame currently the code is something like this,0,52,116 rename names of multiindex pandas dataframe i m in trouble with a dataframe created from a groupby function it returns this result but i would like to rename id prod and price to no sales and revenue but i don t know how to do that because of the multiindex with the print df columns the result is so is this names i would like to change thanks for your help,how to filter list of dictionaries in python i have a list of dictionaries which is as follow how can i get a list of the latest vehicles for each vehicletype based on their creationdate i expect something like this i tried separating out each dictionary based on their vehicletype into different lists and then picking up the latest one i believe there might be a more optimal way to do this,0,68,72 unhashable type dict error in memoize decorator i m writing a memoize decorator but i get a unhashable type dict error when trying it on a simple example here is my code and here is a simple function created to test my decorator i end up with this error i tested just in case if my python was working properly with not in which resulted in the correct output true any help would be appreciated,i couldn t get results when i write compiled code in visual studio code i run python deploy py and it gives me error what i have to edit in my code i have just started coding and it seems that there is something missing in the code this is a compiled code the error message that it gives me after running python deploy py i checked it many times but still has the same error the code is from a lesson i am working on in this link the code in this link here s the code and the error message thank you so much in advance code error,0,77,109 get the middle of all bins from plt hist i have made a histogram with plt hist and i now have an array with the bins in this form is there a easy way to get the middle from these bins end result would be a list with n centers like i don t know beforehand what the bins will be,move widgets in scatter individually in python code i m trying to create a custom widget of which i want to add multiple instances to a layout these widgets should be draggable one way of getting the desired result is to use the dragbehavior mixin which i have already successfully implemented now i wanted to get the same result using a scatter but unfortunately when i try to drag one widget the position of all widgets change what i would like to have is to be able to drag the widgets individually like i did with the dragbehavior implementation it seems like my update callback method never gets called although i bound it on the position of the mylabelwidget object as described in the updating canvas instructions declared in python article by alexander taylor is there any way to achieve the desired effect without using the kv language,0,60,147 can i put input in mindstorms while programming in python when i was programming in mindstorms robot inventor and decided to put an input in my code i bumped into this nameerrorthis is the error is it even possible to put an input in mindstorms,kivy add widget won t appear on screen i m stuck with the following problem when i run the following code this seems to work but when i try this i see through debugging mode that it goes inside the board but it doesn t show anything on screen i know it s not a full code but maybe you could explain how does testapp run works and why would board shows widgets when it run from testapp build and not from startboard,0,46,78 how to change the spliting factor of args to and not discord py i want the splitting factor of args to be and not like i want to split like and not code th pp args or just help me split the args i ve tried it here s the code i tried,how to get complex structure from string i m working on getting complex data structure as dictionary of list of dictionaries from a string like that how can i do that,0,67,30 i have a df with countries and states when i select a particular country i need to get the output as below i need output as in hyd vjy bang output country city india hyd india bang india vjw i tried using to dict to json but i m not getting the desired output thanks,how to web scrape imdb movie rating i am trying to scrape the the movie rating from imdb website i am trying following code as but it gives error i e attributeerror nonetype object has no attribute text my code,0,51,39 issue with else part printing pattern i am trying to print below pattern but not able to able to achieve down word pattern any suggestion or concise approach expected output code the above code printed abnormal pattern in down side how to fix it,why timezone aware datetime is different when running program on macos and on ubuntu the below code produces different results when it is running on macos and on ubuntu aws ubuntu ec instance on macos bigsur it returns on ubuntu it returns in both cases what is the reason which explains that results are different edit i want to represent as being the datetime in paris so i exepect both returning,0,47,81 how to filter double type rows in a dataframe i have a dataframe that has an age column in which only integer values are possible however for some wrong reason it comes with double values in this column and i want to filter those rows out anyone can help me how to filter rows based on double type in a dataframe using python age output age,keyerror when training a hugging face model using pytorch i am training a simple binary classification model using hugging face models using pytorch bert pytorch huggingface here is the code i am reading a text data and classifying it as toxic or non toxic i have downloaded and saved model in path i have attached all the codes above error it s keyerror,0,71,66 convert boundingpoly to yolo format yolov doesn t support segmentation labels and i need to convert it into the correct format how would you convert this to yolo format the yolo format looks like this,how to resample to a coarser resolution but to samples within the original index i have the following use case i would like to get the first matching sample within my index when i resample but doing the following doesn t work note that the dates aren t in my original index i d like to resample to monthly but taking the first matching date sample each time i e i would like the following result i could do a hack as follows but this is not ideal it d only works for this toy example,0,34,91 store formatted strings pass in values later i have a dictionary with a lot of strings is it possible to store a formatted string with placeholders and pass in a actual values later i m thinking of something like this the above code obviously doesn t work but i m looking for something similar,global or static function in python classes i ve got a class that manages a video camera and file stream each instance of the class is a frame that has a bunch of methods attributes etc i m doing all the initialization outside a function so it happens once and sets a few variables that are global to all instances of the class those global variables include video and file objects that i need to close properly at shutdown from my main program i m newish to python and mostly java c c background and i remember having functions that were associated with the class that i could call that accessed global static class variables can i do something similar in python here is my pseudo code for my class now in my main program i need to call cleanupstuff to close out my camera and files properly i m creating hundreds of instances of myclass objects that i use and get destroyed by the garbage collection at some point so i need a way to call at the class level,0,51,175 r to python t test function conversion can someone help me transform this r t test function to python r code t test y mu paired false var equal true alternative greater,how to calculate the total duration for two certain date time in a csv file could occur multiple times by using python i am working on one sample csv file regarding the logs info from one vending machine pretty new to the pandas every day there will be someone to reload the drinks to the machine by scanning the qr code on the bottle i need to solve the below question q what s the total duration to reload all of the drinks to the machine you can find my sample code and sample csv file below info regarding the type of each column df dtypes below are my thoughts to solve the problem there will be many event statuses but i only need to focus on event qc scan and value columns entered or exited due there might be a value error so for each loading bottle duration is equal to then loop through the whole data frame and sum the each duration save the duration as new column name as duration units in mins eventually save as a new csv file contains the duration info but i am not sure how to write a for loop within the csv file and using python pandas can someone please provide me with a sample code,0,31,214 sort columns names only not rows in python hi i have df input which needs to be sorted for only column names not by rows restructuring the dataframe my required output column names should be sorted after n columns here after columns my input dataframe is as follows required output dataframe thanks in advance,ubuntu awslogs active active exited i use do release upgrade to upgrade ubuntu to ubuntu after awslogs cannot run logs cannot be uploaded to aws cloudwatch python var log awslogs log,0,52,28 i have two dataframes and i need to compare them to each other and calculate a measure i have two pandas dataframes in python and need to do a measure based on date condition df has a column named value that i need to divide based on column exchange from df thank you in advance,reduce padding top and bottom in plotly express chart i have the following chart but i wanted to remove big space between the top and bottom of the graph and the first datapoints the image is just a part of the chart it is much bigger because i m showing the data for all the countries here is the code maybe is the height that is too big but if i decrease it the labels and the datapoints overlap and make the chart terrible if i need to reduce height how can i add space between each tip of the y axis btw the whole code is here and the interface is on streamlit cloud if it help on solving the problem,0,55,123 how can i prevent from repeating until the next start time after is finished is executed and as soon as is executed starts immediately when is executed i want to restart when the next start time is reached not the current start time can i try break continue for i range etc,logging for multi module program i want to add a logging mechanism to my program the basic structure of my project directory is so cli py imports all other module py but i also use all other modules as independent executables by themselves even outside the context of this project i e i use all of these commands the basic structure of the files running results i wounder how can i configure logging so even when i ll execute python module py i ll still have the same formatting as defined in root richhandler when i tried to just set an additional formatting inside module py it resulted in a duplicated handler so basically i want to achieve this behavior,0,59,113 increase the value as soon as the condition is met i think this problem is quite easy but i can not find the correct function of pandas to achieve it or link in stackoverflow i tried it with cumsum but did not succeeded my dataframe looks as follows now i want to have a new column and here it should always be increased after every rd time id the output table should look like this,fast way of converting a drawing description into a bitmap first of all no idea exactly how to put this out or even where to ask so please bear with me in the software we are developing we have shapes that describe a scenario think of it as a highly simplified svg in our case we only have rectangles half a dozen give or take defined by their height width rotation and position of the center we need to render a matrix ie d array with the image of this scenario x px at a high frequency roughly every ms but i cannot find an algorithm or a library to do so best i ve been able to accomplish is ms with a home made algorithm but it s not good enough my own algorithm roughly does clearly i need a better algorithm is there such thing out there or even better are there any python libraries to accomplish this goal or will i have to go into some gpu programming how come the tkinter canvas can render it in less that ms at hd quality and i am struggling with such simple requirements,0,75,192 onnx runtime bert inference runtimeerror input must be a list of dictionaries or a single numpy array for input attention mask i am trying to use huggingface bert model using onnx runtime i have used the the docs to convert the model and i am trying to run inference my inference code is i am getting the following error,how to speed up the agg of pandas groupby bins i have created different bins for each column and grouped the dataframe based on these the output of df groupby a bins b bins c bins size indicates the group length is then the statistics of each group are calculated like this,0,58,45 valueerror when trying to run sanic in dev mode i m trying to run a server from the sanic getting started example here is my code in server py and when i run the default command sanic server app everything is ok but when i try to run in dev mode it throws an error should i add something to run sanic in dev mode,extraction of tds from table using beautifulsoup and arranging them in pandas dataframe together with the table id i have the following html code which i have extracted table id table thead tr class table columns th id header column title th th id header column title th tr thead tbody tr class evenrow td headers header firstrowcolumn data td td headers header firstrowcolumn data td tr tr class oddrow td headers header secondrowcolumn data td td headers header secondrowcolumn data td tr tbody table i need to extract the table data and id of the table table then arrange them into a pandas dataframe similar to this,0,62,87 how to loop a list until all items in a list are matched with user input then stop the loop with bingo message for bingo game in python my list items should be matched with user input when matched all numbers a message should show bingo and loop should be stopped,what is meant by object that prefixes method names in the python docs i ve been intensively consulting the python docs lately and i can t figure out what the object prefix means for example i ve been reading about and in the docs its definition header is written as here s the link to its entry what added to the confusion is that running raises the error update i also considered the possibility that it s there to denote instance of a class but then the self parameter becomes invalid,0,50,87 how to use range in a loop python this will print out links how do i limit it to only fetch the first links,python read csv by column header dynamically with hash key i try to read vertically a csv file as follow to insert in graphite carbon timeseries db with python i wish to build a dictionary tuples content as follow in facts i need to write the header of each column with the value of each time with the date convert to epoch time epoch i m able to list the header but i don t know how to keep the date and value for each many thanks for any help,0,26,92 how to correctly read csv file generated by groupby results i have calculated the mean value of dataframe by two groups and saved the results to csv file then i tried to read it again by read csv but the loc function doesn t work for the loaded dataframe here s the code example when i type i got this output but if i use the same method to locate the value from the loaded csv file i got this keyerror,using click in a shell script that has a hy program in a here document how can i convert the following working example of using click with shell python repl i think to hy when i use the following hy example with test sh name shadowrylander count i get when i should be getting normally i can use hy eof eof without issue,0,78,67 how to automate elements without a class id in python selenium i m trying to automate the pressing of the following button in selenium but i m used to referring to elements using their id this button has no id,make python wait for external trigger i m trying to set up a sort of basic screensaver on a raspberry pi i m using python because i like it a lot more than bash the script uses popen to call feh and display a slideshow there s also nodered running on this pi and that manages the actions bound to a few gpio buttons i would like to intercept those button inputs to stop the slideshow i thought of ways so how else could this be achieved is there a way to bind a function to some external trigger,0,38,97 discord py delete message log hi i have made in discord py logs for deleting messages but now it is so when the message was deleted by a bot nothing is displayed can i somehow make that no message is sent when a bot deletes the message,attributeerror dictcursor object has no attribute update i m trying to import some csv files to a table on a mysql database the csv files are updated daily and my intention is to use this program in python to automate the process the idea is if the information already exists i want to update it if the information doesn t exist i want to insert the data but i m having this error attributeerror dictcursor object has no attribute update thanks in advance,0,46,80 how can i prevent from repeating until the next start time after is finished is executed and as soon as is executed starts immediately when is executed i want to restart when the next start time is reached not the current start time can i try break continue for i range etc,how to send png jpg files as bot via url or from specific folder discord py well i tried to send a picture from a specific folder but the bot can t find it is that me i can t write code that would search a folder well i would also like the bot to send images from the url here is my code i m just learning python so any help is appreciated,0,59,70 change the values in a column using pandas i have this csv i want to reset all the values in the table count to to change the values is there a way to do it without mentioning to replace and setting the value directly,plotly dash updating a live figure on a dash application jinja i have a bi interview in a few days and they want me to prepare a dashboard i don t have access to power bi or tableau so i m trying to build up something with plotly dash however i haven t really built anything fancy using it and i m a bit inexperienced i m pretty new to web development and come from a data background i was hoping someone may be able to enlighten me on how i could jinja in plotly dash i have my app layout below someone helped me fix the drop down issue i had and it s coming together and i was hoping one of the geniuses on here might be able to help me out the bit i m trying to update is where it is saying total number jobs and then feed in a value calculated elsewhere i know in html you would use but this is throwing an error also if you are a plotly dash wizard please can you help me figure out to have my dashboard laid out differently the layout is currently figure figure figure figure but i m trying to make it look more like figure figure text figure figure i love how amazing the community here is and thanks for your help in advance,0,44,222 execute df grep w not parsing output correctly i am trying to run the shell command df h grep w using python to watch the root partition usage and wanted to avoid shell true option for security the code i tried as follows the output i get is expected output is,simple https python server to detect weather its connected through ca cert or not first i create a ca cert key pair with now i run a server with python code now this server can be connected for both secure ca cert case and ingore ca cert server connections when using ssl case that is curl cacert public cert pem cert type pem and curl k will work how to detect if the request is ingnore ca cert or not from server side,0,54,76 get value from dict where key is value another list i want to extract the value from dict where key matches another list i get i really need an output with tar values from dict i e how can i get it,increasing a value each time a function passes through a for loop i am trying to make a for loop that returns response json i from an api with i increasing by each time through the loop example my goal is for get url to run times each time printing the response associated with the increasing i value sorry if this is worded poorly i am a total beginner and self taught thanks in advance,0,43,75 django noreversematch so i m learning to create a confirmation email address while registering an account using django this is my urls py i m having this email confirmation html template tokens py and this is my views py in the end i am getting this error my question is why i am getting this error and do you guys have any solution into it thank you,how to set up hydra config to accept a custom enum how do i set up a my hydra config to accept a custom enum specifically i followed the structured config schema tutorial i have a dataclass config with the custom enum error from running python my app py where my app py is just and the config in data config yaml is just,0,61,58 no module named pyfiglet fonts failed to execute script due to unhandled exception i have recently compiled a py file to an application and the py works fine but the application gives me this error no module named pyfiglet fonts failed to execute script due to unhandled exception then closes immediately the modules im using,implementing a machine learning algorithm in python when output is generated one at a time i have a large black box model which i am trying to calibrate and i am trying to implement a basic machine learning algorithm to assist the calibration but i am getting stuck the method i have been using to solve this is as follows this seems like a bad method because it always takes the same amount of time and assumes in advance that i know the best range that scalar will occupy i could fine tune this method by trying to fit a line and retrieving the minimum value but i d still have these problems it seems that some kind of machine learning algorithm would be a better approach here however i m not sure what type of algorithm would suit this problem my intuition says a gradient descent but i ve not seen one implemented in this manner the examples i ve seen have a dataset before running the descent rather than the data being generated on the fly my best guess is that such an algorithm would need to be aware of the gradient between the current mean squared error and the previous mean squared error and then adjust how much the scalar would increase or decrease in response to this my best guess at mapping this out is as follows i m happy to use an out of the box solution such as sklearn classes but it is the implementation that i m getting stuck on,0,55,239 error proxy next proxy pool stopiteration i am trying to run a script and it has a standard url for proxies which allows the script to run fine once i add my own proxy url i am getting the error error proxy next proxy pool stopiteration my url is in another file and i can also link that if needed code is below if anyone can help that would be great,sorting multiindex dataframe format from columns to variables in pandas i have this dataframe it is a multiindex dataframe i m using pandas to get this final result basically all the x columns are merged stacked under one new column x new as well as y columns under y new column always the x value should take the y value of the same raw and column this is what i tried to do first i used melt after i joined the column indices and became single index join col strip it created extra wrong rows these wrong rows have wrong values for example age x and hgt y in the same row remember always for example age x and age y in the same row or hgt x and hgt y are in the same row second i used stack and it gave me this result i don t know what else i can do is there a way to turn the multiindex dataframe to the final result that i m looking for using simple pandascode,0,69,163 i have this list and my for loop that only show odd numbers of list but i want it show only first odd number and if there is not show all of them the code,pandas multiindex select rows where value is between two levels i have a dataframe with a multiindex with levels name lower and upper i want to query data where name is some specific value and some number n lower n upper does not have to be could also be but now i want to have the result might look like this doing this one by one is slow is there any way to select multiple rows note i don t have to use a dataframe nor do i have to use a multiindex if there is some data structure that is better suited for this job i would be happy to use that,0,37,117 how do you attach a function to an instance of a class i used to program in scheme in scheme a functional style functions are values you can attach a function to a struct the scheme equivalent of a class in python can you do something similar with python classes or to put it differently can you pass a function to a constructor,how to retrieve aws s objects url using python i need to write a lambda function that retrieves s object url for object preview i came across this solution but i have a question about it in my case i would like to retrieve url of any object in my s bucket hence there is no keyname how can i retriece url of any future objects stored in my s bucket,0,63,70 custom csv file name using to csv python i m working on writing a pandas dataframe to a csv file using to csv df to csv output csv i m looking to customize the naming of the csv file by adding the actual datetime so it should look like this output t z any idea,concatenate string and pandas field in an apply lambda i try to use concatenate the value from a pandas field with a string in apply lambda endswith but no success i explain i have a df i would like to get lines where the fieldb does not finish with fielda pdf so here my code i also tried this or this but impossible arrgggh any idea,0,47,64 function within function to change a variable value why doesn t the variable url change test and yes it needs to be a function within a function that way the rest of my code is more simple thanks for your help,what s the easiest way to calculate regression coefficient in python i have a by response variable y and a by predictor matrix x i want to calcualte the regression coefficient x x x y currently i m doing it as follows this looks pretty cumbersome while in matlab we could do it just like the original math formula inv x x x y is there an easier way to calculate this regression coefficient in python thanks,0,40,72 put shared axis labels to upper plot returns this figure but i want the x axis labels below the first plot not the second like shown below how can i achieve this,adding a different value to a list based on number of iteration in a for loop i m new to python and programming in general and i am having trouble with a website parsing project this is the code i managed to write what i m trying to do and can t find a solution to is to add to item list the name of the item which the url refers to e g but items name column has the same name for all the rows like this so i wanted to ask what am i doing wrong in the for loop it iterates times which is the amount of urls in the url list but it doesn t change the name of the item what am i not seeing,0,31,124 templatedoesnotexist at fund me issue i have went through the answers to similar question on this site but nothing seems to work as i receive the same error message each time help would be greatly appreciated error message on the bottom directory tree directory tree urls py in fund proj urls py in fund me views py settings py relevant code error message and traceback error msg and traceback,filenotfounderror in subprocess check output i want to connect and use the functions of adb in a python environment in the terminal adb is connected well as shown below to use this in the python environment subprocess check output was used i wrote python code as below i got an error as below in my opinion subprocess check output does not seem to be able to import the path environment variable how should i solve it,0,62,70 i need to make my scatter plot legend dots bigger but w o overlap them i m having issues with a scatter plot legend i need the size of the legend dots to be bigger but i don t know how to do it i tried to multiply sizes but then in the legend the dots overlap thanks for your help here s my code,calculate f score in a named entity recognition model with sklearn i m trying to validate an ml model that performs named entity recognition on some data my question is related to the way f score is calculated im using classification report from sklearn here we have the true labels ids and the predicted ids as we can see the first label differs i e in the prediction it has value however in the labels it has value the way i see it it means that the token was wrongly classified next in order to use the sklearning metrics we have to convert our arrays with fit transform from multilabelbinarizer since we have more than labels this is the part i don t understand this method only saves which entities were used in each sequence but doesn t care about any order or quantity of labels in the end the metrics are quite high but i don t think they are accurate since they were calculated only based on if the predicted sequence had at least one occurrence of each entity present in the true sequence im i reading it wrongly another approach i saw here we are calculating the precision of the pred list against the true list for that the function only checks if the predicted labels are in the true labels list again the number of occurrences and order is not taken into account what would be the correct way to calculate the f score in ner,0,63,243 multiple lists from csv dictreader i have a simple csv file with two keys title and author with a bunch of data i want to make a list of the titles and then a list of the authors my code is as below it prints the title list but no the author list why,retrieve dns query information from a cloudflare zone using graphql i have the following graphql query which returns me the information from cloudflare s analytics dashboard like cachedbytes cachedrequests does anybody know how to retrieve dns query information from a cloudflare zone,0,52,41 changing values in numpy array according to index when i use the indices once to change the values it works however when i use the indices twice to change the values nothing has changed why i can t use the indices twice to change the values,celery task will not execute in django i am leraning django using django by example i want to launch asynchronous task with celery i set the settings but the task will not execute i m using rabbit mq as broker and i m using windows here is my code celery py init py tasks py views py here is the problem in my view i called order created function but the task will not execute and there in no email in my console my email settings are correct because other emails in my app works i use flower to monitor celery and in flower panel it shows that the tasks are executing but there is no email i would be happy if any body can help,0,45,120 how do i get this for loop to create one dataframe instead of creating a new one each time it loops so i am trying to return a dataframe of the values that are separated by a or a in my original dataframe it does this however seems to create a new df every time and i can t concatenate them either which returns but i want any help would be appreciated,make negative values of numpy array positive i have i want to make the negative values positive e g is there an easy way to do this thank you so much in advance,0,73,40 automate whatsapp application using python is there anyway to send msg with attachment from whatsapp application not web browser i tried the command below but it just type the msg without sending it and can not find the way to add attachment i just prefer application over web browser because it is more stable from prespective of whatsapp qr login and it s more faster and thanks,kivymd kivycamera class is initializing without being called this is my first time asking a question here so please bear with me i m trying to make a camera app using opencv and kivy i managed to do it but my problem is that the camera is being called right away even if its not on the right screen i suspect this is because of my init class in kivycamera but i dont know any other methods to do it what i want is that the camera will only initialize after pressing a button here s my main app and here s the kv file thanks i really think i just need to get rid of init but i dont know any alternative way,0,67,121 ros and python versions when launching nodes ros imu bno package works on noetic running ubuntu intel nuc but throws an error on kinetic running on raspberry pi ubiquity robotics image must be python vs python on the nuc python on the pi kinda stuck not sure where to geek from here process ros imu bno node started with pid,packages not visible after venv added i ve installed venv into my python project i ve activated it and then installed from requirments when i run pip list i see all packages installed nevertheless when trying to run my application i see in my init py but its not only flask when i did remove for testing purpose then when ran again i see means none of my packages are visible looks like libraries in venv are not visible how can i sovle it i run my project from app py by python exe app py app py edit as stated by np both commands works on local nevertheless when deployed on azure i got errors in log,0,60,113 python requests print html response variable i use below script to get the temporary code from server no issues in script now i am getting the output as expected now i wanted to get the session key from the html output please let me know how can i get the variable inside the html,python split string multiple times text file input g host ip uid pwd host name g host ip uid pwd host name what i am trying to is split the line from the text file the rate and the rest of the parameters rate and other parameters into separate variables pass the rate into the function then split the variable params further into more variables host ip uid pwd host name sh sl pt the first split in is a str and after the split but when i try the second split it says it is a list i have tried join but it puts every character as its own string with a in between characters any help would be appreciated,0,53,107 unhashable type dict error in memoize decorator i m writing a memoize decorator but i get a unhashable type dict error when trying it on a simple example here is my code and here is a simple function created to test my decorator i end up with this error i tested just in case if my python was working properly with not in which resulted in the correct output true any help would be appreciated,how can i change the image layout options on python docx i need to creat a archive with the same pattern that other one but i need to do this with python in this another archive i have a image with this following configuration the image and text are alligned but when i try to put my image with the following code the image stays alligned just to the first line of the text like in this image allinged just with the first line i see that if i go into the word and change the layout options to this with text wrapping the second option everything work exactaly as i want to but how can i chage this layout options using python,0,77,122 discord py musicbot gives nonetype error i tryed to make a music bot for discord it runs but after using the commands he gives me and error error code is down below import discord from discord ext import commands from discord import ffmpegpcmaudio import youtube dl class music commands cog def init self client self client client def setup client client add cog music client,python selenium check all checkboxes on page i m trying to tick all checkboxes on a page there are about of them and this code seems to work but only ticks what is visible on the screen it doesn t scroll down the table and tick the remaining boxes i m thinking it s only finding those on the screen as the rest are still loading i need to wait until all checkboxes have loaded but i m not sure about how to go about this any help is appreciated below is the table row,0,53,91 how to extract string value in html with parsing in python i am trying to get the string value for each link for example like pennsylvania but since there are title and id attributes i am a bit confused about how to do it i get a null result when i display my array here is my code,python requests why is requestscookiejar object sometimes empty i ve seen a couple of answers on this subject but i still don t quite understand why is the requestscookiejar object sometimes empty in the example below for instance it returns empty output,0,59,41 how to calculate the time difference between two string formatted datetimes i m trying to subtract two columns on a dataset which have string times in order to get a time value for statistical analysis basically toc is start time and ia is end time something is slightly wrong,python mysql this use of cursors works but is it correct i have the code below which selects some data from one table finds related data in another table updates the data in the related table and deletes the data from first table the use of cursors below works but not sure it is best do i need to define a new cursor x db cursor each time like this,0,47,71 selenium python how do i fetch only the first element with href with the following code i am fetching links i need from within some items but for unknown reasons within it there are two identical a tags with the identical contents how can i fetch only one of them,python dataframe to csv unicodeencodeerror charmap codec can t encode characters i use the following code to save roughly scraped profiles from a dataframe to a csv profiles to csv r c users alexa desktop profiles csv index false header true encoding cp inbetween the script stops giving me the following error message the csv file contains roughly profiles which were successfully written into the csv before it breaks does anyone know how to solve this traceback most recent call last file c users alexa pycharmprojects cameo main py line in profiles to csv r c users alexa desktop cameo profiles csv index false header true encoding cp file c users alexa pycharmprojects cameo venv lib site packages pandas core generic py line in to csv return dataframerenderer formatter to csv file c users alexa pycharmprojects cameo venv lib site packages pandas io formats format py line in to csv csv formatter save file c users alexa pycharmprojects cameo venv lib site packages pandas io formats csvs py line in save self save file c users alexa pycharmprojects cameo venv lib site packages pandas io formats csvs py line in save self save body file c users alexa pycharmprojects cameo venv lib site packages pandas io formats csvs py line in save body self save chunk start i end i file c users alexa pycharmprojects cameo venv lib site packages pandas io formats csvs py line in save chunk libwriters write csv rows file pandas libs writers pyx line in pandas libs writers write csv rows file c program files windowsapps pythonsoftwarefoundation python x qbz n kfra p lib encodings cp py line in encode return codecs charmap encode input self errors encoding table unicodeencodeerror charmap codec can t encode characters in position character maps to process finished with exit code,0,50,165 extracting elements from a d array getting error invalid index to scalar variable i have to extract elements from a d array and write a file in this i want to extract suppose elements of u array separately i get my u array as e e e e e e e e e e this is just for example how can i get different elements of u array by using u i am getting error any help is highly appreciated,question regarding negative indices in tuples and lists in python in this program why is the output and not this is the case with lists also i noticed print t doesn t give the output as but instead gives what is going on here why can t we go backwards please help me i ve just started python i have no background in programming,0,78,64 extracting certain words from column i have csv file like below in a column filename and i would like to have the label column name only the word before underscore for example output like below how can i extract only those words from following column and paste into label column,how to block a single integer input with pyinputplus method blockregexes i can t quite understand what the regular expression should be so that it blocks a single digit integer input this code blocks any kind of integer input this also allows inputs such as m even though in allowregexes i wanted to allow roman numerals to be accepted not mixes of roman and arabic numerals if anyone could help i d be very grateful,0,51,73 sending message in all guilds on certain event in discord py i used this code to send a message to a certain channel named giveaway index but the problem is that it only send message to the channel named giveaway index only in one guild i want it to send the message to all guilds that have a channel named giveaway index is there any way i can do it,removing characters in a file and also making it neat i want to basically remove all the characters in delete list from the file line to what would be the neatest way to delete the words without making the code not neat i am not sure whether to open the file again here which i know would not be the right way but i can t think of a different solution any help would be appreciated,0,66,77 node js buffer to string equivalent in python i m converting an old node js lib into python and can t reproduce the behaviour of buffer tostring in python this lib is use in a node environment i did take a look at this node issue but i don t understand if it s linked to my problem js function output python equivalent the output badly shown by stack my actual console message maybe i sould use something different than latin and utf,how to delete the found match from a list i am trying to find out what values of list a is present in list b when the match is found it is stored in match variable what i then try to do is to delete that specific index in which the match was found from list b so that next if there is a duplicate value in list a it will not match the same place as previously but instead move on to the next place it finds a match however it seems that i cant get the index position value of list b deleted i have tried pop del and even remove can anyone help listnwsm holds following k p k p k p f g r g c x k p f b c b listbom holds following actually holds thousands of numbers but this is for example k p c b c b c b c x c b c x k p c b output gives me k p k p how am i getting duplicate index values when the value at position should be deleted after it has been saved,0,79,173 how to append an object to a table i am getting the tweets and the corresponding id of that user in an object obj i want to append the object to a table but i get an empty table what s the problem please,brownie error cannot load native module crypto util cpuid c brownie was working great yesterday today i get this error anyone have a solution ps c users philk demos web py simple storage brownie version info could not find files for the given pattern s traceback most recent call last file c program files windowsapps pythonsoftwarefoundation python x qbz n kfra p lib runpy py line in run module as main return run code code main globals none file c program files windowsapps pythonsoftwarefoundation python x qbz n kfra p lib runpy py line in run code exec code run globals file c users philk local pipx venvs eth brownie scripts brownie exe main py line in file c users philk local pipx venvs eth brownie lib site packages brownie init py line in from brownie project import compile source run file c users philk local pipx venvs eth brownie lib site packages brownie project init py line in from main import noqa file c users philk local pipx venvs eth brownie lib site packages brownie project main py line in from brownie network import web file c users philk local pipx venvs eth brownie lib site packages brownie network init py line in from account import accounts file c users philk local pipx venvs eth brownie lib site packages brownie network account py line in import eth account file c users philk local pipx venvs eth brownie lib site packages eth account init py line in from eth account account import file c users philk local pipx venvs eth brownie lib site packages eth account account py line in from eth keyfile import file c users philk local pipx venvs eth brownie lib site packages eth keyfile init py line in from eth keyfile keyfile import noqa f file c users philk local pipx venvs eth brownie lib site packages eth keyfile keyfile py line in from crypto cipher import aes file c users philk local pipx venvs eth brownie lib site packages crypto cipher init py line in from crypto cipher mode gcm import create gcm cipher file c users philk local pipx venvs eth brownie lib site packages crypto cipher mode gcm py line in from crypto util import cpu features file c users philk local pipx venvs eth brownie lib site packages crypto util cpu features py line in raw cpuid lib load pycryptodome raw lib crypto util cpuid c file c users philk local pipx venvs eth brownie lib site packages crypto util raw api py line in load pycryptodome raw lib raise oserror cannot load native module s s name join attempts oserror cannot load native module crypto util cpuid c not found cpuid c cp win amd pyd not found cpuid c pyd,0,43,205 jinja s template operators how to use function without printing it on web site page so here is a part of code line is the point where i want to know how i can pop one item out of the list on each iteration escaping printing it on web site page,allocator ran out of memory how to clear gpu memory from tensorflow dataset assuming a numpy array x train of shape the following code works fine exactly once when i re run it after slight modifications to x train it then triggers an internalerror due to an out of memory gpu it seems that the first time it finds free gpu memory so all works fine but the subsequent times the gpu memory is already almost full and hence the error from what i understand it seems that simply clearing gpu memory from the old train dataset would be sufficient to solve the problem but i couldn t find any way to achieve this in tensorflow currently the only way to re assign the dataset is to kill the python kernel and re run everything from start is there a way to avoid re starting the python kernel from scratch and instead free the gpu memory so that the new dataset can be loaded into it the dataset doesn t need full gpu memory so i would consider switching to a tfrecord solution as a non ideal solution here as it comes with additional complications,0,49,190 read gz file in python i am trying to read extract the contents of the file train gz my code when i run i get this error on jupyter notebook any suggestions,pandas can not read s excel file error excel file format cannot be determined i am reading excel files xls from s with pandas the code works properly for a few files but for the rest not the files are received daily with different values per day excel files structure is the same so we can consider the files identical the error is valueerror excel file format cannot be determined you must specify an engine manually at this line i have tried all the solutions mentioned on internet specifying the engine openpyxl gives the error zipfile badzipfile file is not a zip file and specifying the engine xlrd gives the error expected str bytes or os pathlike object not nonetype i am using boto to connect to s resource once again for a few files my code works fine what can be the cause of this different behaviour for excel files that looks identical my question is very similar with excel file format cannot be determined with pandas randomly happening but it doesn t have a proper response yet,0,30,174 how to save python result as excel xlsx this code below read txt files and print the results but i need save the results as xlsx i searched the internet but i didn t get any solution can someone help me the data format in txt files is like this them are registration data from images uploaded to an e commerce,rename dict keys in a list of dicts recursively i would like to understand how i can rename keys in a list of dicts recursively without mutation of method parameters i have the following list of dicts this is what i expect to achieve any way i can get around with this thanks,0,59,54 need to split a column but only removing the character good morning below the first rows of my df and my code when i try to split by the to remove the strong tag from the link split only removes the character split returns a keyerror any ideas how to get this to work first desired link,dash table not showing i have the following code however when i run the app only one table shows up and that is the one generated by i don t know what i m doing wrong that the dbc col id table lg doesn t return the table that is defined as warning table and with id table any help with this would be appreciated thank you in advance disclaimer this code will be used in a open source project for an ngo,0,60,74 python jupyter crawling ebay website nested try except error im trying to get the price from pages in ebay but i have different of id tag to the price i v tried few options but i got indentationerror or when i got the output csv got a a column of empty cells,confusion with python import i have a package of utility modules and classes that are imported using the following example statement when marixframework is installed as a package the above statement works fine however i want to do some local testing of the package contents so i want to import directly from my local folder tree that has the following structure if i add workspace marixframework to sys path then i get the following error the import procedure has obviously found the desired source file but fails to import from it why what i am trying to achieve is to import the marixframework modules directly from the folder tree then when my local testing is complete i can just rebuild and install it as a package without having to change the import statement syntax,0,54,132 method not allowed error after deploying python app on heroku i have scrapped a website and after scrapping i have successfully deployed it on heroku but it gives me the error method not allowed i cannot understand the error please help me to solve this error this is link my python app deployed on heroku,read the elements of a text in python i have a text file like this there is no separation mark when i use these lines of code it returns nothing how can i save its elements in a python list or array,0,56,42 why does a change in nested list doesn t affect the first layers and only the subsequent layers i just wanted to know how do we get the following output the given below is a python code output is why x didn t make any changes in the list y but why x changed the element in list y can you give a detailed and simple explanation to this why,how can i make a square with a specified circumference and add margin i am trying to make a square path of a specified length i made a function and if i put then i get a x matrix how can i add a margin of s of eg fields thickness like this,0,68,56 unable to remove empty keys in a python list i have a python list like this and i want to remove empty keys when i receive some null value in my exemple i need to remove all third block because the actual vl this is my code and it s only removing actual vl but i need to remove third block this is my code but as result i keep getting all fiels,pandas styler does not maintain rounding i would like to round off pandas dataframe and then add a title to it but pandas style set caption command ruins the rounding example result how can i add a title while maintaing rouding,0,73,39 how to load an image file from my local hard drive to html page using python hello i am new to python and i wanted to know how i can load an image from a directory on the computer in a html page using python,discord bot can t kick user who blocked the bot few days ago i wrote a little discord bot in python and it s running pretty good but i just ran into a problem it seems as the bot can t interact give roles kick etc with users who blocked the bot is there a way to fix that functions like that don t work,0,45,60 create a python pandas multiindex object from separate index objects without going into detail why i d like to do this is it possible to create a pandas multiindex from separate index objects i m specifically interested in somehow preserving the specific index types in the new multiindex instance solutions including conversions to and from a dataframe series etc are fine as long as the original separate index object types rangeindex int index datetimeindex survive,error could not build wheels for scikit learn which is required to install pyproject toml based projects while i running this command on command prompt i am getting this error,0,74,27 scipy minimize with two equations returns initial values only i would like to get an optimal solution for following equation set x w x m d m x w x m my code is as follows however all i get back res x are the initial values x how do i make it work is there a better approach there are just these two equations for the three variables,end user input logic i am new to python and i have a conundrum which i cannot solve its a bit complicated to explain so bear with me i want the user to have the option of selecting the logic for a b i have built this in pyqt with checkboxes on a small scale so the logic possibilities are as follows for a b now that seems simple to code at those variables but i add only one more option c now i add in d e f g i don t know if the possibilities are truly exponential but they are huge now i am not the first person to have this issue and there must be a solution a novice like me is not aware of for example there are many workflow builder in pm tools like jira smart sheets salesforce where the end user can define almost limitlessly the logic for triggers and actions but i cannot figure out for the life of me how to do this in code without pre defining all the possibilities the end user may pick beforehand hope this makes some sense any help or advice much appreciated on how the experts solve this particular issue,0,71,207 importing csv into database using python i m trying to import a csv file into a connecting mysql database using python however i keep getting the following error programmingerror not enough arguments for format string all code runs perfect until cursor execute does anybody have any ideas code used,how to extract a word table from multiple files using python docx i am working on a project at work where i need to analyze over a thousand ms word files each consisting of the same table from each table i just need to extract few cells and turn them into a row that later will be concatenated to create a dateframe for further analysis i tested python s library docx on one file and it managed to read the table however after plugging the same function inside a for loop that begins by creating a variable consisting of all the file names and then passing that to the document function the output is just one table which is the first table in the list of files i have a feeling i m not looking at this the right way i would appreciate any guidance on this as i m completely helpless now following is the code i used it consists mainly of code i stumbled upon in stackoverflow thanks,0,47,166 how to get a column wise min of list of lists i have a list of lists i m expecting the output of min a to be but the actual output of min a is does anyone know why,pandas number of unique distinct characters in a string how do we calculate the number of unique characters in a string in pandas dataframe i have data in column like this i want to add another column which mentions the length of unique characters in each string expected output so far i have tried however the above code gives me this result please help,0,39,63 extract element from a dictionary and create a dataframe i have a dictionary like this and i would like to create from this dictionary a dataframe containing in the first column the pairname and in the second one the price element like this what is the most correct way of doing this,how can i filter time by using django filters input start time result start time enter a valid time,0,52,22 python how to print only keys of list of dictionaries i would like to be able my list of dictionaries by key however my code is returning the key and the value as follows output if i omit the index in my code i get the following error what is strange about that to me is that if i run this code it returns is this a data structure issue,problem with py stringmatching generalizedjaccard i m using generalizedjaccard from py stringmatching package to measure the similarity between two strings according to this document if the similarity of a token pair exceeds the threshold then the token pair is considered a match for example for word pair method and methods we have the similarity between example word pair is and greater than so this pair must considered a match and i expect that the final generalizedjaccard output for two near duplicate sentences to be equal to but it s so what is the problem,0,71,95 jupyter notebook error schur decomposition solver error i am getting an error while using sarima model for energy consumption project below is the code and error if anyone have any solutions or suggestions they would be greatly appreciated code error python version statsmodel,discord py kick slash command not working when i do kick user reason nothing happend it just gives the interaction failed it doesnt even kick the user or send a message to them saying they where kicked i have no idea what is going on because of my little experience,0,47,49 how to import and read a wsj corpus in python i have a code that builds n gram model to test next word prediction based on a corpus provided how can i replace the given corpus to read wsj corpus as the training corpus a part of the program is given below,scipy curve fit strange result matplotlib inbefore my code results in enter image description here changing xfit np arange to xfit np arange and results in enter image description here why thank you for your help,0,52,38 how can we add quotes around a string in a column in a data frame i have a field named location it looks like this i am trying to add double quotes around the string so it looks like this i tried this it does something very weird i also tried this it adds way too many quotes thoughts,performing operations on a dataframe based on function args i m looking to perform some slicing on a dataframe and i am repeating the same slices on both the mean and std results i am wondering if it would be possible to write a function were mean or std can be defined as an argument if so i may later expand these type of df operations to others such as min and max admittedly a limited set but i m still curious so currently my code looks like this i was wondering if it could look similar to,0,59,96 permissionerror errno permission denied geckodriver exe i am writing a bot for instagram using instapy i need a lot of accounts so i use threads but i get an error ode if i call the code for one account everything works,retrieve indices of certain value in a matrix and put it in a nested list i have this matrix let s say there are hundreds of x value and thousands of y lists inside this matrix how will i be able to retrieve the index of value and put it in a nested list here is the sample output,0,41,60 how to turn python method into setter with the help of metaclass i m new to metaclasses so i m sorry if my question is somehow stupid i need to make a metaclass that takes particular methods of a class and turns them into property methods or setters so if i have i want it to work like this for now i ve just realized how to make it for property but i can t figure out how to do it for setters,how to read clickable labels in tkinter i asked this question yesterday in a way to long manner i now reduced the code to the real problem when i click the link in the window i want the read the pos num this way i can get information from other lists which are in the complete code if i can get the following to work i can implement it in my tool,0,79,71 convert minimum spanning tree to list of indices using scipy if i have the following input and output graphs created using scipy sparse csgraph minimum spanning tree how do i produce a simple list of indices so,typeerror webdriver init got an unexpected keyword argument firefox options error using firefox options as arguments in selenium python i m trying to create a script which downloads a file from a website and for this i want to change the download filepath when i try to do this with the firefox options it gives me this error code,0,33,55 new to python and trying to find out how to gather the quantity of one specific item in a nested list i m trying to figure out a code that will go through all items of the list and keep a count of how many times the given item occurs without the count funtion this is my code,i m doing a hash verification project and after i store the hash and want to verify it it returns false after i check it against the new hash i create a hash and store it in a txt file will encrypt it later but when i create a new hash and check against the stored one it returns false even though the hashes are the exact same help relevant code here s the code to store the hash and here s the code to get the stored hash note it returns no errors but does not return true either complete code can be found here password hashverify,0,57,108 i keep getting unicodedecodeerror utf codec can t decode byte x in position invalid start byte i m trying to read monthly csv file but for some reason i keep getting this error this is my code below what do i do,linux sort command prevent waiting is it possible to prevent sort command from waiting i was assuming that sort will continue sorting even if one of the inputs is are waiting as long as the other one waiting is still higher than the other ones for example lets say we have following python scripts test py test py when i do sort mk python test py python test py i dont seem to get any results until the entire thing is done is sort just not printing flushing the sorted results right away to the console not sure if this is the case since even if i print a lot more data it still wont print anything until the entire thing is complete if it needs to hit a buffer size first before printing in the console is there a way to flush the results out in console right away or is it just waiting for the entire inputs to be completed before it does any sorting i was assuming when i run the command i will see the following right away wait sleep then print the remaining unfortunately i dont see anything until the sleep is completed then the entire results is printed out,0,41,199 i have a small problem with engine runandwait i have a program that s detects and recognizes faces but thats not the point while im trying to include voice follower it is actually does saying and then after a few seconds the whole program is just crashes could you please help me thank you in advance,append to issue description using jira python api i ve been trying unsuccessfully to append to the description of a jira ticket using jira python and the following code updated description description n jira object fields description where jira object is the object containing the ticket data and description is the text i d like to append when i look at the attributes of this object i do not see anything containing the ticket description is there a way to pull a jira ticket description using the python api,0,54,84 why does playwright not change url once button is clicked on uber eats essantially i want to enter an address into uber eats and go on to the next page however i have noticed that the url isn t actually changing once the button is clicked i have tried doing the same thing by specifically targeting the find food button on the landing page for some reason this doesn t actually change the page help would be appreciated thank you,how to deal with different arguments that may have similarly named dest let s say you want to use subcommands and at its core the subcommands want the same object data points to be stored in namespace but perhaps grouped by subcommands how can one extend argparse but not lose any of its standard behavior while achieving this for example the above example just tries to explain my point but the main issue is that what happens is that when the above code executes parse args returns a namespace that just has rawr n but what if my code distinguishes behavior based on the subcommand so its important that there be an object that has an attribute rawr within the namespace object for example if args only has args rawr then you cannot discriminate action or action they both are legal actions without the additional nested layer,0,78,145 i want to check band skipping in antenna machines tested data by compare two csv files using python one is tested file and the other one is reference comparative view firstly program open st csv reference file and read all antenna bands data then open other tested phone file and compare antenna bands whether any band skipped or not in tested phone data,what happens after getting max value of map object in python hi i found out that when next nums is executed stopiteration is raised i thought only the max value of nums would be removed from nums after max nums was executed but are all the values of nums removed after max function is executed looking forward to help thanks,0,63,58 create a new column in data frame based on the range found in another column and a common column i m trying to create a new column in a data frame based on values from another data frame df is df is i want to add zone column in df based on two conditions output df,average of one wrt another or averageifs in python i have a pandas df as displayed i would like to calculate avg rate by dc by brand column which is a similar to averageif in excel i have tried methods like groupby mean but that does not give correct results,0,55,50 how can i get the last name in a path next to the right of a character using re on python i have been trying to make a good regular expression that catches the last name of a file or folder for a given path meaning that for instance the following path c users resetstorex pictures can be reduced to pictures what i have achieved so far is the following re which reduces the previous path to x pictures any ideas,is there a way to reorder a dataframe s column using a user defined list i m currently working on a project where i have to process d arrays using pandas numpy is out of question in the context for reasons i can t explain i have a dataframe that looks like so which yields something like so example initial dataframe i want to swap all the rows in a given column with another set of rows for example i want to change some id order to without losing the order in the other columns basically i want to swap a list of rows with another list of rows this would then be the result after swapping the initial dataframe using the list in this paragraph i would also like to mention that the number of element containing the same value may differ so the initial dataframe may look like so here s what i tried so far none of them worked this solution seemed to work to find the right rows however it fails to swap rows and creates nan values on the whole row i m sorry for posting so many images i m out of ideas and time is running on my side thanks peeps,0,79,213 how to use wildcard in numpy array operations for instance define a numpy array with numpy str format and doing the replace operation supported by numpy char the returned result would be a b c d e f g h but i i i d i i i h is expected,convert tradingview script into python i am looking for a converting from tv to python just a little code this is the code in tradingview for variable longcond and shortcond i have the right value i compared between plot but for others i have some differences i think because of last signal this is my code in python are there errors in my script in python,0,37,70 extract element within string into nested list i am working on a routing project the route looks like this cnshg b pamit r coctg b ushou r coctg b usmsy and i want to break it into a nested list also a route contains multiple segments for example cnshg pamit is one segment transported using b and then pamit coctg transported using r i e rail and so on input the output should be like this i have tried using regex and the below codes but it didn t work thanks a lot,compile python class with numba i am using the numba jitclass decorator to compile a python class honda that takes another python class car as input argument numba can t identity the type of the type of python object class how can i simply use any python object of any class type inside a class that is compiled by a numba jitclass and add class members njit methods to be used is there any better way to achieve this rather than a numba jitclass,0,79,84 i created a virtual environment in my editor but when i wanted to activate it by this code kivy venv scripts activate editor gave me error message the error message was cannot be loaded because the execution of scripts is disabled on this system please see get help about signing for more details can you help me,need to evaluate a mathematical expression using a for loop i have this code already for a calculator that takes string input but i want to replace the eval function with for loops to evaluate the expressions and yield the same result would that be possible,0,54,46 accuracy in classfication report lower than best estimator from gridsearchcv i performed a grid search on an mlpclassifier why the accuracy in classification report is not identical to the highest split test score in this case in the dataframe output code,is there a way to listen for updates on multiple google classroom courses using pub sub trigger a function which updates cloud firestore when a student completes assignments or assignments are added for any course the official docs state that a feed for courseworkchangesinfo requires a courseid and i would like to avoid having a registration and subscription for each course each running on its own thread i have managed to get a registration to one course working and am successfully able to subscribe to those updates alongside my fastapi server the registration and subscription initialization i would very much like to avoid running multiple threads while still being able to subscribe to changes in all my courses any advice would be appreciated,0,43,123 why is there a difference in how the in operator behaves this works perfectly but when i apply the in operator to an array like this it fails,how to search for a value in two different type of field or index or heading of mongodb using python i am new to any kind of programming this is an issue i encountered when using mongodb below is the collection structure of the document i imported from two different csv files the first two entries are from a csv and the next two entries from another csv file now i am creating a user interface where users can search for a telephone number how to write the query to search the telephone number value in both the index telephone number and telephone number using find in the above case if not possible is there a way to change the index s to a desired format while importing csv to db or is there a way where i create two different collection and then import csv to each collections and then perform a collective search of both the collections or can we create a compound index and then search the compound index instead i am using pymongo for all the operations thankyou,0,28,181 how to get all combination node given dictionary and list and sort by the longest node in python how to get all combinations listed from a given dictionary in python my dictionary input desidered output sort by the longest node,bow not considered all elements i m working with the possibility of applying the bow method to generate vectors for represented chords however when i use this method i can generate the vectors but not all chords are considered here is the code elaborated see for example that chords like c d and a are not counted does anyone understand what i might be wrong,0,42,64 how to get column names sql in python i want get a db into pandas df in python i use a following code this code works but i want to get column names as well i tried this question mysql get column name or alias from query but this did not work how can i get column names from db into df thanks,how to declare instance variables in abc which implementations could have different types i have an abc that there will be an instance variable let s say record in all of its implementation classes for readability i want to let readers know the instances of that abc are supposed to have a record instance variable however the type of record varies in different implementation classes and i want to avoid having my abc specify all the possible types that record could use e g record djangomodela djangomodelb in abc because this sounds very not right to me here is a simple version of my current code which mypy complains how should i declare the abstract base class to make mypy and me happy with it,0,63,124 how to retrieve data from mysql database in django and display it in html page i am trying to retrieve data from mysql database and display it in a html page using python here is my view py models py html but i didnot retrieve anything any help will be highly appreciated,multithreading multiprocessing with a for loop in python i have this task which is sort of i o bound and cpu bound at the same time basically i am getting a list of queries from a user google search them via custom search api store each query results in a txt file and storing all results in a results txt file i was thinking that maybe parallelism might be an advantage here my whole task is wrapped with an object which has member fields which i am supposed to use across all threads processes a list and a dictionary therefore when i use multiprocessing i get weird results i assume that it is because of my shared resources i e my dict contains key value pairs of query name list my list is a list of queries to search in google it is safe to assume that it is not written into for each query i search it on google grab the top results and store it in my dict i want to do this in parallel i thought that threading may be good but it seems that they slow the work how i attempted to do it this is the method which is doing the entire job per query this is the method which is supposed to execute all jobs for all queries in parallel the above execution does not work i get corrupted results when i use multithreading however the results are fine but very slow any help would be appreciated thanks,0,50,244 im trying to copy array but both of them has the same link im using python my code is both of the variables are now but i dont want to apply changes to variable a what should i do ive tried to use the c b statement but it didnt help,converting an sql query to pandas i have the following sql left join query to be converted to pandas join i tried the following code in pandas but some where i am getting wrong is this equivalent one or any suggestions please suggest struck here,0,54,44 python shell how to capture value out side scope in shell script which has embedded python code the below embedded py code and get a value from shell and again in python code scope value updated and to be used shell script scope i am not getting the output value of pvar variable which is at last line,is it better to make custom registration with editing django usercreationform class or make it on a new table and class i wanted to make a django authentication but i was confused about wichone is better is it is better to edit the venv lib site packages django contrib auth forms py file and make my custom form and edit db on venv lib site packages django contrib auth models py or it s better to make my authentication system with model and views and forms on my application,0,60,72 how can we create object in desire database in rest framework i m creating project but that project is saving in the default database i want to create that project in other database i m using creatapiview i don t get it how can i use that using otherdataname in get serializer,increasing a value each time a function passes through a for loop i am trying to make a for loop that returns response json i from an api with i increasing by each time through the loop example my goal is for get url to run times each time printing the response associated with the increasing i value sorry if this is worded poorly i am a total beginner and self taught thanks in advance,0,47,75 how can i make some commands only work if you have a specific permission with python i have a command clear which clears a specific number of messages i do not know how to make this command work if you only have the permission administrator if anyone knows how to do this that would help me a lot and here s my code,unable to login site selenium i m trying to do log in into my university site but i receive this error this is the code part and this is the site inspection,0,62,31 changing an double array field to a single array in hive or pyspark i have a field interest product id which looks something like below the schema is as below as the field interest product id is of array type and also the element is array string the field shows how can i convert it to a array string expected outcome please suggest the best way thanks,django it takes a long time to filter the m m model from the m m connected model by specifying the field values of the m m model the m m through table has about million rows the slowdown is probably due to the large number of rows but i m sure i m writing the queryset correctly what do you think is the cause it will take about ms if you do filter by pk instead of name it will not be that slow query issued explain analyze verbose buffers,0,65,84 dash plotly dropdown puts selected value on the right side this just a small thing but i hate how the selected label is aligned to the right while the options in the dropdown are on the left side i would like to center it or even better put it on the left side,get confidence probability scores for each predicted result in catboost classifier i have built a machine learning model using catboost classifier to predict the categoryname of my result as per below screenshot however if i get an unknown as input or any input with which the model has not been trained with then i need to return it as null my idea to approach this is was based on the probability of confidence score as per below scrrenshot expected output for known input the model would have high probability score and for any unknown unseen input the model would have low confidence score how can i achieve this and add probability column to my predicted results as per below screenshot expected output code i am working with output of above code on predict proba is below sample input trained dataframe screenshot expected predicted output is as below screenshot and yellow highlighted is the one which the model has never seen before or trained with so the probability is low and i can write a if condition to omit that as per my requirement,0,53,184 how to check if a property exists in a foreign key model i have a model named product in both foreignkey s i have the same property named number i want to check if that property exists in product model or in its foreignkey s models what i am trying to do is,rebasedata to read backup files so i am trying to read a bak file and from googling it seems rebase is the way to go however i keep getting traceback error traceback most recent call last file c filepath line in from poster encode import multipart encode file c filepath pythonsoftwarefoundation python qbz n kfra p localcache local packages python site packages poster init py line in import poster streaminghttp file c filepath appdata local packages pythonsoftwarefoundation python qbz n kfra p localcache local packages python site packages poster streaminghttp py line print send repr value syntaxerror invalid syntax rebasedata code how do i actually get this script to run thank you note i replaced my original file path with filepath,0,51,85 python how can i print an alphabet from a list given a number given a number from to i m trying to return an alphabet in the corresponding position from a list example i have tried the following as expected that returns a type error because there are no integer values in my list what can i do to return an element from my list in which its position is equal to the users number input,tkinter enable all the dropdown items from a menu item i have checked on a possible duplicate like this however the recommended action is that i disable the menu item itself my main aim is to enable all the menu item on each frame switch to make sure that only the ones i need are disabled as the frame switches i m talking about frame switches because my application works by having one main content frame which gets cleaned whenever a new window layout is required making it so that i don t have to generate a new window for major changes inadvertently one drop down item of a menu item may no be required by another layout so the best option would be to disable it which then brings up the problem after layout switches i am faced with most if not all drop down items of a menu item being disabled if you look at this sample code this is required due to me using the same menubar for each layout a possible fix is just making each layout generate their own menubar but that sounds a bit wonky and seems more of a bandaid to the problem than a fix and also because it sounds like it will require considerably more resources than just enabling them all again and then disabling the ones that s not required i m currently at a lost on how to further approach this many thanks for help or advice,0,77,245 keras functional api imcompatible layer problem i was trying to make ddpg critic s neural network layer with code and i got problem about it would be thankful if you point out the problem and how to solve it,coarsen xarray dataarray with weighted mean let s say i have some dataarray i want to downsample this array to x chunks i can do this with the coarsen function as i understand it this is basically splitting the dataarray into x chunks and averaging each chunk into one value however what i want to do is take a weighted average of this x group so the center points are weighted more heavily in the final mean than the edge points i can create a gaussian kernel with weights like this where window is now a x array with the desired weights for each point however i am unsure how to implement this window kernel when doing the averaging in the coarsen function what is the best way to do this,0,37,129 python discord bot isn t joinig voice channel the bot doesn t join i don t know what i did wrong it should only join my voice channel nothing else i watched this tutorial but as i said it didn t worked,how to cache a function that takes a database connection as an input using streamlit i have a database connection subsequently i have a function this is part of an app in streamlit that i m working on i need streamlit to cache the output of my load data function i thought it worked like this but this gives me the following error the error is much longer and if it helps i will post it the error also contains a link to the streamlit documentation i read it and reformulated my code to look like this but this gives me a nameerror i ve run out of idea s to try any help would be highly appreciated it is very possible that i misunderstood the documentation as it assumes a lot of prior knowledge about the process of hashing and caching,0,38,138 copying files between folders of jupyter notebook i want to copy files from one folder inside jupyter notebook to another folder for example there are some ipynb files text files excel sheets folders hi now i have created another folder named hello and want to copy all the contents of folder hi inside jupyter itself so what will be the desired path to copy,how do i reset the underscore in an interactive session i have overriden the underscore variable in the python interactive interpreter how can i make the underscore work again without restarting the interpreter,0,65,34 python image search function sends small image i am trying to make a program to search for images but the function sends small images how can i fix this for example if the original image is x it will reduce to something like x,how to handle nan values when writing to a database which expects something else than type float i m working scraping project and i m working with postgres i ve set up all tables by hand which include the typical data types like datetime integer text and floats but i run into an issue since i scrape many fields there are always some fields missing and they become nan and since nan is type float i receive an error when i m trying to push a float value into a column which expects a for instance datetime or text object at least i believe so the error message isn t very clear i m basically using pandas only df to sql after i ve created the tables by sqlalchemy s declarative base my process is like as soon as a value within the current scrape obj get data doesn t exist it becomes nan and since nan has type float i can t post it into the table which expect anything else but float can t diagnose it very well but i expect it to be the described reason above is there any way around does it make sense to df fillna none or is there any keyword available i m not aware of,0,44,194 transferring code from a file main py in jupyter notebook i am trying to run the code in jupiter notebook but the figures in it do not run help me to display the btc graph in the pandas dataframe using the matplotlib library,expected an indented block in pycharm using pygame file c users admin pycharmprojects pythonproject main py line running false indentationerror expected an indented block expected an indented block,0,43,25 how can i send a message without a command i want to send a message without command if a condition is true i wrote this code but it doesn t send any message,argument of class is not iterable so i m trying to replicate the enigma machine and one of the things i m trying to make is the plugboard so the class pluglead is meant to establish a connection between two letters plugboard has two functions add which adds the connection between two letters to the plugboard and encode gets the linked letter i get the error so i think i get that pluglead string doesn t return a string but i m not sure how to get it to return a string so i can use it in other classes,0,32,95 how to use pandas to rename rows when they are the same in column a my dataframe is i want to use pandas to rename hospital when a row with the same value in the hospital column has a different value in the generalrepresentation column and when a row with the same value in the hospital column has the same value in the generalrepresentation column no renaming is done for hospital the effect i want is shown below,value is not updated in the if statement i know this is a silly question but i would like to know why dictx is not being updated the functions returns dictx value ignoring the if block thanks,0,79,37 how to access postgresql database from android mobile using python i wand to access the postgresql database from android using pydroid application in my mobile phone to access postgresql database i need to import psycopg but android doesn t support this can anyone please suggest the way to solve this issue,openvino where is deployment tools folder everyone recently i need to convert an onnx model into intermediate representation so i git clone the openvino but i didn t see deployment tools folder in the project even i install it by following the installation guide also another problem it seem that openvino support python i run the cmake by these command that should make the python support the openvino calling i guess import openvino after it successfully cmake and make jobs i try to import openvino and it does not work so i want to ask how i can use it in python,0,50,99 how to split strings with double letters python i have been thinking about it for a while now and decided to ask for your help for instance i have a string abcdefggarfse or abcdeefgh my problem is that i would like to split these string at that point where the letters are doubled abcdefggarfse abcdefg and garfse abcdeefgh abcde and efgh thanks a lot,different upload and download urls for django models s image field i need a way to have different upload and download urls for imagefield i want to upload the image to aws s and while accessing the image i want the image to route through cdn in my case fastly just like i am specifying upload path in imagefield i would like a way to do something similar for accessing image it also seems that i cannot modify avatar url once it is created is there any way around if there is any way i can override the model s behaviour to modify the url while accessing,0,68,104 wxpython import widgets from other classes i m a beginner in wxpython and i ve tried experimenting splitting up the code to make it organized and look neater i ve tried it with simple code but it doesn t work can anyone please give me a hand the code i ve tried problem textbox doesn t show up which is supposed to be the main point,issue while inserting count vectorizer results to the dataframe i have a dataframe with shape and then other dataframe with the shape i need to combine both these dataframes column wise so technically resultant dataframe should be of the shape but am getting as am not able to understand the issue code which i have used result,0,62,65 don t understand why map returns iterator makes code to fail i have some code that does in python it works fine but in python i debugged and delete table id range function is never called i know that map returns now an iterator so i changed the map to become a list with and only adding this the delete table id range function runs i don t understand why is this happening can somebody explains,how to copy files listed in a text file but skip if the filenames does not exist i am copying a list of images from one folder to the other the list contains some image names that is not in the source folder i have to copy only those image names that are both in the list and the source folder and ignore the missing names,0,70,66 label elements within a group in numpy i know how to label elements of one input array like the followings now there are two input arrays including group and value arrays a label resets on the first element of a new group it is if the corresponding value is otherwise it starts from how could i do it without spliting arrays or iteration,bohek customcs callback failed i am using bokeh to do a dashboard and i would like to create a confirm button when user press on the confirm button the savebutton will appear the disabled property of savebutton will change from true to false i have tried it with the following code and it seems like i have made something wrong should i pass the button arguments to javascript i am not very familiar with javascript thank you for your help,0,66,80 increase height of select graphs in subplot i have the following code that produces the output below i would like the same exact output but i want to double the height of the bottom graphs while keeping the size of the top rows of graphs the same using my current code as a starting point is it possible to do so,python how to add items to a menu of an ipyvuetify toolbar i would like to find out the way to add items to a toolbar menu created with ipyvuetify the code above displays the tool bar as follows but i dont know how to add content to the menu like buttons and or input fields does someone know how to code the menu and add it to the lateral toolbar menu symbol thanks,0,63,73 how to iterate over column names and rows at same time how can i better iterate over d field names row code so i don t need to have one line for each column i m trying to make a code independent from the number of columns in my query,how to avoid auth page using google drive api with pydrive i m automating uploading files to google drive using pydrive i m trying to avoid the authentication page that shows google every time i authenticate with the api i ve read some blogs about it but i dont get anything clear,0,47,49 typeerror missing one required positional argument event im making a paint program and i keep running into this error however if i change where event x event y are defined the same error comes up but with a different subroutine here is the code how i am calling the class the error i keep getting,modulenotfounderror no module named pssh i am using python and i got the following error modulenotfounderror no module named pssh on trying to use the library as follows from pssh clients import parallelsshclient i tried installing pssh as follows pip install pssh inside a virtual environment but the error didn t go away which library has to be installed to make the above import work,0,53,65 django django filters in a class based views i ask you if you know how put this filters in this class view i used to build my applications using function based views and this is my first time use class based views any idea,numpy mean cannot get other axis i have my numpy object as my goal is to get a list array of averages in all sub arrays i e get the list i am getting with both np mean and np average which is the average of all first all second all third elements i tried added an argument axis but then i am getting the error i tried casting my object to np array but this made no difference as i commented this is a minimal reproduce of my problem,0,42,94 mocking namedtemporaryfile in python unnittest i have a function like below i am trying to test the xcom push key value but i can t figure out how to mock the namedtemporaryfile i have the following test i get the following error when running the test typeerror expected str bytes or os pathlike object not magicmock i am new to mocking an having trouble figuring it out any help would be appriciated,selenium common exceptions webdriverexception message in python selenium the following codes run with python selenium without an issue but after upgrading selenium package from to code above doesn t work anymore the complete exception messages nothing is specified after selenium common exceptions webdriverexception message i couldn t figure out what goes wrong chrome version and chromedriver version is as follows any help would be appreciated,0,68,61 pandas shift values from one column to other and drop duplicates using python suppose i am getting a dataframe like this how do get a dataframe such that i will be left with this output this is how i am getting my dataframe how do i shift the numbers from name column to value column please help,spotipy index out of range when trying to retrieve album ids so that i can get their release dates i am working with this data which i extracted from a public playlist and shows all of the number s since with their audio features i am now trying to loop through and find their album ids so that i can retrieve their release date and plot their audio features against other time series data using this code it works for the first and then returns nothing without the if statement it returns that the index is out of range i have tested the th element by hard coding in its album name and it returns the correct result this is the same for the next in the list so it isn t an issue with the searching of these album names i have played around with the lists but i am not entirely sure what is out of range of what any help is greatly appreciated,0,57,168 how to make a single image using several images i have these images and there is a shadow in all images i target is making a single image of a car without shadow by using these three images finally how can i get this kind of image as shown below any kind of help or suggestions are appreciated edited according to the comments i used np maximum and achieved easily to my target,extracting floating values from a string in a dataframe i have the following dataframe df the dtypes of the result column is dtype o i need to extract the float values and filter them with a particular threshold i tried the following script to extract the values and change them to float however i m not sure if i m getting the right output especially when the value has a range in this scenario i want the max value i e desired output what would be the smartest way of doing it any suggestions would be appreciated thanks,0,72,96 pair wise distance of points with pair specified by incidence sparse matrix in my code i have an array of point position and a sparse incidence matrix for every non zero ij element of the matrix i want to calculate the distance between the i point and j point currently i m extracting the indices with the nonzero however this method sort the output indices and this sorting is taking most of the execution time of my entire application,keyerror after re running the same code a keyerror is returned when i try to run the below code my dataframe has the following columns i know that there are many questions on the keyerror name but what was weird is that without changing anything this error appeared while running the code but previously i could run the code with no errors nothing has changed any help on this would be great traceback,0,73,72 how can i apply base html file for extending to every template in django is there a way to extend base html file in python django by default i want it because i am overwriting extends tag in every html file,telethon respond to a message using the message id i want to respond to a message in a telegram channel using the message id from the message to respond to with python example is there something like that,0,41,38 error with installing and importing gtts in python i m facing this issue whenever i am installing and importing gtts issue in installing issue in importing i did pip install gtts and imported from gtts import gtts thank you ps python version,filter dataframe based on differnce between multiple columns i am working on the following dataframe df i need to keep only that name where any val column increase by more than from the previous val column if one column increases by less than from the previous column or doesn t even increase we need to drop that name desired output what would be the smartest way of doing it any suggestions would be appreciated thanks,0,43,76 issue in navigating aspx pagination using selenium i would like to scrape this url to iterate over pages and get their content that s what i have tried and i get pages out of specifically the visible page numbers in the url how to paginate all pages in this url,how to access items from ndarray with dtype object how can i access data inside a numpy array with dtype object the following raises an indexerror,0,51,24 how to query on multiple filters in pymongo s find one and update method i am trying to use pymongo s find one and update method to update some values in mongodb but i need to filter based on two different conditions and this does not seem possible i tried passing in a list of filters akin to name name date date but this did not work is there no way to filter on multiple conditions with this method how else can i achieve this thanks,programatically added widget not shown a programatically added widget is not shown dear community as i need to add some plain text i will elaborate i try to add a widget to a floatlayout in kivy and i would expect it to show up on top of the existing label but it s not shown what i m doing wrong python file test kv file thx martin following the hint of furas i changed the kv to still no luck hi is not lurking hidden somwhere,0,78,84 simple salesforce result from bulk insert upsert i am trying to match the output results to the input rows and from my test it looks like bulk operation will return the result the same order but is it guaranteed,discord py kick command errors with list index out of range we have user bob and i try quickly kick him using only nickname kick bob and when i do that it throws an error indexerror list index out of range how do i can fix it,0,37,47 kivy lack of the top bar and window stretching functionality software versions i have a fresh install of kivy and this is my beginnings with this frimware when i run any kivy program i don t see the top bar and window resize functionality i looked at a lot of tutorials and this functionality is by default everywhere why is it not on my computer,not able to redirect the forms in my website and show success message in django i am new to django the form takes input from a user and saves it in admin and also sends mail to my email i am trying to get success message after clicking on send message but i am not able to get the success message also i want page to redirect in same contact form and cleared input fields thankyou my views py my html page my forms py my urls py,0,65,84 unhashable type dict error in memoize decorator i m writing a memoize decorator but i get a unhashable type dict error when trying it on a simple example here is my code and here is a simple function created to test my decorator i end up with this error i tested just in case if my python was working properly with not in which resulted in the correct output true any help would be appreciated,passing list to adf i have a python function that returns a list of items as a string as part of an adf pipeline using when adf picks this up it is littered with escape characters how can i get this list out,0,77,43 unable to install requirements txt i am getting below mentioned error when i am trying to install dependencies psycopg psycopg h fatal error libpq fe h no such file or directory include libpq fe h depends libpq ubuntu but pgdg is to be installed,what does event pos mean in the pygame library i saw an example using it to get the x axis of the cursor and ignore the y axis i don t understand how it works i don t know if i understood the purpose of this function wrong i tried to search what posx event pos means but all i found was that if you want to take x write the code of posx posy pygame mouse get pos and then take posx but i still can t understand the method he followed in the example i saw,0,41,87 appending lists of list with column values from an array i have arrays of x in a list that i want to append to a list of lists where each list is a single row x from each array for example convert this to how can i do this thank you in advance,python re sub removing words between two delimiters under different cases i have a string that contains patterns like how can i use re sub or other methods to edit this string to or i can remove the s afterward i tried using for loop to hard code it but the string is too long and takes a long time to run,0,54,60 i m trying to use gpg with a pypass password store and am missing a file how do i point the python program to gpg id i m getting the error message when trying to use pypass a very intuitive password manager with the command,installing waymo opendataset on windows i am trying to install waymo open dataset in the windows environment however when i try i get the following error python c users pip install waymo open dataset tf error could not find a version that satisfies the requirement waymo open dataset tf from versions none error no matching distribution found for waymo open dataset tf how to resolve this,0,42,55 python optimizing code that checks key in multiple nested lists dicts i have a looping python code with the following nested structure situation question i was wondering if the following code can be written in a shorter cleaner way,how can merge with key and list of keys in pandas dataframe there is a key in df and df has a column having list of keys df df i d like to merge df and df using key column and keys column and keep first in case of duplicated values ex d df,0,41,52 why i keep getting high and fluctuating loss what is wrong with my code i am trying to train a model with minist dataset first column of the dataset is number labels the size of the dataset is x number label x image what is wrong with my code results,not able to download pyqt tools i am trying to install pyqt tools on a windows os every time i try this via the terminal with pip install via the terminal i get an error saying that it is not compatible with python version however i have python version downloaded on my computer,0,57,54 expected str bytes or os pathlike object not dataframe i tried to load embedding file for parts of speech analysis with nlp but it shows what s should i do,not able to click on a button in selenium python bdd framework i am not able to click on a button save on selenium webdriver in bdd framework i am able to click in general script but when i execute same script through bdd framework it doesn t work please help me on this i have tried with below codes i have wasted more than two days on this button the same element works with normal script execution without using any frame work working script below thanks in advance,0,27,87 why doesn t ffmpeg work when using yt dlp in python script i m trying to download a video using yt dlp in python but i m reaching an ffmpeg error in the log ffmpeg is installed through pip and added in path,how do i read the output of an external program while it is running in python i m trying to make a bot that controls a minecraft server and i ve managed to make start and send commands to the server however i can t get the output of the server while it is running what i have now will only send me the output after the server is terminated kind of like a log i would like to be able to use that server information to create a console,0,38,87 what would be the time complexity of this backtracking algorithm for finding permutations i am trying to determine the time and space complexity of this algorithm i created to find all permutations of an array in python is the time complexity o sum k n p n k where p n k is a permutation with k factors,merge all txt files in dataframe pandas i have a series of txt files in a folder and i wanted to move these files to a data frame but i only managed to do this by saving a csv file how do i work with the data frame directly without having to save to a csv file follow my code below,0,51,61 getting syntaxerror invalid syntax when using elif i m getting the following error when i run the following program this is the code that i wrote i was under the impression that this line was written properly,pandas styler does not maintain rounding i would like to round off pandas dataframe and then add a title to it but pandas style set caption command ruins the rounding example result how can i add a title while maintaing rouding,0,36,39 how do i make a dataframe from two dictionaries based on matched keys the idea is to make a pandas data frame with the following two dictionaries the keys are ids desired data frame output based on the matching keys the id x z only exists in d but not d so it is not included in the desired output,why i keep getting high and fluctuating loss what is wrong with my code i am trying to train a model with minist dataset first column of the dataset is number labels the size of the dataset is x number label x image what is wrong with my code results,0,60,57 fix snowballstemmer error attributeerror english object has no attribute default hello there i am using the package snowballstemmer and i am getting an error i am very glad for any kind of help code error here,how to print the first ten results of the code how could i print only the first results of my program i tried creating an empty list but could not store the results properly to then print them,0,37,39 writing a unittest with pytest i have a column in my data frame and t should have a yes values but my unit test code has an error here is my code the error is,how to choose a batch for train on batch i was reading into how the train on batch function in keras works my understanding is that it only trains on a single batch someone on here said that if you feed in images and your batch size is your network will only train on two images which two images in particular just the first two once the batch is chosen does the training work the same as in fit for context i m trying to reproduce the function from scratch,0,34,87 python bitshifting vs php bitshifting i have a code in python which uses right bit shift and it returns the correct value but the same way i tried to shift right in php it returns python code php code i have a very little experience in maths functions would be great if someone can help,how can i get the names in this html code by python i want to get both of names justin cutroni and krista seiden without the tags this is my html code that i want to get the names by python i used beautifulsoup but i don t know how to get deep in the html codes and get the names,0,56,60 sh api access token so i have a code here written in python to generate an access token from the api using the secret key and consumer key provided by stubhub when executing in command prompt i keep getting an error in line saying traceback most recent call last file c users desktop python py line in access token token respoonse access token keyerror access token any suggestions thanks,can i optimize three parameters with a distributionlambda layer i need to create a neural network layer to optimize the three parameters of a generalizedextremevalue distribution that are loc scale and concentration but when more than one parameter is passed to a distributionlambda layer all training metrics are nan and the output distribution is empty plotting the x train and y train it seems that the input datasets are right anyway the neural network outputs a distribution with nan instead of mean and stddev i tried changing the batch size the epochs and the number of outputs from the dense layer but nothing worked,0,63,101 using pysftp to connect via jump server i am trying to upload a file to my home network via pysftp my local device is connected via wireguard to a vps i can use ssh jumps to connect to the local device with is there any way to do the same with pysftp,how to add outliers to a linear regression dataset i am trying to play around to see how outliers in a dataset might affect a linear regression model the issue i m having is i don t exactly know how to add outliers to a dataset i ve only found loads of articles online about how to detect and remove them this is the code i have so far and this is the output my question is how can i add outliers to this clean dataset in order to see the effects outliers will have on the resulting model any help would be appreciated thanks,0,52,102 add links internal pages of pdf file with python i have a python routine that builds a pdf file of around pages i would like to add something like an index page with links to pages inside the same file i would like to know if that is even possible,running flask app in conda virtual environment i am very new to flask trying to run my flask app from conda virtual environment the steps i ve taken are as follow in anaconda prompt base i run then i navigate where the app py is after i do for which i get the following error i wonder what am i doing wrong here is it not possible to run flask in conda vm also despite i set the end to development i still get a warning why is that so,0,51,88 how do i get data from a div in python i m writing a python script that should return a text from a div the html looks like this so my script should return from wikipedia the free encyclopedia but it returns nothing what am i doing wrong,shamir s secret sharing doesn t work with large ints i am to use a python example of shamir s secret sharing from wikipedia when i give it number a larger than it gives completely different output why doesn t it work after that number and is there a way to get around this,0,48,51 when i am fetching the data of students by city in tkinter it s only show last value as i mention i want to print data of student who s belong from city but in label it only shows one data and terminal shows all the data i am using for loop to print data here is text file expected outcome if selected surat then,how to find unique key value from list of dictionary to create new list i have below list i have to create another list from the above list where producer and state are unique so the new list will look like to solve this i first get all the unique producer names and then compare the producer for each asset with the producer unique list only adding entries where producer state is unique but it looks like this logic is not working can anyone please suggest some good way to solve this thanks,0,63,92 python read datatype linestring from csv i am trying to read the linestring datatype into python from a csv file could someone help me parse it efficiently this is what i have so far i am trying to avoid using geopandas for now as my anaconda install is borked,log message not displaying on console below is the code i am trying to run but the log message is not getting displayed on the console i am running code on pycharm with python,0,49,34 creating emr cluster based on ami using boto i have a custom ami i want to create an emr cluster based on that ami using boto i checked the documentation found cli version but didnt find about boto version cli version can anyone please help thanks,display elements in different columns i want to place those two elements in different extremes of my window so the label will be placed on the left and the button in the right as in the image below i tried different styles of layout management as pack and grid but cannot solve my problem main py tkinter window app py schedules py,0,47,59 dijkstra algorithm to select randomly an adjacent node with same minimum weight i have implemented dijkstra s algorithm but i have a problem it always prints the same minimum path while there may be other paths with the same weight how could i change my algorithm so that it randomly selects the neighbors with the same weight my algorithm is below,how to leave gaps in plot of incomplete timeseries i m plotting timeseries with gaps observations come from different dates and lags between consecutive datapoints within each day are on average about seconds on some days observations window is just a part of day e g from to which results in huge gaps in merged series containing all days i d like to plot merged data but leave gaps between days empty instead now there is some kind of linear interpolation on the plot below you can see blue plot of data and red dots above x axis values that are really present in data i find it misleading for example sometimes lines in gaps are on y and due to it i initially though that device this is power consumption data was inactive in that periods and value of y was when in reality we just don t have data for that periods at all what can i do to prevent matplotlib from plotting lines in gaps this is how i created the blue plot edit i ve found someone with opposite problem i want my plot to look like in this question but i don t know what should i change in my code,0,60,207 pandas group by cumsum with a flag condition assuming i have the following data frame i want to create a cumulative sum of the nums grouped by user only if flag so i will get this so far i was able to cumsum by flag disregarding the group by user or cumsum by user disregarding the flag i need help making them work together,how can i fix a typeerror not supported between instances of str and int problem i am new to python and i am trying to make a game i am making a zodiac code and each time i run it i get typeerror not supported between instances of str and int i know that i am missing an int input but i am not sure where to put it here is my code,0,66,74 how to read sqs message using lambda python in aws i have tried to read message from sqs queue using boto client in lambda python but i face issue with errormessage sqs serviceresource object has no attribute receive message couldnt find the root cause anyone help on this my code in lambda,count number of occurrences in csv file i want to be able to make a bar chart with the number of occurrences of a certain room stored in a csv file the number of rooms is not defined in the beginning this is the data stored in the csv file this is the type of graph i want to show but with the code i currently have it doesn t show the number of occurrences what can i do to solve this problem this is my code so far,0,51,88 how to summarize a dictionary per year with only reduce and map i imported a csv file using csv dictreader and converted the dictionaries into a list in this list of dictionaries i need to count the number of type and type actions sum of them for each year i would like to avoid using repeat loops and just use reduce and or map i need the following output,how can i add a bytearray image to qlabel in pyqt as in this example i am importing an image from my system but i need more clarity about if i have a class bytearray how can i use that inside my qlabel if i directly pass class bytearray image to qpixmap it won t work and returns typeerror qpixmap argument has unexpected type bytearray,0,69,65 put shared axis labels to upper plot returns this figure but i want the x axis labels below the first plot not the second like shown below how can i achieve this,python regex how to substitute multiple occurrences with a single pattern i m trying to make a fuzzy autocomplete suggestion box that highlights searched characters with html tags b b for example if the user types ldi and one of the suggestions is leonardo dicaprio then the desired outcome is leonardo dicaprio the first occurrence of each character is highlighted in order of appearance what i m doing right now is results in now i want to replace each occurrence in the result groups with b whatever in the result b and i m not sure how to do it what i m currently doing is looping over the result and using the built in str replace method to replace the occurrences this results in but i think looping like this over the results when i already have the match groups is wasteful furthermore it s not even correct because it checked the string from the beginning each loop so for the input ooo this is the result when it should be le b o b nard b o b dicapri b o b is there a way to simplify this maybe regex here is overkill,0,31,176 alternatively assign values to two column i have a dataset that looks as follows and i am trying to alternatively assign those values to two new columns called left and right something as follows is there a way i can do that,how do i merge items from a dataframe into a query i have a dataframe like this and want to combine these column into a query like this in python sel crd from t union select deb from t union select lon from t thank you,0,42,48 creating and filling empty dates with zeroes i have a dataframe df i want to fill the missing dates for each product id with restocking events to start i have created a date range dataframe using dfdate pd dataframe date pd date range simple date min simple date max where simple is some master dataframe and min and max dates are and,open a terminal with python but keep it running i am developing a distributed app with zeroc and to start all the servers needed we have made a script one of the commands to be executed is icegridregistry ice config registry conf so in the scripts it appears as os system gnome terminal icegridregistry ice config iceflix registry conf and it works but i need that terminal window being opened and active instead of being closed when the command is executed,0,50,72 vis js how to show only children descendents of selected node if not posible with vis js i could do the entire thing on something else but this functionality is crucial so show everything if nothing selected show only children with the from arrow of some node if that node is selected or to select the node in some list or type it somewhere,find numpy array with don t cares in a numpy array i would like to find a numpy array with don t cares like where is the don t care and find it in arrays like and return the row index s and for the above sample the a array are normally around rows shape note the b array can have don t cares any where or none examples,0,62,69 can t we iterate over integer using map in python here in line ans list map int num it s returning int object is not iterable can t we just change int number to list using map,python text based game display items get items i have got the movement down but can not get it to display the item of the room when you move into a room i also can not get it to pick up an item that is in a room i do not want direct code if it is possible i want to learn how to do it i am using a dictionary for the rooms and items and i have tried doing rooms currentroom item and rooms currentroom item both give me a key error i also need to know how to change the dictionary from go south to just south but you still have to use go south to move anywhere i could not figure it out either this is for my school project due on sunday and i have worked on it for weeks and researched for an answer and can not find one anywhere i have tried many things but none have worked the try and except method is the only one i could get to work for the movement and once you get to the mammoth fields i want to be able to fight the boss and check if you have all the items and if not than you die and game over but if you have all the items you fight the boss and win here is my code so far,0,33,231 how to resave a csv file using pandas in python i have read a csv file using pandas and i need to resave the csv file using code instead of opening the csv file and manually saving it is it possible,assert variable that can have different datatypes my x variable can be either string or int this line of code does what i need my concern is that i compare x variable against different datatypes can some unexpected problems arise because of that whouldn t it be better to always cast x to a string and do is there any recommnedated way of doing that,0,41,64 how to schedule code to run at a specific time every day need help to run code that automatically starts at pm every day on python visual studio code i don t want to print anything i just want to execute my commands like pg keyup enter for example only works with printing text,understanding behaviour of removing element from set during iteration i am aware that we shouldn t modify collection while iterating over it but that behaviour blew my mind could someone explain why does it stop and what is happening under the hood in cpython i tried to dissassembly foo function but got no answers at all i am talking about to explore what was happening i added some print statements results,0,51,72 how to shift items in an array by a k number of times shift the items in the given array by some number of times as shown in the below examples i have used the below to achieve the right rotate a list by k positions as of now able to obtain results for test but would like to achieve the test and test,nuitka error main py can t open file gen py i currently have an error with nuitka which i am starting to use i want to compile my script including a folder and its contents here is the command i use python m nuitka follow imports enable plugin tk inter onefile show progress include data dir c users user desktop myprogram datas datas myscript py but every time i ended up with this error and i don t have it when i remove include data dir am i ordering incorrectly or is this another problem thanks edit you must delete the temp gen py folder it will be re generated and problem fixed,0,63,89 id got null in json id null restapi python flask sqlite what to do if id is equal to null using flask framework i created table in sqlite with rows id author title while i run program id is equal to null id null in json format please help out to this i created files in python app py to run my code in flask framework and db py to create a database in sqlite app py flie db py flie,attributeerror nonetype discord py code error file main py line in on ready await member edit suppress false attributeerror none type object has no attribute edit i ve already enabled the privileged gateway intents and i don t know why i still have this error reason,0,77,39 add column dynamically and assign calculated value from another column i have some prepaid sales orders and need to assign the sales value to the subsequent months according to the number of months the sales order cover paid month the dataframe looks like this and it should look like thank you,python progress bar for non iterable process i m using this notebook where section apply documentclassifier is altered as below jupyter labs kernel conda mxnet latest p tqdm is a progress bar wrapper it seems to work both on for loops and in cli however i would like to use it on line this is an iterative process but under the bonnet how can i apply tqdm to this line code cell,0,52,67 how to find the closest date from a mysql query to a specific date i have a table in mysql which stores dates i also have a datetime variable called x i want to get the closest date from the table to the x variable i ve been trying to do something like but it doesn t seem to work any possible solution,how to save a variable to an array every time a while loop runs i want to save the result of my while loop every time it runs to an array then once all conversions have been run the array that stores all the values will be summed,0,61,48 how to get only the last folder and filename of a path how can i get the last folder and the filename of a path in python i am doing is there a simpler way,i am making a physics simulator with pygame python i have a menu issue my physicssim program is the main menu from which i import all the other modules after the specific buttons on the menu have been clicked my issue is that when i click the button and launch the program and then close it via the close window button i cannot reopen the program all my modules have booleans for the while running loops here is my code for physicssim main menu pendulum module code,0,35,86 how to ignore function arguments with cachetools ttl cache i m exploiting the cachetools ttl cache decorator not cached i need to ignore some params in the cache key e g working that way i get this what i need is there a way to get that using ttl cache,the sum of consecutive numbers i have to write a program which asks the user to type in a limit the program then calculates the sum of consecutive numbers until the sum is at least equal to the limit set by the user in addition to the result it should also print out the calculation performed i should do this with only a while loop no lists or true conditionals so for example if the input is the output should be and underneath that should be the consecutive sum if the input is the output should be and underneath that should be the consecutive sum right now i can get it to print the final result base and have gotten it to print out the calculation but it prints out one integer too many if the input is it prints out when it should stop before the,0,45,191 pandas merge overwriting lists in column how do i prevent mutation in the list upon merge as later i want to concatenate the images on both columns many thanks,trying to compare two outputs in an if statement in a rock paper scissors game against com i am very much a beginner trying to build a beginner rock paper scissors game i am having trouble comparing results between the player and the com random my if statement is not recognizing the com s move,0,29,54 how to get the number of servers your bot has joined and display it on the status of the bot i want some code that switches the status from playing help to playing number of servers servers every mins using task loop please help me,deprecation error pyspark doesn t supports python and prior to i was doing a pyspark course and was asked to do hands on on hackerrank platform well my code compiled successfully and passed all test cases but got stuck due to deprecation error pyspark doesn t supports python and prior to what should i do now,0,45,59 python selenium how do i download an mp file located under inspect network on chrome when i hit inspect network i see the mp file i want here is a screenshot when i double click the mp file it opens a separate page where the video starts playing how exactly do i download this video using selenium the html for the second page screenshot of second page,error trying to generate some faces and store in another folder i am trying to use transfer learning to train an image recognition model i want to generate faces in one of my folders into another folder this is my solution however running the code above keeps generating what am i doing wrong,0,69,53 edit confluence page via python script i need to access a confluence page via python script and change all use windows strings to use linux strings i can use want use this command inside of script,how to add a string comment above every single candle using mplfinance plot or any similar package i want to add a string comment above every single candle using mplfinance package is there a way to do it using mplfinance or any other package here is the code i used,0,34,52 how to extract elements based on condition they contains a specific element i d like to extract all href from item list that also contains class list item pay count every item is encapsulated in a div with class box information and has an a some of the items has lists with class list item pay count at the bottom of class list score only these items href i try to scrape,don t insert hyphens when using character wrap with gtksourceview i have a gtksource view with the wrap mode set to gtk wrapmode char when it wraps it inserts at the end of the line how can i prevent that in my research i found that the pango library has a attr insert hyphens new false function which returns a pango attribute but i don t understand how you re meant to use these pango attributes current code,0,61,68 problems with the serializer validator do not allow data to be sent in this question i had a problem to pass the user to the serializer which was solved but now i face another problem that the serializer validator stops sending user information and thinks i am going to create a new user views py my user model class errors,valueerror too many values to unpack expected while iterating over a list i have a list i need to split in two lists one list with keys where images are keys and other one with values tarfiles i am trying to create a string and then convert it to list but i get this message i tried other way removing items function and this is the message removed fluff at end,0,59,72 explode struct column which isn t array in pyspark i got a struct column from json with this schema since all of the inner strcuts have the same fields i want to convert the schema to something like this and add the id for example as a field for each element by doing it i ll be able to explode the column into rows any idea how can i do it or explode the column by any other way,logging configuration with disable existing loggers false the python logging tutorials imply that disable existing loggers should be true but i am having trouble with that configuration what i think is happening is that the main module imports various pieces of the application which setup loggers during import before the logging system can be configured those loggers get disabled at configuration time and don t produce the expected output i have several hundred files of legacy source code and over a dozen main module entry points removing all the toplevel calls to setup individual loggers seems like a difficult cat herding problem re working every main module might be possible but simply flipping disable existing loggers to be false in json is much easier and seems to work i don t think anyone is doing anything extremely tricky with the loggers and i have not seen issues with limited testing of the patch what are the consequences and pitfalls of this approach what needs to be done to make it a reliable solution,0,78,165 azure ml studio container has crashed did your init method fail i am trying to deploy an ml model through the azure ml studio using the notebook itself the commands we are using can be found here we have registered the model as below but while running this command we are getting the error that container has crashed did your init method fail the logs are the init method is,how to send png jpg files as bot via url or from specific folder discord py well i tried to send a picture from a specific folder but the bot can t find it is that me i can t write code that would search a folder well i would also like the bot to send images from the url here is my code i m just learning python so any help is appreciated,0,71,70 is it possible to have different commands for different prefixes in discord py is it possible to have different commands for each prefix for example one command for and another command for for example someone does foo the bot responds with foo but another person does foo the bot responds with bar,welcome message isn t work because getupdates telegram bot api can t record joined notification update in supergroup few days ago i made a telegram bot with python using api from all the code works perfectly until i realize that the getupdates api didn t record the joined notification for the new user in my group my plan is to made a welcome message to new user based on those record the group not allowing user to send message broadcast group and right now i confused that i can t get any single record related to the new user joined so then the welcome message didn t work perfectly this is my function for getupdates api and the welcome message and after that the welcome message should be like this does the restriction of the group member can t send message made the getupdates api couldn t work and the welcome message didn t showing up,0,53,149 modulenotfounderror when running py file from nodejs on heroku my nodejs webserver runs a python file on heroku logs show following error requirements txt runtime txt when adding the python buildpack the entire application stops working note im not running a python webserver just this one file from nodejs everything works locally,asyncio google search in python i apologize if the question is too basic given that i m still learning async programming in general i want to perform a google search to list of companies using python because there are over companies in the list i would like to perform those asynchronously i tried doing this using the asyncio library in python but i m not able to get it to work it still runs synchronously and for over hs how can i make the code below run asynchronously when i run this i get this output but i would like to get it to start each search while it waits for the other search results to come back this would yield something like any help is appreciated thanks,0,50,127 sift match computer vision i need to determine the location of yogurts in the supermarket source photo looks like with template i using sift to extract key points of template result of sift looks like the question is what is the best way to clasterise points to obtain rectangles representing each yogurt i tried ransac but this method doesn t work in this case,how to convert kivy project into apk for android i have a project that contains a py file and kv file and txt file and i want to convert all that to a apk file is it possible to do that using google colab,0,63,44 how plot multiple dictionaries of dataframes by columns python pandas i would like to plot multiple dictionaries of dataframes in the same figure with subplot i can draw a dictionary of several dataframes on the same figure but i can t add another one the figure must be,how do i count only as one attempt if they input the same number multiple times consecutively tried to make a guessing game that counts the number of attempts but i don t know how to count only as one attempt if they input the same number multiple times consecutively,0,49,49 how to avoid colors mixing up between two plot types in matplotlib i have the following result it s a plt scatter with plt bar on top of it for some reason the bar chart is being colored but i want it to be of a specific color which is not part of the colors used by the scatter plot how do i achieve that my current code,regex in python splitting on whitespace character in between two words that start with a capital letter in my nlp pipeline i need to split titles from body text titles always consist of a sequence of capitalized words without any punctuation the titles are separated from the body text using two whitespace characters n n for example i want to split the title and body text on the whitespace using regex in python such that the result is this is a title this is where the body starts can anybody help me to write the right regex i tried the following but then i got the error that lookbehinds only work with strings of fixed length but they should be allowed to be variable note that i cannot use r n n because line separators also occur in the body text so this would result in too many splits many thanks for helping me out,0,65,152 how can i make it so my discord bot mentions a specific person when they type so i m putting this in a cog i want to make it so that if the author is a specific person and they type anything the bot will mention them and reply i m not too sure if i m supposed to use ctx author mention in this context and i m fairly new to how cogs work in discord py,how to solve cv error opencv error bad argument in function imshow i m learning how to use opencv but i m running into this problem results in this error i m using python bit and the latest version for all the packages thank you,0,71,43 new to python and trying to find out how to gather the quantity of one specific item in a nested list i m trying to figure out a code that will go through all items of the list and keep a count of how many times the given item occurs without the count funtion this is my code,enter pandas values cell wise i have a dictionary namely elas key made as follows continuing for a number of countries what i would like to do is a pandas dataframe containing n number of rows being n the unique number of keys in the dictionary row and k columns being k the number of countries i have each cell row k should have as value each value of the elas dictionary note that indices list is nothing else but a list having the name of the keys of elas without the country name so ideally something like actually i have the following code but it is very naive and does not work can you please help me figure this one out thank you federico,0,57,122 python filter items in two lists matching given pattern having the lists in my python code use case as a user i want to loop through items in listiterationdata and find matching items in both listone and listtwo that ends with listiterationdata i items in listiterationdata would function as matching patterns in listone and listtwo something like the following would be my expected results many thanks for your help,input all row values of dataframe into a variable is there a way to get all output values of rows in dataframe into a variable my code is like this the output of q df is this and the output of q data is only is there a way where i can get all the bill number values and put it into a variable thanks in advance i put it into a variable so i can call it to another dataframe query below is another code,0,70,85 why am i getting an error that i m using a local variable inside a function when it is a global variable i have a code right now that i m working on and for some reason whenever i run it my error is local variable buzzcoins referenced before argument as you can see buzzcoins is defined out of a function therefore it should be global if anyone could help me with this that would be a huge help my code,browser not opening using selenium and kora on google colab the browser will not open with the get object while using google colab with selenium and kora here is my code it just returns completed and nothing happens any advice,0,79,40 having problem with the usage of driver find element by selenium i am trying to make a bot that auto logins to a website in order to write the username i m trying to use when i m looking that spesific variable from website on inspect the varible is two word like matinput formcontrolname on any other website if that varible is one word like id i simply write id after by and it works what can i do in this situation,nlargest returning weird results i am trying to fetch the top n result using largest but the behavior is odd in my opinion it would be great if someone can help me understand why the behavior is like this if i keep nlargest then i get the correct output but if i change the value to i only get the columns item id and rcp why does the column user id not appear with nlargest and if this the expected behavior is there a way i can make user id part of the output as well,0,79,96 python publish message to sns with lambda request body i have an aws lambda that is triggered through api gateway set up with the following code however it seems that event does not have the body key i m using this lambda with aws gateway in order to serve as a webhook listener i want to pass the webhook data to my sns topic,python error when i try to install cloudgenix config i installed python and i am trying to run pip install cloudgenix config or pip install cloudgenix config i keep getting the attached error,0,64,31 fix for missing tr class in webscraping i m trying to webscrape different stocks by rows with the data scraped from i am following a tutorial using a similar website however that website uses classes for each of its rows while mine doesn t attached below this is the code i m trying to use however i don t get any output whatsoever i m still pretty new at coding so any feedback is welcome,how can i save scrapy logs in gzip after scrapping without using scripts in bash are there any ways to compress logs i need to store them for some time for later debugging and it would be cool to find a way to reduce their size if there is no such a method then how to organize the compression process more efficiently,0,71,62 python function to combine many dataset without listing them all i wanted to write a function to combine over datasets without actually listing them all ideally having a function to take in one at a time and combine the previous one at the end it accumulates all datasets i am not sure how to recursively accumulate them how should i create this function thanks,how to handle nan values when writing to a database which expects something else than type float i m working scraping project and i m working with postgres i ve set up all tables by hand which include the typical data types like datetime integer text and floats but i run into an issue since i scrape many fields there are always some fields missing and they become nan and since nan is type float i receive an error when i m trying to push a float value into a column which expects a for instance datetime or text object at least i believe so the error message isn t very clear i m basically using pandas only df to sql after i ve created the tables by sqlalchemy s declarative base my process is like as soon as a value within the current scrape obj get data doesn t exist it becomes nan and since nan has type float i can t post it into the table which expect anything else but float can t diagnose it very well but i expect it to be the described reason above is there any way around does it make sense to df fillna none or is there any keyword available i m not aware of,0,65,194 pandas group by sort and plot i have a grouped data frame how to plot this data frame using bar plot that on x axis will be day of week and on y axis values how to sort this data frame by day of week from monday to sunday,how can i find sequences of rows based on two columns this is my dataframe i am trying to find the most common sequences of length and delivery type combined per over ie every six balls is there any way of finding how many times each sequence happens edit i d also like to label these patterns and create a column called ball sequence edit i have now combined delivery type and length in the length type column eg essy is extra short slow yorker i have also created a small table of expected outcome the sequence must occur in the same over and cannot be any random sequence of,0,50,106 how to parse a specific html tag using beautifulsoup i am trying to webscrape this website my code only retrieves the first matching div class tag which is tuition but i only want to retrieve room and board cost how do i parse a specific tag,splitting a column of dataframe into multiple columns i have a df as shown containing option data as follows now in the above dataframe some of the rows are seperated by spaces into parts others are singular words i intend to do the following eg aartiind apr pe should be splitted into columns wherein column one will contain aartiind column will contain the date column will contain the price column will contain the type of option i e pe eg aartiind i is singular hence column will contain aartiind i while column will display na hence after the transformation the final df should be displayed as to split the strings using white spaces i use but since the spacing is not consistent it gives me an error so is there any way i can accomplish the above task using str split or is there any other method in python to achieve the desired output,0,47,154 creating cartesian product of sub dictionary key val pairs i have this dictionary i want a dictionary with the cartesian product of the key val pairs inside i need to create the below dictionary out of it,trying to pipx install brownie without installing ms visual c i m currently trying to install brownie for python on my windows machine using pipx pipx install eth brownie when i run this command there is a fatal error message saying pip failed to build packages bitarray cytoolz lru dict i also get a possibly relevant error message microsoft visual c or greater is required get it with microsoft c build tools i was wondering if anyone knew of a workaround to solve this that did not involve downloading ms visual studio if not its not a fatal blow to the project i m working on i would just like to save storage thanks,0,36,112 python import helpers how do i import helpers in script py python version directory structure script py command error,recursive generic function for cartesian product in python i m looking for a way to implement a recursive function to get a generic cartesian product of the same list n times without using the itertools package the function should get as parameters the list and the n times output example but also or etc i wanna generalize this for every generic list and every n tuple i found different ways to implement this iteratively but none with recursion hope anyone can help me,0,25,81 sqlite math functions python after updating sqlite version it is possible to use the sql math functions if i use it in pycharm query it works well but i can t execute the query in python code then i got the following error message pandas io sql databaseerror execution failed on sql select log increase s from increase no such function log i execute it with the following code what is my mistake i don t see it,failing to build r pi pico hello world program i m attempting to get started with the r pi pico i m unable to build the introductory hello world program using the command line tools the nmake command fails reporting that the c compiler cl exe is not able to compile a simple test program i m following section of getting starting with pico my installation steps are outlined in the readme at my github repo of note i m using vs and python instead of vs and python those were the modern versions when the pico guide was written but they re outdated now here is the complete output of my failed build attempt thank you any help will be greatly appreciated i am going to attempt to build from vs studio gui now cheers,0,72,133 im trying to copy array but both of them has the same link im using python my code is both of the variables are now but i dont want to apply changes to variable a what should i do ive tried to use the c b statement but it didnt help,filter time in a dataframe using python i have a column where there is only time after reading that csv file i have converted that column to datetime datatype as it was object when i read it in jupyter notebook when i try to filter i am getting error like below code sample data here i am trying display the rows whose appointment time is between to datatype info could anyone help thanks in advance,0,54,75 update label text periodically from within function the code below opens a tkinter window with a label showing and when the button is pressed after seconds the label shows instead i am trying to make the label update periodically displaying the numbers through every seconds instead of just and thank you in advance,python round to remove trailing zeros the code below is used to find the x using gradient descent and the problem here is that the final result of req is and when i round it it results in how can i round to get or instead without using any other module,0,61,55 how to remove all characters before a certain character in pandas df column in python how to remove all the characters before i would like to have the output as below,how to read write pandas dataframe acrossing multi class in a shared manner i got this problem when i was trying to access pandas dataframe in a shared manner basically there are different classes maintain different aspects of a single dataframe so over all my classes looks like here is what i want do to repeat call bellow lines as a function i expect to see all the print are same after many times calling but i get bellow after times running what i have growed from aclass doesn t apear available from bclass and cclass i have tried with copy deep false it doesnot work,0,34,103 how to ignore function arguments with cachetools ttl cache i m exploiting the cachetools ttl cache decorator not cached i need to ignore some params in the cache key e g working that way i get this what i need is there a way to get that using ttl cache,python querying last record in sql db but returning blank record i m using python flask and sqlalchemy to create a simple web app that stores a user s input for a book s isbn isbn a unique book id in a db table and then queries that record later to use in an api call it uses the api response to store the book info in another table i have confirmed that the tables are storing data properly i have confirmed that querying the isbn table returns the correct values but when i try to store the query as a python variable and use it in the api call it always acts like the variable is here s the database setup here s the route for querying the isbn table using the isbn record in the api call and then storing the result of that data in another table earlier in the app i use the same method of using user input in the api call and it works fine i have taken out the error handling here but the error is saying the api response has no body to it and upon research i found it is because the isbn table query returns,0,45,204 attributeerror fitsfigure object has no attribute set tick labels font i am a beginner in programming i am trying to produce two plots using aplpy and subplot and simple code the code is as following it gives me the error attributeerror fitsfigure object has no attribute set tick labels font could you please help me thanks in advance,how to start a python program using java runtime getruntime exec i am writing a program that requires the starting of a python script before the rest of the java code runs however i cannot find a solution to my issues i would appreciate if someone could suggest a solution to the problem i am facing code i need help on the part under the comment start python,0,52,66 django newbie templatedoesnotexist my project directory is called test and the app in question is called posts django tried loading these templates in this order using engine django views py urls py i have mentioned the app in settings py so that probably shouldn t be an issue what am i doing wrong filetree,passing array of dict as parameter to ros launch i want to pass an array of dict as parameter to launch file and retrieve these arrays at the node how can i achieve this not finding any example or pseudo code regarding this newbie ros user regards,0,52,46 combine the same values in a list to display as a range i have a list of distances associated with each compass bearing from to degrees also stored as a list i would like to condense the list so as to give ranges of bearings over which the distance is associated e g from to any ideas what sort of approach to take this on with thanks in advance,python groupby with conditions in pandas dataframe i have a dataframe like below i need to do groupby country and product and value column should contain count id where status is closed and i need to return remaining columns expected output format as below i tried the below code but it is returning only three columns country product and value i need the remaining columns which i mentioned in the above expected output format also i tried output second logic with transform returning id column which i don t want value column is based on count id where status is closed i tried the above two methods but not able to get the expected output is there any way to handle this,0,70,118 evaluating expressions in pulp i have developed a lp problem and this works however when i print out total transfers it just gives me an expression like buy aarons m buy adams c buy adrian buy ait nouri r buy ajer k whereas i thought it should be a number how can this be printed out as a number i really want to put this into my objective function as a panalty value but unable to do this,how to web scrape imdb movie rating i am trying to scrape the the movie rating from imdb website i am trying following code as but it gives error i e attributeerror nonetype object has no attribute text my code,0,72,39 on message disables all my command even with bot process bot process commands so i am making a discord bot and i am trying to make a feature if you say hi the bot will say hi back but using on message all my other commands get disabled i would appreciate it if someone could help me fix this error,finding selenium by class attribute when classname isn t unique using selenium how i can select element by class attribute i have i need to click in mis comprobantes i can t use class name because it isn t unique,0,55,37 get score from aws neptune search i want to get the scores for each search result like you would be able to in elasticsearch how do you do this through neptune i m using this gremlin query but i m not sure how you would get the score out of it,sorting correctly month in a plot i wrote a code in pyspark taht applies to a dataframe pandas to have a plot of a historical series quantity trend in years on the x axis i put the name of the months how can i order them correctly and not alphabetically thanks,0,49,50 is there any way to rotate dcc dropdown at an angle as shown drop down button is in the image is rotated is there any way to do it i looked into but didn t find anything,using inner function in other function i would need to use a function defined inside other function is that possible f is defined in f is it possible to use f in f,0,36,33 django db utils connectiondoesnotexist the connection prueba doesn t exist i want migrate django database to mongodb with djongo but i have this error i am trying to connect to a mongodb atlas database my settings py is as follows i am using django and djongo i have tried many djongo versions and but the errors still arises also upgrading django to the latest version is not possible as i m using an old project any idea,googletrans error with dictionary translate trying to use googletrans in my project using version rc python on windows local machine the script is simple it must translate an array of the phrases into english from russian when trying to translate one phrase it s ok but when trying to translate a dictionary the error occurs part of the script where this error occurs where should i dig or maybe someone had such a problem,0,71,77 how to process every nth element in each of this list of lists i have a list of lists that looks like this i want to process the nd element of every list inside this list of lists such that it is replaced by elements created by adding to it it will look like this how can this be done using python thank you,python writing two codes within one code input expected output code code i want to proceed with two steps within one code not two separate codes is there any suggestion for me,0,67,32 create a multidimensional array in python without additional library i have written above code this will create a n dimensional array with aliasing when i am mutating the list it will mutate everything e g aliasing problem click here,how to put the dates in chronological order in python csv so i am working on processing some data and after running my file everything is fine except that the date are not in order i used the code below to try putting them in order but didnt work by the way updated at is the column i am trying to put in chronological please let me know how i can make this work i have attached a picture to for better understanding of my question updated at column pic,0,36,88 list comprehension and str split returns lists in list instead of individual strings assume i need all items from that list sometimes separated by sometimes not the below function works but i d like to know how to do this with list comprehension list comprehension i tried i d like to avoid adding named functions to my code if it can be avoided i m also interested in solving this with lambda functions although i m learning basic stuff at the moment,exit python script when no match in for loop with selenium in python i want to click on a html div container if it contains some words and if it can t find any the script must exit with the below code it is working if there is a div containing a word from the text list but how do i exit where non of the words is found with the code below it executes order click because this is outside the for loop i only want to execute order click and go further with the rest of the script break if words are found,0,78,102 selenium python getting some value enter image description here i need the number value any way how to get them,i m having a problem with a loop in python so im trying to make a code that takes an number input from the user and with that input it will display a x number of other inputs to fill in data to be writed it down on a txt file but i can t really make it stop showing even with a if x f break im still learning python and got this far with my little project,0,20,78 heroku release fails error related to django utils so i updated my python code to django and with that had to remove and update some deprecated code as ungettext lazy and similar locally the code is compiling well but when i push it to heroku i get this error i ve tried a few things but haven t been able to update this on heroku,how to build dynamic python class with a stub file and method validation i have a python class where the implementation of every function in the class is the exact same this is because the main purpose of the class is to build out strings based on function calls for example so with the above code you should be able to do something like this print stringbuilder hello world and the output would be hello world hopefully that makes sense so far here is my question is it possible that i could define all the valid function calls in a stub file so that auto complete can pick them up including any arguments they might support and then for the implementation of stringbuilder i can do something like this where there is a validation to make sure they are calling an accepted function from the stub file and then execute the string builder logic any thoughts,0,62,152 scrapy notimplementederror scraperrspider parse callback is not defined i am new to scrapy i was seeing a tutorial and implementing a spider but this error always keeps up coming please help i have tried everywhere but i can t fix it this is the error i think this is my code,how do i update powerpoint with my dataframe would really love to get some help here i have the below data i wish to update my slides with this slide contains data for country in industry and another part of the slide includes a chart to include the values for data x y and z instead of looping as follows for country industry x y z in df country name industry group name x y z values tolist is there a way to capture all the individual row data in a list to update without having to mention each column names for eg x y z hope this isnt too confusing,0,50,103 cannot import name registermattype from cv cv usr local lib python dist packages cv cv cpython m x linux gnu so i got below error message when i run some codes according to google colab cannot import name registermattype from cv cv usr local lib python dist packages cv cv cpython m x linux gnu so and i tried to uninstall the opencv python headless and installing opencv using the following lines pip uninstall opencv python headless pip install opencv python but it seemed that the new version wasn t installed because it then said no module named cv how should i do to fix this problem,python making changes to key value of list of list im sending input payload from postman to my flask service like this reading data in flask service i want to make changes to input variable so that my final list of list becomes like this so i want to rename name key to packageid and remove other key values like rebootrequired how should i go about it tried some tricks but was unsuccessful,0,71,71 mysql connector errors operationalerror mysql connection not available i get this error message on pythonanywhere when i reload the app a couple of times i need to reload the app from pythonanywhere to make it work error message file home sideproject virtualenvs myvirtualenv lib python site packages mysql connector connection cext py line in cursor raise errors operationalerror mysql connection not available mysql connector errors operationalerror mysql connection not available anyone please help me with this server js file code sql connection py file code,calculate difference between current row and latest row satisfying a condition i have a pandas dataframe looking like i know want to calculate the spread between group and group for the latest values i e in each row i want to look at the latest value for group and group and calculate value of group value of group in the example the output should look like the only function i could find so far was pd diff but it doesn t satisfy my needs so i would really appreciate some help here thanks,0,63,97 conditional when calling functions sequentially in python i have four functions and each one returns a list as a result i want whichever of these functions that i call sequentially brings a list not to look at the others thank you for your help in short i don t want it to go to other functions at all whichever brings results,how to freeze a keras model in tensorflow specifically freeze a saved model format to pb format can any one please explain the procedure to freeze a keras model saved model format into pb format in tensorflow created a sample mobilenet keras model and saved it to the disk in saved model format then in another file i need to load the model and freeze it to a pb format,0,60,72 convert a dask series to a list of values is there a way to convert a series from a dask dataframe to a list in order to iterate over that until now i have thanks,need help formatting a string into a table i want the user to be able to enter multiple authors and output the information in a formatted table column has a minimum field width value of and is left justified column has a minimum field width value of and is right justified currently my program will only print out one author and number of books at a time it prints the table every time you enter the input i am trying to get it to ask the user to keep entering the input until they stop then print out all of the authors and number of books on one table current output,0,35,114 transform a list into a dataframe hi i am trying to have a pandas dataframe with data processed into a loop but i end up with a series here is my code and here is the results i was expecting a dataframe of columns with float values does anyone understand what i am doing wrong,how to iterate a listview items to convert in cards i am coding an app dash how a startpoint to many users a applications dashboard i want to convert the list of applications in cards portfolio style the user login in the platform and in the url dash open the dash django app to here it s perfect with the generic view listview we obtain the list of applications will be available in the platform if exist in the model the application it s installed and available to the user urls py views py and in the html template how to iterate the columns of the object list with this i can iterate the rows but not the column i receive the str output declarated in the model if i can to read the columns data and include in the html app url app icon etc etc,0,55,142 why loop through series in list comprehension gives different result from looping through list can anyone help me understand why list comprehension generates different results when i just changed series to list but if i change to loop through list inside list comprehension i get the result i want why series generates wrong answer thanks in advance,return function and from file type and import issues on pycham i am currently learning to build a racing game with pygame and assets from techwithtim on youtube url it seems like problems are happing secondly my main file is not recognizing versions python pygame pycharm community edition hope to find a solution soon from a young inexperienced programmer,0,57,61 make sphinx build latex pdf in nonstopmode i am using sphinx to build my latex document but everytime i run the make latexpdf command latex stops the build and asks for user input latex is not running with nonstopmode in the past i was able to put the nonstopmode in a makefile and use use make with latexmk to compile everything did some digging on sphinx and can t really find what i am looking for,importerror cannot import name url from sqlalchemy engine while initiating rasa when i run rasa init in the anaconda prompt i am getting into this error importerror cannot import name url from sqlalchemy engine c users user anaconda lib site packages sqlalchemy engine init py,0,75,33 django drf api shows json format instead of interface i recently updated to django and drf and now my api shows in json format by default whereas before it was showing the interface i would like to see an interface like so but this is what i now get is there a way to change this back to the interface sorry if this is a silly question,sqlite icu for windows i know questions like this have been asked a lot and trust me in the past several weeks i have read everything i could find but i cannot find a way to use the sqlite icu extension for python on windows it works flawlessly on linux like a lot of the things i tried i obviously tried installing tru pip and that failed i tried different python and pip versions and that failed so i looked up into the error and the setup py of the pip package and found out it fails bc i don t have pkg config on my machine that is all fine but i don t know shit about libraries on windows on linux it is easy you just apt install what you need and when you need to compile something it just works i tried manually compiling the extension on windows and i got a dll file actually one using cygwin and one with msys but when i try to load them in python i get an error sqlite operationalerror the specified procedure could not be found btw compiling it using gcc on linux and then loading the so on my linux machine works flawlessly i think like with a lot of python extensions coded in c i should compile it using msvc but i cannot find a way to make that work if anybody knows how to do it pls help me or if you have compiled it before pls share the dll file with me at this point i am so desperate i would literally load any dll file you give me as long as it works thank you to anybody who read thru and even more to anybody chimes in,0,70,287 zip folder using python without changing directory i want to zip a folder at x location to y location i have written code for it this is my code i don t want to change directories can i pass path of the folder i want to zip and path of the destination where i want to store that zipped folder is this possible using python,python django modeulnotfounderror no module named somefolder i have a django app it is quite complicated i can t post all the code here so i have a big picture summary the setup of the folders in the big picture related to what i m doing is below note that somefolder is a placeholder name for the actual name some folder is a folder containing some python scripts with functions inside of them it wasn t installed in the django app i dragged and dropped somefolder into the backend folder this is necessary and had to be done it s some python stuff unrelated to django inside of views py at the top i do then inside of views py i have a function that calls some of the functions within the python scripts a py b py and c py this is why i need to import somefolder for example the issue is when i run python manage py runserver i get a modulenotfounderror no module named somefolder in views py the somefolder folder is in the same directory as views py so i m not sure why it s not being recognized i ve seen other similar examples on stackoverflow but didn t really understand them or how to fix it so i m posting my own one here,0,66,204 how to find a pattern inside a pattern when start and end is known i have a pattern that has a starting and ending pattern like my string is i want to find if i use then it gives me an empty result what am i doing wrong here,get request that uses more than one parameter if i build a simple fastapi instance with a get operation like this if i run the api and immediately after that i use i get correctly now i would like to do something like this how does requests get have to be written to get the desired result,0,49,56 numbering each value in a sequence minimum reproducible example there are deliveries faced in an over i then produce a sequence column that gives the sequence of length type in each over using this code however i want to number each delivery in the sequence eg es ls y es ls y s s y es os y es ls y es ls y or something along those lines that uniquely numbers each delivery,why do you run other lines of codes of a python file say test py when you are just importing a piece of test py from somewhere else say main py i have two python files one is main py which i execute the other is test py from which i import a class in main py here is the sample code for main py and here is the sample code for test py finally here s the output when you execute main py from the order of outputs above you can see that once you import a piece of a file the whole file gets executed immediately i am wondering why what s the logic behind that i am coming from java language where all files included a single class with the same name i am just confused that why python behaves this way any explanation would be appricated,0,57,138 how i can set id in django rest framework json api response i am using django rest framework json api then i want to set id in the response i know the response gets id from django model instance but if i set the instance to the serializer the id will be null,python asyncio gather shows deprecationwarning there is no current event loop i have a django app and in one of its views i use asyncio in order to make some concurent requests to an external component here is the idea well when i run the tests i get deprecationwarning there is no current event loop at this line how should i interpret this warning and what do i need to change to get rid of it thanks,0,51,77 split violinplot with different ranges using seaborn i am trying to plot two variables with different ranges using split violinplots in seaborn here s what i have done so far however i am unable to use the right portion of the ax violins here s is the output when i do violin set clip path plt rectangle width y width height transform ax transdata i get this result can someone explain what am i missing also how can i manage having inner stick tia,attributeerror super object has no attribute getattr troubleshooting kivy i am creating an android application using kivy garden mapviev i want the user to be able to move the marker hero icon with buttons when i add an int value to the value dumped from string to float i convert the result back to string when i try to do this i get an error i execute the entire application code in one file screen manager is a string in the file as screen helper when i try to execute the code get the error given in the subject i m new to kivy kivymd below application code and screenshots,0,75,108 apparently empty groups generated with itertools groupby i have some troubles with groupby from itertools output is it works as expected itertools grouper objects seems to be readable only once maybe iterators but list li it seems empty i don t understand why this one works join grp for k grp in groupby aahfffddssssnnb aa h fff dd ssss nn b i am using version question already asked to newsgroup comp lang python without any answsers,how to make a window bounce back when it touches edge of screen tinker this is my code i want to bounce back my window when it touches the screen edge but its just going off the screen whats wrong in my code pls help,0,74,45 why height parameter is not working in label widget pycharm showing me to remove the attribute height it is not an option,python and pandas versions change how a number is interpreted after dataframe read i have environments environment old environment new when i load the same csv file by doing pd read csv name of my csv file csv delimiter dtype str in both of the environments i noticed that python or pandas misinterpret some not all of them just about rows out of rows numbers in environment old the misinterpretation of a number looks like this where in reality the number in the excel file is environment new interprets the number correctly that is as based on this i have questions edit i m not using pd read excel but pd read csv,0,22,111 integrityerror at authentication addprofilepic unique constraint failed authentication userprofile user id i am working with a blog project where i am trying to add profile picture of the user whenever i submit the picture it gives me unique constraint failed authentication userprofile user id views py models py forms py here comes profilepic html but the server shows me this unique constraint failed authentication userprofile user id where is the problem thanks in advance,download dml and ddl sql from teradata using python what approach should i follow to download ddl dml and stored procedures from the teradata database using python i have created the sample code but what is the approach to download these sql files for data migration process unlike mssql which had mssql scripter to download sql files does teradata provide any such option to download also does it provide support to download sequences views and procedures for the schema migration process what should be the best approach to download these files from the teradata as a source,0,59,98 handling duplicates in a pandas dataframe i m pulling cryptocurrency data from binance api and storing it in an database its working but how do i work around duplicates in the database if i run the for loop a second time it raises valueerror table btcusdt already exists how do stop it from creating a new table and just inserting a value if it s not already there using a timestamp as the key,run discord bot client from another file how can i have bot code in one file but run the actual bot in another file not cogs extensions i need to run it in another file because of loop conflicts i tried importing client variable of the bot constructor and start on it but it didnt work only the web server started example code in bot file in another file sanic web app in my case,0,72,73 convert datetime d to month number date index np arange dtype datetime d hello i want to convert the date index to the month name but i don t know how can i do that,is it possible to get wallet status deposit and withdraw on or offline and limits from ccxt i am trying to use ccxt to create a table of currencies with their wallet status whether deposit and withdraws are on or offline plus the respective minimums minimum to deposit minimum to withdraw and maximums maximum to withdraw i e btc deposit on withdraw on minimum deposit minimum withdraw maximum withdraw i am looking to do this for huobi s exchange so if ccxt doesn t offer this ability i may need to use houbi s api directly,0,29,100 how to request uac elevation within python my python script requires administrator privileges however i cannot seem to get it working i want it to be able to request admin privileges but also work when the file is compiled by pyinstaller too i tried this but it doesn t seem to work it requests admin but does nothing with it i am using python version if that helps,scope of object in custom python package i m trying to make a d graphics package i ve made many attempts of finding the best structure for this but i can t get it to work nicely this is the current not working setup i have the files init py scene py and polygon py scene py should init one single object this object has an array where polygons are suppose to be stored in a simple verison of this file looks like this polygon py defines some objects to be drawn circles cubes etc init py just imports the modules and some helper packages however if i try to use this package the scene file isn t scoped correctly i ve been stuck with multiple different architectures i can get this to work if i keep it in one file which doesn t seem ideal ideas to fix this or try a different architecture i would love your input,0,68,146 opening anaconda prompt with python i want to create a script that will help me with installing packages for spyder therefore i want to use python and have the script first open anaconda prompt then execute the commands and then close that window however i can get it to open for example the calculator but it doesn t seem to open the command prompt for opening the calculator i used how can i get it to open the command prompt,flask join children in my problem let s say there is person which can have many addresses and each address can have one location is it possible to get a query where persons contain addresses which are joined with their location so when i loop persons i can access data from both addresses and location as one,0,79,56 adding a row in a dataset csv file through using pandas in python i have tried append method the code is right but its not doing anything my csv is too large to open i cant physically add there so please if anyone can fix my problem pls answer code error showing valueerror found input variables with inconsistent numbers of samples,datetime as a parameter of stored procedure i have this code snippet with a stored procedure read records from to the stored procedure takes to parameters from datetime and to datetime i d like to assign it values taken from fromtoform how can i do this i tried according to this answer but it ended with error,0,62,51 match column names using re compile with or operator i have list of columns names and i built def function to match columns names with prefix xrf and suffix ppm but the result comes only with the xrf pc would you please help to get names xrf pc and xrf ppm code,unknown problem with module using cv and mediapipe i have some trouble running the module on python this is my code it returns me the following traceback i m following a youtube online course for computer vision linked here at around the minute mark the module presented above is added i pretty much copied it and it doesn t work what s happening thanks and sorry for the long post,0,47,69 how do i make this bot run continuously the script stops after items and then i have to rerun it manually how can i automate this and have the script rerun automatically,python problem data mnist data sample i am new to python i m trying to learn how this k nn algorithm works i tried to apply this code but it does not work it displays an error,0,33,37 why do we need to give y in sklearn s kfold split sklearn model selection kfold s split function takes x and y y is optional as parameters why do we ever need to give y all the split function does is to generate the row indices for kfold cv so the number of rows should to be enough actually x is also not needed is it a kind of compatibility issue thanks,query lookups in sqlalchemy i cant find any information about lookup api in the sqlalchemy is it supported im talking about this feature in django orm its very useful for my case because i have a table on frontend with many filtering options and in django i can just queryset filter kwargs if this is not supported is there any way to achieve it,0,67,63 how to update a value in dynamodb table based on condition using python and boto i want to update the below current date value in dynamodb last run date column based on following conditions current date datetime today strftime y m d h m s conditions table name config partition key kpi id sort key metric id i want to function to update an item in python using boto the code which i tried,maximized window with tkinter i want my window to be maximized like i pressed the button left to the x not fullscreen i find that this can be with root state zoomed at the start it looks like its working but it s not the window sometimes appears maximized but when i click on it it goes fullscreen i just want the taskbar on windows to be shown and the tkinter window to be maximized,0,62,72 python selenium i can t acess to a linked page on a page with iframe i want to go from this page to this to this page by clicking on regional feminin u i have tried many solutions but the best i had is not working systematically please coul you help me,python face recognition library import error i wanted to try the face regognition package in python but i get this error and couldn t find a working solution online i im using m mac by the way importerror dlopen opt homebrew lib python site packages dlib pybind cpython darwin so x symbol not found in flat namespace png do expand palette rgb neon anyone has a solution for this,0,53,49 how to convert a dictionary to pandas df i have tried this following code to get live data from an api i have tried to convert tick data to pandas dataframe but getting the following output how can i make proper dataframe,is there any way to replicate realtime streaming from azure blob storage to to azure my sql we can basically use databricks as intermediate but i m stuck on the python script to replicate data from blob storage to azure my sql every second we are using csv file here the script needs to store the csv s in current timestamps,0,41,59 delete old file when uploaded new in django rest framework i wanted to delete old image from folder when uploaded new image and i tried but couldn t get result serializers py services py what i did so far i don t know what s wrong with it,type error with operations with dates datetime package i have this code i get this error typeerror unsupported operand type s for or pow float and datetime timedelta i m interested in the number of the days not with the hours,0,42,39 this python code for quadratic equation isn t working i m trying to get the userinput for a b c using a function and it doesn t seems to work,classification of gravel aggregate i try to measure the width of the individual grains of gravel i need this to recognize whether it is fine gravel or coarse gravel could you help me how can i find the extreme parts of the gravel contour up to this point i was trying to get only the contours from the picture photos under code my current code,0,25,65 pyspark access data in folder xxx i have a pipeline running in azure synpase and i need to execute a pyspark code that create a current date folder the structure must be this is the lastest data that my pipeline was executed one folder for year month and day path dataupdated yyyy mm dd i just need to automate the creation of these folders i think i have to use get datetime,list index out of range when trying to remove instance from list the out of range error shows when i try to remove an instance from a list but doesn t pop up when i just pass the statement,0,71,38 ethereum pre defined gas price in web wallet is this possible im trying to find a way to setup a fix gas price gwei in my metamask probably this is not possible in metamask but is there any way to force that or maybe there is any web wallet which offers that functionality,discord py check balance of other users the bot im making has a economy system and u can check ur balance by doing bal however i want it such that other users can check your balance and you can check other users balance as well but right now i only know how to code it that you can check your own balance only how can i change the code so that you can check other users balance by entering their id or mentioning them i tried to change the ctx author to ctx user but it doesnt work,0,57,96 word cloud counting double words instead of one i am trying to do a word cloud with matplotlib in python and instead of counting single words like will its counting two like i will i have looked at the word cloud documentation and there doesnt seem to be anything that produces this could my input be causing this my code looks like the following,pass input value to dialog and send to screen i have the following code where i would like to be able to click on the navigation drawer select status under users input the name and then be sent to a given screen with the current user now populated main py navigation drawer py questions you can toggle commenting on the two on release below to see the issue,0,64,63 how to expose classes in subdirectory to scripts in parent directory i am trying to create a python package looks like this within train py i would like to import modela like from models import modela rather than using from models model a import modela is this possible many thanks,what library to use so that user can manually classify the given images from the gallery i want to create a python program that asks user to put the images in particular category for example there are categories say to the program will display the image gallery and user will manually put the image in one of the categories after all the images are classified it creates the database of image with the images classified in all these categories so next time the database is loaded it comes with the classified categories for example there are folder containing images of tree cat dog lion etc when program runs user will see the image and decide in which category this image should go manual classification also user can decide what name to give to the particular category what libraries i should use so that it can interact with user i want user to do the manual classification based on image,0,47,164 struggling to figure out where to insert perentheses hey guys i need to figure out where the parentheses fit into this code for the following expression and am a little confused to where the parentheses actually goes into i keep getting it wrong expression,using python selenium to choose an option from a dropdown menu with always changing values i am struggling with a code i want to choose an option from a dropdown menu but the options values are always different i was using this pseudo code i found here this works for now but the some text is always changing depending on the date this is the html of the dropdown menu see picture attached as described the values change regarding the date but the date always changes when i try to automate this to run once a day obviously how can i solve this lets say i d like to always choose the pm option thanks in advance,0,44,117 attempt to convert a value none with an unsupported type class nonetype to a tensor i am facing the error with a pretty trivial code and can t figure where the error comes from running the same code in a jupyter notebook works update error message including backtrace python version python tags v a dcbd may msc v bit amd on win copyright deeplearning ai,python sorting being undone when creating dictionary i have a dictionary that i am converting to a list so i can sort it the dictionary is a key value pair i convert it to the list sort it and then later convert it back to a dictionary when i convert it back to a dictionary it goes back to being unsorted can someone either help me sort it as a dictionary or how to keep my list from becoming unsorted when i convert it back to a dictionary what am i doing wrong or need to do to keep it sorted when it becomes a dictionary,0,64,105 filtering data by multiple value sql i like to query filter some data with multiple value using sql query but i got nothing from it here is my code thanks in advance,change last layer on pretrained huggingface model i want to re finetuned a transformer model but i get an unknown error when i tried to train the model i can t change the num labels on loading the model so i tried to change it manually the error,0,31,45 timeout exception fails when trying to call it selenium i m trying intentionally to locate wrong element so that i can call timeoutexception and then call the function again but instead i see the error stacktrace and it doesn t work code error all i see is the timeoutexception in log but not what i intend to call to handle it what seems to be wrong,function within if statement not returning a value instead getting name error i am doing some fuzzy matching on addresses and am filtering on a high score if that score exists in my data set then i want to call another function that looks at the data and checks to see if there are sales calls associated with it i want to ultimately return a list of values that fit the criteria in that function while debugging i can see the sales and calls test function works i see the values getting appended to my lists however when i go to the next iteration i see my lists in my debug watch change from a value to a name error name call list sales list not defined can someone please look over my syntax and show me what im missing thanks here s my code,0,64,138 how to find the centroid of multiple rectangles python i have to find the exact centroid of multiple rectangles the coordinates of each rectangle are as follows i have around rectangles how can i compute the centroid of them i already tried to implement it but the code did not work well my code,map float ranges in pandas series to strings in dictionary and save to dataframe i would like a simple method for mapping float ranges to strings and saving back to a dataframe i understand you can not use range with floats setup df mapping dictionary or this could be an if else block if needs be i prefer a dict as it is quicker to setup but happy to use if else should there be a simplar solution that way then i want to do something like this i am thinking there is something i am missing as i am finding it tricky put together a working solution for this,0,56,109 compare two datafarmes in two columns and get the difference lets say i have a dataframe like this one how can i compare these two dataframes based on col and col and get the difference remove all the rows that match with df and have a dataframe like this one i tried this one but it is not working,dockerizing django postgres gunicorn ngnix only admin static works other as in topic i have tried to apply solutions i found in internet but no success i am pretty new to programming and as making an app is one thing deploying it just overwhelmed me i have managed to put it on server run it on docker with ssl but main problem is that only admin static files load other give error weird thing is that static subdirectories structure is kept but there are no files inside please help me i am really stuck if you require any other data please write note that neither static root or static dirs work in some cases changing it helped not here thank you very much in advance edit i have no idea why but files exist in home app web staticfiles before i used this directory for static could sb explain what is going on directory structure app dockerfile app entrypoint sh app sancor settings py docker compose staging yml,0,59,159 extract data from tensorflow dataset e g to numpy i m loading images via i want to use the obtained data in non tensorflow routines too therefore i want to extract the data e g to numpy arrays how can i achieve this i can t use tfds,tabnet classifier predictions returning and values i m trying to build a classification model with tabnet i want to output probabilities of s and s that would be value between and i successfully trained the model but predict function is returning only s and s and i don t know how to check probabilities can you help me out here is the code that i m using,0,43,68 telegram bot ngrok deploy to heroku i have created a telegram bot using flask which works completely fine with ngrok but i want to deploy it to heroku for lifetime use below is my webhook function where i used this ngrok url but i want to use heroku url which fails can anyone help me,recursive generic function for cartesian product in python i m looking for a way to implement a recursive function to get a generic cartesian product of the same list n times without using the itertools package the function should get as parameters the list and the n times output example but also or etc i wanna generalize this for every generic list and every n tuple i found different ways to implement this iteratively but none with recursion hope anyone can help me,0,54,81 how to simplify the for loop of dataframe i am wondering to simplify these similar codes it seems to be easy but i couldnt make it df ls and df ls are both types of dataframe if i write it couldnt work because list object has no attribute values so other methods to solve it,lack of permissions in windows i created c users homedir documents python windows automatically puts that in onedrive s path is this causing the permission errors is the only problem i need to create the directory or modify setup py to install in python s path elsewhere i am the admin for this machine i m in the group administrators there is no higher root on my machine i opened a powershell as an admin and ran the python interpreter still insufficient permissions looking at windows explorer i am owner of all the files the error says if you do not have administrative access to this machine you may wish to choose a different installation directory preferably one that is listed in your python path environment variable,0,53,119 remove group if contains record with status i would like to group records by id from df and delete group if any of records has status output i would like to get i tried dfnew df groupby id filter lambda x x status but i got the error typeerror filter function returned a series but expected a scalar bool,aws managed airflow to databricks ssl error i am trying to use databricks inbuilt operator provided by airflow such as databrickssubmitrunoperator or databricksrunnowoperator but i am not able to use it it gives below error attempt api request to databricks failed with reason httpsconnectionpool host usdev databaricks xyz com port max retries exceeded with url api jobs run now caused by sslerror sslcertverificationerror ssl certificate verify failed certificate verify failed self signed certificate in certificate chain ssl c if i were to use custom python code then i can supply verify false in requests module of python but since i am using this inbuilt operator i don t see any option to disable the ssl validation from airflow to databricks sample code being used,0,60,113 how to call methods using schedule module in python we can call a simple function using schedule like this but when im creating a class and calling a method i get,click how to make argument mutex i m writing a cli using the beautiful click library the use case i want to implement is something like this but the list show only the available arg so my purpose is to make all arguments optional in this use case i m started from this request on the official repo and a previous similar question very similar but it works only on options i ve not found an elegant solution because arguments works differently in my real case i have a lot of arguments and options so is not possible to reduce all arguments into options,0,31,101 systemd service taking a long time to run i am having service running as background service in ec instance but it taking a long time to start a new one or restart a service refer to image i reboot ec and a service restart at but at the a service print the first log here is my service config file in etc systemd system please help,label is not updating in python kivy label hello doesnt update to listening on press label hello doesnt update to listening on press,0,68,23 how to add prefix to column names except some columns this is an adaptation of a question posed by scalaboy here and answered by timgeb the question is the same except it is about a prefix not suffix given pandas dataframe how can i add the prefix new to all columns except two columns id and name,how to show a widget on top of other widgets in pyqt in my pyqt app i create a virtual keyboard and i want to show this keyboard on top of other widgets in window whenever i click on show button i used a qframe for keyboard and my widgets are in different pages of qstackedwidget in the code blow the keyboard pushes the other widgets up which is not what i want how can i get it to work,0,57,80 error by creating my own scorer with make scorer in sklearn the make scorer method of sklearn seems so simple in all the examples i see but when i try to use it on my cross validation it gives me all nan then i realize that something in make scorer is not working but i cannot figure out what i ll show you a small example if i run if i run,subclassing xgboostregressor for scikit learn estimators receives typeerror super takes no keyword arguments i tried to subclass xgbregressor to create a custom scikit learn compatible estimator with gridsearchcv embedded i kept receiving the typeerror message saying super takes no keyword arguments in the context below the first code is a procedural version of the second code the second code is what i intended to do but failed i want to create a new class for xgboost regressors with gridsearchcv as a cross validator running the following commands xgbr xgbr xgbr fit x y you should see the error message,0,67,94 problem with code not being able to go to else block i just want to be able to move onto the else block if the length of the list is greater than person as of course what i say to if only one person is coming will not be appropriate to say if or more are coming,how to implement string in python class i m working on a problem called employee class and mostly thru it but it s not printing what i want this is my program and this is the file with my class in it i know i need to implement a string but i m stuck,0,59,51 bitnami review board the python module subvertpy is not installed when adding repository bitnami review board the python module subvertpy is not installed when adding repository the python module subvertpy is not installed you may need to restart the server after installing it,how can i read the error content outputs of mysql command executed from python bash fc rf mysql u source user name h source ipv addr password source db password when i use the following functions for the above command mysql warning using a password on the command line interface can be insecure mysql unknown os character set cp mysql switching to the default character set utf mb error access denied for user root pc mshome net using password yes i can t read the output is there a method you know of so i can read it,0,43,87 fix for missing tr class in webscraping i m trying to webscrape different stocks by rows with the data scraped from i am following a tutorial using a similar website however that website uses classes for each of its rows while mine doesn t attached below this is the code i m trying to use however i don t get any output whatsoever i m still pretty new at coding so any feedback is welcome,tkinter update a variable in a label can anyone help resolve this issue or point me in the right direction i am using python my goal is to create a python program that displays a timedelta between two variables using tkinter i want this variable to update each second as it counts down i have created the tk window with my header text and timedif label appearing inside however while my program runs the timedif label does not update timedif label only displays the timedelta when the program was executed i defined a function countdown update intending to use the after method to update the countdown every ms then included a print statement to visually see that the function was called i can see the print statement in the terminal my label does not update i am unsure how to resolve this any help would be appreciated thanks,0,71,150 python sqlalchemy orm filter condition i have this orm class and trying to filter the data from table here is the orm query this give below sql statement how can i change this sql like this in the orm query,sqlalchemy how to using and in or operation i need to do this query i ve tried and the query sql still like this how should i do,1,40,27 why my button in tkinter don t works normal i wanted to make button in tkinter but when i started program the command always calls when code just starts here is example code and then button didn t worked when you press it it don t works i don t know what i m doing wrong so i need help,why is the command bound to a button or event executed when declared my code is the button doesn t work it prints hey and het once without my command and then when i press the button nothing happens,1,55,38 if else syntax bug im using this code to make a rock paper scissors game but im stuck on this part i want the program to tell the player that his input is false if he inputs anything other than r p or s which is working but whenever i do input r p or s it still prints the error message error choose a valid answer r p s,check if something is not in a list in python i have a list of tuples in python and i have a conditional where i want to take the branch only if the tuple is not in the list if it is in the list then i don t want to take the if branch this is not really working for me though what have i done wrong,1,61,67 how does the self work in this python code have two simple python codes both are working but no sure what is the self in there that makes the difference when to use and when not to use self,what is the self parameter in class methods self refers to the specific object instance created from a class but why must every method explicitly include self as a parameter conversely in ruby there is no self,1,39,37 derive random key from dictionary json the essence of the question is how to derive a random key value from a json dictionary if i can sort the dictionary in reverse order sorted and take the very first value from it can i sort it randomly and take the first value and of course it will always be different,how to pick one key from a dictionary randomly i am a beginner of python i try to use this method but there is an error my dictionary is very simple like do you how to solve this problem thanks a lot,1,59,42 what is the point of a behind a parameter in a function python in this code what is the points of the behind the args function,use of args and kwargs so i have difficulty with the concept of args and kwargs so far i have learned that i don t understand what programming task this would be helpful for maybe i think to enter lists and dictionaries as arguments of a function and at the same time as a wildcard so i can pass any argument is there a simple example to explain how args and kwargs are used also the tutorial i found used just the and a variable name are args and kwargs just placeholders or do you use exactly args and kwargs in the code,1,29,103 how to get html source code from qwebenginepage in pyqt i am trying to get html code from the url with qwebenginepage and qwebengineview i found this answer but realy dont undrsestad the syntax get html from qwebenginepage in qwebengineview using lamda so my question is how can i get html source code from url with qwebenginepage in pyqt thanks in advance and sorry about my english skill,save html files in qwebengineview browser i am trying to create my own browser using python qwebengineview i have followed a tutorial that worked on an previous version of pyqt around but due to its recent updates some parts of the previous code no longer work i have fixed most errors but i am unable to perform html file opening saving i always receive a system error when i click on the save button the following is my code for file saving qmainwindow class save file function thank you,1,68,89 create directory if does not exist python is there a better way to write this code create a directory if does not exist,check if a folder exists in a given path and if not then create a folder there i want to check if a folder by the name output folder exists at the path d laptopdata isis project test d b ba e if the folder by the name output folder does not exist then create that folder there can anyone please help with providing a solution for this,1,23,61 python if statements when the condition variable is boolean if i have an boolean variable such as and it is used in an if statement is there any diference between the uses other then readability for example,if x vs if x true vs if x is true apologies if this has been asked before but i have searched in vain for an answer to my exact question basically with python i have a program running a series of geoprocessing tools depended on what is reqested via a series of true false variables that the user adjusts in the script e g however i have now discovered that x does not need to be literally true for the function to run for example so any value other than false appears to evaluate to true which would not be the case for if x true or if x is true seeing as pep strongly recommends only using the if x variant can anybody explain why this behaviour occurs it seems that if x is more a test for if x is not false or if x exists with that in mind i believe i should be using if x is true in this case despite what pep has to say,1,36,175 syntaxerror unicode error unicodeescape codec can t decode bytes in position truncated uxxxxxxxx escape hi there i am trying to run a quite commplicated cmd command in python but i keep on getting the error in the title here s the command,windows path in python what is the best way to represent a windows directory for example c meshes as i have been trying to modify a script but it never works because i can t seem to get the directory right i assume because of the acting as escape character,1,41,48 powershell execute python code passed as arguments this is what happens when i try to run python code through the powershell prompt what is the correct way to write the powershell statement to do this,pwsh command is removing quotation marks in pwsh call the following result ok now do the same via pwsh result is missing quotation marks and square brackets,1,35,27 how to export an environment variable from a python script how do i make the environment variable foo bar accessible to the calling bash script,is it possible to change the environment of a parent process in python in linux when i invoke python from the shell it replicates its environment and starts the python process therefore if i do something like the following when the python process returns foo assuming it was undefined originally will still be undefined is there a way for the python process or any child process to modify the environment of its parent process i know you typically solve this problem using something like but this conflicts with other requirements i have,1,24,92 why can t i get the value of a table when requesting this site in python please let me know why the g cc does not appear in my python output all i did was do beautifulsoup s get linkforsrc content html parser where linkforsrc was the full url from the src at the top of the image from the website thank you this is the site that i m trying to scrape this is what i get when i request that src link in python,can bs get the dynamic content of a webpage if requests can t so i ve tried selenium previously and now wanted to test out bs i tried running the following code but recieved none as an output after researching for a while i found out that requests doesn t load dynamic content like the subcount on youtube or socialblade is there a way to get this information with bs or if do i have to switch back to something like selenium thanks in advance,1,79,82 vs code terminal color i want to change the final result of powershell on vscode to another color i ve tried to use terminal foreground but it change the url too i just want the result i love pizza to lime green thank you guys so much,how do i print colored text to the terminal how do i output colored text to the terminal in python,1,45,20 how to remove even integers from a list in python my function is still returning even numbers i am having some trouble while removing even integers from a list in python this is what i am trying to do but i can t figure out what am i doing wrong is the array skipping elements due to items being removed i would really appreciate some help,how to remove even numbers from a list in python i m trying to remove even numbers from a list my final output is but it is supposed to be empty,1,65,31 how to make all matplotlib histogram rectangles in one color and set words written on x axis on vertical position how can i make all histogram rectangles in one color make certain grid as on photo and set words written on x axis on vertical position as on example,how to change the color of bars in a bar graph according to its x ticks matplotlib python i want to change the bar color of the state az ca fl ny oh and ok i did it by counting the index however i am wondering if i can change the color according to the names of the x ticks here is the graph,1,47,64 why is pygame init needed i ve recently been studying pygame and have stumbled upon the need to use pygame init to initialize all imported modules my question is why is it necessary specifically for pygame none of the other libraries i ve worked with so far pandas numpy nltk pyautogui etc have required this,what exactly does pygame init do every pygame tutorial i have ever read seen have said to squeeze pygame init into your code before you think about doing anything else apparently it initializes pygame modules or something which seems pretty important this was until i thought to remove the pygame init line from my code just to see what would happen lo and behold my game works exactly the same i took to the web and once again every where i went i was told pygame init is necessary but no it is clearly not as i just took it out of my code which works just fine so needless to say i am pretty confused i would really appreciate it if someone explained a the function of pygame init b whether or not it is required in a pygame program if it is then why did my game work and if it is not then when is it needed c any other things you think i should know,1,51,163 wrap x and y axis tick labels in seaborn heatmap i created a heatmap using seaborn library i am struggling to do the text wrapping on the x and y axis tick labels this is how my code looks like please guide me on how i can resolve this issue thanks,split tick labels or wrap tick labels i have pretty long plot tick labels which unfortunately i cannot shorten i am thus looking for a code to split the label into multiple lines wrap text i tried text wrap but it caused an error in my code having the tick label at rotation makes the tick label overlap each other and becomes un readable i also tried having a rotation but the tick label instead spills into my chart space,1,51,79 how to get cython to switch a compiler so basically i want cython to use gcc g but it says that i must download visual studio which is useless making it a bloatware last time i asked at github people suggested me to download visual studio and if you want to download it you must be subscribed and that did not help me so how do i force cython to use gcc g setup py,how to tell distutils to use gcc i want to wrap a test project containing c and openmp code with cython and build it with distutils via a setup py file the content of my file looks like this the fopenmp flag is used with gcc to compile and link against openmp however if i just invoke this flag is not recognized because the compiler is clang i ve unsucessfully tried to specify gcc how can i tell distutils to use gcc,1,74,80 i am unable to resolve syntax error on pip install new to python cannot find error in archives here is my environment and error i am receiving in doing first install,why does pip install inside python raise a syntaxerror i m trying to use pip to install a package i try to run pip install from the python shell but i get a syntaxerror why do i get this error how do i use pip to install the package,1,31,48 why i m getting unicodeencodeerror charmap codec can t encode characters in position character maps to undefined when i ran the doctests with coverage in pycharm i got the following error i m using python and utf in vs code how to solve this,unicodedecodeerror charmap codec can t decode byte x in position character maps to undefined i am using pycharm on windows to write python code i am trying to add ncclient library and i am receiving the below error,1,43,39 what is python spyder equivalent of javadoc what is the equivalent of javadoc in python i would like to comment some code and if i use them in another class i want the documentation shown while hovering it i am using trying to set up spyder by the way thanks in advance,what are the most common python docstring formats i have seen a few different styles of writing docstrings in python what are the most popular styles,1,50,26 where can i see the source code for python s random library i want to check how they implemented the methods containing the particular library,where do i find the python standard library code i wanted to try and look up the source of some of the modules in the python standard library but wasn t able to find them i tried looking in the modules directory after downloading the python tarball but it has mainly c files i also tried looking at the directory where the python that already comes with the os mac osx has it s modules and there it seems to have mainly pyc and pyo files would really appreciate it if someone can help me out i tried what was suggested in the question how do i find the location of python module sources with no luck,1,24,115 how to get function value from txt file with exec python i want to execute python code from txt file and store it in txt file i have this code in python,import module from string variable i m working on a documentation personal for nested matplotlib mpl library which differs from mpl own provided by interested submodule packages i m writing python script which i hope will automate document generation from future mpl releases i selected interested submodules packages and want to list their main classes from which i ll generate list and process it with pydoc problem is that i can t find a way to instruct python to load submodule from string here is example of what i tried and here is way comparison of above lists through pprint i don t understand what s loaded in y object it s base matplotlib plus something else but it lack information that i wanted and that is main classes from matplotlib text package it s top blue coloured part on screenshot x list please don t suggest sphinx as different approach,1,32,144 how to print inside python from one number to another how to print inside python from one number to another for example how can i print from to,print range of numbers on same line using python i want to print a range of numbers on the same line how can i do this using python i can do it using c by not adding n but how can i do it using python i am trying to get this result,1,31,53 how convert timedelta to time how can i retrieve the clock from a dataframe with timedelta format so that it becomes,python how do i get time from a datetime timedelta object a mysql database table has a column whose datatype is time when the table data is accessed python returns the value of this column as a datetime timedelta object how do i extract the time out of this i didn t really understand what timedelta is for from the python manuals e g the column in the table contains the value python mysqldb returns this as datetime timedelta please ignore what is below it does return different value added irrespective of the time value in the table python mysqldb seems to only return datetime timedelta note i use python,1,21,110 how do you add info to a table from an entry in sqlite and tkinter i m trying to add information to a sqlite database from an entry i also want a dropdown menu to have the data from the database when i m doing that i get a attributeerror nonetype object has no attribute get error could someone help successfully accomplish this code,tkinter attributeerror nonetype object has no attribute attribute name i ve created this simple gui i get the ui up and running when i click on the grab button i get the following error on the console why is entrybox set to none,1,62,42 what is the purpose of the square brackets in this line of python code the code in question that i do not fully understand is this it outputs the code does not work without the square brackets so i m wondering what its purpose is,what does list comprehension and similar mean how does it work and how can i use it i have the following code when i run it in the python shell it returns i ve searched and it seems this is called a list comprehension and similarly there seem to be set dict comprehensions and generator expressions but how does it work,1,44,59 is there any module that c supports the same as os module in python python is a great programming language with a diverse library resource one of which is the os module so i wonder if it exists in c or must be installed from the outside source before asking this question i spent quite a lot of time for finding modules thanks in advance,c version of python s os module what is the c module equivalent of python s import os any time i try to google c version of python os it shows me how to get the operating system version in either python or c,1,65,42 very unusual fractions in sympy how do i solve this i get very weird fractions in sympy i have no clue why it is given me these unusual fractions,how do i replace floats with rationals in a sympy expression i have an expression from a sympy calculation where a b c are symbols and would like to parse it so that the floats are replaced with rationals like in i know how to do one by hand but do not quite know how to go about parsing the atoms and picking only the ones that are floats and substituting back the rational number approximation what is the smartest way of doing these substitutions in the expression,1,29,86 python pyqt gtkdialog mapped without a transient parent this is discouraged file untitled ui file untitled py file main py running python main py and the clicking in the choose folder button there an error or warning under linux ubuntu x how to avoid this error warning thanks in advance chris pappas,qfiledialog gtkdialog mapped without a transient parent i ve a source code snippet of a program written with qt in c running under linux that creates a qfiledialog for opening an existing file if i execute this everything seems to work alright but when the dialog was created i got a warning saying gtk message gtkdialog mapped without a transient parent in another thread i figured out that calling this function gtk window set transient for fixes this error but this function is part of the gtk library but i use the qt framework so are there any solutions to fix this error parent of this dialog is a qmainwindow,1,47,104 how to interact with interface elements through different classes for example i want to change the text of a button by binding it to a function from another class but i get an error on the line self ui pushbutton settext ok attributeerror bool object has no attribute ui here is main py code here is test gui py code please tell me what is the problem,linking a qtdesigner ui file to python pyqt so if i go into qtdesigner and build a ui it ll be saved as a ui file how can i make this as a python file or use this in python,1,60,38 how to put back data together into new dataframe lets say i have original data frame as i then wrote some cote to group it df groupby a c max i got this output how to go back to displaying the whole date expected output,get the row s which have the max value in groups using groupby how do i find all rows in a pandas dataframe which have the max value for count column after grouping by sp mt columns example the following dataframe which i group by sp mt expected output get the result rows whose count is max in each group like example this dataframe which i group by sp mt for the above example i want to get all the rows where count equals max in each group e g,1,41,87 python while doesn t break no matter what i do when i execute my code it is always looping the while doesn t matter the parameter i put in it and i have no clue why that happens i would be very thankfull if someone can help me,how to test multiple variables for equality against a single value i m trying to make a function that will compare multiple variables to an integer and output a string of three letters i was wondering if there was a way to translate this into python so say which would return a list of,1,46,53 printing from a part of a string without knowing its position i m trying to create a discord bot that display epic free games using data from an rss feed and it outputs a very long description the important part is this i m trying separate this epicgames direct link,how can i get href links from html using python so far so good but i want only href links from the plain text html how can i solve this problem,1,49,31 convert the string m to or k to in pandas dataframe need some help on processing data inside a pandas dataframe i want to convert the form of col into the form of col what should i do,convert the string k to or m to in pandas dataframe need some help on processing data inside a pandas dataframe any help is most welcome i have ohclv data in csv format i have loaded the file in to pandas dataframe how do i convert the volume column from k to or m to the column can contain both k in form of thousands and m in millions,1,40,73 use class function as init parameter default value i made a class and in its init function i d like to use its class function as a default value is this possible it should look something like this however the interpreter gives me back,python nameerror when defining class the below python fails for some reason i get the following error,1,43,17 python pandas changing form of dataframe one to multiple columns right now i m dealing with a dataframe like this old dataframe is there a specific function inside pandas to change the format of the dataframe and split every row into multiples like this new dataframe as you can see i always have multiple pairs of data val a val b val a val b and so on thanks for your help and have a great day,how do i melt a pandas dataframe on the pandas tag i often see users asking questions about melting dataframes in pandas i am gonna attempt a cannonical q a self answer with this topic i am gonna clarify what is melt how do i use melt when do i use melt i see some hotter questions about melt like convert columns into rows with pandas this one actually could be good but some more explanation would be better pandas melt function nice question answer is good but it s a bit too vague not much expanation melting a pandas dataframe also a nice answer but it s only for that particular situation which is pretty simple only pd melt df pandas dataframe use columns as rows melt very neat but the problem is that it s only for the specific question the op asked which is also required to use pivot table as well so i am gonna attempt a canonical q a for this topic i will have all my answers on this dataset of random grades for random people with random ages easier to explain for the answers d i am gonna have some problems and they will be solved in my self answer below how do i melt a dataframe so that the original dataframe becomes i want to transpose this so that one column would be each subject and the other columns would be the repeated names of the students and there age and score this is similar to problem but this time i want to make the problem output subject column only have math i want to filter out the english column i want the output to be like the above if i was to group the melt and order the students by there scores how would i be able to do that to get the desired output like the below i need it to be ordered and the names separated by comma and also the subjects separated by comma in the same order respectively how would i unmelt a melted dataframe let s say i already melted this dataframe to become then how would i translate this back to the original dataframe the below how would i go about doing this if i was to group by the names of the students and separate the subjects and grades by comma how would i do it i want to have a dataframe like above if i was gonna completely melt my dataframe all columns as values how would i do it i want to have a dataframe like above all columns as values,1,71,434 i want to make a custom id system in sqlite in python i am currently making a stock management system in python and i am using sqlite as my database i am trying to make a custom id system for my items that can be sold in this program for example i want a id to be iid how would you do this in sqlite or would i have to write a function to work it out for me,how to add auto increment id with character for python sqlite i m trying to make auto increment id with the character when i add the new data example for id afk afk afk and etc this should be auto field,1,79,41 trying to figure out why this function does not result in type int and is nonetype it returns nonetype and im not sure how to fix this,what causes my function to return none at the end my very simple python function is returning none at the end of it and i m not sure quite why i ve looked at some other posts and still can t figure it out here is my code,1,26,45 attributeerror numpy ndarray object has no attribute xaxis when trying to create a plot with multiple figures i get this error my code is and foo is a variable from value to so it has length but it works when i hyperparametrize nrows and ncols only assigning the following values by doing the following i get success why is this happening a deeper view of the error,getting error when plotting a figure with sublpots using axes in matplotlib i tried to plot the subplots using the below code but i am getting attributeerror numpy ndarray object has no attribute boxplot but changing the plt subplots it is plotting the box plot with indexerror i am expecting four subplots should be plotted but attributeerror is throwing,1,70,57 pandas how do you sum values that match same id i m using pandas to manipulate a csv file with several rows and columns that looks like the following how do i add third column for the total sum for unique id like i m pretty sure that it should not be super hard just not sure where should i go,how do i pandas group by to get sum i am using this data frame i want to aggregate this by name and then by fruit to get a total number of fruit per name for example i tried grouping by name and fruit but how do i get the total number of fruit,1,59,53 convert python list into map i have a key value pair say using the below command i can convert the key to a list so my list will be like and i want to convert it into a map to have the final output in variable my dict as so that when i print this,how to create a nested dictionary from a list in python i have a list of strings tree list parents children grandchildren how can i take that list and convert it to a nested dictionary like this,1,52,37 usage of findcontours causes valueerror not enough values to unpack expected got i am working with raspberrypi i am trying to run this code which shows below error,too many values to unpack calling cv findcontours i am a python beginner i was trying to run this code when i summon the mask py i got this valueerror what is wrong with this code,1,31,38 oop python arguments in self budget app could somebody explain me difference between these two pieces of code i know that in the second case the arguments can be passed while instansiating the object but my problem was that when i used the option then the ledger list contained all objects that i have created with the first one list is unique for the object as expected,least astonishment and the mutable default argument anyone tinkering with python long enough has been bitten or torn to pieces by the following issue python novices would expect this function to always return a list with only one element the result is instead very different and very astonishing for a novice a manager of mine once had his first encounter with this feature and called it a dramatic design flaw of the language i replied that the behavior had an underlying explanation and it is indeed very puzzling and unexpected if you don t understand the internals however i was not able to answer to myself the following question what is the reason for binding the default argument at function definition and not at function execution i doubt the experienced behavior has a practical use who really used static variables in c without breeding bugs edit baczek made an interesting example together with most of your comments and utaal s in particular i elaborated further to me it seems that the design decision was relative to where to put the scope of parameters inside the function or together with it doing the binding inside the function would mean that x is effectively bound to the specified default when the function is called not defined something that would present a deep flaw the def line would be hybrid in the sense that part of the binding of the function object would happen at definition and part assignment of default parameters at function invocation time the actual behavior is more consistent everything of that line gets evaluated when that line is executed meaning at function definition,1,69,273 what is the fastest way to execute commands in python i m writing a python script and i need to call some commands for example creating directories deleting files execute docker commands git commands make command etc what is the fastest way to invoke such commands should i use os system or subprocess the python script will run on windows and linux,speed difference betwen subprocess call and os system is there any speed difference in the execution of the subprocess call and os system command suppose that the command itself is exactly same i know there are many posts out there talking about the benefits of subprocess and why os system should be ditched but no one mentioned anything about the speed of them from what i understand subprocess is nowhere near a wrapper for os system which means there could be speed differences would prefer an answer with experimental data instead of theory stuff as i m actually needing it to evaluate the performance of a script that has hundreds of such calls,1,60,105 panda processing nested dataframe i have a nested dataframe which is converted from json and in one of the column source it is nested how can i convert it to dataframe with the header input output thank you very much,split explode a column of dictionaries into separate columns with pandas i have data saved in a postgresql database i am querying this data using python and turning it into a pandas dataframe however the last column of this dataframe has a dictionary of values inside it the dataframe df looks like this i need to split this column into separate columns so that the dataframe df looks like this the major issue i m having is that the lists are not the same lengths but all of the lists only contain up to the same values a b and c and they always appear in the same order a first b second c third the following code used to work and return exactly what i wanted df i was running this code just last week and it was working fine but now my code is broken and i get this error from line i made no changes to the code but am now getting the error i feel this is due to my method not being robust or proper any suggestions or guidance on how to split this column of lists into separate columns would be super appreciated edit i think the tolist and apply methods are not working on my code because it is one unicode string i e the data is imported from the postgresql database in this format any help or ideas with this issue is there a way to convert the unicode,1,40,248 error with print function typeerror numpy float object is not callable i m getting this error message whenever i try to use the print function it shows the same error regardless of what object i m trying to print array syntax number has this ever happened to anyone and if so do you know how to fix it,typeerror int object is not callable given the following integers and calculation this results in how can i round the output to an integer,1,55,24 converting missing data to np nan there is a column in my data set that i should convert its elements to another unit e g bit to byte and there is some missing values e g that i should change all of them to np nan i can do that separately and using something like a for loop but i believe there is a better way any help please,replacing blank values white space with nan in pandas i want to find all values in a pandas dataframe that contain whitespace any arbitrary amount and replace those values with nans any ideas how this can be improved basically i want to turn this into this i ve managed to do it with the code below but man is it ugly it s not pythonic and i m sure it s not the most efficient use of pandas either i loop through each column and do boolean replacement against a column mask generated by applying a function that does a regex search of each value matching on whitespace it could be optimized a bit by only iterating through fields that could contain empty strings but that s not much of an improvement and finally this code sets the target strings to none which works with pandas functions like fillna but it would be nice for completeness if i could actually insert a nan directly instead of none,1,65,162 extract the sublist from the below list numbers and print it extract the sublist from the below list numbers and print it numbers,understanding slicing i need a good explanation references are a plus on python slicing,1,37,14 is there any module that c supports the same as os module in python python is a great programming language with a diverse library resource one of which is the os module so i wonder if it exists in c or must be installed from the outside source before asking this question i spent quite a lot of time for finding modules thanks in advance,how does c interact with the operating system like how javascript is able to manipulate the dom because the browser exposes the dom to javascript in the form of an object is that the same way c is able to do things like draw on the screen does the operating system create a c interface in the form of c classes or does the operating system have some generic interface that my specific version of c knows how to implement,1,65,80 how to split data inside list into individual separate columns using pandas i want to split data inside names into individual separate columns using pandas,how do i split a string into several columns in a dataframe with pandas python i am aware of the following questions how to split a column based on several string indices using pandas how do i split text in a column into multiple rows i want to split these into several new columns though suppose i have a dataframe that looks like this i know that using i can split a string but as a next step i want to efficiently put the split string into new columns like so i could for example do this but how could one achieve the same result more elegantly a,1,25,109 use isinstance on type variable i have a class defined with a generic i m trying to check if an object passed to a function is of type t however this doesn t work is there a way to do something similar,generic t base class how to get type of t from within instance assume you have a python class that inherits from generic t is there any way to get a hold of the actual type passed in from within the class instance for example on here it is suggested the type arg would be present in in the args field of the type and indeed would print class int however i can t seem to access this from within the instance directly e g substituting doesn t seem to to the trick thanks,1,41,89 seaborn split column names for hue i have a dataframe like this i would like to use sns lineplot but instead of the name of the columns as hue i would like to make a split of the names in order to have a legend that considers the two combinations,split pandas column and add last element to a new column i have a pandas dataframe containing besides other columns full names i want to create a new column which splits the fullname column along the blank space and assigns the last element to a new column the result should look like i thought it would work like this however i get a keyerror i use that is the last element of the split group in order to be sure that i get the real last name in some cases e g a name like andreas martin master this helps to get the last name that is master so how can i do this,1,49,115 monkeypatching a private method how do you monkeypatch a private method and still have access to the self variable edit while the question is indeed a duplicate the original answer is too long it s a whole tutorial solution access self by using function get object instance where object instance is the instance of the object you want to monkeypatch,adding a method to an existing object instance i ve read that it is possible to add a method to an existing object i e not in the class definition in python i understand that it s not always good to do so but how might one do this,1,55,46 how to set default data type for parameter in a class with the class itself i just want to deploy datatypes for some parameters for example parameter left is a treenode type but when i wrote the code like this i will receive a error message nameerror name treenode is not defined so could anyone can tell me how to set default datatypes with the current class,python type hinting own class in method edit i notice people commenting about how the type hint should not be used with eq and granted it shouldn t but that s not the point of my question my question is why can t the class be used as type hint in the method parameters but can be used in the method itself python type hinting has proven very useful for me when working with pycharm however i ve come across behaviour i find strange when trying to use a class own type in its methods for example here when typing other the property id is not offered automatically i was hoping to solve it by defining eq as follows however this gives nameerror name foo is not defined but when i use the type within the method id is offered after writing other my question is why is it not possible to use the class own type for type hinting the parameters while it is possible within the method,1,67,165 print items from a list of lists i have a list of lists and i want to print a row of items from each list i have this code and this is the result i m getting why is the script not iterating for a fourth time and what does it say about looping though list of lists in python,how do i iterate through two lists in parallel i have two iterables and i want to go over them in pairs that should result in one way to do it is to iterate over the indices but that seems somewhat unpythonic to me is there a better way to do it,1,59,52 why does that both lists are modified so i m trying to create a back up of a list but when i want to modify the backup variable both are being modified output what can i do so my output looks like this,how do i clone a list so that it doesn t change unexpectedly after assignment while using new list my list any modifications to new list changes my list every time why is this and how can i clone or copy the list to prevent it,1,42,42 i got this error assertion failed empty in function cv cascadeclassifier detectmultiscale open cv i am trying to create with my partrners a semaphore detector but on my partner s pc it gives the following problem the complete code is,opencv python error assertion failed empty in function cv cascadeclassifier detectmultiscale consider the following code there is a problem that when i run this line of code i always get the same error as you can see i have the two files in the same folder i ve tried all the solutions that i ve seen like giving the whole path for the classifier but nothing seems to be working,1,40,65 how to merge dataframes by conserving all the lines i have two dataframes like that dataframe dataframe i m looking for this final dataframe do you know how to have this result i want to have a unique line when the two keys value date id are present in dataframe a and b i tried some things with concatenate with pandas but it failed thanks in advance,pandas merging and more i ve seen these recurring questions asking about various facets of the pandas merge functionality most of the information regarding merge and its various use cases today is fragmented across dozens of badly worded unsearchable posts the aim here is to collate some of the more important points for posterity this q a is meant to be the next installment in a series of helpful user guides on common pandas idioms see this post on pivoting and this post on concatenation which i will be touching on later please note that this post is not meant to be a replacement for the documentation so please read that as well some of the examples are taken from there for ease of access merging basics basic types of joins read this first index based joins generalizing to multiple dataframes cross join,1,73,143 how can i solve this problem typeerror can only concatenate str not int to str i was trying to print the input plus a string,how do i put a variables value inside a string i would like to put an int into a string this is what i am doing at the moment i have to run the program for several different numbers so i d like to do a loop but inserting the variable like this doesn t work how do i insert a variable into a python string,1,25,64 python return value in bash script i have python script which is ran from bash script bash script python script output of bash script problem is that variable exit code in bash script is empty empty line if i put into python script to exit function some string e g exit example i get this value in bash script but with integer there is problem could someone help me where is the problem,get exit status of a process in bash i have a c executable named test i want to find out the getexitcodeprocess code when the execution is completed i can find out the status code by writing the following in another wrapper program as such and then check for wifsignaled wifstopped etc statuses however instead of writing a wrapper program can i get the exit status code from the pid of the test program by writing a bash script edit does writing a in the bash after executing test gives the solution to the above problem edit summary is when i run an executable from the command line how do i not a program get the exit status,1,70,120 how to map out with python django management cmd the is active flag and blacklist flag have the same intention although both are available since with is active filtering is possible and it is seen in the overview all blacklist should be mapped to is active,django update management command i am trying to give the command such a way when blacklist is true and active will false but i am getting all the blacklist true and active is false,1,46,34 python flask project download excel error every time this is downloading the excel with same content can someone please help me to understand if this is something related to caching or session issue and how we can resolve it,are global variables thread safe in flask how do i share data between requests in my application the state of a common object is changed by making requests and the response depends on the state if i run this on my development server i expect to get and so on if requests are made from different clients simultaneously can something go wrong the expected result would be that the different clients each see a unique number from to or will something like this happen since there were only two clients the expected results were and not and a number was skipped will this actually happen as i scale up my application what alternatives to a global variable should i look at,1,39,131 discord py commands don t work but events work and no errors i ve made a discord bot but when i run it events work fine all the cogs load in correctly but the commands wouldn t work when i use a command it wouldn t show the output i used discord py on version here is the code,commands don t run in discord py no errors but run in discord py i m trying to understand how migrating from discord py version to works in particular this is test code i m using in discord py the bot prints bot is ready and i can do the command test in discord py the bot prints bot is ready but i can t do the command and there is no error message in the console when i m trying to do the command why does this occur and how can i restore the behaviour of version in my bot,1,54,99 related field not populating in the response in django rest framework have two models and have two serializers the subtopics are not populating in the response of the topic serializer,related field not populating with data in django rest framework serializer have two models and have two serializers the subtopics are not populating in the response,1,30,26 how to automate dataframe parsing on pandas i have dataframe with almost rows to make comupatation easier i did that how to automate code below to avoid annecessary mistakes,split pandas dataframe into multiple dataframes with equal numbers of rows i have a dataframe df that i need to split into multiple dataframes that will contain every rows of df and every small dataframe i will write to separate file so i decided create multilevel dataframe and for this first assign the index to every rows in my df with this method that throws out so do you have an idea of how to fix it where is my method wrong but if you have another approach to split my dataframe into multiple dataframes every of which contains rows of df you are also welcome cause this approach was just the first i thought about but i m not sure that it s the best one,1,30,129 jupyter how do i prevent matplotlib figures from being automatically shown i like to only show a matplotlib figure with an explicit show fig but jupyter automatically shows all created figures this link has a workaround but it is essentially just capturing all the output of a cell i don t want to do that related ps i am actually using seaborn not matplotlib directly,prevent plot from showing in jupyter notebook how can i prevent a specific plot to be shown in jupyter notebook i have several plots in a notebook but i want a subset of them to be saved to a file and not shown on the notebook as this slows considerably a minimal working example for a jupyter notebook is as you can see i have two types of plots a and b i want a s to be plotted and shown and i don t want the b plots to be shown i just want them them to be saved in a file hopefully this will speed things a bit and won t pollute my notebook with figures i don t need to see thank you for your time,1,63,125 the pyplot does not save the figure i have the code that uses pyplot function but the plot that is saved shows an empty area removing variables did not give result what is wrong,matplotlib pyplot savefig outputs blank image i am trying to save plots i make using matplotlib however the images are saving blank here is my code and tessstttyyy png is blank also tried with jpg,1,34,34 pandas compare two dataframes and remove from df that also exists in df i have two separate pandas dataframes df and df and i want to remove records from df if the combination also exists in df df df result df remove row containing unique combination of and df i though of using the isin method but dont know how to use it with two columns is this possible without looping,how to do df not df dataframe merge in pandas i have pandas dataframes df df with common columns keys x y i want to merge do a df not df kind of merge on keys x y meaning i want my code to return a dataframe containing rows with x y only in df not in df sas has an equivalent functionality who to replicate the same functionality in pandas elegantly it would have been great if we can specify how left right in merge,1,73,85 mixing yield and return yield cand return vs return cand why do they lead to different output why does lead to different output behavior than i m solving leetcode combination sum and was wondering why one solution works but not the other on the following input the working solution correctly prints while the non working solution prints i m wondering why yield cand return works but return cand doesn t,return in generator together with yield in python in python there was an error when return was together with yield in function definition but for this code in python there is no error that return is used in function with yield however when the function next is called then there is thrown exception stopiteration why there is not just returned value is this return somehow ignored,1,66,70 how to create a conda environment with older python version i need to create a conda environment with python on macbook m but it is no longer supported i got collecting package metadata repodata json done solving environment failed packagesnotfounderror the following packages are not available from current channels this conda osx arm link list the version that is currently supported how do i create a conda environment with python when it is no longer supported,cannot install python on osx arm i am trying to create a new environment with python using conda like i got following errors why is python apparently unavailable this is on an apple silicon osx arm machine running macos,1,76,40 can t check password that s hashed in php in python i hashed a password through php and posted it to a db i want to check it in python but i get typeerror expected string or bytes like object to my understanding i m supposed to specify that it s a b hash but can t seem to figure out how to do that with a variable,how to get a single result from a sql query in python is there an elegant way of getting a single result from an sqlite select query when using python for example is there a way to avoid those nested fors and get the value directly i ve tried without any success,1,62,51 issue installing web on python not c issue i m having issues with installing web i read that python does not support it so i reinstalled went through everything again and i am still getting the same error i already have c installed so that is not my issue if someone could help me what i m doing wrong that would be great,cannot open include file io h no such file or directory i was trying to compile a simple pyx file using cython here s my setup py then i run the command the error is shown below i ve struggled on googling it but found nothing helpful can someone help me to resolve the error please i have anaconda python and visual studio express installed,1,64,64 in pandas how to turn a dataframe into tidy data in python and pandas i have a dataframe that i need to turn into tidy data to make charts easier the original data is like this i want to transform into a dataframe with the transposition of the data and adapting column names please is there a way in python to do this,how do i melt a pandas dataframe on the pandas tag i often see users asking questions about melting dataframes in pandas i am gonna attempt a cannonical q a self answer with this topic i am gonna clarify what is melt how do i use melt when do i use melt i see some hotter questions about melt like convert columns into rows with pandas this one actually could be good but some more explanation would be better pandas melt function nice question answer is good but it s a bit too vague not much expanation melting a pandas dataframe also a nice answer but it s only for that particular situation which is pretty simple only pd melt df pandas dataframe use columns as rows melt very neat but the problem is that it s only for the specific question the op asked which is also required to use pivot table as well so i am gonna attempt a canonical q a for this topic i will have all my answers on this dataset of random grades for random people with random ages easier to explain for the answers d i am gonna have some problems and they will be solved in my self answer below how do i melt a dataframe so that the original dataframe becomes i want to transpose this so that one column would be each subject and the other columns would be the repeated names of the students and there age and score this is similar to problem but this time i want to make the problem output subject column only have math i want to filter out the english column i want the output to be like the above if i was to group the melt and order the students by there scores how would i be able to do that to get the desired output like the below i need it to be ordered and the names separated by comma and also the subjects separated by comma in the same order respectively how would i unmelt a melted dataframe let s say i already melted this dataframe to become then how would i translate this back to the original dataframe the below how would i go about doing this if i was to group by the names of the students and separate the subjects and grades by comma how would i do it i want to have a dataframe like above if i was gonna completely melt my dataframe all columns as values how would i do it i want to have a dataframe like above all columns as values,1,63,434 how to add to a variable to keep the number of tries i m trying to make a dumbed down version of hangman to practice python i have a count variable but it isn t counting when the condition is met what am i doing wrong,using global variables in a function how do i create or use a global variable inside a function how do i use a global variable that was defined in one function inside other functions,1,44,34 why can t read global var when it is going to be changed testing global vars scope i found with this situation and can t understand why first function works and sencond don t the error unboundlocalerror is raised at same line,unboundlocalerror on local variable when reassigned after first use the following code works as expected in both python and however when i uncomment line b i get an unboundlocalerror c not assigned at line a the values of a and b are printed correctly this has me completely baffled for two reasons why is there a runtime error thrown at line a because of a later statement on line b why are variables a and b printed as expected while c raises an error the only explanation i can come up with is that a local variable c is created by the assignment c which takes precedent over the global variable c even before the local variable is created of course it doesn t make sense for a variable to steal scope before it exists could someone please explain this behavior,1,40,142 is there a way to use set issubset in an order aware way in python i am trying to check if shorter tuples are contained inside a longer one but i need the order in which things are placed in the larger tuple to be respected during the checking here is an example my expectation is set b issubset a to return true as it is but set c issubset a should return false is there a way to do this without a tedious for loops,check for presence of a sliced list in python i want to write a function that determines if a sublist exists in a larger list is there a python function that can do this,1,78,34 how to check for enter key press in curses curses key enter not working i am trying to get user input in curses python and for some reason it cannot detect when i press the enter key the if part is not working and the elif part is working fine,interpreting enter keypress in stdscr curses module in python i am using python s curses module in stdscr whenever i press enter key curse moves to the first column in the same line i have couple of questions regarding it what is the reason for that is there a way to move the curse to the next line if i want to do certain things execute some function or something on enter key press then what will come in if condition e g,1,48,81 how to consolidate the dataframe of matching indices and splitting other columns i have a dataframe which needs to be consolidated for same ids and split other columns to different columns as such i have presented the example input dataframe and required output dataframe input dataframe example required output dataframe,how to transpose values from top few rows in python dataframe into new columns i am trying to select the values from the top records of each group in a python sorted dataframe and put them into new columns i have a function that is processing each group but i am having difficulties finding the right method to extract rename the series then combine the result as a single series to return below is a simplified example of an input dataframe df in and the expected output df out i am reproducing below examples of the functions i ve tested and trying to get a more efficient option that works especially if i have to process many more columns and records function best prices v works but have to explicitly specify each column or variable and is especially an issue as i have to add more columns codes to call function second attempt to improve reduce codes and explicit names for each variable not complete and not working,1,50,165 pandas remove duplicates and replace with min value i have a dataframe which has multiple ids giving two different values i e in example below there are two entries for id with different values and is there a way i can change this to be the min of the two so the output table is as below,pandas change values in group to minimum what i have what i need is to group by series and series and to convert the values in series to the minimum of that group i e i have a feeling this can be done with groupby but i m not sure how to replace it in the existing dataframe or to add it as new series i m able to get which are the correct minimums per group but i cant figure out a simple way to pop that back into the original dataframe,1,58,90 replacing character in python i have a dataset with many columns the values in columns start with and end with like sinopharm i want to replace and with nothing i did the following code but not both can be changed important i want to replace both at once and to all columns like q q etc,replace multiple characters across all columns pandas df my df has columns some of the column names contain special characters like i need to replace all with i also need to replace empty spaces as well here is my code with the above code i was only able to replace,1,60,56 can we use positional and keyword arg in python the following code give error typeerror test args takes positional argument but were given can we use positional and keyword same line,how to pass through python args and kwargs while i have a general understanding i think of python s args and kwargs i m having trouble understanding how to pass them from one function through to another here s my model i ve split saving a name into two functions above this way i can unit test the logic i would normally put all in the save name method by unit testing the save name for method instead when i run this in the interpreter and stop in the save name method as i would expect i see this if i then step into the save name for method i see this is there some way to pass the kwargs that are received by the save name method directly into save name for method so that they appear in the latter s kwargs i d like to see something like this in save name for method s name space i realize i could parse them in save name and then pass them explicitly to save name for but that seems rather inelegant i also thought i might do this since args is a tuple but it doesn t appear to work args is just everything i don t understand this is there a pythonic way to do this,1,31,194 how to select a part of a dataframe according to a list i have the following dataframe and i have the following list with some cities located in america i would like to keep in the dataframe only the name of the countries that are in the list americ so i tried to do the following code this code is producing the following error i would like the output to be,use a list of values to select rows from a pandas dataframe lets say i have the following pandas dataframe i can subset based on a specific value but how can i subset based on a list of values something like this to get,1,70,45 can i write in a user input in python i would like to add a default value to an input something like this so that the user can edit it like the value attribute in html input i tried using pyautogui but naturally it doesn t work because pyautogui hotkey is called after input is there any way to do this,show default value for editing on python input possible is it possible for python to accept input like this but instead of the user typing download it is already there as a initial value if the user wants to edit it as downloads all he has to do is add a s and press enter using normal input command all i can get is a blank prompt is there a simple way to do this that i m missing,1,59,78 i ve set nullable to true for my row in sqlalchemy database but i keep getting integrityerror for the same help me through so i was trying to create a movie class object but i kept getting integrityerror despite the fact that i ve set nullable true for ranking attribute in the following class definition,error occurs when i try to create a new column with passwords in database i get my website up and running but when i go to signup an error occurs sqlalchemy exc operationalerror sqlite operationalerror no such column passwords key sql select passwords id as passwords id passwords name as passwords name passwords key as passwords key passwords date created as passwords date created from passwords order by passwords date created background on this error at any help is much appreciated,1,52,66 numpy how to scale an array smoothly say i have a numpy array like this and i would like to scale it by a factor of two filling in the gaps using the mean of two adjacent numbers result anyone knows how to do this,numpy interpolation to increase a vector size hi i have to enlarge the number of points inside of vector to enlarge the vector to fixed size for example for this simple vector now i want to get a vector with size of taken the a vector as base the results will be edit what i need is a function that will enter the base vector and the number of values that must be the resultant vector and i return a new vector with size equal to the parameter something like to use like and b contains data results of linear cubic or whatever interpolation methods,1,45,107 extract every th elements from the numpy array i want to extract every th element in the numpy array the array is final array shuld be the array is ofocurse very huge so just the indices would not be possible i guess is there a quicker way to do it instead of iterating using for loop,pythonic way to return list of every nth item in a larger list say we have a list of numbers from to is there a pythonic efficient way to produce a list of the first and every subsequent th item i e yes i can do this using a for loop but i m wondering if there is a neater way to do this perhaps even in one line,1,57,74 find the completion of download in qwebenginedownloaditem with the function isfinished or finished in python i want to detect the completion of download by pyqt qtwebenginewidgets qwebenginedownloaditem i have read the docs but its showing error i want to detect by isfinished or finished with this code below and the connect function ok w is the view i want to detect it inside downloadrequested and after the detection i want to execute this code,how to download csv file with qwebengineview and qurl i m building a program which uses qwebengineview and qurl to display a website in my pyqt app running on windows however i now want to be able to download a csv file from the same website but being a noob i can t seem to figure out how i m familiar with using requests urllib request urllib etc for downloading files but for this i specifically want to do it with the qwebengineview as the user will have authenticated the request previously in the pyqt window the code to show the website in the first place goes like this does anyone have any suggestion on how this can be achieved,1,73,117 make the drawn picture clickable i made several drawn squares for my basic game the problem occurs when i tried to make them clickable i ve searched around hours in google but could not found similar topic to my specific problem here is my code the game will be tic tac toe could you give me any suggestions of how to make them alive i want onclick to appears x or o,pygame mouse clicking detection i was wondering how to write code that would detect the mouse clicking on a sprite for example,1,72,22