I have a python project with a handful of python scripts, a domain and repository folder with additional python scripts in each etc…. I’d like to create a config folder within this python project that will contain a csv file for configurations that my python project will use. I then would like to read this csv file into a dataframe
Tag: dataframe
Importing count() data for use within bokeh
I am trying to create a visualisation using the bokeh package which I have imported into the Databricks environment. I have transformed the data from a raw data frame into something resembling the following (albeit much larger): From there, I wish to create a line graph using the bokeh package to show the number of papers released per month (for
How to combine queries with a single external variable using Pandas
I am trying to accept a variable input of many search terms seperated by commas via html form (@search) and query 2 columns of a dataframe. Each column query works on its own but I cannot get them to work together in a and/or way. First column query: Second column query: edit combining like this: Gives the following error, highlighting
Python/Pandas searching data in Dataframe
I want to explain my question with an example. I have a dataset which includes avocado average prices and many features about these prices(I guess avocado prices dataset is very popular, idk). And there is a feature called “region” that shows where avocadoes grew. I wrote this line of code to get to avocados feature which grews on “west”. my
Pandas append row based on conditional sum in long form
So, I have some sample data as such: which gives a dataframe in long form like: I want to, for each pair/grouping of location and time, conditionally sum the value column based on the value in the fruit column. Specifically: I want to sum the apple and orange but NOT the banana rows for each grouping. Resulting in the below
How to calculate relative frame values for events in a video or photo stack in Python?
I have a dataframe with: column 1 : a list of particles column 2: the frame in which they are observed in a video column 3: measurement x I need to compare the particles’ measurements over the time they are visible in the video. I cannot use the frame directly, since I need it to be relative to the first
Checking if column headers match PYTHON
I have two dataframes: df1: df2 I want to write a function that checks if the column headers are matching/the same as columns in df1. IF not we get a message telling us what column is missing. Example of the message given these dataframes: I want a generalized code that can work for any given dataframe. Is this possible on
How to remove urls between texts in pandas dataframe rows?
I am trying to solve a nlp problem, here in dataframe text column have lots of rows filled with urls like http.somethingsomething.some of the urls and other texts have no space between them for example- ‘:http:\something’,’;http:\something’,’,http:\something’. so there sometime , before url text without any space and sometime something else but mostly , ,. ,:, ;. and url either at
Extracting Specific Text From column in dataframe
I have the following dataframe and I’m trying to extract the string that has the ABC followed by it’s numbers. Description ABC12345679 132465 Test ABC12346548 Test ABC1231321 4645 I have tried: But its giving me what it comes after on instances that there’s more text after the ABC* like so: Description ABC12345679 132465 ABC12346548 ABC1231321 4645 And I need the
Apply for loop in multiple dataframe for multiple columns?
Dataframe is like below: Where I want to change dataframes value to ‘dead’ if age is more than 100. Desired outcome I was trying something like this: Error shown: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() I am looking for a loop that works on all dataframe. Please correct my