Category "dataframe"

Replacing a value in a column with a value from the same column based upon information

I am looking for a way to do Missing value imputation. There is a table of entries over a given time, with an entry per hour done on days. There is a seperate

Calculate Mean Absolute Error for each row of a Pandas dataframe

Below is a sample of pandas dataframe that I'm working with. I want to calculate mean absolute error for each row but only considering relevant columns for valu

Matching and indexing through two dataframes and one matrix

I have a dataframe events with xy-coords of unique points. I have a dataframe all_nodes with xy-coords of network nodes. All points of events are also in all_no

Scikit-learn pipeline: Non-finite test scores error / Inconsistent number of samples

I have a dataframe with two columns of texts and only the POS tags (of the same texts), which I want to use for language classification. I am trying to use both

Why does column + column concatenation create arrays for some Windows accounts?

When running the below Python code, I get different results depending on the user account/admin privileges that is used. The code is saved as test.py on a Windo

Select all in pandas where column equals value and all other columns are blank

I have a DataFrame containing permissions for roles of each user, e.g. function/role role1_permissions role2_permissions role3_permissions role4_permissions ca

SettingWithCopyWarning Python3

I am finding the max of df2 by row, and setting the max value to new col on df1. df1['max'] = df2[df2.keys().tolist()].max(axis=1) This line is throwing a Sett

How do obtain max and mean values from different columns with a Date column condition in R?

I am trying to get the daily mean and maximum values for each pollutant. For each of the monitoring stations, the daily mean and maximum values of each pollutan

Setting X axis label name more frequently in Matplotlib

I have a dataframe like this Time(DDHHMM) True AOG Predicted AOG 5184 28:0:0.0 4.0 4.697324 5185 28:0:5.0 10.0 0.366948 518

Getting error 'NoneType' object has no attribute 'read' in python for image processing image_dataframe['image']

I am working on image classification using CNN. I am using below source code for that task. I am stuck with this error : AttributeError: 'NoneType' object has

How to reassign values in column by condition in dataframe?

df = pd.DataFrame([["A", "AA", "AAA", "found"], ["A", "AB", "ABA", "not found"], ["A", "AB", "ABB", "not found"],

How to exclude weekends and holidays from finding the difference between two dates in python

I need to find the difference between 2 dates where certain end dates are blank. I am need to exclude the weekends, as well as the holidays when calculating the

How to return the range of values shared between two data frames in R?

I have several data frames that have the same columns names, and ID , the following to are the start from and end to of a range and group label from each of the

How to plot multiple chart on one figure and combine with another?

# Create an axes object axes = plt.gca() # pass the axes object to plot function df.plot(kind='line', x='鄉鎮別', y='男', ax=axes,figs

How to plot multiple chart on one figure and combine with another?

# Create an axes object axes = plt.gca() # pass the axes object to plot function df.plot(kind='line', x='鄉鎮別', y='男', ax=axes,figs

How to plot multiple chart on one figure and combine with another?

# Create an axes object axes = plt.gca() # pass the axes object to plot function df.plot(kind='line', x='鄉鎮別', y='男', ax=axes,figs

How to make a loop of random column combinations without repeating the combination in pandas dataframe?

I have a pandas dataframe that has 4 columns (A,B,D,E,F,G). I want to randomize each combination into 4 combinations (e.g. ABDE, ADEF, AEFG). And then add the c

How to save the Pandas dataframe from pd.crosstab as a figure (with render_mpl_table)?

I'm trying to save output from crosstab as an image. I found a great solution here How to save the Pandas dataframe/series data as a figure?. However, I am not

Extracting specific number of rows from dataframe

I have a csv file having two columns i.e. imagename and ID. There are multiple image names for same ID as shown in picture. Number of image names against id is

Importing a data frame from CSV file using Pandas with column name having spaces

I am trying to import a data frame from a .csv file which contains Per Capita Income. Moreover, in the above mentioned file the column name is Per Capita Income