import{s as et,n as at,o as st}from"../chunks/scheduler.d6170356.js";import{S as lt,i as nt,g as p,s as l,r as w,A as it,h as o,f as a,c as n,j as O,u as X,x as T,k as tt,y as pt,a as s,v as G,d as _,t as k,w as F}from"../chunks/index.fcd4cc08.js";import{C as E}from"../chunks/CodeBlock.7b16bdef.js";import{H as ot,E as rt}from"../chunks/EditOnGithub.da2b595c.js";function dt(L){let i,b,R,Y,r,j,d,P=`<a href="https://github.com/pandas-dev/pandas" rel="nofollow">Pandas</a> is a widely used Python data analysis toolkit.
Since it uses <a href="https://filesystem-spec.readthedocs.io" rel="nofollow">fsspec</a> to read and write remote data, you can use the Hugging Face paths (<a href="https://huggingface.co/docs/huggingface_hub/guides/hf_file_system#integrations" rel="nofollow"><code>hf://</code></a>) to read and write data on the Hub:`,B,h,x='First you need to <a href="https://huggingface.co/docs/huggingface_hub/quick-start#login" rel="nofollow">Login with your Hugging Face account</a>, for example using:',U,u,q,c,S='Then you can <a href="https://huggingface.co/docs/huggingface_hub/quick-start#create-a-repository" rel="nofollow">Create a dataset repository</a>, for example using:',V,m,I,f,A='Finally, you can use <a href="https://huggingface.co/docs/huggingface_hub/guides/hf_file_system#integrations" rel="nofollow">Hugging Face paths</a> in Pandas:',W,y,v,g,K=`This creates a dataset repository <code>username/my_dataset</code> containing your Pandas dataset in Parquet format.
You can reload it later:`,H,J,C,M,D='To have more information on the Hugging Face paths and how they are implemented, please refer to the <a href="https://huggingface.co/docs/huggingface_hub/guides/hf_file_system" rel="nofollow">the client library’s documentation on the HfFileSystem</a>.',Q,Z,z,$,N;return r=new ot({props:{title:"Pandas",local:"pandas",headingTag:"h1"}}),u=new E({props:{code:"aHVnZ2luZ2ZhY2UtY2xpJTIwbG9naW4=",highlighted:'huggingface-<span class="hljs-keyword">cli</span> login',wrap:!1}}),m=new E({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEhmQXBpJTBBJTBBSGZBcGkoKS5jcmVhdGVfcmVwbyhyZXBvX2lkJTNEJTIydXNlcm5hbWUlMkZteV9kYXRhc2V0JTIyJTJDJTIwcmVwb190eXBlJTNEJTIyZGF0YXNldCUyMik=",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfApi

HfApi().create_repo(repo_id=<span class="hljs-string">&quot;username/my_dataset&quot;</span>, repo_type=<span class="hljs-string">&quot;dataset&quot;</span>)`,wrap:!1}}),y=new E({props:{code:"aW1wb3J0JTIwcGFuZGFzJTIwYXMlMjBwZCUwQSUwQWRmLnRvX3BhcnF1ZXQoJTIyaGYlM0ElMkYlMkZkYXRhc2V0cyUyRnVzZXJuYW1lJTJGbXlfZGF0YXNldCUyRmRhdGEucGFycXVldCUyMiklMEElMEElMjMlMjBvciUyMHdyaXRlJTIwaW4lMjBzZXBhcmF0ZSUyMGZpbGVzJTIwaWYlMjB0aGUlMjBkYXRhc2V0JTIwaGFzJTIwdHJhaW4lMkZ2YWxpZGF0aW9uJTJGdGVzdCUyMHNwbGl0cyUwQWRmX3RyYWluLnRvX3BhcnF1ZXQoJTIyaGYlM0ElMkYlMkZkYXRhc2V0cyUyRnVzZXJuYW1lJTJGbXlfZGF0YXNldCUyRnRyYWluLnBhcnF1ZXQlMjIpJTBBZGZfdmFsaWQudG9fcGFycXVldCglMjJoZiUzQSUyRiUyRmRhdGFzZXRzJTJGdXNlcm5hbWUlMkZteV9kYXRhc2V0JTJGdmFsaWRhdGlvbi5wYXJxdWV0JTIyKSUwQWRmX3Rlc3QlMjAudG9fcGFycXVldCglMjJoZiUzQSUyRiUyRmRhdGFzZXRzJTJGdXNlcm5hbWUlMkZteV9kYXRhc2V0JTJGdGVzdC5wYXJxdWV0JTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

df.to_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/data.parquet&quot;</span>)

<span class="hljs-comment"># or write in separate files if the dataset has train/validation/test splits</span>
df_train.to_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/train.parquet&quot;</span>)
df_valid.to_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/validation.parquet&quot;</span>)
df_test .to_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/test.parquet&quot;</span>)`,wrap:!1}}),J=new E({props:{code:"aW1wb3J0JTIwcGFuZGFzJTIwYXMlMjBwZCUwQSUwQWRmJTIwJTNEJTIwcGQucmVhZF9wYXJxdWV0KCUyMmhmJTNBJTJGJTJGZGF0YXNldHMlMkZ1c2VybmFtZSUyRm15X2RhdGFzZXQlMkZkYXRhLnBhcnF1ZXQlMjIpJTBBJTBBJTIzJTIwb3IlMjByZWFkJTIwZnJvbSUyMHNlcGFyYXRlJTIwZmlsZXMlMjBpZiUyMHRoZSUyMGRhdGFzZXQlMjBoYXMlMjB0cmFpbiUyRnZhbGlkYXRpb24lMkZ0ZXN0JTIwc3BsaXRzJTBBZGZfdHJhaW4lMjAlM0QlMjBwZC5yZWFkX3BhcnF1ZXQoJTIyaGYlM0ElMkYlMkZkYXRhc2V0cyUyRnVzZXJuYW1lJTJGbXlfZGF0YXNldCUyRnRyYWluLnBhcnF1ZXQlMjIpJTBBZGZfdmFsaWQlMjAlM0QlMjBwZC5yZWFkX3BhcnF1ZXQoJTIyaGYlM0ElMkYlMkZkYXRhc2V0cyUyRnVzZXJuYW1lJTJGbXlfZGF0YXNldCUyRnZhbGlkYXRpb24ucGFycXVldCUyMiklMEFkZl90ZXN0JTIwJTIwJTNEJTIwcGQucmVhZF9wYXJxdWV0KCUyMmhmJTNBJTJGJTJGZGF0YXNldHMlMkZ1c2VybmFtZSUyRm15X2RhdGFzZXQlMkZ0ZXN0LnBhcnF1ZXQlMjIp",highlighted:`<span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

df = pd.read_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/data.parquet&quot;</span>)

<span class="hljs-comment"># or read from separate files if the dataset has train/validation/test splits</span>
df_train = pd.read_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/train.parquet&quot;</span>)
df_valid = pd.read_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/validation.parquet&quot;</span>)
df_test  = pd.read_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/test.parquet&quot;</span>)`,wrap:!1}}),Z=new rt({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/datasets-pandas.md"}}),{c(){i=p("meta"),b=l(),R=p("p"),Y=l(),w(r.$$.fragment),j=l(),d=p("p"),d.innerHTML=P,B=l(),h=p("p"),h.innerHTML=x,U=l(),w(u.$$.fragment),q=l(),c=p("p"),c.innerHTML=S,V=l(),w(m.$$.fragment),I=l(),f=p("p"),f.innerHTML=A,W=l(),w(y.$$.fragment),v=l(),g=p("p"),g.innerHTML=K,H=l(),w(J.$$.fragment),C=l(),M=p("p"),M.innerHTML=D,Q=l(),w(Z.$$.fragment),z=l(),$=p("p"),this.h()},l(t){const e=it("svelte-u9bgzb",document.head);i=o(e,"META",{name:!0,content:!0}),e.forEach(a),b=n(t),R=o(t,"P",{}),O(R).forEach(a),Y=n(t),X(r.$$.fragment,t),j=n(t),d=o(t,"P",{"data-svelte-h":!0}),T(d)!=="svelte-jc90ym"&&(d.innerHTML=P),B=n(t),h=o(t,"P",{"data-svelte-h":!0}),T(h)!=="svelte-120khpu"&&(h.innerHTML=x),U=n(t),X(u.$$.fragment,t),q=n(t),c=o(t,"P",{"data-svelte-h":!0}),T(c)!=="svelte-100w438"&&(c.innerHTML=S),V=n(t),X(m.$$.fragment,t),I=n(t),f=o(t,"P",{"data-svelte-h":!0}),T(f)!=="svelte-1ell932"&&(f.innerHTML=A),W=n(t),X(y.$$.fragment,t),v=n(t),g=o(t,"P",{"data-svelte-h":!0}),T(g)!=="svelte-19lewo4"&&(g.innerHTML=K),H=n(t),X(J.$$.fragment,t),C=n(t),M=o(t,"P",{"data-svelte-h":!0}),T(M)!=="svelte-1o8dsbk"&&(M.innerHTML=D),Q=n(t),X(Z.$$.fragment,t),z=n(t),$=o(t,"P",{}),O($).forEach(a),this.h()},h(){tt(i,"name","hf:doc:metadata"),tt(i,"content",ht)},m(t,e){pt(document.head,i),s(t,b,e),s(t,R,e),s(t,Y,e),G(r,t,e),s(t,j,e),s(t,d,e),s(t,B,e),s(t,h,e),s(t,U,e),G(u,t,e),s(t,q,e),s(t,c,e),s(t,V,e),G(m,t,e),s(t,I,e),s(t,f,e),s(t,W,e),G(y,t,e),s(t,v,e),s(t,g,e),s(t,H,e),G(J,t,e),s(t,C,e),s(t,M,e),s(t,Q,e),G(Z,t,e),s(t,z,e),s(t,$,e),N=!0},p:at,i(t){N||(_(r.$$.fragment,t),_(u.$$.fragment,t),_(m.$$.fragment,t),_(y.$$.fragment,t),_(J.$$.fragment,t),_(Z.$$.fragment,t),N=!0)},o(t){k(r.$$.fragment,t),k(u.$$.fragment,t),k(m.$$.fragment,t),k(y.$$.fragment,t),k(J.$$.fragment,t),k(Z.$$.fragment,t),N=!1},d(t){t&&(a(b),a(R),a(Y),a(j),a(d),a(B),a(h),a(U),a(q),a(c),a(V),a(I),a(f),a(W),a(v),a(g),a(H),a(C),a(M),a(Q),a(z),a($)),a(i),F(r,t),F(u,t),F(m,t),F(y,t),F(J,t),F(Z,t)}}}const ht='{"title":"Pandas","local":"pandas","sections":[],"depth":1}';function ut(L){return st(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class gt extends lt{constructor(i){super(),nt(this,i,ut,dt,et,{})}}export{gt as component};
