Exporting Data
Once you've cleaned, filtered, and shaped your data, the last step is usually getting it back out — into a CSV file others can use, or a quick chart to see what you found.
Writing to CSV
import pandas as pd
df = pd.DataFrame({"name": ["Maya", "Sam"], "score": [88, 92]})
df.to_csv("results.csv", index=False)
name,score Maya,88 Sam,92
to_csv() writes the DataFrame's index as an extra unnamed first column in the file — surprising if you weren't expecting it. index=False, used above, skips it and writes only the real columns.Writing to Excel
The same idea works for spreadsheets, using .to_excel() (this needs the openpyxl package installed alongside pandas):
df.to_excel("results.xlsx", index=False, sheet_name="Scores")
Same index=False habit applies here too.
A quick look with .plot()
pandas includes basic charting built on matplotlib — enough for a fast sanity check without switching tools, though a real report usually reaches for matplotlib or a dedicated charting library directly:
df.plot(kind="bar", x="name", y="score")
kind="bar" draws a bar chart directly from the DataFrame; other values like "line" or "scatter" cover the other common chart shapes. This only renders in an environment that can display a plot (like Jupyter), not in a plain terminal script.