» Home » DataFrame » Page 1
Pandas: Why does DataFrame.drop(labels) return a DataFrame with removed label name
by jaset in Programming Languages

When I drop some variables from a DataFrame, the returned dataframe is as I expect except the index.name is removed. Why would this be?


test = pd.DataFrame([[1,2,3],[3,4,5],[5,6,7]], index=['a','b','c'], columns=['d','e','f'])
second d e f
a 1 2 3
b 3 4 5
c 5 6 7

How do I define a dataframe in R that contains the results of a mathematical operation on two columns of another dataframe?
by DexNFx in Coding

I have a dataframe with the following column names and 19 rows

> [1] "X12C.Signal_Grn" "X12C.Signal_Red" "X11P.Signal_Grn"
> [4] "X11P.Signal_Red" "X7P_.A..Signal_Grn" "X7P_.A..Signal_Red"
> [7] "X8P.Signal_Grn" "X8P.Signal_Red" "X9P.Signal_Grn"
>[10] "X9P.Signal_Red" "X10PA.Signal_Grn" "X10PA.Signal_Red"
>[13] "X

Extract intervals inside groups in a dataframe , using information of another dataframe .
by Piriya in Programming Languages

Like i said in the title, my purpose is to extract intervals of subset of my dataframe using information of another dataframe.

my input:


subject x y
7G001-0024-10 0,00 15
7G001-0024-10 97,29 18
7G001-0024-10 197,34 21
7G001-0024-10 314,66 22
7G001-0024-10 482,77 25
7G001-0030-10 0,00

casting converts a dataframe to a list in r (reshape package) - would like to keep as dataframe
by Jorgemr in Web Design

I must be missing something trivial but I can't see why the below cast converts my dataframe to a list. I would like the output to be a dataframe if possible.

It starts as

'data.frame': 12 obs. of 4 variables:
$ credit_id: num 12 12 12 12 18 ...
$ Date : Date, format: "2003-06-30" "2003-09-30" "2003-12-31" ...

Dividing all columns in dataframe by column in different dataframe using unique identifier of both dfs
by venom361 in Databases

Basically what I need to perform is to transform my country variables into per capita terms, i.e. divide all values by the country's population.

So I have df:

country <- c("A","B","C","D")
income <- c(10,20,30,40)
cars <- c(100,200,300,400)
df <- data.frame(country,income,cars)

And I want to divide all colu

Filling continuous pandas dataframe from sparse dataframe
by kharakawa in Programming Languages

I have a dictionary name date_dict keyed by datetime dates with values corresponding to integer counts of observations. I convert this to a sparse series/dataframe with censored observations that I would like to join or convert to a series/dataframe with continuous dates. The nasty list comprehension is my hack to get around the fact that pandas apparently won't automatically covert datetime da

Extract Rows in first Dataframe for which certain values are not found in second dataframe
by Rahulmax in Programming Languages

I'm trying to eliminate from a first dataframe all of the rows for which a certain value is in a second dataframe.

Using the R programming language for statistical data analysis.

This is the first question I post here, so bear with me if you please ;)

I work with confidential data, so I recreated the problem with an example.


Change a dataframe with multiple elements at each position in the dataframe
by Shantanu in Programming Languages

This is actually a continuation of a previous question:

Spline on multiple factors in data frame

so apologies for going through the first part again. And believe me I tried to solve myself!

So some sample data:

mydf<- data.frame(c("a","a","b","b","c","c"),c("e","e","e","e","e","e")
How can I change a dataframe of factors so that the dataframe can be boxplotted?
by Brainonska511 in Programming Languages

I have a dataframe of which the columns contain a variable amount of numbers and a variable amount of NA's. The dataframe looks like this:

V1 V2 V3 V4 V5 V6
1 0 11 4 0 0 10
2 0 17 3 0 2 2
3 NA 0 4 0 1 9
4 NA 12 NA 1 1 0
743 NA NA NA NA 8 NA
744 NA NA NA NA 0 NA

I want to make a box

create dataframe in for loop using dataframe array
by TwiceOver in Programming Languages

I'm having a dataframe as like below. I need to extract df based on the region which is availabe in RL

region SN value
beta 1 32
alpha 2 44
beta 3 55
beta 4 60
atp 5 22
> RL
1 beta
2 alpha


Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .