'Using multiple Dataframe Methods at once

Is stacking up pandas dataframe mehtods an issue? I always use methods in a consecutive manner like df.sort_value().dropna().unstack().reset_index() etc

However, I just figured out that this right here leads to an empty/deleted dataframe:

import pandas as pd
df = pd.DataFrame(data={'col1': [1, 2], 'col2': [4, 3]})
df = df.sort_values(by=['col2']).to_excel('TestOut.xlsx')
print(df)

Out: None

Furthermore, I am also wondering right now, are consecutive methods processed from left to right?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source