Stack Exchange
Programming Data to CSV using Pandas
I am trying to make a CSV, Excel I followed an online aid however, it appears not to work, and it brings up KeyError: 'Teflon'. Any thoughts why? 
Here is the aid I was following Aid
import pandas as pd
import os

def sort_data_frame_by_Teflon_column(dataframe):
     dataframe = dataframe.sort_values(by= ['Teflon'])
def sort_data_frame_by_LacticAcid_column(dataframe):
    dataframe = dataframe.sort_values(by= ['Lactic Acid'])
def sort_data_frame_by_ExperimentalWeight_column(dataframe):
    dataframe = dataframe.sort_values(by= ['Experimental Weight'])
def sort_data_frame_by_Ratio_column(dataframe):
    dataframe = dataframe.sort_values(by= ['Ratio of Lactic Acid to Experimental Weight'])
def get_data_in_Teflon(dataframe):
    dataframe = dataframe.loc[dataframe['Teflon']]
    dataframe = dataframe.sort_values(by=['Teflon'])
def get_data_in_LacticAcid(dataframe):
   dataframe = dataframe.loc[dataframe['Lactic Acid']]
   dataframe = dataframe.sort_values(by= ['Lactic Acid'])
def get_data_in_ExperimentalWeight(dataframe):
   dataframe = dataframe.loc[dataframe['Experimental Weight']]
   dataframe = dataframe.sort_values(by= ['Experimental Weight'])
def get_data_in_Ratio(dataframe):
   dataframe = dataframe.loc[dataframe['Ratio of Lactic Acid to Experimental Weight']]
   dataframe = dataframe.sort_values(by= ['Ratio of Lactic Acid to Experimental Weight'])
   path = 'C:\\Users\\Light_Wisdom\\Documents\\Spyder\\Mass-TeflonLacticAcidRatio.csv'
 #output_file = open(path,'x')
 #text = input("Input Data: ")
 #text.replace('\\n', '\n')
 #output_file.write(text. replace('\\', ''))
 #output_file.close()
 csv_file = 'C:\\Users\\Light_Wisdom\\Documents\\Spyder\\Mass-TeflonLacticAcidRatio.csv'
 dataframe = pd.read_csv(csv_file)
 dataframe = dataframe.set_index('Teflon')
 sort_data_frame_by_Teflon_column(dataframe)
 sort_data_frame_by_LacticAcid_column(dataframe)
 sort_data_frame_by_ExperimentalWeight_column(dataframe)
 sort_data_frame_by_Ratio_column(dataframe)
 get_data_in_Teflon(dataframe)
 get_data_in_LacticAcid(dataframe)
 get_data_in_ExperimentalWeight(dataframe)
 get_data_in_Ratio(dataframe)
 write_to_csv_file_by_pandas("C:\\images\\Trial1.csv", dataframe)
 write_to_excel_file_by_pandas("C:\\images\\Trial1.xlsx", dataframe)
 #data_frame.to_csv(csv_file_path)
 #excel_writer = pd.ExcelWriter(excel_file_path, engine = 'xlsxwriter')
 #excel_writer.save()

Here is the CSV:
Teflon,Lactic Acid,Experimental Weight,Ratio of Lactic Acid to Experimental Weight
1.973,.2201,1.56,.14
2.05,.15,.93,.16
1.76,.44,1.56,.28

Edit New Question  7/24/19
I am trying to automate an answer with functions and I was on the attempt when I got this error.
def get_Data():
check = 'No'
while(check == 'Yes'):
    row_name = input("What is the row number? ")
    row_name = []
    data = float(input("Teflon, Lactic_Acid, Expt_Wt, LacticAcid_to_Expt1_Wt: "))
    dataframe = []
    check = input("Add another row? ")
    return row_name,data, dataframe
 def row_inputter(row_name,data,dataframe):
    row_name.append(data)
    dataframe.append(row_name)
    return row_name, dataframe

  # Define your data
  #row1 = [ 1.973, .2201, 1.56, .14]
  #row2 = [2.05, .15, .93, .16]
  #row3 = [1.76, .44, 1.56, .28]
 row_name,data, dataframe = get_Data()
 row, df = row_inputter()


