Closed SmritiSatyan closed 4 years ago
Is your paragraphs
column filled with lists of paragraphs for each row (like the structure indicated in the readme)?
If it's not, it might be what is causing the problem.
Also, be sure to load the dataframe using the literal_eval
function as converter to the paragraphs
:
df = pd.read_csv('your-file.csv', converters={'paragraphs': literal_eval})
Hello sir, thank you for the reply. Yes my paragraphs column is a list that contains multiple paragraphs. When I try to load the data frame with the literal_eval function, I encounter "malformed string" error.
Update: The literal_eval function is not working on my data, I have decided to go with 'eval' function.
Hence, my line of code that reads the CSV file into a dataframe would look like below:
df = pd.read_csv('your-file.csv', converters={'paragraphs': eval})
I have my csv file in place, that has 2 columns- 'title', and 'paragraphs'. When I try to run the line of code -
cdqa_pipeline.fit_retriever(df)
, I get the error-ValueError: zero-dimensional arrays cannot be concatenated
and it talks about an issue in this line).assign(**{lst_col: np.concatenate(df[lst_col].values)})[df.columns]
.In the cdqa_sklearn.py file, I changed the line 'np.concatenate' to 'np.array', but when I do that, I get a different error :
ValueError: Length of values does not match length of index
but when I cross verified it, my index and the columns in my dataframe have the same length. My dataframe doesn't have any empty columns/nans as well. Below is the stack trace:when I call
cdqa_pipeline.fit_retriever(df)
When reading the csv using the pandas dataframe, the below line is what I used:
df = pd.read_csv('path to csv file')
Any help on this would be much appreciated.