Top "Dataframe" questions

A data frame is a 2D tabular data structure.

Converting a Pandas GroupBy output from Series to DataFrame

I'm starting with input data like this df1 = pandas.DataFrame( { "Name" : ["Alice", "Bob", "Mallory", "Mallory", "Bob" , "Mallory"] , "City" : ["Seattle", "Seattle", "…

python pandas dataframe pandas-groupby multi-index
How to sum a variable by group

I have a data frame with two columns. First column contains categories such as "First", "Second", "Third", and the second …

r dataframe aggregate r-faq
How to convert index of a pandas dataframe into a column?

This seems rather obvious, but I can't seem to figure out how to convert an index of data frame to …

python pandas dataframe
Convert data.frame columns from factors to characters

I have a data frame. Let's call him bob: > head(bob) phenotype exclusion GSM399350 3- 4- 8- 25- 44+ 11b- 11…

r dataframe
pandas: filter rows of DataFrame with operator chaining

Most operations in pandas can be accomplished with operator chaining (groupby, aggregate, apply, etc), but the only way I've found …

python pandas dataframe
How does one reorder columns in a data frame?

How would one change this input (with the sequence: time, in, out, files): Time In Out Files 1 2 3 4 2 3 4 5 To this output (…

r sorting dataframe r-faq
Adding a column to a data.frame

I have the data.frame below. I want to add a column that classifies my data according to column 1 (h_…

r dataframe
How to combine multiple conditions to subset a data-frame using "OR"?

I have a data.frame in R. I want to try two different conditions on two different columns, but I …

r conditional dataframe
How to reset index in a pandas dataframe?

I have a dataframe from which I remove some rows. As a result, I get a dataframe in which index …

python indexing pandas dataframe
Selecting/excluding sets of columns in pandas

I would like to create views or dataframes from an existing dataframe based on column selections. For example, I would …

python pandas dataframe