I can tell that you are a Pandas beginner.  No worries...  Here's how you do the first few operations.  
The AID that you reference is doing things the old fashioned way, and not leveraging many fine tools already created for working with CSV and XLSX data in and out of Pandas and Python.  
XLSXWriter is a fabulous library that reads and writes Pandas data easily.
[XLXSwriter.com][1]https://xlsxwriter.readthedocs.io/working_with_pandas.html
# Do necessary imports
import pandas as pd
import os
import xlsxwriter

# Define your data
expt_data = ["Teflon", "Lactic_Acid", "Expt_Wt", "LacticAcid_to_Exptl_Wt"]
row1 = [ 1.973, .2201, 1.56, .14]
row2 = [2.05, .15, .93, .16]
row3 = [1.76, .44, 1.56, .28]

# Create dataframe using constructor method
df1 = pd.DataFrame([row1, row2, row3], columns=expt_data)

# Output dataframe
df1

# Sort dataframe by Teflon column values and output it
Teflon_Sorted = df1.sort_values(by=["Teflon"])
Teflon_Sorted

# Sort dataframe by Lactic_Acid column values and output it
Lactic_Acid_Sorted = df1.sort_values(by=["Lactic_Acid"])
Lactic_Acid_Sorted

# Sort dataframe by Expt_Wt column values and output it
Expt_Wt_sorted = df1.sort_values(by=["Expt_Wt"])
Expt_Wt_sorted

# Sort dataframe by Expt_Wt column values and output it
LacticAcid_to_Exptl_Wt_sorted = df1.sort_values(by=["LacticAcid_to_Exptl_Wt"])
LacticAcid_to_Exptl_Wt_sorted

# Create a Pandas Excel writer using XlsxWriter as the engine.
writer = pd.ExcelWriter("Trial1.xlsx", engine='xlsxwriter')

# Convert all dataframes to XlsxWriter Excel objects and then write each to a different worksheet in the workbook created above named "Trial1.xlsx".
Teflon_Sorted.to_excel(writer, sheet_name='Teflon_Sorted')
Lactic_Acid_Sorted.to_excel(writer, sheet_name='Lactic_Acid_Sorted')
Expt_Wt_sorted.to_excel(writer, sheet_name='Expt_Wt_sorted')
LacticAcid_to_Exptl_Wt_sorted.to_excel(writer, sheet_name='LacticAcid_to_Exptl_Wt_sorted')

# Close the Pandas Excel writer and output the Excel file.
writer.save()

# now go to your current directory in your file system where the Jupyter Notebook or Python file is executing and find your file. 

# Type !dir in Jupyter cell to list current directory on MS-Windows
!dir 

[XLXSwriter.com][1]https://xlsxwriter.readthedocs.io/working_with_pandas.html
Sorry this is not a complete application that does everything you want, but I have limited time.  I showed you how to write out your final results.  I left it as a learning exercise for you to learn how to read in your data file, rather than creating it "on the fly" inline in your Python program.
My recommendation is to use XLXSwriter for everything related to Excel or Pandas.  Follow the fabulous tutorial on the XLSXwriter website.  XLSXwriter is probably the best and easiest Python-Pandas-Excel toolkit right now.  It does everything programmatically that someone would normally have to do manually ("interactively").

I am trying to automate your code with there being an input and this is my attempt but I got this error TypeError: cannot unpack non-iterable NoneType object.

You already set Teflon as index by 
 dataframe = dataframe.set_index('Teflon')

you dataframe no longer contains that columns. Your function
sort_data_frame_by_Teflon_column()

would fail and through that error.
Also, the other functions like:
def get_data_in_LacticAcid(dataframe):
   dataframe = dataframe.loc[dataframe['Lactic Acid']]
   dataframe = dataframe.sort_values(by= ['Lactic Acid'])

will likely fail or turns your dataframe to an empty one due to the first line. What exactly are you trying to achieve with those functions?

"None of [Float64Index([1.973, 2.05, 1.76], dtype='float64')] are in the [index]" then I get this errorremoving the Teflon set index

You must learn more about Pandas and Python before blindly using a website example.  A pandas column (a Series) and pandas index (an Index) are different.  When you .set_index(), it converts "Teflon" from a values column to an index, so it can then be used with access operator "[ ]" to retrieve data from a regular "named" column, e.g., ["Lactic_Acid"].  Your syntax is "function first" not "dataframe first".  Learn the object.method() syntax of Python and Pandas.  Create a "lab_data" dataframe, add data to it (in a loop if you like), then sort by column name, then get data using ["Lactic_Acid"]
