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 X,A as it,h as r,f as a,c as n,j as O,u as T,x as w,k as tt,y as pt,a as s,v as G,d as _,t as k,w as b}from"../chunks/index.fcd4cc08.js";import{C as E}from"../chunks/CodeBlock.7b16bdef.js";import{H as rt,E as dt}from"../chunks/EditOnGithub.da2b595c.js";function ot(L){let i,$,F,Y,d,j,o,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,u,x='First you need to <a href="../huggingface_hub/quick-start#login">Login with your Hugging Face account</a>, for example using:',U,h,q,m,S='Then you can <a href="../huggingface_hub/quick-start#create-a-repository">Create a dataset repository</a>, for example using:',V,c,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,J,K=`This creates a dataset repository <code>username/my_dataset</code> containing your Pandas dataset in Parquet format.
You can reload it later:`,H,M,C,g,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,R,N;return d=new rt({props:{title:"Pandas",local:"pandas",headingTag:"h1"}}),h=new E({props:{code:"aHVnZ2luZ2ZhY2UtY2xpJTIwbG9naW4=",highlighted:'huggingface-<span class="hljs-keyword">cli</span> login',wrap:!1}}),c=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}}),M=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 dt({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/datasets-pandas.md"}}),{c(){i=p("meta"),$=l(),F=p("p"),Y=l(),X(d.$$.fragment),j=l(),o=p("p"),o.innerHTML=P,B=l(),u=p("p"),u.innerHTML=x,U=l(),X(h.$$.fragment),q=l(),m=p("p"),m.innerHTML=S,V=l(),X(c.$$.fragment),I=l(),f=p("p"),f.innerHTML=A,W=l(),X(y.$$.fragment),v=l(),J=p("p"),J.innerHTML=K,H=l(),X(M.$$.fragment),C=l(),g=p("p"),g.innerHTML=D,Q=l(),X(Z.$$.fragment),z=l(),R=p("p"),this.h()},l(t){const e=it("svelte-u9bgzb",document.head);i=r(e,"META",{name:!0,content:!0}),e.forEach(a),$=n(t),F=r(t,"P",{}),O(F).forEach(a),Y=n(t),T(d.$$.fragment,t),j=n(t),o=r(t,"P",{"data-svelte-h":!0}),w(o)!=="svelte-jc90ym"&&(o.innerHTML=P),B=n(t),u=r(t,"P",{"data-svelte-h":!0}),w(u)!=="svelte-1hbzj8b"&&(u.innerHTML=x),U=n(t),T(h.$$.fragment,t),q=n(t),m=r(t,"P",{"data-svelte-h":!0}),w(m)!=="svelte-1tu70ef"&&(m.innerHTML=S),V=n(t),T(c.$$.fragment,t),I=n(t),f=r(t,"P",{"data-svelte-h":!0}),w(f)!=="svelte-1ell932"&&(f.innerHTML=A),W=n(t),T(y.$$.fragment,t),v=n(t),J=r(t,"P",{"data-svelte-h":!0}),w(J)!=="svelte-19lewo4"&&(J.innerHTML=K),H=n(t),T(M.$$.fragment,t),C=n(t),g=r(t,"P",{"data-svelte-h":!0}),w(g)!=="svelte-1o8dsbk"&&(g.innerHTML=D),Q=n(t),T(Z.$$.fragment,t),z=n(t),R=r(t,"P",{}),O(R).forEach(a),this.h()},h(){tt(i,"name","hf:doc:metadata"),tt(i,"content",ut)},m(t,e){pt(document.head,i),s(t,$,e),s(t,F,e),s(t,Y,e),G(d,t,e),s(t,j,e),s(t,o,e),s(t,B,e),s(t,u,e),s(t,U,e),G(h,t,e),s(t,q,e),s(t,m,e),s(t,V,e),G(c,t,e),s(t,I,e),s(t,f,e),s(t,W,e),G(y,t,e),s(t,v,e),s(t,J,e),s(t,H,e),G(M,t,e),s(t,C,e),s(t,g,e),s(t,Q,e),G(Z,t,e),s(t,z,e),s(t,R,e),N=!0},p:at,i(t){N||(_(d.$$.fragment,t),_(h.$$.fragment,t),_(c.$$.fragment,t),_(y.$$.fragment,t),_(M.$$.fragment,t),_(Z.$$.fragment,t),N=!0)},o(t){k(d.$$.fragment,t),k(h.$$.fragment,t),k(c.$$.fragment,t),k(y.$$.fragment,t),k(M.$$.fragment,t),k(Z.$$.fragment,t),N=!1},d(t){t&&(a($),a(F),a(Y),a(j),a(o),a(B),a(u),a(U),a(q),a(m),a(V),a(I),a(f),a(W),a(v),a(J),a(H),a(C),a(g),a(Q),a(z),a(R)),a(i),b(d,t),b(h,t),b(c,t),b(y,t),b(M,t),b(Z,t)}}}const ut='{"title":"Pandas","local":"pandas","sections":[],"depth":1}';function ht(L){return st(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Jt extends lt{constructor(i){super(),nt(this,i,ht,ot,et,{})}}export{Jt as component};
