I’m making a playlist website that can create display and delete playlists and songs. I’m using a JSON file to store the data. The only feature that isn’t working is the delete song feature. This is my JSON file I’m using the ID of the playlist and the index of the song to locate it in…
Tag: python
Fastest way to filter csv using pandas and create a matrix
input dict I have large csv files in the below format basename_AM1.csv I have large csv files in the below format basename_AM1.csv Now I need to create a similarity dict like below for the given input_dict by searching/filter the csv files I have come up with the below logic but for an input_dict of 100 sampl…
I can’t get a response from the server via socket python
I’m trying to send a string to the server, but I can’t send the data and get a response, what’s the problem, please help. When I connect to the server via netcat, everything is fine. Answer I was finally able to get a response from the server, it was because NetCat automatically adds n when …
function to output pairwise of passed letters
I would like to create a Python function that can take in letters and output a pairwise comparison of the letter given. So for example, if my function is named pairwise_letters(), then it should behave as follows: Answer Use itertools.combinations() to get each pairing. By default, itertools.combinations() ou…
PerformanceWarning: dropping on a non-lexsorted multi-index without a level parameter may impact performance. How to get rid of it?
I have the following line of code It basically, filts my multi index df by a specific level 1 column. Drops a few not wanted columns. And does the sum, of all the other ones. I took a glance, at a few of the documentation and other asked questions. But i didnt quite understood what causes the warning, and i
How can you use RD coordinates instead of gps coordinates to plot traffic routes in a folium plot?
In want to show traffic routes on a folium map. These routes are in the Netherlands and the coordinates are in RD (EPSG:28992). I tried to map the routes using the following code: But this won’t work and this results in a random red line: However it does work whenever I transform the RD coordinates to G…
Defining Parent For a Dataset with Several Conditions in Pandas
I have a CSV file with more than 10,000,000 rows of data with below structures: I have an ID as my uniqueID per group: Data Format For defining parent relationship below conditions exist: Each group MUST has 1 Head. It is OPTIONAL to have ONLY 1 Senior in each group. Each group MUST have AT LEAST one Junior. …
How to use pip for Python3.10 instead of Python 3.9?
I would like to use the Python toolkit Neurokit2 (https://neurokit2.readthedocs.io/en/latest/index.html) on Mac OS 12.3.1 in Python 3.10.4. Python 3.10.4 was installed via homebrew. Python 3.9 was also installed via homebrew because of dependencies for jupyterlab and scipy. When installing Neurokit2 via pip3 …
Python Django Rest – Return extra field with lowest, highest and average values of some other field
I’m new to Django and APIs in general and I want to create a Django based API using Django Rest Framework. Here’s what I want to do: Endpoint to age range report: Response: Endpoint to salary range report: Response: I have two apps, employees and reports. Here’s employees/models.py: HereR…
Random search grid not displaying scoring metric
I want to do a grid search of some few hyperparameters through a XGBClassifier of a binary class, but whenever i run it the score value (roc_auc) is not being display. I read in other question that this can be related to some error in model training but i am not sure which one is in this case. My model