Answers for "pandas csv to dataframe example"

9

how to import csv in pandas

import pandas as pd

df = pd.read_csv (r'Path where the CSV file is stored\File name.csv')
print (df)
Posted by: Guest on April-15-2020
28

save pandas into csv

df.to_csv(r'Path where you want to store the exported CSV file\File Name.csv', index = False)
Posted by: Guest on May-06-2020
0

how to read csv file online into pandas

import pandas as pd
import io
import requests
url="https://raw.githubusercontent.com/cs109/2014_data/master/countries.csv"
s=requests.get(url).content
c=pd.read_csv(io.StringIO(s.decode('utf-8')))
Posted by: Guest on November-11-2020

Python Answers by Framework

Browse Popular Code Answers by Language