I have created a pandas dataframe called df using this code: import numpy as np import pandas as pd The dataframe looks like this: The columns contain some special characters (/ and @) that I need to replace with a blank space. Now, I have a list of special characters: listOfSpecialChars = ‘¬`!”£$…
Tag: python
Python – Anyone mind to assist in this Pandas Dataframe problem? URGENT
I am facing some difficulties using merge function in Pandas. I am looking for some kind of Vlookup formula to assist me on this. However, I couldn’t solve my problem. My data is huge and I couldn’t share here due to confidential. However, I try to came up with similar data here. Old Code New Code…
Python iterate folder of csv and convert do json
I am amateur at python but I have a task of converting folder of csv to json files. I have this script working with specified CSV file but I have no idea how to make the script iterate thrue folder of csv and convert all of those csv to json. The original script: someone will give me a hint? Answer
Getting a dictionnary of lists that contain element from a column using a groupby
I have a dataframe that looks like this, with 1 string column and 1 int column. I would like to get at the very end a dictionnary of lists that store all values of column B groupby A, like this : What I made to achieve this to used a groupby to get number of occurences for column_B : And
Cumulative count of column based on Month
I have a dataframe that looks like this: Code Period A 2022-04-29 A 2022-04-29 A 2022-04-30 A 2022-05-01 A 2022-05-01 A 2022-05-01 I have to create a new column, i.e., if the month ends then Count should start from 1. Below is the code that I have tried at my end. Code Period size A 2022-04-29 2 A 2022-04-30 …
how to avoid row number in read_sql output
When I use pandas read_sql to read from mysql, it returns rows with row number as first column as given below. Is this possible to avoid row numbers? Answer You can use False as the second parameter to exclude indexing. Example or Use this function to guide you You can read more about this here -> Pandas D…
Selenium cant find element on Javascript page
I am still quite new to python and selenium, However have managed to get quite far with what I am doing. But I appear to now be stuck. The page in question is an internal business page. I have tried using ID, name and XPATH with very little success. The problem I am having is with the filter, I think
I am writing the python script for copy the image files (.jpg)from one folder to another folder by giving inputs values in one line
I have large jpeg files datasets names like: 965_0000000005_0000000001_20211105153826.jpg I want to make the python script to copy the file by giving inputs start value and end then copy again give another start value and end by the file names. I am trying to copy multiple image files from one folder to anoth…
I am trying to make a discord chatbot but I am facing a problem
I have been trying to make a discord chatbot I finished the code “technically” it should work Here’s my code : This is the error I’m getting: Any help would be super appreciated, Thank you. Answer I’ve not familiar with Dicord’s API, but I’m pretty sure it should be a…
How to calculate ticket classification after putting in a sentence? (Python/NLP)
I trained a model to classify tickets into 2 categories. I’m using GradientBoostClassifier. Now, I want to call on a function, where if I put any sentence in, the trained model would calculate the probability whether it will be category 1 or category 2. How do I write a code for this? Let’s imagin…