My Notes/Questions

  • Pandas: a library that makes formatting datasets much more efficient and easier to keep track of
  • some functions within Pandas: analyzing, cleaning, manipulating data
  • dataframe: another name for a data table
  • metadata: the darker squares in the Data Frame (aka data table)
  • nil or nol = missing (like doesn't exist)
  • ^ garbage data needs to be cleaned using Pandas
  • csv = comma seperated values
  • like a cat: you start petting at the head and stop at the tail
  • head= top of list
  • tail= bottom of list
  • is there a way you could identify garbage data and then change it to fit? Ex: could you change the string "junior" to "11"?

Pandas and DataFrames

In this lesson we will be exploring data analysis using Pandas.

  • College Board talks about ideas like
    • Tools. "the ability to process data depends on users capabilities and their tools"
    • Combining Data. "combine county data sets"
    • Status on Data"determining the artist with the greatest attendance during a particular month"
    • Data poses challenge. "the need to clean data", "incomplete data"
  • From Pandas Overview -- When working with tabular data, such as data stored in spreadsheets or databases, pandas is the right tool for you. pandas will help you to explore, clean, and process your data. In pandas, a data table is called a DataFrame. DataFrame
'''Pandas is used to gather data sets through its DataFrames implementation'''
import pandas as pd

Cleaning Data

When looking at a data set, check to see what data needs to be cleaned. Examples include:

  • Missing Data Points
  • Invalid Data
  • Inaccurate Data

Run the following code to see what needs to be cleaned

df = pd.read_json('files/grade.json')

print(df)
# What part of the data set needs to be cleaned?
# From PBL learning, what is a good time to clean data?  Hint, remember Garbage in, Garbage out?
   Student ID Year in School   GPA
0         123             12  3.57
1         246             10  4.00
2         578             12  2.78
3         469             11  3.45
4         324         Junior  4.75
5         313             20  3.33
6         145             12  2.95
7         167             10  3.90
8         235      9th Grade  3.15
9         nil              9  2.80
10        469             11  3.45
11        456             10  2.75

Extracting Info

Take a look at some features that the Pandas library has that extracts info from the dataset

DataFrame Extract Column

print(df[['GPA']])

print()

#try two columns and remove the index from print statement
print(df[['Student ID','GPA']].to_string(index=False))
     GPA
0   3.57
1   4.00
2   2.78
3   3.45
4   4.75
5   3.33
6   2.95
7   3.90
8   3.15
9   2.80
10  3.45
11  2.75

Student ID  GPA
       123 3.57
       246 4.00
       578 2.78
       469 3.45
       324 4.75
       313 3.33
       145 2.95
       167 3.90
       235 3.15
       nil 2.80
       469 3.45
       456 2.75

DataFrame Sort

print(df.sort_values(by=['GPA']))

print()

#sort the values in reverse order
print(df.sort_values(by=['GPA'], ascending=False))
   Student ID Year in School   GPA
11        456             10  2.75
2         578             12  2.78
9         nil              9  2.80
6         145             12  2.95
8         235      9th Grade  3.15
5         313             20  3.33
3         469             11  3.45
10        469             11  3.45
0         123             12  3.57
7         167             10  3.90
1         246             10  4.00
4         324         Junior  4.75

   Student ID Year in School   GPA
4         324         Junior  4.75
1         246             10  4.00
7         167             10  3.90
0         123             12  3.57
3         469             11  3.45
10        469             11  3.45
5         313             20  3.33
8         235      9th Grade  3.15
6         145             12  2.95
9         nil              9  2.80
2         578             12  2.78
11        456             10  2.75

DataFrame Selection or Filter

print(df[df.GPA > 3.00])
   Student ID Year in School   GPA
0         123             12  3.57
1         246             10  4.00
3         469             11  3.45
4         324         Junior  4.75
5         313             20  3.33
7         167             10  3.90
8         235      9th Grade  3.15
10        469             11  3.45

DataFrame Selection Max and Min

print(df[df.GPA == df.GPA.max()])
print()
print(df[df.GPA == df.GPA.min()])
  Student ID Year in School   GPA
4        324         Junior  4.75

   Student ID Year in School   GPA
11        456             10  2.75

Create your own DataFrame

Using Pandas allows you to create your own DataFrame in Python.

Python Dictionary to Pandas DataFrame

import pandas as pd

#the data can be stored as a python dictionary
dict = {
  "calories": [420, 380, 390],
  "duration": [50, 40, 45]
}
#stores the data in a data frame
print("-------------Dict_to_DF------------------")
df = pd.DataFrame(dict)
print(df)

print("----------Dict_to_DF_labels--------------")

#or with the index argument, you can label rows.
df = pd.DataFrame(dict, index = ["day1", "day2", "day3"])
print(df)
-------------Dict_to_DF------------------
   calories  duration
0       420        50
1       380        40
2       390        45
----------Dict_to_DF_labels--------------
      calories  duration
day1       420        50
day2       380        40
day3       390        45

Examine DataFrame Rows

print("-------Examine Selected Rows---------")
#use a list for multiple labels:
print(df.loc[["day1", "day3"]])

#refer to the row index:
print("--------Examine Single Row-----------")
print(df.loc["day1"])
-------Examine Selected Rows---------
      calories  duration
day1       420        50
day3       390        45
--------Examine Single Row-----------
calories    420
duration     50
Name: day1, dtype: int64

Pandas DataFrame Information

print(df.info())
<class 'pandas.core.frame.DataFrame'>
Index: 3 entries, day1 to day3
Data columns (total 2 columns):
 #   Column    Non-Null Count  Dtype
---  ------    --------------  -----
 0   calories  3 non-null      int64
 1   duration  3 non-null      int64
dtypes: int64(2)
memory usage: 180.0+ bytes
None

Example of larger data set

Pandas can read CSV and many other types of files, run the following code to see more features with a larger data set

import pandas as pd

#read csv and sort 'Duration' largest to smallest
df = pd.read_csv('files/data.csv').sort_values(by=['Duration'], ascending=False)

print("--Duration Top 10---------")
print(df.head(10))

print("--Duration Bottom 10------")
print(df.tail(10))
--Duration Top 10---------
     Duration  Pulse  Maxpulse  Calories
69        300    108       143    1500.2
79        270    100       131    1729.0
109       210    137       184    1860.4
60        210    108       160    1376.0
106       180     90       120     800.3
90        180    101       127     600.1
65        180     90       130     800.4
61        160    110       137    1034.4
62        160    109       135     853.0
67        150    107       130     816.0
--Duration Bottom 10------
     Duration  Pulse  Maxpulse  Calories
68         20    106       136     110.4
100        20     95       112      77.7
89         20     83       107      50.3
135        20    136       156     189.0
94         20    150       171     127.4
95         20    151       168     229.4
139        20    141       162     222.4
64         20    110       130     131.4
112        15    124       139     124.2
93         15     80       100      50.5

APIs are a Source for Writing Programs with Data

3rd Party APIs are a great source for creating Pandas Data Frames.

  • Data can be fetched and resulting json can be placed into a Data Frame
  • Observe output, this looks very similar to a Database
'''Pandas can be used to analyze data'''
import pandas as pd
import requests

def fetch():
    '''Obtain data from an endpoint'''
    url = "https://flask.nighthawkcodingsociety.com/api/covid/"
    fetch = requests.get(url)
    json = fetch.json()

    # filter data for requirement
    df = pd.DataFrame(json['countries_stat'])  # filter endpoint for country stats
    print(df.loc[0:5, 'country_name':'deaths']) # show row 0 through 5 and columns country_name through deaths
    
fetch()
  country_name       cases     deaths
0          USA  82,649,779  1,018,316
1        India  43,057,545    522,193
2       Brazil  30,345,654    662,663
3       France  28,244,977    145,020
4      Germany  24,109,433    134,624
5           UK  21,933,206    173,352

Hacks

Early Seed award

  • Add this Blog to you own Blogging site.
  • Have all lecture files saved to your files directory before Tech Talk starts. Have data.csv open in vscode. Don't tell anyone. Show to Teacher.

AP Prep

  • Add this Blog to you own Blogging site. In the Blog add notes and observations on each code cell.
  • In blog add College Board practice problems for 2.3.

The next 4 weeks, Teachers want you to improve your understanding of data. Look at the blog and others on Unit 2. Your intention is to find some things to differentiate your individual College Board project.

  • Create or Find your own dataset. The suggestion is to use a JSON file, integrating with your PBL project would be Fambulous.
When choosing a data set, think about the following:- Does it have a good sample size?    - Is there bias in the data?
- Does the data set need to be cleaned?
- What is the purpose of the data set?
- ...
  • Continue this Blog using Pandas extract info from that dataset (ex. max, min, mean, median, mode, etc.)

Hack Helpers

Here is how Mort started on this assignment by asking ChatGPT ... Regarding Python Pandas, what are some data sets that would be good for learning Pandas?

  • There are many data sets that are suitable for learning pandas, depending on your interests and the skills you want to develop. Here are some suggestions:- Titanic Dataset: This is a classic dataset for data analysis and machine learning, and is often used as an introduction to pandas. The dataset contains information about passengers on the Titanic, including their demographics, ticket class, and survival status.

    • Iris Dataset: This is another classic dataset that is often used in machine learning and data analysis courses. The dataset contains information about iris flowers, including their sepal length, sepal width, petal length, and petal width.

    • NBA Player Stats: This dataset contains information about NBA players, including their stats for various games, their positions, and their salaries. It is a great dataset for learning how to clean and manipulate data using pandas.

    • Housing Prices Dataset: This dataset contains information about housing prices in a particular city or region, including variables such as the number of bedrooms, square footage, and price. It is a great dataset for learning how to manipulate and analyze numerical data using pandas.

    • COVID-19 Dataset: This dataset contains information about the COVID-19 pandemic, including the number of cases, deaths, and recoveries in various countries and regions. It is a great dataset for learning how to manipulate and analyze time-series data using pandas.

    • World Bank Dataset: This dataset contains information about economic indicators from various countries, such as GDP, population, and poverty rates. It is a great dataset for learning how to manipulate and analyze large datasets using pandas.

  • These are just a few examples of the many datasets that are suitable for learning pandas. The best dataset for you will depend on your interests and the specific skills you want to develop.

    Follow up question, "where can I find Titanic data set?"

  • The Titanic dataset is a popular dataset for data analysis and machine learning, and it can be found on various websites and data repositories. Here are a few places where you can find the Titanic dataset:- Kaggle: The Titanic dataset is available on Kaggle, which is a popular platform for data scientists and machine learning enthusiasts. You can download the dataset from the Kaggle website after creating an account.

    • UCI Machine Learning Repository: The Titanic dataset is also available on the UCI Machine Learning Repository, which is a collection of datasets that are commonly used for machine learning research. You can download the dataset from the UCI Machine Learning Repository website.

    • Seaborn library: If you have the Seaborn library installed in your Python environment, you can load the Titanic dataset directly from the library using the following code:

      import seaborn as sns
      titanic_data = sns.load_dataset('titanic')
      

Titanic Data

Look at a sample of data.

import seaborn as sns

# Load the titanic dataset
titanic_data = sns.load_dataset('titanic')

print("Titanic Data")


print(titanic_data.columns) # titanic data set

print(titanic_data[['survived','pclass', 'sex', 'age', 'sibsp', 'parch', 'class', 'fare', 'embark_town']]) # look at selected columns
Titanic Data
Index(['survived', 'pclass', 'sex', 'age', 'sibsp', 'parch', 'fare',
       'embarked', 'class', 'who', 'adult_male', 'deck', 'embark_town',
       'alive', 'alone'],
      dtype='object')
     survived  pclass     sex   age  sibsp  parch   class     fare  \
0           0       3    male  22.0      1      0   Third   7.2500   
1           1       1  female  38.0      1      0   First  71.2833   
2           1       3  female  26.0      0      0   Third   7.9250   
3           1       1  female  35.0      1      0   First  53.1000   
4           0       3    male  35.0      0      0   Third   8.0500   
..        ...     ...     ...   ...    ...    ...     ...      ...   
886         0       2    male  27.0      0      0  Second  13.0000   
887         1       1  female  19.0      0      0   First  30.0000   
888         0       3  female   NaN      1      2   Third  23.4500   
889         1       1    male  26.0      0      0   First  30.0000   
890         0       3    male  32.0      0      0   Third   7.7500   

     embark_town  
0    Southampton  
1      Cherbourg  
2    Southampton  
3    Southampton  
4    Southampton  
..           ...  
886  Southampton  
887  Southampton  
888  Southampton  
889    Cherbourg  
890   Queenstown  

[891 rows x 9 columns]

Use Pandas to clean the data. Most analysis, like Machine Learning or even Pandas in general like data to be in standardized format. This is called 'Training' or 'Cleaning' data.

# Preprocess the data
from sklearn.preprocessing import OneHotEncoder


td = titanic_data
td.drop(['alive', 'who', 'adult_male', 'class', 'embark_town', 'deck'], axis=1, inplace=True)
td.dropna(inplace=True)
td['sex'] = td['sex'].apply(lambda x: 1 if x == 'male' else 0)
td['alone'] = td['alone'].apply(lambda x: 1 if x == True else 0)

# Encode categorical variables
enc = OneHotEncoder(handle_unknown='ignore')
enc.fit(td[['embarked']])
onehot = enc.transform(td[['embarked']]).toarray()
cols = ['embarked_' + val for val in enc.categories_[0]]
td[cols] = pd.DataFrame(onehot)
td.drop(['embarked'], axis=1, inplace=True)
td.dropna(inplace=True)

print(td)
     survived  pclass  sex   age  sibsp  parch      fare  alone  embarked_C  \
0           0       3    1  22.0      1      0    7.2500      0         0.0   
1           1       1    0  38.0      1      0   71.2833      0         1.0   
2           1       3    0  26.0      0      0    7.9250      1         0.0   
3           1       1    0  35.0      1      0   53.1000      0         0.0   
4           0       3    1  35.0      0      0    8.0500      1         0.0   
..        ...     ...  ...   ...    ...    ...       ...    ...         ...   
705         0       2    1  39.0      0      0   26.0000      1         0.0   
706         1       2    0  45.0      0      0   13.5000      1         0.0   
707         1       1    1  42.0      0      0   26.2875      1         0.0   
708         1       1    0  22.0      0      0  151.5500      1         0.0   
710         1       1    0  24.0      0      0   49.5042      1         1.0   

     embarked_Q  embarked_S  
0           0.0         1.0  
1           0.0         0.0  
2           0.0         1.0  
3           0.0         1.0  
4           0.0         1.0  
..          ...         ...  
705         0.0         1.0  
706         0.0         1.0  
707         1.0         0.0  
708         0.0         1.0  
710         0.0         0.0  

[564 rows x 11 columns]

The result of 'Training' data is making it easier to analyze or make conclusions. In looking at the Titanic, as you clean you would probably want to make assumptions on likely chance of survival.

This would involve analyzing various factors (such as age, gender, class, etc.) that may have affected a person's chances of survival, and using that information to make predictions about whether an individual would have survived or not.

  • Data description:- Survival - Survival (0 = No; 1 = Yes). Not included in test.csv file. - Pclass - Passenger Class (1 = 1st; 2 = 2nd; 3 = 3rd)

    • Name - Name
    • Sex - Sex
    • Age - Age
    • Sibsp - Number of Siblings/Spouses Aboard
    • Parch - Number of Parents/Children Aboard
    • Ticket - Ticket Number
    • Fare - Passenger Fare
    • Cabin - Cabin
    • Embarked - Port of Embarkation (C = Cherbourg; Q = Queenstown; S = Southampton)
  • Perished Mean/Average

print(titanic_data.query("survived == 0").mean())
survived       0.000000
pclass         2.464072
sex            0.844311
age           31.073353
sibsp          0.562874
parch          0.398204
fare          24.835902
alone          0.616766
embarked_C     0.185629
embarked_Q     0.038922
embarked_S     0.775449
dtype: float64
  • Survived Mean/Average
print(td.query("survived == 1").mean())
survived       1.000000
pclass         1.878261
sex            0.326087
age           28.481522
sibsp          0.504348
parch          0.508696
fare          50.188806
alone          0.456522
embarked_C     0.152174
embarked_Q     0.034783
embarked_S     0.813043
dtype: float64

Survived Max and Min Stats

print(td.query("survived == 1").max())
print(td.query("survived == 1").min())
survived        1.0000
pclass          3.0000
sex             1.0000
age            80.0000
sibsp           4.0000
parch           5.0000
fare          512.3292
alone           1.0000
embarked_C      1.0000
embarked_Q      1.0000
embarked_S      1.0000
dtype: float64
survived      1.00
pclass        1.00
sex           0.00
age           0.75
sibsp         0.00
parch         0.00
fare          0.00
alone         0.00
embarked_C    0.00
embarked_Q    0.00
embarked_S    0.00
dtype: float64

Machine Learning

From Tutorials Point%20is,a%20consistence%20interface%20in%20Python). Scikit-learn (Sklearn) is the most useful and robust library for machine learning in Python. It provides a selection of efficient tools for machine learning and statistical modeling including classification, regression, clustering and dimensionality reduction via a consistence interface in Python.> Description from ChatGPT. The Titanic dataset is a popular dataset for data analysis and machine learning. In the context of machine learning, accuracy refers to the percentage of correctly classified instances in a set of predictions. In this case, the testing data is a subset of the original Titanic dataset that the decision tree model has not seen during training......After training the decision tree model on the training data, we can evaluate its performance on the testing data by making predictions on the testing data and comparing them to the actual outcomes. The accuracy of the decision tree classifier on the testing data tells us how well the model generalizes to new data that it hasn't seen before......For example, if the accuracy of the decision tree classifier on the testing data is 0.8 (or 80%), this means that 80% of the predictions made by the model on the testing data were correct....Chance of survival could be done using various machine learning techniques, including decision trees, logistic regression, or support vector machines, among others.

  • Code Below prepares data for further analysis and provides an Accuracy. IMO, you would insert a new passenger and predict survival. Datasets could be used on various factors like prediction if a player will hit a Home Run, or a Stock will go up or down.
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score

