I converted a pd.series into a dataframe. After conversion, one of the dataframe column does not have any name and the other one has "0" as its name. I need to give names to the column.
I tried using df.columns = ["A","B"] and rename but it does not help
import pandas as pd
import nltk
from nltk.corpus import stopwords #for removing stopwords
import re #for removing numbers, special characters
#Import CSV into dataframe
filepath = "C:/a/Python/Clustering/LabeledRawDatav2.csv"
df = pd.read_csv(filepath,encoding='windows-1252')
print(df.head(2))
freq = pd.DataFrame(columns=["Word","Count"])
freq = pd.Series(' '.join(df["Notes"]).split()).value_counts()[:]
freq = pd.Series.to_frame(freq)
freq.rename(columns = {"0":"Freq"},inplace=True)
print(freq)
Expected result would be
Word freq
- 206
the 65
for 62
1 62
DAYS 56
Actual result is
0
- 206
the 65
for 62
1 62
DAYS 56