0

I am using Python and Pandas. I want the processed dataframe to be saved in a read-only csv file, such that people can open and look at it but can not modify and resave/overwrite the existing csv file?

I check the documentation, it doesn't seem to have that option. Any work-around for this?

KubiK888
  • 4,377
  • 14
  • 61
  • 115
  • 1
    No, you cannot do this directly through Pandas when you write the data – roganjosh Jul 18 '19 at 16:28
  • 1
    The concept of "read-only" is operating system and user/file system level specific and isn't/shouldn't be a part of a data analysis library... Have you thought if you can just use some OS command/wrapper around it to modify the file permissions afterwards? – Jon Clements Jul 18 '19 at 16:29
  • 1
    You can set the OS permissions on the file to read-only but a user can easily change it. Sounds like you need to store your data in a database, not a `csv` file. Then you can define users and grant permissions over who can change what. – BoarGules Jul 18 '19 at 17:13
  • 1
    See https://stackoverflow.com/questions/16249440/changing-file-permission-in-python/16249475See – GreenMatt Jul 18 '19 at 20:49
  • Thanks everyone. – KubiK888 Jul 18 '19 at 21:13

0 Answers0