I have a file named export .py and the code looks like this (I am learning how to use pandas)
import pandas as pd
dict = {"country": ["Brazil", "Russia", "India", "China", "South Africa"],
"capital": ["Brasilia", "Moscow", "New Dehli", "Beijing", "Pretoria"],
"area": [8.516, 17.10, 3.286, 9.597, 1.221],
"population": [200.4, 143.5, 1252, 1357, 52.98] }
brics = pd.DataFrame(dict)
brics.index = ["BR", "RU", "IN", "CH", "SA"]
print(brics)
print()
print()
print("Exporting as .csv file...")
export_csv = brics.to_csv ('/some/path/to/file/panda.csv', index=True, header=True)
print("Done!")
and another file, import.py:
import pandas as pd
brics = pd.read_csv("/path/to/file/panda.csv")
print(brics)
and the outputs are:
#export.py
country capital area population
BR Brazil Brasilia 8.516 200.40
RU Russia Moscow 17.100 143.50
IN India New Dehli 3.286 1252.00
CH China Beijing 9.597 1357.00
SA South Africa Pretoria 1.221 52.98
Exporting as .csv file...
Done!
#import.py
Unnamed: 0 country capital area population
0 BR Brazil Brasilia 8.516 200.40
1 RU Russia Moscow 17.100 143.50
2 IN India New Dehli 3.286 1252.00
3 CH China Beijing 9.597 1357.00
4 SA South Africa Pretoria 1.221 52.98
Can anyone tell me how to clean the table up so the two outputs look the same (removing the "0, 1, 2, 3..." indexes)?