reshape data Flashcards
con que metodo pandas conseguirias lo siguiente?
con melt

como conseguirias lo siguiente en un dataframe? (Spread rows into columns)

con df.pivot(columns=’var’, values=’val’)

como conseguirias lo siguiente ? (Append rows of DataFrames)

con pd.concat([df1,df2])

como conseguirias los siguiente ?? (Append columns of DataFrames)

con pd.concat([df1,df2], axis=1)
otros argumentos mirar la foto

Order rows by values of a column (low to high).
df.sort_values(‘mpg’)
Order rows by values of a column (high to low)
df.sort_values(‘mpg’,ascending=False)
Rename the columns of a DataFrame
df.rename(columns = {‘y’:’year’})
Sort the index of a DataFrame
df.sort_index()

Reset index of DataFrame to row numbers, moving index to columns.
df.reset_index()
Drop columns from DataFrame
df.drop(columns=[‘Length’,’Height’])