Category "pandas"

calculationg the mean from each Dataframe column

I've to write a function (column_means), that calculates the mean of each column from Dataframe and give me a list of means at the end. I'm not allowed to use t

Dataframe extracted from email, ValueError: Cannot index with multidimensional key

A dataframe extracted from email (email saved to local disk, ".msg"), that I am not able to read its content. The dataframe extracted from email, when wrote to

Data problem: identifying data rows where colleagues have reached a consensus

I have a table that shows the results of four colleagues trying to classify several objects as either a, b, c or d. If the colleagues were able to agree on the

Chaining Pandas DataFrame Styles

*edited DataFrame random generator I have 2 dfs, one used as a mask for the other. rndm = pd.DataFrame(np.random.randint(0,15,size=(100, 4)), columns=list('ABCD

how to apply a format on multiple excel files at once (hide gridlines & autofit columns)

I'm trying to apply a specific format on an iterate excel files, i need to hide the gridlines and autofit columns width, i tried many codes and styles but no on

Analysing words in dataset based on training data

I have a training dataset for eg. Letter Word A Apple B Bat C Cat D Dog E Elephant and I need to check the dataframe

What would be the correct merge function in this pandas dataframe?

df.head() index match_datetime country league home_team away_team home_odds draw_odds away_odds predicted_home_sco

Read images from url and put them on a dataframe column with the label to another column in python

I would like to read images from url and place them on a pandas dataframe column and place label to another another column. How can I do that please help. Below

Why is lambda not working property 'value'?

this df2['CLINE_TYPE']: Increase_FALSE Decrease Increase_FALSE Increase_SUPERPOSITION Decrease_FALSE Increase Increase_SUPERPOSITION Decrease_FALSE Increase Inc

What would be the equivalent code of following google finance query in python?

I'm trying to fetch weekly EOD data in python using yfinance module. I wanna use the same format of the excel code given below. gives me weekly closes (Friday)

First occurrence of a specific value in a row (prepping for survival analysis) - python

I have the following data (see attached - easier this way). I am trying to find the first occurrence of the value 0 for each customer ID. Then, I plan to use c

Find nth occurrence of a character in a row and replace it in Python, in order to fix/replace a wrong/leftover ";" separator in a text file

I would like to import a text file, with 14 columns with the symbol ";" as a column separator. So, if we have 14 columns, it means we'll find 13 ";" separators

How to count values between a date time and make a new column out of it

In Python Pandas I need to create a new column in a dataframe (number of encounters in last year) in the below dataframe with the following logic. I want to cou

Separate values in a DataFrame column into a new columns depending on value

I have a DataFrame like below but much larger: df = pd.DataFrame({'team': ['Mavs', 'Lakers', 'Spurs', 'Cavs', 'Mavs', 'Lakers', 'Spurs', 'Cavs'],

Function df.empty returning an empty dataframe even when it's not

I have a function in my script that checks if the user is already registred in the DataFrame. But I'm having a problem, sometimes this function simply doesn't w

pd.style.applymap only to 1 CELL , accesed by row and column name/index

for index, rows in taxcode[['ITC Tax Code']].iterrows(): if str(taxcode['ITC Tax Code'][index]).endswith('ZERO') and taxcode['% VAT rate verification'][index] =

Cant read JSON file imported from MongoDB using pandas

I am trying to read a json file into a pandas dataframe, the import from MongoDB from completed as below client = pymongo.MongoClient("localhost", 27017)

How to improve the given line of code while filtering pandas dataframe?

The below line of code was to filter a dataframe. I would like to know how to improve this line of code T1_df = df2[((df2['Azimuth'] > (df2['Sim_Az'] - 1

mplcursors with seaborn and multiple dataframes

I am trying to use mplcursors when plotting data from multiple pandas DataFrames (or from multiple subsets of a single DataFrame). I have read the answers of th

Is there a way to turn the sorting in a descending way on the y axis in Plotly? [duplicate]

I've created a program which sorts the highest 50 US airports with the most starts in year 2015 in a bar chart. Unfortunately, the program sho