what is a KeyError in Python 3.5/Pandas?
I work with files were exported from stream twitter . but when run code then error : KeyError: 'text' on tweets['python'] = tweets['text'].apply(lambda tweet: word_in_text('python', tweet)). how to fix it ? thank everyone..!.
`import re
import json
import string
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
tweets_data_path = '...\\..\\log1000.txt'

tweets_data = []
tweets_file = open(tweets_data_path, "r")
for line in tweets_file:
    try:
        tweet = json.loads(line)
        tweets_data.append(tweet)
    except:
        continue	
def word_in_text(word, text):
    word = word.lower()
    text = text.lower()
    match = re.search(word, text)
    if match:
        return True
    return False
#------------------------DataFrame--------------------------
tweets = pd.DataFrame()	
#------------------------------------------------------------------------
tweets['python'] = tweets['text'].apply(lambda tweet: word_in_text('python', tweet))
#----------------------------------------------------------------
print (tweets['python'].value_counts()[True])`