Loading…
DS · Data basics · Program 01 · In the record
Import and export datasets in CSV, Excel and JSON using Pandas.
1import pandas as pd2 3df = pd.DataFrame({'Name': ['Alice', 'Bob', 'Charlie'], 'Age': [25, 30, 35]})4df.to_csv('01.csv', index=False)5df.to_json('01.json', orient='records')6df.to_excel('01.xlsx', index=False)7 8print("CSV Data:\n", pd.read_csv('01.csv'))9print("\nJSON Data:\n", pd.read_json('01.json'))10print("\nExcel Data:\n", pd.read_excel('01.xlsx'))CSV Data:
Name Age
0 Alice 25
1 Bob 30
2 Charlie 35
JSON Data:
Name Age
0 Alice 25
1 Bob 30
2 Charlie 35
Excel Data:
Name Age
0 Alice 25
1 Bob 30
2 Charlie 35Run program 01 in your browser
Python 3.14 · Pyodide. Change the code or the input, run it, break it, and see what happens.