# Split arrays or matrices into random train and test subsets.
X = td.drop('survived', axis=1)
y = td['survived']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)

# Train a decision tree classifier
dt = DecisionTreeClassifier()
dt.fit(X_train, y_train)

# Test the model
y_pred = dt.predict(X_test)
accuracy = accuracy_score(y_test, y_pred)
print('DecisionTreeClassifier Accuracy:', accuracy)

# Train a logistic regression model
logreg = LogisticRegression()
logreg.fit(X_train, y_train)

# Test the model
y_pred = logreg.predict(X_test)
accuracy = accuracy_score(y_test, y_pred)
print('LogisticRegression Accuracy:', accuracy)
DecisionTreeClassifier Accuracy: 0.7588235294117647
LogisticRegression Accuracy: 0.788235294117647
/home/alexac54767/anaconda3/lib/python3.9/site-packages/sklearn/linear_model/_logistic.py:814: ConvergenceWarning: lbfgs failed to converge (status=1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.

Increase the number of iterations (max_iter) or scale the data as shown in:
    https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
    https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
  n_iter_i = _check_optimize_result(

Using Chat GPT to format a dataset about food nutrients (related to our fitness project!)

import pandas as pd

# Load the data
df = pd.read_csv('/home/alexac54767/vscode/Alexa-Fastpage/_notebooks/files/nutrients_csvfile.csv')

# Print the column names
print(df.columns)
Index(['Food', 'Measure', 'Grams', 'Calories', 'Protein', 'Fat', 'Sat.Fat',
       'Fiber', 'Carbs', 'Category'],
      dtype='object')
import pandas as pd
pd.set_option('display.max_rows', 332)

# Load the data
df = pd.read_csv('/home/alexac54767/vscode/Alexa-Fastpage/_notebooks/files/nutrients_csvfile.csv')

# Keep only required columns
df = df.loc[:, ['Food', 'Grams', 'Calories', 'Protein', 'Fat', 'Sat.Fat', 'Fiber', 'Carbs']]

# Drop rows with missing values
df.dropna(inplace=True)

# Convert binary categorical variable to numeric
df['Calories'] = df['Calories'].apply(lambda x: 1 if x == 'Low' else 0)

print(df)
                                         Food  Grams  Calories Protein  Fat  \
0                                  Cows' milk    976         0      32   40   
1                                   Milk skim    984         0      36    t   
2                                  Buttermilk    246         0       9    5   
3                       Evaporated, undiluted    252         0      16   20   
4                              Fortified milk  1,419         0      89   42   
5                               Powdered milk    103         0      27   28   
6                               skim, instant     85         0      30    t   
7                           skim, non-instant     85         0      30    t   
8                                 Goats' milk    244         0       8   10   
9                         (1/2 cup ice cream)    540         0      24   24   
10                                      Cocoa    252         0       8   11   
11                                 skim. milk    250         0      18    4   
12                               (cornstarch)    248         0       9   10   
13                                    Custard    248         0      13   14   
14                                  Ice cream    188         0       6   18   
15                                   Ice milk    190         0       9   10   
16                     Cream or half-and-half    120         0       4   15   
17                                or whipping    119         0       2   44   
18                                     Cheese    225         0      30   11   
19                                  uncreamed    225         0      38    t   
20                                    Cheddar     17         0       4    6   
21                        Cheddar, grated cup     56         0      14   19   
22                               Cream cheese     28         0       2   11   
23                           Processed cheese     28         0       7    9   
24                             Roquefort type     28         0       6    9   
25                                      Swiss     28         0       7    8   
26                                   Eggs raw    100         0      12   12   
27                    Eggs Scrambled or fried    128         0      13   16   
28                                      Yolks     34         0       6   10   
29                                     Butter     14         0       t   11   
30                                     Butter    112         0     114  115   
31                                     Butter    112         0     114  115   
32                   Hydrogenated cooking fat    100         0       0  100   
33                                       Lard    110         0       0  110   
34                                  Margarine    112         0       t   91   
35                        Margarine, 2 pat or     14         0       t   11   
36                                 Mayonnaise     15         0       t   12   
37                                   Corn oil     14         0       0   14   
38                                  Olive oil     14         0       0   14   
39                         Safflower seed oil     14         0       0   14   
40                            French dressing     15         0       t    6   
41                      Thousand Island sauce     15         0       t    8   
43                                      Bacon     16         0       4    8   
44                                       Beef     85         0      23   16   
45                                  Hamburger     85         0      21   17   
46                                Ground lean     85         0      24   10   
47                                 Roast beef     85         0      16   36   
48                                      Steak     85         0      20   27   
49                      Steak, lean, as round     85         0      24   12   
50                                Corned beef     85         0      22   10   
51                    Corned beef hash canned     85         0      12    8   
52                     Corned beef hash Dried     56         0      19    4   
53                                    Pot-pie    227         0      18   28   
54                      Corned beef hash Stew    235         0      15   10   
55                                    chicken     85         0      23    9   
56     Fried, breast or leg and thigh chicken     85         0      25   15   
57                            Roasted chicken    100         0      25   20   
58                      Chicken livers, fried    100         0      22   14   
59                             Duck, domestic    100         0      16   28   
60                        Lamb, chop, broiled    115         0      24   35   
61                                Leg roasted     86         0      20   14   
62                          Shoulder, braised     85         0      18   23   
63                        Pork, chop, 1 thick    100         0      16   21   
64                            Ham pan-broiled     85         0      16   22   
65                                   Ham, as      57         0      13   13   
66                        Ham, canned, spiced     57         0       8   14   
67                                 Pork roast     85         0      21   24   
68                               Pork sausage    100         0      18   44   
69                                     Turkey    100         0      27   15   
70                                       Veal     85         0      23    9   
71                                      Roast     85         0      13   14   
72                                      Clams     85         0      12    1   
73                                        Cod    100         0      28    5   
74                                  Crab meat     85         0      14    2   
75                          Fish sticks fried    112         0      19   10   
76                                   Flounder    100         0      30    8   
77                                    Haddock     85         0      16    5   
78                                    Halibut    100         0      26    8   
79                                    Herring    100         0      22   13   
80                                    Lobster    100         0      18    1   
81                                   Mackerel     85         0      18    9   
82                                    Oysters    230         0     232  233   
83                                Oyster stew     85         0      19    6   
84                                     Salmon     85         0      17    5   
85                                   Sardines     85         0      22    9   
86                                   Scallops    100         0      18    8   
87                                       Shad     85         0      20   10   
88                                     Shrimp     85         0      23    1   
89                                  Swordfish    100         0      27    6   
90                                       Tuna     85         0      25    7   
91                                  Artichoke    100         0       2    t   
92                                  Asparagus     96         0       1    t   
93                                      Beans    125         0       1    t   
94                                       Lima    160         0       8    t   
95                          Lima, dry, cooked    192         0      16    t   
96                      Navy, baked with pork    200         0      11    6   
97                                 Red kidney    260         0      15    1   
98                               Bean sprouts     50         0       1    t   
99                                Beet greens    100         0       2    t   
101                                  Broccoli    150         0       5    t   
102                          Brussels sprouts    130         0       6    t   
103                                Sauerkraut    150         0       1    t   
104                           Steamed cabbage    170         0       2    t   
105                                   Carrots    150         0       1    t   
106                               Raw, grated    110         0       1    t   
107                          Strips, from raw     50         0       t    t   
108                               Cauliflower    120         0       3    t   
109                                    Celery    100         0       1    t   
110                                 Stalk raw     40         0       1    t   
111                             Chard steamed    150         0       2    t   
112                                  Collards    150         0       5    t   
113                                      Corn    100         0       3    1   
114                          cooked or canned    200         0       5    t   
115                                 Cucumbers     50         0       t    0   
116                          Dandelion greens    180         0       5    1   
117                                  Eggplant    180         0       2    t   
118                                    Endive     57         0       1    t   
119                                      Kale    110         0       4    1   
120                                  Kohlrabi    140         0       2    t   
121                   Lambs quarters, steamed    150         0       5    t   
122                                   Lentils    200         0      15    t   
123                                   Lettuce    100         0       1    t   
124                                   Iceberg    100         0       t    t   
125                          Mushrooms canned    120         0       2    t   
126                            Mustard greens    140         0       3    t   
127                                      Okra    100         0       1    t   
128                                    Onions    210         0       2    t   
129                                Raw, green     50         0       t    t   
130                                   Parsley     50         0       t    t   
131                                  Parsnips    155         0       2    1   
132                                      Peas    100         0       3    t   
133                       Fresh, steamed peas    100         0       5    t   
135                         Split cooked peas    100         0       8    t   
136                               heated peas    100         0       3    t   
137                            Peppers canned     38         0       t    t   
138                 Peppers Raw, green, sweet    100         0       1    t   
139              Peppers with beef and crumbs    150         0      19    9   
140                           Potatoes, baked    100         0       2    t   
141                              French-fried     60         0      -1    7   
142      Potatoes Mashed with milk and butter    200         0       4   12   
143                       Potatoes, pan-tried    100         0       4   14   
144            Scalloped with cheese potatoes    100         0       6    8   
145           Steamed potatoes before peeling    100         0       2    t   
146                              Potato chips     20         0       1    7   
147                                  Radishes     50         0       t    0   
148                                 Rutabagas    100         0       t    0   
149                                  Soybeans    200         0      22   11   
150                                   Spinach    100         0       3    t   
151                                    Squash    210         0       1    t   
152                            Winter, mashed    200         0       4    t   
153                            Sweet potatoes    110         0       2    1   
154                                   Candied    175         0       2    6   
155                                  Tomatoes    240         0       2    t   
156                           Raw, 2 by 2 1/2    150         0       1    t   
157                              Tomato juice    240         0       2    t   
158                             Tomato catsup     17         0       t    t   
159                             Turnip greens    145         0       4    1   
160                          Turnips, steamed    155         0       1    t   
161                     Watercress stems, raw     50         0       1    t   
162                        Apple juice canned    250         0       t    0   
163                             Apple vinegar    100         0       t    0   
164                               Apples, raw    130         0       t    t   
165                          Stewed or canned    240         0       t    t   
166                                  Apricots    250         0       2    t   
167                           Dried, uncooked     75         0       4    t   
168                                     Fresh    114         0       1    t   
169                          Nectar, or juice    250         0       1    t   
170                                   Avocado    108         0       2   18   
171                                    Banana    150         0       1    t   
172                              Blackberries    144         0       2    1   
173                               Blueberries    250         0       1    t   
174                                Cantaloupe    380         0       1    t   
175                                  Cherries    257         0       2    1   
176                                Fresh, raw    114         0       1    t   
177                 Cranberry sauce sweetened    277         0       t    t   
178                                     Dates    178         0       4    t   
179                                      Figs     42         0       2    t   
180                           Fresh, raw figs    114         0       2    t   
181                   figs Canned with syrup     115         0       1    t   
182                    Fruit cocktail, canned    256         0       1    t   
183                       Grapefruit sections    250         0       1    t   
184            Grapefruit, fresh, 5" diameter    285         0       1    t   
185                          Grapefruit juice    250         0       1    t   
186                                    Grapes    153         0       1    t   
187                European, as Muscat, Tokay    160         0       1    t   
188                               Grape juice    250         0       1    t   
189                               Lemon juice    125         0       t    t   
190                Lemonade concentratefrozen    220         0       t    t   
191                Limeade concentrate frozen    218         0       t    t   
192                              Olives large     65         0       1   10   
193                                OlivesRipe     65         0       1   13   
194                       Oranges 3" diameter    180         0       2    t   
195                              Orange juice    250         0       2    t   
196                                   Frozen     210         0       2    t   
197                                    Papaya    200         0       1    t   
198                                   Peaches    257         0       1    t   
199                                Fresh, raw    114         0       1    t   
200                                     Pears    255         0       1    t   
201                              Raw, 3 by 2V    182         0       1    1   
202                                Persimmons    125         0       1    t   
203                                 Pineapple    122         0       t    t   
204                         Pineapple Crushed    260         0       1    t   
205                                Raw, diced    140         0       1   t'   
206                           Pineapple juice    250         0       1    t   
207                                     Plums    256         0       1    t   
208                          Raw, 2" diameter     60         0       t    t   
209                                    Prunes    270         0       3    1   
210                               Prune juice    240         0       1    t   
211                                   Raisins     88         0       2    t   
212                               Raspberries    100         0       t    t   
213                                  Raw, red    100         0       t    t   
214                         Rhubarb sweetened    270         0       1    t   
215                              Strawberries    227         0       1    t   
216                                       Raw    149         0       t    t   
217                                Tangerines    114         0       1    t   
218                                Watermelon    925         0       2    1   
219                                  Biscuits     38         0       3    4   
220                               Bran flakes     25         0       3    t   
221                      Bread, cracked wheat     23         0       2    1   
222                                       Rye     23         0       2    1   
223                      White, 20 slices, or    454         0      39   15   
224                               Whole-wheat    454         0      48   14   
225                               Whole-wheat     23         0       2    1   
226                    Corn bread ground meal     50         0       3    4   
227                                Cornflakes     25         0       2    t   
228                         Corn grits cooked    242         0       8    t   
229                                 Corn meal    118         0       9    4   
230                                  Crackers     14         0       1    1   
231                        Soda, 2 1/2 square     11         0       1    1   
232                                    Farina    238         0       3    t   
233                                     Flour    110         0      39   22   
234                       Wheat (all purpose)    110         0      12    1   
235                             Wheat (whole)    120         0      13    2   
236                                  Macaroni    140         0       5    1   
237                         Baked with cheese    220         0      18   25   
238                                   Muffins     48         0       4    5   
239                                   Noodles    160         0       7    2   
240                                   Oatmeal    236         0       5    3   
241                         Pancakes 4" diam.    108         0       7    9   
242                  Wheat, pancakes 4" diam.    108         0       7    9   
243                           Pizza 14" diam.     75         0       8    6   
244                            Popcorn salted     28         0       3    7   
245                               Puffed rice     14         0       t    t   
246                 Puffed wheat presweetened     28         0       1    t   
247                                      Rice    208         0      15    3   
248                                 Converted    187         0      14    t   
249                                     White    191         0      14    t   
250                               Rice flakes     30         0       2    t   
251                               Rice polish     50         0       6    6   
252                                     Rolls     50         0       3   12   
253                          of refined flour     38         0       3    2   
254                               whole-wheat     40         0       4    1   
255                 Spaghetti with meat sauce    250         0      13   10   
256                  with tomatoes and cheese    250         0       6    5   
257                              Spanish rice    250         0       4    4   
258                    Shredded wheat biscuit     28         0       3    1   
259                                   Waffles     75         0       8    9   
260                                Wheat germ     68         0      17    7   
261                 Wheat-germ cereal toasted     65         0      20    7   
262               Wheat meal cereal unrefined     30         0       4    1   
263                             Wheat, cooked    200         0      12    1   
264                                Bean soups    250         0       8    5   
265                                 Beef soup    250         0       6    4   
266                                  Bouillon    240         0       5    0   
267                              chicken soup    250         0       4    2   
268                              Clam chowder    255         0       5    2   
269                               Cream soups    255         0       7   12   
270                                    Noodle    250         0       6    4   
271                            Split-pea soup    250         0       8    3   
272                               Tomato soup    245         0       6    7   
273                                 Vegetable    250         0       4    2   
274                               Apple betty    100         0       1    4   
275                             Bread pudding    200         0      11   12   
276                                     Cakes     40         0       3    t   
277                           Chocolate fudge    120         0       5   14   
278                                   Cupcake     50         0       3    3   
279                                Fruit cake     30         0       2    4   
280                               Gingerbread     55         0       2    7   
281                      Plain, with no icing     55         0       4    5   
282                               Sponge cake     40         0       3    2   
283                                     Candy     25         0       t    3   
284                          Chocolate creams     30         0       t    4   
285                                     Fudge     90         0       t   12   
286                              Hard candies     28         0       t    0   
287                              Marshmallows     30         0       1    0   
288                            Milk chocolate     56         0       2    6   
289                           Chocolate syrup     40         0       t    t   
290                                 Doughnuts     33         0       2    7   
291                  Gelatin, made with water    239         0       4    t   
292                                     Honey     42         0       t    0   
293                                 Ice cream    300         0       0    0   
294                                      Ices    150         0       0    0   
295                                 preserves     20         0       0    0   
296                                   Jellies     20         0       0    0   
297                                  Molasses     20         0       0    0   
298                                Cane Syrup     20         0       0    0   
299                              9" diam. pie    135         0       3   13   
300                                Cherry Pie    135         0       3   13   
301                                   Custard    130         0       7   11   
302                            Lemon meringue    120         0       4   12   
303                                     Mince    135         0       3    9   
304                               Pumpkin Pie    130         0       5   12   
305                            Puddings Sugar    200         0       0    0   
306                         3 teaspoons sugar     12         0       0    0   
307            Brown, firm-packed, dark sugar    220         0       0    t   
308                                     Syrup     40         0       0    0   
309                        table blends sugar     40         0       0    0   
310                     Tapioca cream pudding    250         0      10   10   
311                                   Almonds     70         0      13   38   
312                        roasted and salted     70         0      13   40   
313                               Brazil nuts     70         0      10   47   
314                                   Cashews     70         0      12   32   
315                         coconut sweetened     50         0       1   20   
316                             Peanut butter     50         0      12   25   
317                    Peanut butter, natural     50         0      13   24   
318                                   Peanuts     50         0      13   25   
319                                    Pecans     52         0       5   35   
320                              Sesame seeds     50         0       9   24   
321                           Sunflower seeds     50         0      12   26   
322                                   Walnuts     50         0       7   32   
323                                      Beer    480         0       t    0   
324                                       Gin     28         0       0    0   
325                                     Wines    120         0       t    0   
326                     Table (12.2% alcohol)    120         0       t    0   
327  Carbonated drinks Artificially sweetened    346         0       0    0   
328                                 Club soda    346         0       0    0   
329                               Cola drinks    346         0       0    0   
330                       Fruit-flavored soda    346         0       0    0   
331                                Ginger ale    346         0       0    0   
332                                 Root beer    346         0       0    0   
333                                    Coffee    230         0       t    0   
334                                       Tea    230         0       0    t   

    Sat.Fat  Fiber Carbs  
0        36      0    48  
1         t      0    52  
2         4      0    13  
3        18      0    24  
4        23    1.4   119  
5        24      0    39  
6         t      0    42  
7         t      1    42  
8         8      0    11  
9        22      0    70  
10       10      0    26  
11        3      1    13  
12        9      0    40  
13       11      0    28  
14       16      0    29  
15        9      0    32  
16       13      0     5  
17       27      1     3  
18       10      0     6  
19        t      0     6  
20        5      0     t  
21       17      0     1  
22       10      0     1  
23        8      0     t  
24        8      0     t  
25        7      0     t  
26       10      0     t  
27       14      0     1  
28        8      0     t  
29       10      0     t  
30      116    117   118  
31      116    117   118  
32       88      0     0  
33       92      0     0  
34       76      0     t  
35        9      0     t  
36        5      0     t  
37        5      0     0  
38        3      0     0  
39        3      0     0  
40        2      0     2  
41        3      0     1  
43        7      0     1  
44       15      0     0  
45       15      0     0  
46        9      0     0  
47       35      0     0  
48       25      0     0  
49       11      0     0  
50        9      0     0  
51        7      t     6  
52        4      0     0  
53       25      t    32  
54        9      t    15  
55        7      0     0  
56       11      0     0  
57       16      0     0  
58       12      0  2.30  
59        0      0     0  
60       33      0     0  
61       14      0     0  
62       21      0     0  
63       18      0     0  
64       19      0     0  
65       11      0     0  
66       12      0     1  
67       21      0     0  
68       40      0     0  
69        0      0     0  
70        8      0     0  
71       13      0     0  
72        0      0     2  
73        0      0     0  
74        0      0     1  
75        5      0     8  
76        0      0     0  
77        4      0     6  
78        0      0     0  
79        0      0     0  
80        0      0     t  
81        0      a     0  
82      234    235   236  
83        1      0     0  
84        1      0     0  
85        4      0     0  
86        0      0    10  
87        0      0     0  
88        0      0     0  
89        0      0     0  
90        3      0     0  
91        t      2    10  
92        t    0.5     3  
93        t    0.8     6  
94        t    3.0    24  
95        t      2    48  
96        6      2    37  
97        0    2.5    42  
98        0    0.3     3  
99        0    1.4     6  
101       0    1.9     8  
102       0    1.7    12  
103       0    1.2     7  
104       0    1.3     9  
105       0    0.9    10  
106       0    1.2    10  
107       0    0.5     5  
108       0      1     6  
109       0      1     4  
110       0    0.3     1  
111       0    1.4     7  
112       0      2     8  
113       t    0.8    21  
114       0    1.6    41  
115       0    0.2     1  
116       0    3.2    16  
117       0    1.0     9  
118       0    0.6     2  
119       0    0.9     8  
120       0    1.5     9  
121       0    3.2     7  
122       0    2.4    38  
123       0    0.5     2  
124       0    0.5     3  
125       0      t     4  
126       0    1.2     6  
127       0      1     7  
128       0    1.6    18  
129       0      1     5  
130       0      t     t  
131       0      3    22  
132       0    0.1    13  
133       0    2.2    12  
135       0    0.4    21  
136       0      1    10  
137       0      t     2  
138       0    1.4     6  
139       8      1    24  
140       0    0.5    22  
141       3    0.4    20  
142      11    0.7    28  
143       6   0.40    33  
144       7   0.40    14  
145       0   0.40    19  
146       4      t    10  
147       0    0.3     2  
148       0    1.4     8  
149       0    3.2    20  
150       0      1     3  
151       0    0.6     8  
152       0    2.6    23  
153       0      1    36  
154       5    1.5    80  
155       0      1     9  
156       0    0.6     6  
157       0    0.6    10  
158       0      t     4  
159       0    1.8     8  
160       0    1.8     9  
161       0    0.3     1  
162       0      0    34  
163       0      0     3  
164       0      1    18  
165       0      2    26  
166       0      1    57  
167       0      1    50  
168       0   0.70    14  
169       0      2    36  
170      12   1.80     6  
171       0    0.9    23  
172       0   6.60    19  
173       0      2    65  
174       0   2.20     9  
175       0      2    26  
176       0    0.8    15  
177       0    1.2   142  
178       0    3.6   134  
179       0    1.9    30  
180       0      1    22  
181       0      1    32  
182       0    0.5    50  
183       0    0.5    44  
184       t      1    14  
185       0      1    24  
186       0    0.8    16  
187       0    0.7    26  
188       0      t    42  
189       0      t    10  
190       0      t   112  
191       0      t   108  
192       9    0.8     3  
193      12      1     1  
194       t      1    16  
195       0    0.2    25  
196       t    0.4    78  
197       0    1.8    18  
198       0      1    52  
199       0    0.6    10  
200       0      2    50  
201       0      2    25  
202       0      2    20  
203       0    0.4    26  
204       0    0.7    55  
205       0    0.6    19  
206       0    0.2    32  
207       0    0.7    50  
208       0    0.2     7  
209       0    0.8    81  
210       0    0.7    45  
211       0    0.7    82  
212       0      2    25  
213       0      5    14  
214       0    1.9    98  
215       0    1.3    60  
216       0    1.9    12  
217       0      1    10  
218       0    3.6    29  
219       3      t    18  
220       0   0.10    32  
221       1   0.10    12  
222       1   0.10    12  
223      12   9.00   229  
224      10  67.50   216  
225       0   0.31    11  
226       2   0.30    15  
227       0    0.1    25  
228       0    0.2    27  
229       2    1.6    74  
230       0      t    10  
231       0      t     8  
232       0      8    22  
233       0    2.9    33  
234       0    0.3    84  
235       0    2.8    79  
236       0    0.1    32  
237      24      t    44  
238       4      t    19  
239       2    0.1    37  
240       2    4.6    26  
241       0    0.1    28  
242       0    0.1    28  
243       5      t    23  
244       2    0.5    20  
245       0      t    12  
246       0    0.6    26  
247       0    1.2   154  
248       0    0.4   142  
249       0    0.3   150  
250       0    0.1    26  
251       0    1.2    28  
252      11    0.1    23  
253       2      t    20  
254       0    0.1    20  
255       6   0.50    35  
256       3   0.50    36  
257       0   1.20    40  
258       0   0.70    23  
259       1   0.10    30  
260       3   2.50    34  
261       3   2.50    36  
262       0   0.70    25  
263       0   4.40    35  
264       4   0.60    30  
265       4   0.50    11  
266       0      0     0  
267       2      0    10  
268       8   0.50    12  
269      11   1.20    18  
270       3   0.20    13  
271       3   0.50    25  
272       6   0.50    22  
273       2      0    14  
274       0    0.5    29  
275      11   0.20    56  
276       0      0    23  
277      12    0.3    70  
278       2      t    31  
279       3    0.2    17  
280       6      t    28  
281       4      t    31  
282       2      0    22  
283       3      0    19  
284       4      0    24  
285      11    0.1    80  
286       0      0    28  
287       0      0    23  
288       6    0.2    44  
289       t      0    22  
290       4      t    17  
291       t      0    36  
292       0      0    30  
293      12     10     0  
294       0      0    48  
295       0      t    14  
296       0      0    13  
297       0      8    11  
298       0      0    13  
299      11    0.1    53  
300      11    0.1    55  
301      10      0    34  
302      10    0.1    45  
303       8   0.70    62  
304      11      8    34  
305       0      0   199  
306       0      0    12  
307       0      0   210  
308       0      0    25  
309       0      0    29  
310       9      0    42  
311      28    1.8    13  
312      31    1.8    13  
313      31      2     7  
314      28    0.9    20  
315      19      2    26  
316      17    0.9     9  
317      10    0.9     8  
318      16    1.2     9  
319      25    1.1     7  
320      13    3.1    10  
321       7    1.9    10  
322       7      1     8  
323       0      0     8  
324       0      0     t  
325       0      0     9  
326       0      0     5  
327       0      0     0  
328       0      0     0  
329       0      0    38  
330       0      0    42  
331       0      0    28  
332       0      0    35  
333       0      0     1  
334       0      0     1