fileinput = str(input("Which file do you want?"))
if not ".csv" in fileinput:
fileinput += ".csv"
import pandas as pd
data = pd.read_csv(fileinput)
rowcol = input("Column or row?")
if rowcol == "column":
column = int(input("Which column?"))
result = data.iloc([column])
elif rowcol == "row":
row = int(input("Which row?"))
result = data.iloc[[row]]
else:
print("Invalid response.")
print(result)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter