Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting Corpus to Dataframe not working. #279

Closed
drizk1 opened this issue Nov 27, 2023 · 2 comments
Closed

Converting Corpus to Dataframe not working. #279

drizk1 opened this issue Nov 27, 2023 · 2 comments

Comments

@drizk1
Copy link

drizk1 commented Nov 27, 2023

I saw issue #236 was fixed but i am encountering an error. is there a different way for me to do this?

crps = Corpus([StringDocument("hello world")])
update_lexicon!(crps)

convert(DataFrame, crps)

ERROR: MethodError: Cannot `convert` an object of type Corpus{StringDocument{String}} to an object of type DataFrame

Closest candidates are:
  convert(::Type{DataFrame}, ::SubDataFrame)
   @ DataFrames ~/.julia/packages/DataFrames/58MUJ/src/subdataframe/subdataframe.jl:319
  convert(::Type{T}, ::T) where T
   @ Base Base.jl:64
  DataFrame(::Any; copycols)
   @ DataFrames ~/.julia/packages/DataFrames/58MUJ/src/other/tables.jl:48
  ...

Stacktrace:
 [1] top-level scope
   @ ~/Desktop/Julia Libraries/datesnstrings/scratch:371

@rssdev10
Copy link
Collaborator

You don't need to do convert. Corpus implements the Tables interface. Use:
DataFrame(crps) instead.

@drizk1
Copy link
Author

drizk1 commented Nov 27, 2023

awesome. thank you.

@drizk1 drizk1 closed this as completed Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants